/* ============================================================
   Inkshelf — admin (#/admin). Frosted liquid-glass cards on soft
   colour blobs. Only base.css tokens are used, so data-scheme /
   data-style themes apply automatically.
   ============================================================ */
.admin-page { position: relative; isolation: isolate; overflow-x: clip; }
.admin-page::before, .admin-page::after { /* soft colour fields for the glass to blur */
  content: ""; position: fixed; z-index: -1; pointer-events: none; border-radius: 50%;
  filter: blur(60px); opacity: .55;
}
.admin-page::before { width: 70vw; height: 70vw; max-width: 520px; max-height: 520px; left: -20vw; top: 6vh;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%); }
.admin-page::after { width: 60vw; height: 60vw; max-width: 460px; max-height: 460px; right: -18vw; top: 48vh;
  background: radial-gradient(circle, color-mix(in srgb, var(--pink) 22%, transparent), transparent 70%); }

.adm-wrap { max-width: 720px; padding-top: 16px; }
.adm-stage { position: relative; }

/* ---------- glass card ---------- */
.adm-card {
  position: relative; margin-bottom: 14px; padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow), inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 0 0 1px var(--glass-edge);
}
.adm-card::before { /* specular highlight along the top edge */
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(170deg, rgba(255, 255, 255, .28), rgba(255, 255, 255, 0) 38%);
}
.adm-card > * { position: relative; }

.adm-loading { display: grid; place-items: center; padding: 22vh 0; }
.adm-hint { color: var(--text-2); font-size: 14.5px; line-height: 1.5; }

/* ---------- token gate ---------- */
.adm-gate { margin-top: 8vh; padding: 26px 20px 20px; text-align: center; }
.adm-gate-icon {
  display: grid; place-items: center; width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 20px;
  color: var(--accent-contrast); background: linear-gradient(140deg, var(--accent-light), var(--accent));
  box-shadow: 0 10px 26px rgba(214, 54, 15, .32), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.adm-gate-icon .icon { width: 32px; height: 32px; }
.adm-gate-title { font-size: 21px; margin-bottom: 8px; }
.adm-gate-text { color: var(--text-2); font-size: 14px; line-height: 1.5; margin: 0 0 18px; }
.adm-gate-text code { font-size: 13px; padding: 1px 5px; border-radius: 5px; background: var(--surface-2); }
.adm-gate .field { margin-bottom: 14px; }

/* ---------- list ---------- */
.adm-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 14px 10px; }
.adm-stat { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.adm-stat b { font-size: 18px; font-weight: 600; color: var(--pink); white-space: nowrap; }
.adm-stat span { font-size: 12px; color: var(--text-2); }
.adm-new { margin-bottom: 14px; }
.adm-new .icon, .adm-ch-actions .icon, .adm-hero-actions .icon, .adm-form .btn .icon, .adm-btn-danger .icon { width: 20px; height: 20px; }

.adm-list { padding: 4px 14px; }
.adm-row, .adm-ch {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 12px 0; border-bottom: 1px solid var(--border);
}
.adm-row:last-child, .adm-ch:last-child { border-bottom: 0; }
.adm-row:active { opacity: .7; }
.adm-thumb { width: 52px; flex-shrink: 0; display: grid; place-items: center; color: var(--muted); }
.adm-thumb > .icon { position: absolute; inset: 0; margin: auto; }
.adm-row-main, .adm-ch-main { flex: 1; min-width: 0; }
.adm-row-title { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-row-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.adm-chevron { width: 18px; height: 18px; color: var(--muted); }
.adm-pill {
  display: inline-flex; align-items: center; height: 22px; margin-top: 6px; padding: 0 9px;
  border-radius: 999px; font-size: 12px; font-weight: 500;
}
.adm-pill.ok { color: #1f9d55; background: rgba(31, 157, 85, .12); }
.adm-pill.warn { color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); }
.adm-warn-text { color: var(--orange); }
.adm-foot { display: grid; gap: 10px; margin-top: 22px; }
.adm-signout { color: #e03131; }

/* ---------- editor ---------- */
.adm-hero { display: flex; gap: 16px; align-items: flex-start; }
.adm-cover { width: 118px; flex-shrink: 0; }
.adm-cover-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: 12px; }
.adm-cover-busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, .3); }
.adm-hero-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.adm-hero-title { font-size: 19px; font-weight: 600; line-height: 1.25; word-break: break-word; }
.adm-hero-meta .adm-row-sub { margin-top: 4px; }
.adm-folder { display: flex; align-items: center; gap: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.adm-folder .icon { width: 15px; height: 15px; }
.adm-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.adm-hero-actions .btn { padding: 0 12px; }

.admin-page .section-head { margin: 22px 0 12px; }
.adm-ch-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.adm-ch-actions .btn { padding: 0 12px; }
.adm-icon-btn { width: 40px; height: 40px; color: var(--text-2); flex-shrink: 0; }
.adm-icon-btn .icon { width: 21px; height: 21px; }
.adm-icon-btn.danger { color: #e03131; margin-right: -8px; }

.adm-form .chip-grid { margin-top: 2px; }
.adm-form textarea.input { min-height: 120px; }
.adm-btn-danger { background: #e03131; color: #fff; box-shadow: 0 6px 18px rgba(224, 49, 49, .25); }
.adm-btn-danger:active { filter: brightness(.94); }

/* ---------- sheets (confirm / prompt / add chapter / bulk) ---------- */
.adm-dialog-text { margin: 0 0 6px; color: var(--text-2); font-size: 15.5px; line-height: 1.5; text-align: center; }
.adm-dialog .sheet-footer .btn-outline { flex: 1; }
.adm-sources { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.adm-source {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 6px 12px;
  border-radius: var(--radius); background: var(--surface-2); border: 1.5px solid transparent; text-align: center;
}
.adm-source:active { border-color: var(--accent-light); background: var(--accent-soft); }
.adm-source .icon { width: 28px; height: 28px; color: var(--accent-light); }
.adm-source-label { font-size: 14.5px; font-weight: 500; }
.adm-source-hint { font-size: 11.5px; color: var(--muted); }
.adm-pick-status { min-height: 22px; font-size: 14px; color: var(--text-2); text-align: center; margin-bottom: 4px; }
.adm-bulk-list { display: flex; flex-direction: column; }
.adm-bulk-row { display: flex; justify-content: space-between; gap: 12px; padding: 11px 2px; border-bottom: 1px solid var(--border); font-size: 15px; }
.adm-bulk-row:last-child { border-bottom: 0; }
.adm-bulk-row .adm-row-sub { margin: 0; white-space: nowrap; }

/* ---------- upload progress overlay ---------- */
.adm-overlay {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px var(--gutter);
  background: rgba(0, 0, 0, .32); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.adm-up-card {
  width: 100%; max-width: 380px; padding: 22px 20px 18px; text-align: center;
  border-radius: 22px; background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .28), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.adm-up-icon { display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 10px; border-radius: 50%; color: var(--accent-light); background: var(--accent-soft); }
.adm-up-title { font-size: 17px; font-weight: 600; }
.adm-up-sub { font-size: 13px; color: var(--muted); min-height: 18px; }
.adm-bar { height: 8px; margin: 14px 0 8px; border-radius: 99px; overflow: hidden; background: var(--surface-2); }
.adm-bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent-light), var(--accent)); transition: width .2s ease; }
.adm-up-count { font-size: 14px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.adm-up-error { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius); font-size: 13.5px; text-align: left; color: #e03131; background: rgba(224, 49, 49, .1); word-break: break-word; }
.adm-up-actions { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.adm-up-actions .btn { flex: 1; max-width: 140px; }

@media (min-width: 640px) {
  .adm-cover { width: 140px; }
  .adm-foot { grid-template-columns: 1fr 1fr; }
}
