@font-face {
  font-family: "Quicksand";
  src: url("/assets/fonts/quicksand-latin-400.woff2") format("woff2");
  font-weight: 400; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Quicksand";
  src: url("/assets/fonts/quicksand-vietnamese-400.woff2") format("woff2");
  font-weight: 400; font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Quicksand";
  src: url("/assets/fonts/quicksand-latin-700.woff2") format("woff2");
  font-weight: 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Quicksand";
  src: url("/assets/fonts/quicksand-vietnamese-700.woff2") format("woff2");
  font-weight: 700; font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito-latin-400.woff2") format("woff2");
  font-weight: 400; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito-vietnamese-400.woff2") format("woff2");
  font-weight: 400; font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito-latin-700.woff2") format("woff2");
  font-weight: 700 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito";
  src: url("/assets/fonts/nunito-vietnamese-700.woff2") format("woff2");
  font-weight: 700 900; font-display: swap;
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}
@font-face {
  font-family: "Space Grotesk";
  src: url("/assets/fonts/space-grotesk-vietnamese-400.woff2") format("woff2");
  font-weight: 400; font-display: swap;
  unicode-range: U+0000-00FF, U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* ---- tokens ---- */
:root {
  /* 7N brand (also used by the rendered Markdown document) */
  --tn-primary: #14b8a6;
  --tn-primary-dark: #0d9488;
  --tn-primary-neon: #22d3ee;
  --tn-accent: #ff7f50;
  --tn-canvas: #fff7ed;
  --tn-surface: #ffffff;
  --tn-dark: #0b1121;
  --tn-ink: #0f172a;
  --tn-text: #334155;
  --tn-muted: #64748b;
  --tn-divider: #dbe7e5;
  --radius-page: 28px;
  --shadow-page: 0 24px 70px rgba(15, 23, 42, .12);

  /* app chrome */
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f1f0ec;
  --border: #e4e2dc;
  --border-strong: #cfccc4;
  --text: #1c2230;
  --muted: #6b7280;
  --accent: #0d9488;
  --accent-strong: #0f766e;
  --accent-soft: rgba(20, 184, 166, .12);
  --on-accent: #ffffff;
  --danger: #dc2626;
  --danger-soft: rgba(220, 38, 38, .1);
  --ok: #059669;
  --stage: #ffffff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 8px 28px rgba(15, 23, 42, .1);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .16);
  --radius: 12px;
  --font-display: "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
  --font-doc: "Quicksand", system-ui, sans-serif;
  --font-label: "Space Grotesk", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  --bar-h: 56px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1121;
    --surface: #121a2b;
    --surface-2: #19233a;
    --border: #243049;
    --border-strong: #34425f;
    --text: #e6eaf2;
    --muted: #94a3b8;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: rgba(45, 212, 191, .14);
    --on-accent: #042f2a;
    --danger: #f87171;
    --danger-soft: rgba(248, 113, 113, .14);
    --ok: #34d399;
    --stage: #0e1626;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, .35);
    --shadow-lg: 0 18px 50px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

/* ---- base ---- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 400 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent-soft); }
a { color: var(--accent); text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; color: var(--text); font-family: var(--font-display); line-height: 1.25; }
p { margin: 0; }
code { font-family: var(--font-mono); font-size: .88em; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.icon { display: inline-flex; width: 18px; height: 18px; flex: none; }
.icon svg { width: 100%; height: 100%; }

/* ---- controls ---- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  background: var(--surface);
  font: 700 14px/1 var(--font-body);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn.primary { border-color: var(--accent); color: var(--on-accent); background: var(--accent); }
.btn.primary:hover { border-color: var(--accent-strong); background: var(--accent-strong); }
.btn.primary.active { box-shadow: inset 0 0 0 2px rgba(0, 0, 0, .15); }
.btn.ghost { background: transparent; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.sm .icon { width: 15px; height: 15px; }
.btn.block { width: 100%; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn:disabled { opacity: .55; cursor: default; }

.icon-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 10px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn.active { color: var(--accent); background: var(--accent-soft); }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm .icon { width: 15px; height: 15px; }

input[type="text"], input[type="password"], input[type="search"], select, textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
  color: var(--text);
  background: var(--surface);
  font: 400 14px/1.4 var(--font-body);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { width: auto; height: 36px; padding: 0 30px 0 11px; cursor: pointer; }
textarea { min-height: 72px; resize: vertical; line-height: 1.5; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  color: var(--muted);
  background: var(--surface-2);
  font: 600 12px/1 var(--font-body);
  white-space: nowrap;
}
.badge.tab { color: var(--accent); background: var(--accent-soft); font: 500 11px/1 var(--font-label); letter-spacing: .06em; text-transform: uppercase; }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); }
.segmented button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  min-width: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  font: 700 13px/1 var(--font-body);
  cursor: pointer;
}
.segmented button.active { color: var(--text); background: var(--surface); box-shadow: var(--shadow-sm); }
.segmented.wide { display: flex; }
.segmented.wide button { flex: 1; }

.kind-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  height: 20px;
  padding: 0 6px;
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-2);
  font: 500 10px/1 var(--font-label);
  letter-spacing: .06em;
}
.kind-pill.kind-html { color: #c2410c; background: rgba(255, 127, 80, .16); }
.kind-pill.kind-pdf { color: #b91c1c; background: rgba(220, 38, 38, .12); }
.kind-pill.kind-markdown { color: var(--accent); background: var(--accent-soft); }
.kind-pill.kind-image { color: #7c3aed; background: rgba(124, 58, 237, .12); }

/* ---- menus ---- */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 50;
  min-width: 200px;
  margin: 0;
  padding: 6px;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.menu-pop button, .menu-pop a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: none;
  font: 600 14px/1.2 var(--font-body);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-pop button:hover, .menu-pop a:hover { background: var(--surface-2); }

/* ---- toasts ---- */
.toasts { position: fixed; z-index: 100; left: 50%; bottom: 20px; display: flex; flex-direction: column; gap: 8px; align-items: center; transform: translateX(-50%); width: min(92vw, 440px); pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 100%;
  padding: 10px 8px 10px 14px;
  border-radius: 12px;
  color: #f8fafc;
  background: #111827;
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  pointer-events: auto;
  animation: toast-in .18s ease-out;
}
.toast > .icon { color: #5eead4; }
.toast.error > .icon { color: #fca5a5; }
.toast span:not(.icon) { flex: 1; overflow-wrap: anywhere; }
.toast-close { display: inline-flex; padding: 4px; border: 0; border-radius: 6px; color: #94a3b8; background: none; cursor: pointer; }
.toast-close .icon { width: 15px; height: 15px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---- auth ---- */
.auth-screen { display: grid; min-height: 100%; place-items: center; padding: 24px 16px; }
.auth-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(100%, 380px);
  padding: 32px 28px 28px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.auth-card h1 { font-size: 24px; font-weight: 900; }
.auth-card > .muted { margin-top: -6px; margin-bottom: 8px; font-size: 14px; }
.auth-logo { width: 56px; height: 56px; margin: 0 auto 4px; border-radius: 50%; object-fit: cover; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-card input { height: 40px; }
.auth-card .btn { height: 40px; }
.auth-error { color: var(--danger); font-size: 13px; }
.auth-card.locked { width: min(100%, 420px); padding-top: 0; overflow: hidden; }
.lockout-art { width: calc(100% + 56px); height: 210px; margin: 0 -28px 8px; object-fit: contain; background: #fff1f2; }
.lockout-countdown { color: var(--danger); font: 700 22px/1 var(--font-label); font-variant-numeric: tabular-nums; }

/* ---- gallery ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 16px;
  height: var(--bar-h);
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font: 900 17px/1 var(--font-display); text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.search { position: relative; flex: 1; max-width: 520px; margin: 0 auto; }
.search input { height: 36px; padding-left: 36px; padding-right: 36px; background: var(--surface); }
.search-icon { position: absolute; left: 11px; top: 50%; color: var(--muted); transform: translateY(-50%); }
.search-icon .icon { width: 16px; height: 16px; }
.search kbd { position: absolute; right: 9px; top: 50%; padding: 1px 6px; border: 1px solid var(--border); border-radius: 5px; color: var(--muted); background: var(--surface-2); font: 500 11px/1.4 var(--font-label); transform: translateY(-50%); }
.search input:focus + kbd { display: none; }

.gallery { width: min(100%, 1320px); margin: 0 auto; padding: 24px 20px 64px; }
.gallery-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.gallery-head h1 { font-size: 22px; font-weight: 900; }
.gallery-head .count { padding: 2px 8px; border-radius: 999px; color: var(--muted); background: var(--surface-2); font: 600 12px/1.5 var(--font-label); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 22px; }
.chips { display: flex; gap: 6px; flex: 1 1 auto; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
  font: 700 13px/1 var(--font-body);
  white-space: nowrap;
  cursor: pointer;
}
.chip:hover { border-color: var(--border-strong); }
.chip.active { border-color: var(--text); color: var(--bg); background: var(--text); }
.chip-count { color: var(--muted); font: 500 11px/1 var(--font-label); }
.chip.active .chip-count { color: inherit; opacity: .7; }
.filters select { height: 32px; border-radius: 999px; font-size: 13px; font-weight: 600; }

.day-group { margin-bottom: 30px; }
.day-group > h2 { margin-bottom: 12px; font-size: 14px; font-weight: 800; letter-spacing: .01em; }

.cards.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  color: inherit;
  background: var(--surface);
  text-decoration: none;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.thumb iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 800px; border: 0; background: #fff; transform-origin: 0 0; pointer-events: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.thumb-file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 100%; color: var(--muted); font: 500 12px/1 var(--font-label); letter-spacing: .08em; }
.thumb-file .icon { width: 34px; height: 34px; opacity: .6; }
.thumb.kind-pdf .thumb-file { color: #b91c1c; }
.card-body { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px 13px; }
.card h3 { display: -webkit-box; overflow: hidden; font-size: 15px; font-weight: 800; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; min-height: 22px; }
.card-sub { color: var(--muted); font-size: 12px; }
.flag { display: inline-flex; color: var(--muted); }
.flag .icon { width: 15px; height: 15px; }
.flag.shared { color: var(--accent); }

.cards.rows { display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 16px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; }
.row:first-child { border-top: 0; }
.row:hover { background: var(--surface-2); }
.row-title { flex: 1 1 auto; min-width: 0; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.row-badges { display: flex; gap: 5px; }
.row-time { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.empty, .stage-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 72px 16px; text-align: center; }
.empty h2, .stage-empty h2 { font-size: 18px; overflow-wrap: anywhere; }
.empty .btn, .stage-empty .btn { margin-top: 8px; }
.empty-art { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 18px; color: var(--muted); background: var(--surface-2); }
.empty-art .icon { width: 28px; height: 28px; }

/* ---- viewer (private SPA and public share page) ---- */
.viewer-screen, .viewer-page { display: flex; flex-direction: column; height: 100vh; height: 100dvh; overflow: hidden; }
.viewer-page { margin: 0; }
.bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  height: var(--bar-h);
  padding: 0 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.bar-logo { width: 28px; height: 28px; margin: 0 4px; border-radius: 50%; object-fit: cover; }
.bar-title { flex: 1; min-width: 0; }
.bar-title h1 { overflow: hidden; font-size: 15px; font-weight: 800; text-overflow: ellipsis; white-space: nowrap; }
.bar-title p { display: flex; align-items: center; gap: 4px; overflow: hidden; color: var(--muted); font-size: 12px; white-space: nowrap; }
.bar-title .badge { height: 18px; padding: 0 6px; font-size: 10px; }
.bar-actions { display: flex; align-items: center; gap: 4px; }
.bar-actions .btn { margin-left: 4px; }
.file-select { max-width: 220px; height: 34px; margin-right: 4px; font-size: 13px; }
.viewer-body { display: flex; flex: 1; min-height: 0; }
.stage { position: relative; flex: 1; min-width: 0; overflow: auto; background: var(--stage); }
.stage iframe { display: block; width: 100%; height: 100%; border: 0; background: #fff; }
.stage-image { display: grid; min-height: 100%; padding: 24px; place-items: center; background: repeating-conic-gradient(var(--surface-2) 0 25%, transparent 0 50%) 0 0 / 20px 20px; }
.stage-image img { max-width: 100%; max-height: calc(100dvh - var(--bar-h) - 48px); border-radius: 6px; box-shadow: var(--shadow-md); }
.stage-text { min-height: 100%; margin: 0; padding: 20px 24px; color: var(--text); font: 13px/1.6 var(--font-mono); white-space: pre-wrap; overflow-wrap: anywhere; }

.drawer { display: flex; flex-direction: column; flex: none; width: 380px; min-height: 0; border-left: 1px solid var(--border); background: var(--surface); }
.drawer-head { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 10px 0 14px; border-bottom: 1px solid var(--border); }
.drawer-tabs { display: flex; flex: 1; gap: 4px; }
.drawer-tabs button { appearance: none; height: 32px; padding: 0 12px; border: 0; border-radius: 8px; color: var(--muted); background: none; font: 700 14px/1 var(--font-body); cursor: pointer; }
.drawer-tabs button.active { color: var(--text); background: var(--surface-2); }
.drawer-body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 16px 18px 28px; overflow-y: auto; }
.drawer-body h3 { margin-top: 12px; color: var(--muted); font: 500 11px/1 var(--font-label); letter-spacing: .1em; text-transform: uppercase; }
.drawer-body .hint { padding: 10px 12px; border-radius: 10px; color: var(--muted); background: var(--surface-2); font-size: 13px; line-height: 1.5; }
.drawer-body .hint strong { color: var(--text); }
.drawer-body .hint .icon { width: 14px; height: 14px; vertical-align: -2px; }
.drawer-body > .btn.block { margin-top: 6px; height: 40px; }
.form-row { display: flex; align-items: center; gap: 8px; }
.save-status { font-size: 13px; }
.facts { display: grid; grid-template-columns: 76px 1fr; gap: 9px 12px; margin: 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.file-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: 10px; }
.file-list li { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 4px; border-top: 1px solid var(--border); }
.file-list li:first-child { border-top: 0; }
.file-list li.current { background: var(--accent-soft); }
.file-name { display: flex; flex: 1; align-items: center; gap: 8px; min-width: 0; padding: 6px; border: 0; border-radius: 7px; color: var(--text); background: none; font: 600 13px/1.3 var(--font-body); text-align: left; cursor: pointer; }
.file-name:hover { background: var(--surface-2); }
.file-name .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .size { color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.share-list { display: flex; flex-direction: column; gap: 10px; margin: 0; padding: 0; list-style: none; }
.share-link { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
.share-link:not(.active) { opacity: .7; }
.share-link-top { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.share-url { display: block; padding: 7px 9px; border-radius: 8px; color: var(--text); background: var(--surface-2); font-size: 12px; overflow-wrap: anywhere; user-select: all; }
.pill { padding: 2px 8px; border-radius: 999px; font: 700 11px/1.5 var(--font-body); }
.pill.active { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.pill.revoked { color: var(--danger); background: var(--danger-soft); }
.pill.expired { color: var(--muted); background: var(--surface-2); }
.share-history summary { color: var(--muted); font-size: 13px; cursor: pointer; }
.share-history .share-list { margin-top: 10px; }

/* public share page extras */
.share-note { flex: none; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--accent-soft); font-size: 14px; }
.share-note p { margin-top: 2px; }
.share-files { min-width: 280px; max-height: 60vh; overflow-y: auto; }
.share-files a { justify-content: space-between; }
.share-files small { color: var(--muted); }

@media (max-width: 900px) {
  .drawer { position: fixed; z-index: 40; inset: auto 0 0 0; width: 100%; max-height: 78dvh; border-left: 0; border-top: 1px solid var(--border); border-radius: 18px 18px 0 0; box-shadow: var(--shadow-lg); }
}
@media (max-width: 640px) {
  .topbar { gap: 10px; padding: 0 12px; }
  .brand span { display: none; }
  .search kbd { display: none; }
  .gallery { padding: 18px 12px 48px; }
  .cards.grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card-body { padding: 10px 11px 11px; }
  .card h3 { font-size: 14px; }
  .card-meta .badge:not(.tab) { display: none; }
  .row-badges { display: none; }
  .row { padding: 8px 12px; }
  .bar { gap: 4px; padding: 0 6px; }
  .bar-actions { gap: 0; }
  .hide-sm, .file-select { display: none !important; }
  .bar-actions .btn { width: 36px; padding: 0; }
  .lockout-art { height: 170px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- rendered Markdown artifact (document stays light) ---- */
.markdown-body { font: 400 16px/1.75 var(--font-doc); color-scheme: light; }
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 { color: var(--tn-ink); font-family: var(--font-display); font-weight: 900; line-height: 1.2; }
.markdown-body a { color: var(--tn-primary-dark); }
.markdown-body .eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 20px; border: 1px solid rgba(20, 184, 166, .32); border-radius: 999px; padding: 7px 12px; color: var(--tn-primary-dark); background: rgba(240, 253, 250, .86); font: 400 11px/1 var(--font-label); letter-spacing: .11em; text-transform: uppercase; }
.markdown-body .eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--tn-primary); }
.markdown-body .table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--tn-divider); border-radius: 16px; }
.markdown-body table { width: 100%; border-collapse: collapse; font-size: 14px; }
.markdown-body th { padding: 13px 15px; color: white; background: var(--tn-primary-dark); text-align: left; font: 700 13px/1.4 var(--font-doc); }
.markdown-body td { padding: 12px 15px; border-bottom: 1px solid var(--tn-divider); vertical-align: top; }
.markdown-body tbody tr:nth-child(even) td { background: rgba(20, 184, 166, .035); }
.markdown-body tbody tr:last-child td { border-bottom: 0; }

/* ---- rendered Markdown artifact ---- */
.markdown-body {
  margin: 0;
  min-height: 100vh;
  padding: 28px 16px 64px;
  color: var(--tn-text);
  background-color: var(--tn-canvas);
  background-image: radial-gradient(rgba(20,184,166,.48) 1px, transparent 1px);
  background-size: 20px 20px;
}
.markdown-document {
  width: min(calc(100% - 32px), 920px);
  margin: 0 auto;
  padding: 52px 64px 72px;
  border: 1px solid rgba(20,184,166,.18);
  border-radius: var(--radius-page);
  background: var(--tn-surface);
  box-shadow: var(--shadow-page);
}
.markdown-document h1 { margin: 0 0 34px; font-size: clamp(34px, 6vw, 56px); letter-spacing: -.035em; }
.markdown-content h2 { margin-top: 42px; font-size: 32px; }
.markdown-content h3 { margin-top: 30px; font-size: 22px; }
.markdown-content h4 { margin-top: 24px; font-size: 17px; }
.markdown-content p { margin: 0 0 18px; }
.markdown-content ul, .markdown-content ol { margin: 0 0 20px; padding-left: 28px; }
.markdown-content li { margin: 5px 0; }
.markdown-content blockquote { margin: 22px 0; padding: 16px 20px; border-left: 5px solid var(--tn-primary); border-radius: 0 16px 16px 0; background: rgba(240,253,250,.72); }
.markdown-content blockquote p:last-child { margin-bottom: 0; }
.markdown-content code { padding: 2px 6px; border-radius: 6px; color: var(--tn-ink); background: rgba(20,184,166,.1); font-family: var(--font-mono); font-size: .9em; }
.markdown-content pre { overflow-x: auto; margin: 22px 0; padding: 18px 20px; border-radius: 14px; color: #e2e8f0; background: var(--tn-dark); }
.markdown-content pre code { padding: 0; color: inherit; background: transparent; }
.markdown-content hr { margin: 34px 0; border: 0; border-top: 1px solid var(--tn-divider); }
.markdown-content img { max-width: 100%; height: auto; }
.markdown-content .table-wrap { margin: 22px 0; }
.markdown-preview-frame { background: var(--tn-canvas); }
@media (max-width: 700px) {
  .markdown-document { width: calc(100% - 16px); padding: 34px 24px 48px; border-radius: 20px; }
}
.markdown-content h2, .markdown-content h3, .markdown-content h4 { margin-bottom: 14px; }
