/* ==========================================================================
   TempShare — design system
   Light, warm, emerald accents. Mobile-first. No frameworks.
   ========================================================================== */

/* Global guard: the hidden attribute must always win over any class that
   sets display (e.g. .dropzone{display:flex}). Without this, the UA
   stylesheet's [hidden]{display:none} loses to author display rules. */
[hidden] { display: none !important; }

/* ---------- tokens ---------- */
:root {
  color-scheme: light;
  --bg: #fafaf9;
  --bg-soft: #f4f4f3;
  --surface: #ffffff;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --text: #1c1917;
  --text-2: #57534e;
  --text-3: #a8a29e;

  --brand: #059669;
  --brand-strong: #047857;
  --brand-deep: #065f46;
  --brand-soft: #ecfdf5;
  --brand-border: #a7f3d0;
  --brand-ink: #065f46;

  --amber: #b45309;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;

  --red: #dc2626;
  --red-strong: #b91c1c;
  --red-soft: #fef2f2;
  --red-border: #fecaca;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-sm: 0 1px 2px rgb(28 25 23 / 0.05), 0 1px 3px rgb(28 25 23 / 0.06);
  --shadow-md: 0 4px 14px -2px rgb(28 25 23 / 0.08), 0 2px 5px -2px rgb(28 25 23 / 0.05);
  --shadow-lg: 0 24px 48px -16px rgb(6 95 70 / 0.18), 0 8px 20px -8px rgb(28 25 23 / 0.1);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial,
    "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --header-h: 62px;
  --container: 1120px;
  --container-narrow: 760px;
}

/* ---------- dark theme (auto + manual toggle) ---------- */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0c0a09;
  --bg-soft: #1c1917;
  --surface: #171412;
  --border: #292524;
  --border-strong: #44403c;
  --text: #fafaf9;
  --text-2: #d6d3d1;
  --text-3: #78716c;

  --brand: #34d399;
  --brand-strong: #10b981;
  --brand-deep: #059669;
  --brand-soft: rgb(16 185 129 / 0.10);
  --brand-border: rgb(52 211 153 / 0.38);
  --brand-ink: #6ee7b7;

  --amber: #fbbf24;
  --amber-soft: rgb(245 158 11 / 0.12);
  --amber-border: rgb(245 158 11 / 0.38);

  --red: #f87171;
  --red-strong: #ef4444;
  --red-soft: rgb(239 68 68 / 0.12);
  --red-border: rgb(239 68 68 / 0.42);

  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4), 0 1px 3px rgb(0 0 0 / 0.5);
  --shadow-md: 0 4px 14px -2px rgb(0 0 0 / 0.55), 0 2px 5px -2px rgb(0 0 0 / 0.45);
  --shadow-lg: 0 24px 48px -16px rgb(0 0 0 / 0.7), 0 8px 20px -8px rgb(0 0 0 / 0.5);
}

/* No-JS fallback: follow the OS preference until the inline head script
   pins an explicit data-theme. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    color-scheme: dark;
    --bg: #0c0a09;
    --bg-soft: #1c1917;
    --surface: #171412;
    --border: #292524;
    --border-strong: #44403c;
    --text: #fafaf9;
    --text-2: #d6d3d1;
    --text-3: #78716c;
    --brand: #34d399;
    --brand-strong: #10b981;
    --brand-deep: #059669;
    --brand-soft: rgb(16 185 129 / 0.10);
    --brand-border: rgb(52 211 153 / 0.38);
    --brand-ink: #6ee7b7;
    --amber: #fbbf24;
    --amber-soft: rgb(245 158 11 / 0.12);
    --amber-border: rgb(245 158 11 / 0.38);
    --red: #f87171;
    --red-strong: #ef4444;
    --red-soft: rgb(239 68 68 / 0.12);
    --red-border: rgb(239 68 68 / 0.42);
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4), 0 1px 3px rgb(0 0 0 / 0.5);
    --shadow-md: 0 4px 14px -2px rgb(0 0 0 / 0.55), 0 2px 5px -2px rgb(0 0 0 / 0.45);
    --shadow-lg: 0 24px 48px -16px rgb(0 0 0 / 0.7), 0 8px 20px -8px rgb(0 0 0 / 0.5);
  }
}

/* Targeted dark overrides for elements with hardcoded light tints. */
:root[data-theme="dark"] body {
  background:
    radial-gradient(1100px 420px at 50% -160px, rgb(16 185 129 / 0.06), transparent 70%),
    var(--bg);
}
:root[data-theme="dark"] .site-header { background: rgb(12 10 9 / 0.82); }
:root[data-theme="dark"] .admin-topbar { background: rgb(12 10 9 / 0.85); }
:root[data-theme="dark"] .hero-title .accent {
  background: linear-gradient(120deg, #34d399, #10b981);
  -webkit-background-clip: text;
  background-clip: text;
}
:root[data-theme="dark"] .section-alt {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.025), transparent);
}
:root[data-theme="dark"] .dropzone {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.02), rgb(0 0 0 / 0.15));
}
:root[data-theme="dark"] .admin-table tbody tr:hover { background: rgb(16 185 129 / 0.07); }
:root[data-theme="dark"] .ad-slot-placeholder {
  background: repeating-linear-gradient(45deg, transparent, transparent 12px, rgb(255 255 255 / 0.03) 12px, rgb(255 255 255 / 0.03) 24px);
}

/* file icons: dark tints */
:root[data-theme="dark"] .kind-image   { background: rgb(16 185 129 / 0.16); color: #6ee7b7; }
:root[data-theme="dark"] .kind-video   { background: rgb(244 63 94 / 0.16); color: #fda4af; }
:root[data-theme="dark"] .kind-audio   { background: rgb(245 158 11 / 0.16); color: #fcd34d; }
:root[data-theme="dark"] .kind-pdf     { background: rgb(239 68 68 / 0.16); color: #fca5a5; }
:root[data-theme="dark"] .kind-archive { background: rgb(234 88 12 / 0.16); color: #fdba74; }
:root[data-theme="dark"] .kind-code    { background: rgb(13 148 136 / 0.16); color: #5eead4; }
:root[data-theme="dark"] .kind-text    { background: rgb(148 163 184 / 0.14); color: #cbd5e1; }
:root[data-theme="dark"] .kind-doc     { background: rgb(132 204 22 / 0.16); color: #bef264; }
:root[data-theme="dark"] .kind-generic { background: rgb(120 113 108 / 0.18); color: #d6d3d1; }

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

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

body {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background:
    radial-gradient(1100px 420px at 50% -160px, rgb(16 185 129 / 0.09), transparent 70%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.chromeless { background: var(--bg); }

img, svg { display: inline-block; vertical-align: middle; }
a { color: var(--brand-strong); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

h1, h2, h3, h4 { line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; }
h2 { font-size: 1.65rem; }
h3 { font-size: 1.1rem; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection { background: rgb(16 185 129 / 0.25); }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: 20px;
}
.container-narrow { max-width: var(--container-narrow); }

.site-main { flex: 1 0 auto; display: flow-root; padding-bottom: 40px; }
.scroll-mt { scroll-margin-top: calc(var(--header-h) + 16px); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -48px; left: 16px;
  z-index: 200;
  padding: 10px 16px;
  background: var(--brand);
  color: #fff;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0; text-decoration: none; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: rgb(255 255 255 / 0.86);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.18rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-name em { font-style: normal; color: var(--brand-strong); }
.logo-mark { border-radius: 8px; box-shadow: 0 2px 6px rgb(5 150 105 / 0.35); }

.site-nav {
  display: none;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}
.site-nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}
.site-nav a:hover { background: var(--bg-soft); color: var(--text); text-decoration: none; }

.header-cta { margin-left: auto; }
.site-nav + .header-cta { margin-left: 8px; }

@media (min-width: 760px) {
  .site-nav { display: flex; }
  .header-cta { margin-left: 0; }
}

/* ---------- buttons / inputs ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease,
    border-color 0.15s ease, color 0.15s ease;
  user-select: none;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(180deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgb(4 120 87 / 0.4), inset 0 1px 0 rgb(255 255 255 / 0.16);
}
.btn-primary:hover { background: linear-gradient(180deg, #047857 0%, #065f46 100%); box-shadow: var(--shadow-md); }

.btn-ghost {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text-2);
}
.btn-ghost:hover { background: var(--bg-soft); color: var(--text); }

.btn-danger {
  background: linear-gradient(180deg, var(--red) 0%, var(--red-strong) 100%);
  color: #fff;
  box-shadow: 0 1px 2px rgb(153 27 27 / 0.35);
}
.btn-danger:hover { filter: brightness(1.05); }

.btn-sm { padding: 7px 12px; font-size: 0.85rem; border-radius: 8px; }
.btn-lg { padding: 14px 24px; font-size: 1.05rem; border-radius: 12px; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover { background: var(--bg-soft); color: var(--text); }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); border-color: var(--red-border); }

.input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(16 185 129 / 0.18);
}
.input-sm { padding: 8px 10px; font-size: 0.9rem; }

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
}

/* ---------- cards / alerts / badges ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  border: 1px solid;
}
.alert-error {
  background: var(--red-soft);
  border-color: var(--red-border);
  color: var(--red-strong);
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.badge-active { background: var(--brand-soft); color: var(--brand-ink); border: 1px solid var(--brand-border); }
.badge-expired { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-border); }
.badge-deleted { background: var(--red-soft); color: var(--red-strong); border: 1px solid var(--red-border); }

/* ---------- hero ---------- */
.hero { padding: 56px 0 8px; text-align: center; }
.hero-inner { display: flex; flex-direction: column; align-items: center; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  color: var(--brand-ink);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 22px;
}

.hero-title {
  font-size: clamp(2.1rem, 6vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.08;
  max-width: 16ch;
}
.hero-title .accent {
  background: linear-gradient(120deg, #10b981, #047857);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  position: relative;
}

.hero-sub {
  margin-top: 18px;
  max-width: 54ch;
  color: var(--text-2);
  font-size: clamp(1rem, 2.4vw, 1.15rem);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  list-style: none;
  padding: 0;
  margin: 26px 0 34px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
}
.chip svg { color: var(--brand); }

/* ---------- upload card ---------- */
.upload-wrap { width: 100%; max-width: 620px; }
.upload-card { padding: 22px; }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 44px 20px 38px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgb(255 255 255 / 0.6), rgb(244 244 243 / 0.4));
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.12s ease;
  text-align: center;
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.dropzone.dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
  transform: scale(1.01);
  box-shadow: var(--shadow-md);
}
.dz-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(160deg, rgb(16 185 129 / 0.14), rgb(4 120 87 / 0.10));
  color: var(--brand-strong);
  margin-bottom: 10px;
}
.dz-title { font-weight: 700; font-size: 1.08rem; }
.dz-sub { color: var(--text-2); font-size: 0.94rem; }
.dz-browse { color: var(--brand-strong); font-weight: 600; }
.dz-hint { color: var(--text-3); font-size: 0.8rem; margin-top: 8px; }

.file-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
  animation: rise 0.25s ease;
}
.file-row-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.file-row-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.file-row-size { color: var(--text-3); font-size: 0.85rem; }

.upload-card .btn-lg { margin-top: 14px; }
.file-row + .btn-lg { margin-top: 14px; }

/* file icons */
.file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px; height: 42px;
  border-radius: 11px;
  flex: none;
}
.kind-image    { background: #ecfdf5; color: #059669; }
.kind-video    { background: #fff1f2; color: #e11d48; }
.kind-audio    { background: #fffbeb; color: #d97706; }
.kind-pdf      { background: #fef2f2; color: #dc2626; }
.kind-archive  { background: #fff7ed; color: #ea580c; }
.kind-code     { background: #f0fdfa; color: #0d9488; }
.kind-text     { background: #f8fafc; color: #475569; }
.kind-doc      { background: #f7fee7; color: #65a30d; }
.kind-generic  { background: #f5f5f4; color: #78716c; }

/* progress */
.progress-wrap { margin-top: 18px; }
.progress {
  height: 10px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #059669);
  background-size: 200% 100%;
  animation: shimmer 1.2s linear infinite;
  transition: width 0.2s ease;
}
.progress-label { margin-top: 10px; font-size: 0.88rem; color: var(--text-2); text-align: center; }

@keyframes shimmer {
  0% { background-position: 0% 0; }
  100% { background-position: -200% 0; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.08); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes fadein {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* success state */
.upload-done { text-align: center; animation: fadein 0.3s ease; }
.done-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px; height: 58px;
  border-radius: 50%;
  background: var(--brand-soft);
  border: 2px solid var(--brand-border);
  color: var(--brand-strong);
  animation: pop 0.4s cubic-bezier(0.3, 1.6, 0.6, 1);
  margin-bottom: 12px;
}
.done-title { font-size: 1.35rem; }
.done-sub { color: var(--text-2); font-size: 0.94rem; margin: 6px 0 18px; }

.share-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.share-input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 0.86rem;
  color: var(--brand-ink);
  background: var(--brand-soft);
}
.share-input:focus { outline: none; border-color: var(--brand); }
.share-row .btn { flex: none; }
.share-row .btn.copied { background: var(--brand-deep); }
/* On narrow screens the link input takes the full first row; the copy and
   share buttons flow onto a second row instead of squeezing the input. */
@media (max-width: 480px) {
  .share-row { flex-wrap: wrap; }
  .share-input { flex-basis: 100%; }
  .share-row .btn { flex: 1; }
}

.done-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 0.88rem;
  color: var(--text-2);
}
.done-link { font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.upload-done .ad-slot { margin-top: 20px; }
.upload-done .btn-block { margin-top: 20px; }

/* ---------- ad slots (PRD §34) ---------- */
.ad-slot {
  margin: 28px auto 0;
  max-width: var(--container-narrow);
  text-align: center;
}
.ad-slot-label {
  display: block;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.ad-slot-placeholder {
  min-height: 92px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  background:
    repeating-linear-gradient(45deg, transparent, transparent 12px, rgb(28 25 23 / 0.018) 12px, rgb(28 25 23 / 0.018) 24px);
}
.ad-slot-tall { min-height: 250px; }

/* ---------- sections ---------- */
.section { padding: 56px 0 8px; }
.section-alt {
  background: linear-gradient(180deg, rgb(255 255 255 / 0.55), transparent);
  border-block: 1px solid var(--border);
  padding: 56px 0;
  margin-top: 48px;
}
.section-title { text-align: center; font-size: clamp(1.5rem, 4vw, 2rem); }
.section-sub { text-align: center; color: var(--text-2); margin: 8px auto 0; max-width: 56ch; }

/* steps */
.steps {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 18px;
  margin-top: 36px;
}
.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 22px 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.step:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.step-num {
  position: absolute;
  top: -14px; left: 20px;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, #10b981, #047857);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  border-radius: 999px;
  box-shadow: 0 3px 8px rgb(4 120 87 / 0.35);
}
.step-icon { color: var(--brand-strong); margin-bottom: 12px; }
.step h3 { margin-bottom: 6px; }
.step p { color: var(--text-2); font-size: 0.94rem; }

/* features */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 36px;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.feature:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.feature-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 11px;
  margin-bottom: 12px;
}
.f-emerald { background: var(--brand-soft); color: var(--brand-strong); border: 1px solid var(--brand-border); }
.feature h3 { font-size: 1rem; margin-bottom: 5px; }
.feature p { color: var(--text-2); font-size: 0.9rem; }

/* guide cards */
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
  margin-top: 36px;
}
.guide-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.guide-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-border);
  text-decoration: none;
}
.guide-card h3 { font-size: 1.02rem; }
.guide-card p { color: var(--text-2); font-size: 0.9rem; flex: 1; }
.guide-more {
  color: var(--brand-strong);
  font-weight: 600;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* faq */
.faq-list { margin-top: 30px; display: grid; gap: 10px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 18px;
  font-weight: 600;
  font-size: 0.97rem;
  cursor: pointer;
  list-style: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary svg { flex: none; color: var(--text-3); transition: transform 0.2s ease; }
.faq-item[open] summary svg { transform: rotate(180deg); color: var(--brand-strong); }
.faq-item summary:hover { background: var(--bg-soft); }
.faq-item p { padding: 0 18px 16px; color: var(--text-2); font-size: 0.93rem; }

/* ---------- download page ---------- */
.dl-section { padding: 48px 0 8px; animation: fadein 0.3s ease; }
.dl-card { padding: 30px 26px; }
.dl-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--brand-strong);
  font-weight: 700;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}
.dl-file {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0 8px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.dl-file-meta { min-width: 0; }
.dl-filename {
  font-size: clamp(1.05rem, 3.4vw, 1.3rem);
  word-break: break-all;
  line-height: 1.3;
}
.dl-file-sub { color: var(--text-3); font-size: 0.84rem; margin-top: 4px; }
.dl-btn { margin-top: 20px; }

.dl-expiry {
  margin-top: 22px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  text-align: center;
}
.dl-expiry-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--amber);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dl-countdown {
  font-family: var(--mono);
  font-size: clamp(1.9rem, 6vw, 2.6rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  margin: 4px 0 8px;
}
.dl-countdown.warn { color: var(--amber); }
.dl-countdown.danger { color: var(--red); animation: pulse 1s ease infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.dl-expiry-note { color: var(--text-2); font-size: 0.86rem; }

.dl-backlink { text-align: center; color: var(--text-3); font-size: 0.9rem; margin-top: 26px; }

/* error pages */
.error-card {
  padding: 44px 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.error-icon {
  display: grid;
  place-items: center;
  width: 64px; height: 64px;
  border-radius: 18px;
}
.ei-amber { background: var(--amber-soft); color: var(--amber); border: 1px solid var(--amber-border); }
.ei-red { background: var(--red-soft); color: var(--red); border: 1px solid var(--red-border); }
.error-heading { font-size: 1.5rem; }
.error-body { color: var(--text-2); max-width: 46ch; }
.error-card .btn { margin-top: 6px; }

/* ---------- article / content pages ---------- */
.article { padding: 44px 0 8px; }
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-3);
  margin-bottom: 22px;
}
.crumbs a { color: var(--text-2); font-weight: 500; }

.article-header h1 {
  font-size: clamp(1.7rem, 5vw, 2.4rem);
  letter-spacing: -0.03em;
}
.article-intro {
  margin-top: 14px;
  font-size: 1.08rem;
  color: var(--text-2);
  max-width: 62ch;
}
.article-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
}
.article-cta-note { color: var(--brand-ink); font-size: 0.85rem; font-weight: 500; }

.article .ad-slot { margin: 30px auto 0; }

.article-section { margin-top: 40px; }
.article-section h2 { font-size: 1.4rem; margin-bottom: 14px; }
.article-section > p { color: var(--text-2); margin-bottom: 14px; max-width: 72ch; }
.article-list {
  margin: 6px 0 14px;
  padding-left: 22px;
  color: var(--text-2);
  display: grid;
  gap: 8px;
  max-width: 72ch;
}
.article-list li::marker { color: var(--brand); }
.article-tip {
  padding: 14px 18px;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius-sm);
  color: var(--brand-ink);
  font-size: 0.93rem;
  max-width: 72ch;
}
.inline-code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--brand-ink);
}
.text-link { font-weight: 600; }

.article-related { margin-top: 48px; }
.article-related h2 { font-size: 1.25rem; }
.related-links { display: grid; gap: 10px; margin-top: 16px; }
.related-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 600;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.related-link:hover { border-color: var(--brand-border); transform: translateY(-2px); text-decoration: none; }
.related-link span { color: var(--brand-strong); }

/* ---------- footer (sticky — PRD layout rules) ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 44px 0 0;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding-bottom: 36px;
}
.footer-brand .brand { margin-bottom: 12px; }
.footer-blurb { color: var(--text-2); font-size: 0.9rem; max-width: 38ch; }
.footer-col { display: flex; flex-direction: column; gap: 9px; }
.footer-col h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-3);
  margin-bottom: 4px;
}
.footer-col a { color: var(--text-2); font-size: 0.92rem; }
.footer-col a:hover { color: var(--brand-strong); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-block: 18px;
  display: flex;
  justify-content: center;
}
.footer-bottom p { color: var(--text-3); font-size: 0.82rem; text-align: center; }

@media (min-width: 720px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
  .steps { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- admin ---------- */
.admin-login-section {
  flex: 1;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}
.admin-login-card {
  width: 100%;
  max-width: 380px;
  padding: 34px 30px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.admin-login-title { font-size: 1.3rem; margin-top: 14px; }
.admin-login-sub { color: var(--text-2); font-size: 0.9rem; margin: 6px 0 22px; }
.admin-login-form { width: 100%; text-align: left; }
.admin-secret-row { display: flex; gap: 8px; }
.admin-login-form .btn { margin-top: 14px; }
.admin-login-form .alert { margin-top: 12px; }
.admin-login-note { color: var(--text-3); font-size: 0.78rem; margin-top: 16px; }

.admin-shell { min-height: 100svh; display: flex; flex-direction: column; }
.admin-topbar {
  border-bottom: 1px solid var(--border);
  background: rgb(255 255 255 / 0.9);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.admin-topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 12px;
  flex-wrap: wrap;
}
.admin-brand { display: inline-flex; align-items: center; gap: 10px; font-size: 1.02rem; }
.admin-topbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* Keep the topbar comfortable on small screens: tighter gaps, shorter
   buttons — the row wraps instead of overflowing horizontally. */
@media (max-width: 560px) {
  .admin-topbar-inner { gap: 8px; padding-block: 10px; }
  .admin-topbar-actions { gap: 6px; }
  .admin-topbar-actions .btn-sm { padding-inline: 10px; }
  .admin-topbar-actions .btn-sm svg { display: none; }
}

.admin-main { flex: 1; padding: 28px 20px 60px; }
.admin-section-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 26px 0 14px;
}
.admin-section-head h1 { font-size: 1.45rem; }
.admin-section-head h2 { font-size: 1.2rem; }
.admin-muted { color: var(--text-3); font-size: 0.82rem; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stat-label { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-3); }
.stat-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 0.76rem; color: var(--text-3); }

.monitor-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 800px) { .monitor-grid { grid-template-columns: 1fr 1fr; } }
.monitor-card { padding: 18px; }
.monitor-card h3 { font-size: 0.95rem; margin-bottom: 10px; color: var(--text-2); }
.monitor-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.monitor-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.86rem;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.monitor-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.monitor-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.monitor-meta { color: var(--text-3); flex: none; font-variant-numeric: tabular-nums; }

/* round 9 — monitor entries are buttons that open the detail drawer */
.monitor-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 6px 8px;
  margin: -6px -8px;
  background: none;
  border: 0;
  border-radius: 8px;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.monitor-entry:hover { background: var(--bg-2); }
.monitor-entry:hover .monitor-name { color: var(--brand); }
.monitor-entry:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 8px;
}
/* round 9 — copyable share-id chip in the drawer */
.drawer-code.drawer-copy {
  cursor: pointer;
  border: 1px dashed transparent;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.drawer-code.drawer-copy:hover { border-color: var(--brand); color: var(--brand); }
.drawer-code.drawer-copy:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.drawer-code.drawer-copy.copied { color: var(--brand); border-color: var(--brand); border-style: solid; }

.admin-files-card { padding: 18px; }
.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 14px;
}
.admin-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 220px;
  max-width: 360px;
  color: var(--text-3);
}
.admin-search .input { padding-left: 32px; margin-left: -32px; }
.admin-filters { display: flex; gap: 8px; }

.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 860px;
}
.admin-table th {
  text-align: left;
  padding: 10px 12px;
  background: var(--bg-soft);
  color: var(--text-2);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr:hover { background: rgb(236 253 245 / 0.4); }
.cell-file-name { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.cell-ip { font-family: var(--mono); font-size: 0.76rem; color: var(--text-3); }
.cell-actions { display: flex; gap: 6px; }
.cell-expires.warn { color: var(--amber); font-weight: 600; }
.admin-empty { text-align: center; color: var(--text-3); padding: 34px 12px !important; white-space: normal; }

.admin-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.admin-dialog {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 40px);
}
.admin-dialog::backdrop { background: rgb(28 25 23 / 0.45); }
.admin-dialog-form { padding: 26px; }
.admin-dialog-form h3 { font-size: 1.15rem; margin-bottom: 10px; }
.admin-dialog-form p { color: var(--text-2); font-size: 0.92rem; }
.admin-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* table responsive: hide lower-priority columns on small screens */
@media (max-width: 900px) {
  .col-ip, .col-uploaded { display: none; }
  .admin-table { min-width: 640px; }
}
@media (max-width: 640px) {
  .col-size, .col-downloads { display: none; }
  .admin-table { min-width: 460px; }
}

/* ---------- misc ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* custom scrollbar (long lists) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ==========================================================================
   Round 2 additions — theme toggle, toasts, QR, recent link, cancel,
   admin chart + skeletons, micro-interaction polish
   ========================================================================== */

/* ---------- placeholder + shake ---------- */
::placeholder { color: var(--text-3); opacity: 1; }

@keyframes shake {
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}
.shake { animation: shake 0.3s ease; }

/* ---------- header: actions cluster + scroll elevation ---------- */
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.site-nav + .header-actions { margin-left: 12px; }
.site-nav { margin-left: auto; }
@media (min-width: 760px) {
  .site-nav { margin-left: auto; }
  .header-actions { margin-left: 0; }
}

.theme-toggle { position: relative; overflow: hidden; }
.theme-toggle .icon-sun,
.theme-toggle .icon-moon { transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1), opacity 0.2s ease; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: inline-flex; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: inline-flex; }

.site-header { transition: box-shadow 0.25s ease, background 0.25s ease; }
.site-header.scrolled { box-shadow: var(--shadow-md); }

/* ---------- chips hover micro-interaction ---------- */
.chip {
  transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease;
}
.chip:hover { transform: translateY(-1px); border-color: var(--brand-border); color: var(--text); }

/* ---------- FAQ open animation ---------- */
.faq-item[open] summary { color: var(--brand-strong); }
.faq-item p { animation: faq-open 0.25s ease; }
@keyframes faq-open {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- toast notifications ---------- */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 32px);
}
.toast {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 18px;
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.15);
  max-width: 100%;
}
.toast svg { flex: none; }
.toast.leaving { animation: toast-out 0.22s ease forwards; }
.toast.leaving .toast-timer { animation-play-state: paused; }
.toast-error { background: var(--red-strong); color: #fff; }
/* round 9 — shrinking bar that mirrors the toast lifetime */
.toast-timer {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2.5px;
  background: currentColor;
  opacity: 0.3;
  transform-origin: left center;
  border-radius: 0 0 999px 999px;
  animation-name: toast-timer;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}
@keyframes toast-timer {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(8px) scale(0.97); }
}

/* ---------- upload: cancel + QR + recent link ---------- */
.progress-cancel {
  margin-top: 10px;
  color: var(--text-2);
  font-size: 0.84rem;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.progress-cancel:hover { color: var(--red); }

.qr-block {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  padding: 16px 16px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.qr-block canvas {
  display: block;
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
  image-rendering: pixelated;
}
.qr-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-2);
}
.qr-hint svg { color: var(--brand-strong); }

.recent-panel {
  margin-top: 16px;
  padding: 13px 15px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-soft);
  animation: fadein 0.3s ease;
  text-align: left;
}
.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}
.recent-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.recent-title svg { color: var(--brand-strong); }
.recent-dismiss {
  border: none;
  background: none;
  color: var(--text-3);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
}
.recent-dismiss:hover { color: var(--red); }
.recent-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.recent-url {
  flex: 1;
  min-width: 160px;
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--brand-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.recent-meta {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  font-size: 0.76rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.recent-meta .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgb(16 185 129 / 0.18);
  flex: none;
}

/* ---------- admin: activity chart ---------- */
.chart-card { padding: 20px; }
.chart-card h3 { font-size: 0.95rem; margin-bottom: 2px; color: var(--text-2); }
.chart-sub { font-size: 0.78rem; color: var(--text-3); }
.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 165px;
  margin-top: 16px;
}
.chart-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  height: 100%;
  min-width: 0;
}
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 128px;
}
.bar {
  width: 14px;
  min-height: 3px;
  border-radius: 4px 4px 1px 1px;
  transition: height 0.5s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.bar-up { background: linear-gradient(180deg, var(--brand), var(--brand-strong)); }
.bar-down { background: var(--border-strong); }
.chart-col.today .bar-up { box-shadow: 0 0 0 1px var(--brand-border); }
.chart-day { font-size: 0.7rem; color: var(--text-3); white-space: nowrap; }
.chart-col.today .chart-day { color: var(--brand-strong); font-weight: 700; }
.chart-legend {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin-top: 14px;
  font-size: 0.78rem;
  color: var(--text-2);
}
.chart-legend .swatch {
  display: inline-block;
  width: 11px;
  height: 11px;
  border-radius: 3px;
  margin-right: 6px;
  vertical-align: -1px;
}
.chart-legend .swatch-up { background: linear-gradient(180deg, var(--brand), var(--brand-strong)); }
.chart-legend .swatch-down { background: var(--border-strong); }
.chart-empty { text-align: center; color: var(--text-3); font-size: 0.88rem; padding: 28px 0; }

/* ---------- admin: table skeletons ---------- */
.skeleton {
  display: inline-block;
  border-radius: 6px;
  height: 14px;
  background: linear-gradient(100deg, var(--bg-soft) 40%, var(--border) 50%, var(--bg-soft) 60%);
  background-size: 200% 100%;
  animation: skeleton-wave 1.3s linear infinite;
}
.skeleton-cell { width: 82px; }
.skeleton-cell.w-lg { width: 130px; }
.skeleton-cell.w-sm { width: 46px; }
.skeleton-cell.w-xs { width: 30px; }
.skeleton-circle { width: 18px; height: 18px; border-radius: 50%; }
@keyframes skeleton-wave {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ---------- print ---------- */
@media print {
  .site-header,
  .site-footer,
  .ad-slot,
  .theme-toggle,
  .toast-region { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; }
}

/* ---------- article date line (round 2) ---------- */
.article-date {
  margin-top: 10px;
  font-size: 0.8rem;
  color: var(--text-3);
}

/* ==========================================================================
   Round 3 additions — keyboard shortcuts, PWA, micro-interaction polish
   ========================================================================== */

/* ---------- keyboard hint chips ---------- */
.kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 6px;
  box-shadow: 0 1px 0 rgb(28 25 23 / 0.04);
  vertical-align: 1px;
}
:root[data-theme="dark"] .kbd {
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.4);
}
.dz-kbd-hint {
  margin: 10px 0 0;
  font-size: 0.74rem;
  color: var(--text-3);
}
.dz-kbd-hint .kbd { margin: 0 1px; }

/* ---------- shortcuts help dialog ---------- */
.shortcut-dialog {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 0;
  max-width: 400px;
  width: calc(100% - 40px);
}
.shortcut-dialog::backdrop { background: rgb(28 25 23 / 0.45); }
.shortcut-form { padding: 26px; }
.shortcut-title { font-size: 1.15rem; margin: 0 0 4px; }
.shortcut-sub { color: var(--text-3); font-size: 0.85rem; margin: 0 0 18px; }
.shortcut-list { margin: 0 0 20px; display: grid; gap: 4px; }
.shortcut-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
}
.shortcut-row:nth-child(odd) { background: var(--bg-soft); }
.shortcut-row dt { flex: none; width: 58px; text-align: center; }
.shortcut-row dd { margin: 0; font-size: 0.9rem; color: var(--text-2); }

/* ---------- upload progress: candy-stripe shimmer ---------- */
.progress-bar {
  position: relative;
  overflow: hidden;
}
.progress-bar::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: linear-gradient(
    45deg,
    rgb(255 255 255 / 0.22) 25%,
    transparent 25%,
    transparent 50%,
    rgb(255 255 255 / 0.22) 50%,
    rgb(255 255 255 / 0.22) 75%,
    transparent 75%,
    transparent
  );
  background-size: 18px 18px;
  animation: stripe-slide 0.7s linear infinite;
}
@keyframes stripe-slide {
  from { background-position: 0 0; }
  to { background-position: 18px 0; }
}
/* paused (finished/failed) state stops the shimmer */
.progress-bar.full::after, .progress-bar.stalled::after { animation: none; opacity: 0; }

/* ---------- success card: celebratory pop ---------- */
.upload-done { animation: pop-in 0.45s cubic-bezier(0.34, 1.4, 0.44, 1); }
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to { opacity: 1; transform: none; }
}
.upload-done .done-check { animation: check-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) 0.08s both; }
@keyframes check-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.qr-block:not([hidden]) { animation: fadein 0.4s ease 0.15s both; }

/* ---------- admin: stat count-up bump + card hover ---------- */
.stat-card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--brand-border);
}
.stat-value.bump { animation: stat-bump 0.35s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes stat-bump {
  0% { transform: scale(1); }
  45% { transform: scale(1.12); color: var(--brand); }
  100% { transform: scale(1); }
}

/* ---------- admin: chart bar grow-in + hover feedback ---------- */
.bar { transform-origin: bottom; animation: bar-grow 0.55s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
.bar-up:nth-child(1), .chart-col:nth-child(1) .bar { animation-delay: 0.02s; }
.chart-col:nth-child(2) .bar { animation-delay: 0.06s; }
.chart-col:nth-child(3) .bar { animation-delay: 0.1s; }
.chart-col:nth-child(4) .bar { animation-delay: 0.14s; }
.chart-col:nth-child(5) .bar { animation-delay: 0.18s; }
.chart-col:nth-child(6) .bar { animation-delay: 0.22s; }
.chart-col:nth-child(7) .bar { animation-delay: 0.26s; }
@keyframes bar-grow {
  from { transform: scaleY(0); }
  to { transform: scaleY(1); }
}
.chart-col .bar-up:hover, .chart-col .bar-down:hover {
  filter: brightness(1.12);
}

/* ---------- admin: table rows stagger in ---------- */
.admin-table tbody tr:not(.skeleton-row) { animation: row-in 0.28s ease both; }
.admin-table tbody tr:nth-child(1) { animation-delay: 0.02s; }
.admin-table tbody tr:nth-child(2) { animation-delay: 0.05s; }
.admin-table tbody tr:nth-child(3) { animation-delay: 0.08s; }
.admin-table tbody tr:nth-child(4) { animation-delay: 0.11s; }
.admin-table tbody tr:nth-child(5) { animation-delay: 0.14s; }
.admin-table tbody tr:nth-child(6) { animation-delay: 0.17s; }
.admin-table tbody tr:nth-child(7) { animation-delay: 0.2s; }
.admin-table tbody tr:nth-child(8) { animation-delay: 0.23s; }
@keyframes row-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* ---------- admin: thin themed scrollbar for the table viewport ---------- */
.admin-table-wrap { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
.admin-table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.admin-table-wrap::-webkit-scrollbar-track { background: var(--bg-soft); }
.admin-table-wrap::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}
.admin-table-wrap::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---------- admin: friendlier empty state ---------- */
.admin-empty { white-space: normal; }
.admin-empty .empty-icon {
  display: block;
  margin: 0 auto 10px;
  color: var(--text-3);
  opacity: 0.7;
}
.admin-empty .empty-hint { display: block; margin-top: 4px; font-size: 0.78rem; color: var(--text-3); }

/* ---------- export button spin while preparing ---------- */
#exportCsv svg { transition: transform 0.3s ease; }
#exportCsv:disabled svg { animation: spin 0.9s linear infinite; }
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ==========================================================================
   Round 4 additions — chart drill-down, date chip, guide-card art
   ========================================================================== */

/* ---------- chart: clickable day columns with count tooltips ---------- */
.chart-col {
  cursor: pointer;
  border-radius: 10px;
  padding: 4px 2px 2px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.chart-col:hover, .chart-col:focus-visible {
  background: var(--bg-soft);
  transform: translateY(-1px);
}
.chart-col:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.chart-col.selected {
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1.5px var(--brand-border);
}
:root[data-theme="dark"] .chart-col.selected {
  background: rgb(16 185 129 / 0.12);
}
.chart-col.selected .chart-day { color: var(--brand-strong); font-weight: 700; }

/* per-bar value shown above the bar on hover/focus */
.bar { position: relative; }
.bar::after {
  content: attr(data-count);
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 2;
  font-variant-numeric: tabular-nums;
}
.chart-col:hover .bar::after,
.chart-col:focus-visible .bar::after { opacity: 1; }
.bar[data-count="0"]::after { display: none; }

/* day-of-month under the weekday label */
.chart-daynum {
  font-size: 0.62rem;
  color: var(--text-3);
  line-height: 1;
  margin-top: -2px;
  font-variant-numeric: tabular-nums;
}

/* ---------- date-filter chip in the files toolbar ---------- */
.date-chip[hidden] { display: none; }
.date-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  padding: 5px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.date-chip:hover {
  background: rgb(16 185 129 / 0.18);
  border-color: var(--brand);
  transform: translateY(-1px);
}
:root[data-theme="dark"] .date-chip {
  color: #6ee7b7;
  background: rgb(16 185 129 / 0.1);
  border-color: rgb(6 78 59 / 0.9);
}

/* ---------- back-to-top button ---------- */
.back-to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 60;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  box-shadow: var(--shadow-md);
  cursor: pointer;
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, background 0.15s ease, color 0.15s ease;
}
.back-to-top.visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}
.back-to-top:hover {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.back-to-top:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
/* respect the iOS safe area */
@supports (padding: env(safe-area-inset-bottom)) {
  .back-to-top { bottom: calc(22px + env(safe-area-inset-bottom)); }
}

/* ---------- homepage guide cards: per-card icon + accent ---------- */
.guide-card { position: relative; }
.guide-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  margin-bottom: 12px;
  flex: none;
}
.guide-card-a .guide-card-icon { background: var(--brand-soft); color: var(--brand-strong); }
.guide-card-b .guide-card-icon { background: var(--amber-soft); color: var(--amber); }
.guide-card-c .guide-card-icon { background: var(--red-soft); color: var(--red); }
:root[data-theme="dark"] .guide-card-a .guide-card-icon { background: rgb(16 185 129 / 0.14); color: #6ee7b7; }
:root[data-theme="dark"] .guide-card-b .guide-card-icon { background: rgb(180 83 9 / 0.16); color: #fbbf24; }
:root[data-theme="dark"] .guide-card-c .guide-card-icon { background: rgb(220 38 38 / 0.14); color: #f87171; }
/* accent hairline that grows on hover */
.guide-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 16px;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: var(--brand);
  transform: scaleX(0.32);
  transform-origin: left;
  opacity: 0.55;
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.3, 1), opacity 0.2s ease;
}
.guide-card-a::before { background: linear-gradient(90deg, var(--brand), var(--brand-strong)); }
.guide-card-b::before { background: linear-gradient(90deg, #f59e0b, var(--amber)); }
.guide-card-c::before { background: linear-gradient(90deg, #f87171, var(--red)); }
.guide-card:hover::before, .guide-card:focus-visible::before {
  transform: scaleX(1);
  opacity: 1;
}

/* ---------- article section anchors ---------- */
.article-section h2 {
  position: relative;
  scroll-margin-top: calc(var(--header-h) + 14px);
}
.section-anchor {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
  color: var(--text-3);
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 0.18s ease, transform 0.18s ease, color 0.15s ease;
}
.article-section h2:hover .section-anchor,
.section-anchor:focus-visible {
  opacity: 1;
  transform: none;
}
.section-anchor:hover, .section-anchor:focus-visible { color: var(--brand); }
.section-anchor:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 4px; }

/* ---------- download button: attention shine sweep ---------- */
.dl-btn { position: relative; overflow: hidden; }
.dl-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -80%;
  width: 45%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgb(255 255 255 / 0.35), transparent);
  transform: skewX(-18deg);
  animation: dl-shine 3.2s ease-in-out infinite;
  animation-delay: 1.2s;
  pointer-events: none;
}
@keyframes dl-shine {
  0% { left: -80%; }
  55%, 100% { left: 130%; }
}

/* ---------- footer links: gentle nudge ---------- */
.footer-col a {
  position: relative;
  transition: color 0.15s ease, transform 0.18s ease;
}
.footer-col a:hover, .footer-col a:focus-visible {
  transform: translateX(3px);
}

/* ==========================================================================
   Round 5 additions — guide TOC sidebar + scroll-spy, chart range selector,
   paste-to-upload, micro-interaction polish
   ========================================================================== */

/* Anchor targets are the <section> elements — give them scroll room too. */
.article-section { scroll-margin-top: calc(var(--header-h) + 14px); }

/* ---------- article + TOC layout ----------
   Wide screens: 760px article body + 232px sticky TOC aside, centered.
   Narrow screens: single column; the aside hides and a collapsible
   <details> TOC (rendered under the header) takes over. */
.article-layout {
  display: block;
}
.toc { display: none; }
.toc-mobile { display: block; margin: 26px 0 6px; }

/* collapsible TOC (narrow screens) */
.toc-mobile summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.toc-mobile summary::-webkit-details-marker { display: none; }
.toc-mobile summary:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.toc-mobile summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.toc-summary-icon {
  display: inline-flex;
  color: var(--text-3);
  transition: transform 0.2s ease, color 0.15s ease;
}
.toc-mobile[open] .toc-summary-icon { transform: rotate(180deg); color: var(--brand); }
.toc-mobile-body {
  margin-top: 10px;
  padding: 8px 10px 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

/* shared link list */
.toc-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}
.toc-link {
  display: block;
  position: relative;
  padding: 6px 10px 6px 16px;
  font-size: 0.84rem;
  line-height: 1.35;
  color: var(--text-2);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
  overflow-wrap: anywhere;
}
.toc-link::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: var(--border-strong);
  transform: translateY(-50%) scale(0.6);
  transition: transform 0.18s ease, background 0.15s ease;
}
.toc-link:hover, .toc-link:focus-visible {
  color: var(--text);
  background: var(--bg-soft);
}
.toc-link:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.toc-link.active {
  color: var(--brand-strong);
  font-weight: 600;
  border-left-color: var(--brand);
  background: var(--brand-soft);
}
.toc-link.active::before {
  background: var(--brand);
  transform: translateY(-50%) scale(1);
}
:root[data-theme="dark"] .toc-link.active { color: #6ee7b7; }

/* sticky aside (wide screens) */
@media (min-width: 1100px) {
  .article-layout {
    display: grid;
    grid-template-columns: minmax(0, 760px) 232px;
    gap: 52px;
    justify-content: center;
    align-items: start;
  }
  .toc {
    display: block;
    position: sticky;
    top: calc(var(--header-h) + 24px);
    max-height: calc(100vh - var(--header-h) - 48px);
    overflow-y: auto;
    padding: 18px 4px 18px 0;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
  }
  .toc::-webkit-scrollbar { width: 6px; }
  .toc::-webkit-scrollbar-thumb { background: var(--border-strong); border: none; border-radius: 999px; }
  .toc-mobile { display: none; }
}
.toc-title {
  margin: 0 0 10px;
  padding-left: 16px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* reading progress (aside footer) */
.toc-progress {
  margin-top: 18px;
  padding: 12px 10px 10px 16px;
  border-top: 1px dashed var(--border);
  display: grid;
  gap: 8px;
}
.toc-progress-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.toc-progress-track {
  display: block;
  height: 5px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  overflow: hidden;
}
.toc-progress-bar {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  transition: width 0.2s ease;
}
.toc-progress-pct {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-3);
}

/* TOC entrance */
@media (min-width: 1100px) {
  .toc-link { opacity: 0; transform: translateX(-4px); animation: toc-in 0.4s ease forwards; }
  .toc-list li:nth-child(1) .toc-link { animation-delay: 0.02s; }
  .toc-list li:nth-child(2) .toc-link { animation-delay: 0.06s; }
  .toc-list li:nth-child(3) .toc-link { animation-delay: 0.1s; }
  .toc-list li:nth-child(4) .toc-link { animation-delay: 0.14s; }
  .toc-list li:nth-child(5) .toc-link { animation-delay: 0.18s; }
  .toc-list li:nth-child(6) .toc-link { animation-delay: 0.22s; }
  .toc-list li:nth-child(7) .toc-link { animation-delay: 0.26s; }
  .toc-list li:nth-child(n+8) .toc-link { animation-delay: 0.3s; }
}
@keyframes toc-in {
  to { opacity: 1; transform: none; }
}

/* ---------- admin chart range selector ---------- */
.chart-range {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
}
.chart-range-btn {
  appearance: none;
  border: none;
  background: transparent;
  padding: 4px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.chart-range-btn:hover { color: var(--text); }
.chart-range-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}
.chart-range-btn[aria-pressed="true"] {
  color: #ffffff;
  background: var(--brand);
  box-shadow: 0 1px 4px rgb(5 150 105 / 0.35);
}
.chart-range-btn:active { transform: scale(0.96); }
.chart-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
/* chart refresh ripple when the range changes */
.chart.refreshing .chart-col { animation: chart-pulse 0.45s ease; }
@keyframes chart-pulse {
  40% { opacity: 0.35; }
}

/* ---------- paste-to-upload ---------- */
.dz-paste-hint {
  margin: 8px 0 0;
  font-size: 0.74rem;
  color: var(--text-3);
}
.dz-paste-hint .kbd { margin: 0 2px; }
@keyframes dz-paste-flash {
  0% { box-shadow: 0 0 0 0 rgb(5 150 105 / 0.45); }
  60% { box-shadow: 0 0 0 7px rgb(5 150 105 / 0); }
  100% { box-shadow: 0 0 0 0 rgb(5 150 105 / 0); }
}
.dropzone.pasted { animation: dz-paste-flash 0.8s ease; }

/* ---------- print: no sidebar nav, no progress ---------- */
@media print {
  .toc, .toc-mobile, .toc-progress { display: none !important; }
  .article-layout { display: block !important; }
}

/* dense chart (14/30-day ranges): thinner bars, tighter gutters */
.chart.dense { gap: 3px; }
.chart.dense .chart-bars { gap: 2px; }
.chart.dense .bar { width: 8px; border-radius: 3px 3px 1px 1px; }
.chart.dense .chart-day { font-size: 0.64rem; }
.chart.dense .chart-daynum { font-size: 0.62rem; }
.chart.dense .chart-col { gap: 5px; }
@media (max-width: 640px) {
  .chart.dense .bar { width: 5px; }
  .chart.dense .chart-daynum { display: none; }
}

/* ==========================================================================
   Round 6 additions — upload speed/ETA, QR save, native share, reading
   time, SW update banner, admin auto-refresh, focus polish
   ========================================================================== */

/* ---------- upload progress: bytes · speed · eta ---------- */
.progress-meta {
  margin-top: 4px;
  font-size: 0.78rem;
  color: var(--text-3);
  text-align: center;
  font-variant-numeric: tabular-nums;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  animation: fadein 0.25s ease both;
}
.progress-meta[hidden] { display: none; }

/* ---------- success card: native share button + QR save ---------- */
.share-row .btn-share {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.share-row .btn-share[hidden] { display: none; }
.btn-share svg { transition: transform 0.2s ease; }
.btn-share:hover svg { transform: rotate(-8deg) scale(1.08); }

.qr-save {
  margin-top: 2px;
}
.qr-save[hidden] { display: none; }
.qr-save:active svg { transform: translateY(1px); }

/* ---------- guide header: reading-time chip ---------- */
.article-date {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.read-time {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--brand-border);
  background: var(--brand-soft);
  color: var(--brand-ink);
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.15s ease, transform 0.15s ease;
}
.read-time svg { color: var(--brand-strong); }
:root[data-theme="dark"] .read-time {
  background: rgb(6 95 70 / 0.16);
  border-color: rgb(52 211 153 / 0.25);
  color: #a7f3d0;
}
:root[data-theme="dark"] .read-time svg { color: #34d399; }

/* ---------- service-worker update banner ---------- */
.sw-update-banner {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 16px);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 11px 16px;
  max-width: min(520px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--brand-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 90;
}
.sw-update-banner.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0);
}
.sw-update-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
}
.sw-update-text svg { color: var(--brand-strong); flex: none; }
.sw-update-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

/* ---------- admin: auto-refresh toggle ---------- */
.auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  user-select: none;
  padding: 0 2px;
}
.auto-refresh input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
}
.auto-refresh-track {
  position: relative;
  width: 34px;
  height: 19px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  flex: none;
}
.auto-refresh-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s cubic-bezier(0.34, 1.4, 0.5, 1), background 0.2s ease, border-color 0.2s ease;
}
.auto-refresh-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-2);
  transition: color 0.2s ease;
}
.auto-refresh:hover .auto-refresh-track { border-color: var(--brand); }
.auto-refresh input:checked + .auto-refresh-track {
  background: var(--brand);
  border-color: var(--brand);
}
.auto-refresh input:checked + .auto-refresh-track .auto-refresh-thumb {
  transform: translateX(15px);
  border-color: var(--brand-deep);
}
.auto-refresh input:checked ~ .auto-refresh-label { color: var(--brand-strong); }
.auto-refresh input:focus-visible + .auto-refresh-track {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.auto-refresh:active .auto-refresh-thumb { width: 15px; }

/* ---------- focus-visible polish (round 6 audit) ---------- */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 0;
  border-radius: 6px;
}
.dropzone:focus-visible {
  outline-offset: 4px;
}

/* ---------- reduced motion: nothing new should animate ---------- */
@media (prefers-reduced-motion: reduce) {
  .progress-meta,
  .read-time,
  .sw-update-banner,
  .auto-refresh-track,
  .auto-refresh-thumb { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   Round 7 additions — /faq hub page + admin busiest-hours heat strip
   ========================================================================== */

/* ---------- /faq hub ---------- */
.faq-title-accent {
  background: linear-gradient(120deg, var(--brand-strong), var(--brand));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.faq-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 18px;
}
.faq-stat {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-2);
}
.faq-stat svg { color: var(--brand-strong); flex: none; }

.faq-search-wrap { margin-top: 30px; }
.faq-search {
  position: relative;
  display: flex;
  align-items: center;
}
.faq-search > svg {
  position: absolute;
  left: 16px;
  color: var(--text-3);
  pointer-events: none;
}
.faq-search .input {
  width: 100%;
  padding-left: 44px;
  padding-right: 118px;
  font-size: 0.95rem;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.faq-search .input::-webkit-search-cancel-button { -webkit-appearance: none; }
.faq-count {
  position: absolute;
  right: 14px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  transition: color 0.2s ease;
  pointer-events: none;
}
.faq-count.filtered { color: var(--brand-strong); }

.faq-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
.faq-cat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.faq-cat:hover {
  border-color: var(--brand-border);
  color: var(--brand-strong);
  transform: translateY(-1px);
  text-decoration: none;
}
.faq-cat-n {
  display: inline-grid;
  place-items: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  font-size: 0.68rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand-ink);
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 999px;
}

.faq-section { padding-top: 6px; margin-top: 42px; }
.faq-section-head { margin-bottom: 14px; }
.faq-section-head h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  font-size: 1.3rem;
}
.faq-section-num {
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--brand);
  letter-spacing: 0.04em;
}
.faq-section-blurb { margin-top: 4px; color: var(--text-3); font-size: 0.9rem; }

.faq-more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--brand-strong);
  text-decoration: none;
}
.faq-more svg { transition: transform 0.18s ease; }
.faq-more:hover { text-decoration: underline; text-underline-offset: 3px; }
.faq-more:hover svg { transform: translateX(3px); }

.faq-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 26px;
  padding: 34px 20px;
  text-align: center;
  color: var(--text-2);
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.faq-empty svg { color: var(--text-3); }
.faq-empty p { font-size: 0.95rem; }

.faq-hub-cta { display: flex; justify-content: center; margin-top: 26px; }

/* ---------- admin: busiest-hours heat strip ---------- */
.hours-card { margin-top: 14px; padding: 20px; }
.hours-card h3 { font-size: 0.95rem; margin-bottom: 2px; color: var(--text-2); }
.hour-peak {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  font-size: 0.76rem;
  background: var(--brand-soft);
  border: 1px solid var(--brand-border);
  border-radius: 999px;
  white-space: nowrap;
}
.hour-peak-label { color: var(--brand-ink); font-weight: 600; }
.hour-peak strong { color: var(--brand-ink); font-variant-numeric: tabular-nums; }
.hour-strip {
  display: grid;
  grid-template-columns: repeat(24, 1fr);
  gap: 3px;
  margin-top: 16px;
}
.hour-cell {
  height: 36px;
  border-radius: 5px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: hour-rise 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) backwards;
}
.hour-cell:nth-child(1) { animation-delay: 0.01s; }
.hour-cell:nth-child(2) { animation-delay: 0.025s; }
.hour-cell:nth-child(3) { animation-delay: 0.04s; }
.hour-cell:nth-child(4) { animation-delay: 0.055s; }
.hour-cell:nth-child(5) { animation-delay: 0.07s; }
.hour-cell:nth-child(6) { animation-delay: 0.085s; }
.hour-cell:nth-child(7) { animation-delay: 0.1s; }
.hour-cell:nth-child(8) { animation-delay: 0.115s; }
.hour-cell:nth-child(9) { animation-delay: 0.13s; }
.hour-cell:nth-child(10) { animation-delay: 0.145s; }
.hour-cell:nth-child(11) { animation-delay: 0.16s; }
.hour-cell:nth-child(12) { animation-delay: 0.175s; }
.hour-cell:nth-child(13) { animation-delay: 0.19s; }
.hour-cell:nth-child(14) { animation-delay: 0.205s; }
.hour-cell:nth-child(15) { animation-delay: 0.22s; }
.hour-cell:nth-child(16) { animation-delay: 0.235s; }
.hour-cell:nth-child(17) { animation-delay: 0.25s; }
.hour-cell:nth-child(18) { animation-delay: 0.265s; }
.hour-cell:nth-child(19) { animation-delay: 0.28s; }
.hour-cell:nth-child(20) { animation-delay: 0.295s; }
.hour-cell:nth-child(21) { animation-delay: 0.31s; }
.hour-cell:nth-child(22) { animation-delay: 0.325s; }
.hour-cell:nth-child(23) { animation-delay: 0.34s; }
.hour-cell:nth-child(24) { animation-delay: 0.355s; }
@keyframes hour-rise {
  from { opacity: 0; transform: translateY(6px) scaleY(0.6); }
  to { opacity: 1; transform: translateY(0) scaleY(1); }
}
.hour-cell.heat-1 { background: rgb(16 185 129 / 0.2); border-color: rgb(16 185 129 / 0.28); }
.hour-cell.heat-2 { background: rgb(16 185 129 / 0.42); border-color: rgb(16 185 129 / 0.5); }
.hour-cell.heat-3 { background: rgb(16 185 129 / 0.64); border-color: rgb(16 185 129 / 0.72); }
.hour-cell.heat-4 {
  background: linear-gradient(180deg, var(--brand), var(--brand-strong));
  border-color: var(--brand-strong);
}
.hour-cell.peak { box-shadow: 0 0 0 2px var(--brand-border), 0 4px 10px -3px rgb(16 185 129 / 0.55); }
.hour-cell:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  cursor: default;
}
.hour-axis {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

/* heat strip on small screens: tighter cells */
@media (max-width: 560px) {
  .hour-strip { gap: 2px; }
  .hour-cell { height: 28px; border-radius: 4px; }
  .hour-peak { padding: 4px 10px; font-size: 0.72rem; }
}

/* ---------- /faq print + reduced-motion ---------- */
@media print {
  .faq-search-wrap,
  .faq-hub-cta,
  .faq-empty { display: none !important; }
  .faq-cat-n { border-color: #999; }
}
@media (prefers-reduced-motion: reduce) {
  .hour-cell,
  .faq-cat,
  .faq-more svg { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   Round 8 — admin: per-file detail drawer, cleanup run timeline
   ========================================================================== */

/* ---------- files table: drawer affordance on the file name ---------- */
.admin-table tbody tr { cursor: pointer; }
.cell-file-name {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  text-align: left;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.cell-file-name:hover { color: var(--brand); border-bottom-color: var(--brand-border); }
.cell-file-name:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}
.admin-table tbody tr:active .cell-file-name { color: var(--brand-strong); }

/* ---------- drawer: overlay + panel ---------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgb(28 25 23 / 0.38);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: overlay-in 0.2s ease;
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }
body.drawer-open { overflow: hidden; }

.file-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 95;
  width: min(420px, 92vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 44px -14px rgb(28 25 23 / 0.22);
  transform: translateX(103%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.25, 1);
  visibility: hidden;
}
.file-drawer.open {
  transform: translateX(0);
  visibility: visible;
}
.file-drawer[aria-hidden="true"] { pointer-events: none; }

.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--brand-soft), transparent);
}
.drawer-head-main { flex: 1; min-width: 0; }
.drawer-title {
  margin: 4px 0 0;
  font-size: 1.02rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--text);
  overflow-wrap: anywhere;
}
.drawer-head .icon-btn { flex: none; }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}
.drawer-body::-webkit-scrollbar { width: 8px; }
.drawer-body::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 4px;
}
.drawer-skeleton { display: flex; flex-direction: column; gap: 12px; }

/* lifetime progress */
.drawer-lifetime { margin-bottom: 16px; }
.drawer-bar-track {
  height: 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  overflow: hidden;
}
.drawer-bar {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), var(--brand-strong));
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.drawer-bar.warn { background: linear-gradient(90deg, #d97706, var(--amber)); }
.drawer-bar.danger { background: linear-gradient(90deg, var(--red-strong), var(--red)); }
.drawer-bar.done { background: linear-gradient(90deg, var(--text-3), #78716c); }
.drawer-lifetime-label {
  display: flex;
  justify-content: space-between;
  margin: 7px 0 0;
  font-size: 0.76rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

/* copyable share url */
.drawer-share-url {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--brand-ink);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.drawer-share-url:hover { border-color: var(--brand); background: var(--brand-soft); }
.drawer-url-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-share-url:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* detail grid */
.drawer-grid { margin: 0; }
.drawer-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
.drawer-row dt {
  flex: none;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.drawer-row dd {
  margin: 0;
  text-align: right;
  font-size: 0.86rem;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}
.drawer-note { color: var(--text-3); font-size: 0.76rem; }
.drawer-code {
  font-family: var(--mono);
  font-size: 0.78rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 1px 6px;
}
.drawer-object { font-weight: 600; }
.drawer-object.ok { color: var(--brand); }
.drawer-object.bad { color: var(--red); }
.drawer-object.unknown { color: var(--amber); }
.drawer-object.gone { color: var(--text-3); }

/* actions */
.drawer-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.drawer-actions .btn { flex: 1; justify-content: center; }
.drawer-foot {
  margin: 14px 0 0;
  font-size: 0.72rem;
  text-align: center;
}

/* ---------- cleanup run timeline ---------- */
.cleanup-card { margin-top: 14px; padding: 20px; }
.cleanup-card h3 { font-size: 0.95rem; margin-bottom: 2px; color: var(--text-2); }
.cleanup-timeline {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.run-dot {
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  background: var(--bg-soft);
  border: 1px solid var(--border-strong);
  cursor: default;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  animation: dot-pop 0.3s ease backwards;
}
.run-dot:hover { transform: scale(1.35); box-shadow: var(--shadow-md); }
.run-dot:nth-child(1) { animation-delay: 0.02s; }
.run-dot:nth-child(2) { animation-delay: 0.06s; }
.run-dot:nth-child(3) { animation-delay: 0.1s; }
.run-dot:nth-child(4) { animation-delay: 0.14s; }
.run-dot:nth-child(5) { animation-delay: 0.18s; }
.run-dot:nth-child(6) { animation-delay: 0.22s; }
.run-dot:nth-child(7) { animation-delay: 0.26s; }
.run-dot:nth-child(8) { animation-delay: 0.3s; }
.run-dot:nth-child(9) { animation-delay: 0.34s; }
.run-dot:nth-child(10) { animation-delay: 0.38s; }
.run-dot:nth-child(11) { animation-delay: 0.42s; }
.run-dot:nth-child(12) { animation-delay: 0.46s; }
@keyframes dot-pop {
  from { opacity: 0; transform: scale(0.3); }
  to { opacity: 1; transform: scale(1); }
}
.run-dot.work {
  background: linear-gradient(180deg, var(--brand), var(--brand-strong));
  border-color: var(--brand-strong);
}
.run-dot.fail {
  background: linear-gradient(180deg, var(--red), var(--red-strong));
  border-color: var(--red-strong);
  animation: dot-pop 0.3s ease backwards, dot-pulse 1.6s ease-in-out 0.6s infinite;
}
@keyframes dot-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgb(220 38 38 / 0.45); }
  50% { box-shadow: 0 0 0 5px rgb(220 38 38 / 0); }
}
.cleanup-summary {
  margin: 12px 0 0;
  font-size: 0.78rem;
}

/* ---------- dark variants ---------- */
:root[data-theme="dark"] .file-drawer {
  background: #181512;
  border-left-color: rgb(63 56 54);
  box-shadow: -18px 0 44px -14px rgb(0 0 0 / 0.5);
}
:root[data-theme="dark"] .drawer-head {
  background: linear-gradient(180deg, rgb(16 185 129 / 0.08), transparent);
  border-bottom-color: rgb(63 56 54);
}
:root[data-theme="dark"] .drawer-row { border-bottom-color: rgb(63 56 54 / 0.7); }
:root[data-theme="dark"] .drawer-code { background: rgb(41 37 36); border-color: rgb(63 56 54); }
:root[data-theme="dark"] .drawer-share-url { background: rgb(23 21 20); border-color: rgb(63 56 54); }
:root[data-theme="dark"] .drawer-share-url:hover { border-color: var(--brand); background: rgb(16 185 129 / 0.1); }
:root[data-theme="dark"] .run-dot { background: rgb(41 37 36); border-color: rgb(87 83 78); }
:root[data-theme="dark"] .cell-file-name:hover { color: #6ee7b7; border-bottom-color: rgb(110 231 183 / 0.4); }

/* ---------- mobile drawer ---------- */
@media (max-width: 480px) {
  .file-drawer { width: 100vw; border-left: 0; }
  .drawer-actions { flex-direction: column; }
  .cleanup-timeline { gap: 6px; }
  .run-dot { width: 12px; height: 12px; }
}

/* ---------- print + reduced motion ---------- */
@media print {
  .file-drawer,
  .drawer-overlay,
  .cleanup-card { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .file-drawer { transition: none; }
  .drawer-overlay { animation: none; }
  .drawer-bar { transition: none; }
  .run-dot,
  .run-dot.fail { animation: none; }
  .run-dot:hover { transform: none; }
}

/* ---------- round 8 polish: selected-row highlight while drawer is open ---------- */
.admin-table tbody tr.selected-row { background: rgb(236 253 245 / 0.65); }
.admin-table tbody tr.selected-row td:first-child { box-shadow: inset 3px 0 0 var(--brand); }
:root[data-theme="dark"] .admin-table tbody tr.selected-row { background: rgb(16 185 129 / 0.1); }

/* cleanup peak pill: keep label + value readable when squeezed on small screens */
@media (max-width: 560px) {
  .cleanup-card .hour-peak { padding: 4px 10px; font-size: 0.72rem; }
  .cleanup-summary { font-size: 0.72rem; }
}

/* ---------- round 9: full-window drag overlay (homepage) ---------- */
.drag-overlay {
  position: fixed;
  inset: 0;
  z-index: 250; /* above header/back-to-top, below toasts (300) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgb(16 185 129 / 0.12);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  /* Purely visual: never intercept the pointer or the drop itself. */
  pointer-events: none;
  animation: drag-overlay-in 0.18s ease-out;
}
:root[data-theme="dark"] .drag-overlay { background: rgb(6 78 59 / 0.35); }
.drag-overlay-panel {
  max-width: 460px;
  padding: 36px 44px;
  text-align: center;
  color: var(--brand-deep, #065f46);
  background: var(--card, #ffffff);
  border: 2px dashed var(--brand);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgb(6 78 59 / 0.25);
  animation: drag-panel-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
:root[data-theme="dark"] .drag-overlay-panel {
  color: #6ee7b7;
  box-shadow: 0 24px 60px rgb(0 0 0 / 0.55);
}
.drag-overlay-panel svg { margin: 0 auto 14px; color: var(--brand); display: block; animation: drag-float 1.4s ease-in-out infinite; }
.drag-overlay-title { font-size: 1.35rem; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 8px; }
.drag-overlay-sub { font-size: 0.88rem; color: var(--text-3); margin: 0; line-height: 1.5; }
@keyframes drag-overlay-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes drag-panel-in { from { opacity: 0; transform: scale(0.94) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes drag-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@media (prefers-reduced-motion: reduce) {
  .drag-overlay, .drag-overlay-panel { animation: none; }
  .drag-overlay-panel svg { animation: none; }
}
@media print { .drag-overlay { display: none !important; } }

/* ---------- round 9 polish: monitor urgency tints + reduced-motion guard ---------- */
.monitor-meta.warn { color: var(--amber); font-weight: 700; }
.monitor-meta.danger { color: var(--red-strong); font-weight: 700; }
:root[data-theme="dark"] .monitor-meta.warn { color: var(--amber); }
:root[data-theme="dark"] .monitor-meta.danger { color: #f87171; }
@media (prefers-reduced-motion: reduce) {
  .toast-timer { animation: none; opacity: 0.18; }
}

/* ---------- round 10 · A: upload image preview (thumbnail + lightbox) ---------- */
.file-thumb {
  flex: none;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 11px;
  overflow: hidden;
  background: var(--bg-soft);
  cursor: zoom-in;
  position: relative;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.file-thumb::after {
  /* subtle zoom affordance, revealed on hover/focus */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgb(0 0 0 / 0) 55%, rgb(0 0 0 / 0.38));
  opacity: 0;
  transition: opacity 0.16s ease;
}
.file-thumb:hover, .file-thumb:focus-visible {
  transform: translateY(-1px);
  border-color: var(--brand);
  box-shadow: 0 6px 16px rgb(5 150 105 / 0.18);
  outline: none;
}
.file-thumb:hover::after, .file-thumb:focus-visible::after { opacity: 1; }
.file-thumb:focus-visible { box-shadow: 0 0 0 3px rgb(16 185 129 / 0.28), 0 6px 16px rgb(5 150 105 / 0.18); }
:root[data-theme="dark"] .file-thumb { background: var(--bg-soft); }

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 280; /* above the admin drawer (250), below toasts (300) */
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgb(9 9 11 / 0.72);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: lightbox-fade 0.18s ease;
}
body.lightbox-open { overflow: hidden; }
.image-lightbox-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: min(92vw, 920px);
  animation: lightbox-pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.image-lightbox-img {
  max-width: min(92vw, 920px);
  max-height: 68vh;
  border-radius: 14px;
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.55);
  background: var(--bg-soft);
}
.image-lightbox-caption {
  color: rgb(255 255 255 / 0.82);
  font-size: 0.85rem;
  margin: 0;
  text-align: center;
  text-shadow: 0 1px 4px rgb(0 0 0 / 0.6);
  max-width: 88vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.image-lightbox-close {
  position: fixed;
  top: 18px;
  right: 18px;
  background: rgb(255 255 255 / 0.92);
  color: #1c1917;
  border: 1px solid rgb(0 0 0 / 0.14);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.3);
}
.image-lightbox-close:hover { background: #fff; transform: scale(1.05); }
@keyframes lightbox-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes lightbox-pop { from { opacity: 0; transform: scale(0.92); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .image-lightbox, .image-lightbox-inner { animation: none; }
  .file-thumb { transition: none; }
  .image-lightbox-close:hover { transform: none; }
}
@media print { .image-lightbox { display: none !important; } }

/* ---------- round 10 · B: admin bulk selection + delete ---------- */
.col-check { width: 42px; text-align: center; }
.admin-table .col-check input[type="checkbox"],
.row-check {
  width: 16px;
  height: 16px;
  accent-color: var(--brand);
  cursor: pointer;
  vertical-align: middle;
}
.row-check:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 3px;
}
/* Row tint for checked rows — distinct from the drawer's selected-row rail. */
tr.checked-row td {
  background: rgb(16 185 129 / 0.05);
}
tr.checked-row .cell-file-name { color: var(--brand-strong); }

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 14px;
  margin-bottom: 12px;
  border: 1px solid var(--brand);
  border-radius: 10px;
  background: rgb(16 185 129 / 0.06);
  animation: bulk-bar-in 0.2s ease;
}
.bulk-count {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--brand-strong);
}
.bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; }
:root[data-theme="dark"] .bulk-bar {
  background: rgb(16 185 129 / 0.1);
  border-color: rgb(16 185 129 / 0.55);
}
:root[data-theme="dark"] tr.checked-row td {
  background: rgb(16 185 129 / 0.08);
}
.bulk-delete-names {
  margin: 10px 0 0;
  font-size: 0.85rem;
  color: var(--text-3);
  max-height: 7.2em;
  overflow-y: auto;
  line-height: 1.6;
}
@keyframes bulk-bar-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .bulk-bar { animation: none; }
}
@media print { .bulk-bar, .col-check { display: none !important; } }

/* ---------- round 11 · B: download-page image preview ---------- */
.dl-preview { margin: 18px 0 4px; }
.dl-preview-frame {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  background:
    repeating-conic-gradient(var(--bg-soft) 0% 25%, transparent 0% 50%) 0 0 / 22px 22px,
    var(--bg);
  overflow: hidden;
  cursor: zoom-in;
  min-height: 148px;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.dl-preview-frame:hover, .dl-preview-frame:focus-visible {
  border-color: var(--brand);
  box-shadow: 0 8px 22px rgb(5 150 105 / 0.14);
  outline: none;
}
.dl-preview-img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  width: auto;
  height: auto;
  object-fit: contain;
  animation: preview-in 0.25s ease;
}
.dl-preview-skeleton {
  width: min(78%, 320px);
  height: 120px;
  border-radius: 8px;
  background: linear-gradient(100deg, var(--bg-soft) 40%, var(--border) 50%, var(--bg-soft) 60%);
  background-size: 220% 100%;
  animation: skeleton-sweep 1.3s ease-in-out infinite;
}
:root[data-theme="dark"] .dl-preview-frame {
  background:
    repeating-conic-gradient(rgb(28 25 23 / 0.9) 0% 25%, transparent 0% 50%) 0 0 / 22px 22px,
    #1c1917;
}
.dl-preview-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--text-3);
  text-align: center;
}
:root[data-theme="dark"] .dl-preview-hint { color: rgb(214 211 209 / 0.6); }
@keyframes preview-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: none; }
}
@keyframes skeleton-sweep {
  from { background-position: 120% 0; }
  to { background-position: -120% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .dl-preview-img, .dl-preview-skeleton { animation: none; }
  .dl-preview-frame { transition: none; }
}
@media print { .dl-preview { display: none !important; } }
