/* ── Design tokens ─────────────────────────────────────────────── */
:root {
  --font-sans: "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-serif: Georgia, "Times New Roman", serif;
  --font-roboto: "Roboto", "Segoe UI", system-ui, sans-serif;
  --reader-font: var(--font-serif);

  --color-bg: #f1f5f9;
  --color-surface: #ffffff;
  --color-surface-2: #f8fafc;
  --color-border: #e2e8f0;
  --color-text: #0f172a;
  --color-text-muted: #64748b;
  --color-primary: #2563eb;
  --color-primary-hover: #1d4ed8;
  --color-primary-soft: rgba(37, 99, 235, 0.12);
  --color-danger: #dc2626;
  --color-header: #0f172a;
  --color-header-text: #f8fafc;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.14);

  --header-h: 3.25rem;
  --content-max: 72rem;
  --reader-max: 48rem;
  --transition: 0.18s ease;
}

/* ── Base ──────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
}

body.reader-dark {
  --color-bg: #0f172a;
  --color-surface: #1e293b;
  --color-surface-2: #334155;
  --color-border: #475569;
  --color-text: #f1f5f9;
  --color-text-muted: #94a3b8;
  --color-header: #020617;
}

.hidden { display: none !important; }

/* ── App header ────────────────────────────────────────────────── */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-h);
  padding: 0 0.75rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.5rem;
  background: var(--color-header);
  color: var(--color-header-text);
  box-shadow: var(--shadow-sm);
}

.app-header-start {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.app-header-end {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem;
  min-width: 0;
}

.app-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  cursor: default;
}

.app-title.is-book {
  cursor: pointer;
}

.app-title.is-book:hover {
  opacity: 0.85;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  font-size: 1.05rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition);
}

.icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.16);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.icon-btn-text {
  width: auto;
  padding: 0 0.65rem;
  font-size: 0.85rem;
  font-weight: 500;
}

.header-link {
  display: inline-flex;
  align-items: center;
  height: 2.25rem;
  padding: 0 0.65rem;
  border-radius: var(--radius-sm);
  color: inherit;
  text-decoration: none;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.08);
  transition: background var(--transition);
}

.header-link:hover {
  background: rgba(255, 255, 255, 0.16);
}

/* ── Main layout ───────────────────────────────────────────────── */
.app-main {
  padding-top: calc(var(--header-h) + 1rem);
  padding-bottom: 2rem;
  min-height: 100vh;
}

.library-shell {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1rem;
}

.library-shell.drag-over #library {
  outline: 2px dashed var(--color-primary);
  outline-offset: 4px;
  border-radius: var(--radius-lg);
}

.library-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.65rem;
  margin-bottom: 0.85rem;
}

.library-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.9rem;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.library-btn:hover {
  background: var(--color-surface-2);
  border-color: #cbd5e1;
}

.library-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.library-btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.library-btn-primary:hover:not(:disabled) {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.library-status {
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.library-status.is-error {
  color: var(--color-danger);
}

.library-form {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.library-form label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.library-form input[type="text"],
.library-form select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  font-size: 0.95rem;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
}

.library-form-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.library-form-book {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--color-text);
}

.library-form-error {
  margin: 0;
  font-size: 0.8rem;
  color: var(--color-danger);
}

.library-form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.library-form-actions .library-btn {
  min-width: 5.5rem;
}

.library-card--book.dragging {
  opacity: 0.45;
}

.library-card--folder.drop-target {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-soft);
  transform: translateY(-2px);
}

.library-card-move {
  position: absolute;
  top: 0.4rem;
  left: 0.4rem;
  z-index: 2;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.72);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
}

.library-card:hover .library-card-move,
.library-card:focus-within .library-card-move {
  opacity: 1;
}

.library-card-move:hover {
  background: var(--color-primary);
}

.library-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.35rem;
  margin-bottom: 1rem;
  padding: 0.55rem 0.85rem;
  font-size: 0.875rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.library-nav a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.library-nav a:hover {
  text-decoration: underline;
}

.library-nav-sep {
  color: var(--color-border);
  user-select: none;
}

#library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr));
  gap: 1rem;
  align-items: start;
}

@media (min-width: 640px) {
  #library {
    grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
    gap: 1.25rem;
  }
}

@media (min-width: 520px) {
  .library-card--folder {
    grid-column: span 2;
  }
}

.library-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}

/* ── Library cards ─────────────────────────────────────────────── */
.library-card {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.library-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.library-card:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.cover-wrap {
  position: relative;
  aspect-ratio: 2 / 3;
  background: linear-gradient(145deg, var(--color-surface-2), #e2e8f0);
  overflow: hidden;
}

.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--color-text-muted);
  background: linear-gradient(160deg, #eef2ff 0%, #e2e8f0 100%);
}

/* ── Library folders ───────────────────────────────────────────── */
.library-card--folder {
  flex-direction: row;
  align-items: stretch;
  min-height: 4.75rem;
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 55%, #f8fafc 100%);
  border-color: #bae6fd;
}

.library-card--folder:hover {
  border-color: #7dd3fc;
  background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 55%, #f0f9ff 100%);
}

.library-card--folder .folder-visual {
  flex: 0 0 4.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 0 0.65rem 0.75rem;
}

.folder-graphic {
  position: relative;
  width: 3.25rem;
  height: 2.6rem;
  filter: drop-shadow(0 3px 6px rgba(2, 132, 199, 0.22));
  transition: transform var(--transition);
}

.library-card--folder:hover .folder-graphic {
  transform: translateY(-2px) scale(1.04);
}

.folder-tab {
  position: absolute;
  top: 0;
  left: 0;
  width: 1.55rem;
  height: 0.55rem;
  background: linear-gradient(180deg, #38bdf8, #0ea5e9);
  border-radius: 4px 6px 0 0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.folder-graphic .folder-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(165deg, #38bdf8 0%, #0284c7 100%);
  border-radius: 4px 8px 8px 8px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.folder-glyph {
  width: 1.35rem;
  height: 1.35rem;
  color: rgba(255, 255, 255, 0.92);
}

.folder-body-text {
  flex: 1;
  min-width: 0;
  justify-content: center;
  padding: 0.6rem 0.75rem 0.6rem 0.25rem;
}

.folder-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: #0c4a6e;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.folder-label {
  margin: 0.2rem 0 0;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #0369a1;
  opacity: 0.75;
}

body.reader-dark .library-card--folder {
  background: linear-gradient(135deg, #0c4a6e 0%, #075985 55%, #1e293b 100%);
  border-color: #0369a1;
}

body.reader-dark .library-card--folder:hover {
  border-color: #38bdf8;
  background: linear-gradient(135deg, #075985 0%, #0c4a6e 55%, #1e293b 100%);
}

body.reader-dark .folder-title {
  color: #e0f2fe;
}

body.reader-dark .folder-label {
  color: #7dd3fc;
}

body.reader-dark .folder-tab {
  background: linear-gradient(180deg, #7dd3fc, #38bdf8);
}

body.reader-dark .folder-graphic .folder-body {
  background: linear-gradient(165deg, #0ea5e9 0%, #0369a1 100%);
}

.format-badge {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  padding: 0.15rem 0.45rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: rgba(15, 23, 42, 0.72);
  border-radius: 999px;
  backdrop-filter: blur(4px);
}

.card-body {
  padding: 0.65rem 0.75rem 0.75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.book-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  margin: 0;
  font-size: 0.78rem;
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-progress {
  margin-top: 0.35rem;
  height: 3px;
  background: var(--color-border);
  border-radius: 999px;
  overflow: hidden;
}

.book-progress-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 999px;
  transition: width 0.2s ease;
}

/* ── Reader ────────────────────────────────────────────────────── */
.reader-shell {
  display: block;
  width: 100%;
}

.reader-column {
  width: 100%;
  max-width: var(--reader-max);
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

#viewer {
  display: none;
  line-height: var(--line-height, 1.65);
  text-align: var(--text-align, left);
  font-family: var(--reader-font, var(--font-serif));
}

#viewer .book-content,
#viewer .html-book {
  text-align: var(--text-align, left);
}

#viewer .book-content p,
#viewer .html-book p {
  text-align: inherit;
  margin: 0 0 var(--para-spacing, 1rem);
}

#viewer .book-content h2,
#viewer .html-book h1,
#viewer .html-book h2 {
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  font-family: inherit;
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

#viewer section,
#viewer .book-chapter {
  scroll-margin-top: calc(var(--header-h) + 1rem);
}

.html-book img {
  max-width: 100%;
  height: auto;
}

.html-book pre.book-text {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

/* TOC sidebar */
.reader-toc {
  display: none;
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  width: 18rem;
  max-width: min(18rem, 88vw);
  overflow-y: auto;
  padding: 1rem 1rem 1.5rem;
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
  z-index: 150;
}

.reader-toc.open { display: block; }

body.toc-open::before {
  content: '';
  position: fixed;
  inset: var(--header-h) 0 0 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 140;
  pointer-events: auto;
}

.reader-toc-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
}

#progressContainer {
  height: 4px;
  background: var(--color-border);
  margin-bottom: 1rem;
  border-radius: 999px;
  overflow: hidden;
}

#progressBar {
  height: 100%;
  background: var(--color-primary);
  width: 0%;
  transition: width 0.15s ease;
  border-radius: 999px;
}

.reader-toc nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.reader-toc nav ul ul {
  padding-left: 0.85rem;
  margin-top: 0.15rem;
  border-left: 1px solid var(--color-border);
}

.reader-toc nav li { margin: 0.15rem 0; }

.reader-toc nav a {
  display: block;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.85rem;
  line-height: 1.4;
  transition: background var(--transition);
}

.reader-toc nav a:hover {
  background: var(--color-primary-soft);
}

.reader-toc nav a.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 600;
}

.toc-modal-mobile { display: none !important; }

@media (max-width: 768px) {
  .reader-column {
    padding: 0 1rem 2.5rem;
  }

  #library {
    grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
    gap: 0.85rem;
  }
}

/* ── Modals ────────────────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(2px);
}

.modal-panel {
  position: relative;
  width: 100%;
  max-width: 26rem;
  max-height: min(85vh, 640px);
  overflow: auto;
  padding: 1.25rem 1.35rem 1.35rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.modal-panel-wide {
  max-width: 32rem;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-close {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.modal-close:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.settings-group {
  margin-bottom: 1.25rem;
}

.settings-group:last-child { margin-bottom: 0; }

.settings-label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
}

.theme-picker {
  display: flex;
  gap: 0.65rem;
}

.theme-option {
  flex: 1;
  cursor: pointer;
}

.theme-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-swatch {
  display: block;
  height: 2.75rem;
  border-radius: var(--radius-md);
  border: 2px solid var(--color-border);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.theme-option input:checked + .theme-swatch {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.theme-swatch-light { background: #ffffff; }
.theme-swatch-sepia { background: #f4ecd8; }
.theme-swatch-dark { background: #1e293b; }

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.setting-row label {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.setting-row input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--color-primary);
}

.setting-value {
  min-width: 3rem;
  text-align: right;
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.setting-row select {
  flex: 1;
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
}

#infoContent {
  font-size: 0.925rem;
  line-height: 1.55;
}

#infoContent p {
  margin: 0 0 0.65rem;
}

#infoContent img {
  max-width: 100%;
  border-radius: var(--radius-md);
  margin-top: 0.75rem;
}

/* ── Auth ──────────────────────────────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
  background: linear-gradient(160deg, #eef2ff 0%, var(--color-bg) 45%, #f8fafc 100%);
}

.auth-card {
  width: 100%;
  max-width: 22rem;
  padding: 2rem 1.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

.auth-card h1 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  text-align: center;
}

.auth-sub {
  margin: 0 0 1.5rem;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

.auth-card label {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.auth-card input {
  display: block;
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.auth-card input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-soft);
}

.auth-card button[type="submit"] {
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.7rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition);
}

.auth-card button[type="submit"]:hover {
  background: var(--color-primary-hover);
}

.error-text {
  margin: 0 0 0.75rem;
  color: var(--color-danger);
  font-size: 0.875rem;
}

/* ── Admin ─────────────────────────────────────────────────────── */
.admin-page {
  background: var(--color-bg);
  min-height: 100vh;
}

.admin-header {
  background: var(--color-header);
  color: var(--color-header-text);
  padding: 0.85rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: var(--shadow-sm);
}

.admin-header h1 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

.admin-header a {
  color: #93c5fd;
  text-decoration: none;
  font-size: 0.9rem;
}

.admin-header a:hover { text-decoration: underline; }

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.admin-header button {
  padding: 0.45rem 0.85rem;
  border: none;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.1);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background var(--transition);
}

.admin-header button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.admin-main {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.5rem 1rem 2.5rem;
}

.admin-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.admin-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 700;
}

.hint {
  color: var(--color-text-muted);
  font-size: 0.875rem;
  margin: 0 0 1rem;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.inline-form input,
.inline-form select {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--color-surface);
}

.inline-form button {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--color-primary);
  color: #fff;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}

.inline-form button:hover {
  background: var(--color-primary-hover);
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.admin-table th,
.admin-table td {
  border: 1px solid var(--color-border);
  padding: 0.5rem 0.65rem;
  text-align: left;
}

.admin-table th {
  background: var(--color-surface-2);
  font-weight: 600;
}

.info-box {
  background: var(--color-surface-2);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  font-size: 0.9rem;
}

.code-preview {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem;
  overflow: auto;
  font-size: 0.8rem;
  border-radius: var(--radius-md);
  max-height: 320px;
  line-height: 1.45;
}

.token-box {
  background: #fffbeb;
  border: 1px solid #fde68a;
  padding: 0.75rem;
  margin-bottom: 1rem;
  word-break: break-all;
  border-radius: var(--radius-md);
}
