/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #030712;
  --surface:   #111827;
  --surface2:  #1f2937;
  --border:    #374151;
  --text:      #f9fafb;
  --text-sub:  #9ca3af;
  --primary:   #3b82f6;
  --primary-h: #2563eb;
  --danger:    #ef4444;
  --danger-h:  #dc2626;
  --success:   #22c55e;
  --radius:    10px;
  --shadow:    0 4px 24px rgba(0,0,0,.4);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* ── Screen ── */
.screen { min-height: 100vh; }
.hidden { display: none !important; }

/* ── Login ── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-box {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
  box-shadow: var(--shadow);
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  text-align: center;
}
.login-sub {
  text-align: center;
  color: var(--text-sub);
  margin-bottom: 28px;
  font-size: 13px;
}

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 56px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.navbar-title {
  font-size: 16px;
  font-weight: 700;
}

/* ── Container ── */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.card-title {
  font-size: 15px;
  font-weight: 600;
}

/* ── Table ── */
.table {
  width: 100%;
  border-collapse: collapse;
}
.table th,
.table td {
  padding: 12px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.table th {
  background: var(--surface2);
  color: var(--text-sub);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--surface2); }

.token-cell {
  font-family: monospace;
  font-size: 12px;
  color: var(--text-sub);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.actions-cell {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.loading-row,
.empty-row {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-sub);
  font-size: 14px;
}

/* ── Logo Preview ── */
.logo-preview-area {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80px;
  background: var(--surface2);
}
.logo-preview-area img {
  max-height: 64px;
  max-width: 240px;
  object-fit: contain;
}
.logo-placeholder {
  color: var(--text-sub);
  font-size: 13px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, opacity .15s;
  padding: 8px 16px;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary   { background: var(--primary);  color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }

.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-danger    { background: var(--danger);   color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-h); }

.btn-ghost { background: transparent; color: var(--text-sub); }
.btn-ghost:hover:not(:disabled) { background: var(--surface2); color: var(--text); }

.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; }

/* upload-label として使う label.btn */
.upload-label { cursor: pointer; }

/* ── Input ── */
.input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s;
  margin-bottom: 12px;
}
.input:focus { border-color: var(--primary); }
.input::placeholder { color: var(--text-sub); }

/* ── Field ── */
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 4px;
}
.required { color: var(--danger); }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow);
}
.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
}
.modal-sub {
  color: var(--text-sub);
  font-size: 13px;
  margin-bottom: 16px;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ── URL box ── */
.url-box {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  margin: 12px 0;
  word-break: break-all;
}
.url-box code {
  font-size: 13px;
  font-family: monospace;
  color: var(--primary);
}

/* ── Error ── */
.error-msg {
  color: var(--danger);
  font-size: 13px;
  margin-top: 8px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 22px;
  border-radius: 999px;
  box-shadow: var(--shadow);
  z-index: 200;
  white-space: nowrap;
}
.toast.toast-success { background: #14532d; border-color: var(--success); color: #bbf7d0; }
.toast.toast-error   { background: #7f1d1d; border-color: var(--danger);  color: #fecaca; }
