/* 連結庫 — cool paper, navy ink, one highlighter. */

:root {
  --paper: #F5F7FA;
  --sheet: #FFFFFF;
  --ink: #18202E;
  --ink-2: #485263;
  --ink-3: #7A8393;
  --rule: #DFE3EA;
  --rule-strong: #C9CFD9;
  --hl: #FFE14D;
  --hl-mark: rgba(255, 220, 60, 0.62);
  --hl-ink: #2B2400;
  --accent: #2752BE;
  --danger: #B8322A;
  --ok: #2C7A4B;
  --film: #1A1E26;
  --film-edge: #2A303B;
  --hover: rgba(24, 32, 46, 0.045);
  --focus: 0 0 0 3px rgba(39, 82, 190, 0.35);

  --font-display: "LXGW WenKai TC", "Kaiti TC", "BiauKai", "STKaiti", serif;
  --font-body: -apple-system, BlinkMacSystemFont, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --gutter: 16px;
  --sidebar: 248px;
  --list: 400px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10141B;
    --sheet: #171C25;
    --ink: #E6E9EF;
    --ink-2: #AEB5C2;
    --ink-3: #7D8594;
    --rule: #262D39;
    --rule-strong: #353D4B;
    --hl: #E9CF4A;
    --hl-mark: rgba(233, 207, 74, 0.30);
    --hl-ink: #1D1900;
    --accent: #86A6FF;
    --danger: #FF7A70;
    --ok: #6BCB92;
    --film: #0B0E13;
    --film-edge: #1E242E;
    --hover: rgba(230, 233, 239, 0.05);
    --focus: 0 0 0 3px rgba(134, 166, 255, 0.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #10141B; --sheet: #171C25; --ink: #E6E9EF; --ink-2: #AEB5C2; --ink-3: #7D8594;
  --rule: #262D39; --rule-strong: #353D4B; --hl: #E9CF4A; --hl-mark: rgba(233, 207, 74, 0.30);
  --hl-ink: #1D1900; --accent: #86A6FF; --danger: #FF7A70; --ok: #6BCB92; --film: #0B0E13;
  --film-edge: #1E242E; --hover: rgba(230, 233, 239, 0.05); --focus: 0 0 0 3px rgba(134, 166, 255, 0.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, textarea, select { font: inherit; color: inherit; }
img, video { max-width: 100%; display: block; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 14px;
  border: 1px solid var(--rule-strong); border-radius: var(--r-md);
  background: var(--sheet); color: var(--ink);
  cursor: pointer; font-size: 15px; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--hl); border-color: transparent; color: var(--hl-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(.97); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 32px; padding: 0 10px; font-size: 14px; border-radius: var(--r-sm); }
.icon-btn {
  width: 40px; height: 40px; display: inline-grid; place-items: center;
  border: 0; border-radius: var(--r-md); background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.on { color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }
.field {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1px solid var(--rule-strong); border-radius: var(--r-md);
  background: var(--sheet); outline: none;
}
.field:focus { border-color: var(--accent); box-shadow: var(--focus); }
textarea.field { resize: vertical; min-height: 88px; line-height: 1.55; }

/* ---------- shell ---------- */
.shell { min-height: 100vh; min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  padding: calc(env(safe-area-inset-top) + 8px) var(--gutter) 8px;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.brand { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: .02em; margin-right: auto; color: var(--ink); }
.brand:hover { text-decoration: none; }

.layout { display: block; }
.sidebar { display: none; }
.list-pane { min-width: 0; }
.detail-pane { display: none; }
.layout.show-detail .list-pane { display: none; }
.layout.show-detail .detail-pane { display: block; }

@media (min-width: 900px) {
  .topbar.mobile-only { display: none; }
  .layout {
    display: grid;
    grid-template-columns: var(--sidebar) var(--list) minmax(0, 1fr);
    height: 100vh; height: 100dvh;
  }
  .sidebar {
    display: flex; flex-direction: column; gap: 2px;
    padding: 20px 12px 24px; overflow-y: auto;
    border-right: 1px solid var(--rule);
  }
  .list-pane { overflow-y: auto; border-right: 1px solid var(--rule); }
  .detail-pane { display: block; overflow-y: auto; background: var(--sheet); }
  .layout.show-detail .list-pane { display: block; }
  .layout.page-mode { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .layout.page-mode .list-pane { display: none; }
  .layout.page-mode .detail-pane { display: block; }
  .back-btn { display: none !important; }
}
@media (min-width: 900px) and (max-width: 1180px) {
  :root { --sidebar: 210px; --list: 340px; }
}

/* ---------- sidebar ---------- */
.sidebar .brand { padding: 4px 10px 14px; display: block; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 15px; cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
}
.nav-link:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav-link.active { background: var(--sheet); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--hl); }
.nav-link .count { margin-left: auto; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.nav-link svg { width: 18px; height: 18px; flex: none; }
.nav-group { margin-top: 18px; }
.nav-group > h3 { margin: 0 10px 6px; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.nav-group .tag-cloud { padding: 0 6px; }

/* ---------- compose ---------- */
.compose { padding: 4px var(--gutter) 10px; }
.compose form { display: flex; gap: 8px; }
.compose .field { font-size: 16px; }
@media (min-width: 900px) {
  .compose { position: sticky; top: 0; z-index: 5; padding: 18px 18px 10px; background: var(--paper); }
}
.compose-hint { margin: 6px 2px 0; font-size: 13px; color: var(--ink-3); }

/* ---------- filter chips ---------- */
.chips {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none;
  padding: 2px var(--gutter) 10px;
}
.chips::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .chips { padding: 0 18px 10px; flex-wrap: wrap; } .chips.hide-wide { display: none; } }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--rule-strong); background: var(--sheet);
  font-size: 14px; color: var(--ink-2); cursor: pointer; white-space: nowrap;
}
.chip:hover { color: var(--ink); }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.chip .n { font-size: 12px; opacity: .7; font-variant-numeric: tabular-nums; }
.active-filter {
  display: flex; align-items: center; gap: 8px; margin: 0 var(--gutter) 10px;
  padding: 8px 12px; border-radius: var(--r-md); background: var(--sheet); border: 1px solid var(--rule);
  font-size: 14px; color: var(--ink-2);
}
.active-filter strong { color: var(--ink); }
.active-filter .btn { margin-left: auto; }
@media (min-width: 900px) { .active-filter { margin: 0 18px 10px; } }

/* ---------- item list ---------- */
.items { list-style: none; margin: 0; padding: 0 0 120px; }
.item {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 14px;
  padding: 14px var(--gutter); border-top: 1px solid var(--rule); cursor: pointer;
}
.item:hover { background: var(--hover); }
.item.selected { background: var(--sheet); box-shadow: inset 3px 0 0 var(--hl); }
@media (min-width: 900px) { .item { padding: 14px 18px; } }
.item .thumb {
  grid-column: 2; grid-row: 1 / span 3; width: 76px; height: 76px; border-radius: var(--r-sm);
  object-fit: cover; background: var(--rule); align-self: start;
}
.item .title {
  grid-column: 1; margin: 0; font-family: var(--font-display); font-size: 19px; line-height: 1.35; font-weight: 700;
  color: var(--ink); overflow-wrap: anywhere;
}
.item.unread .title::before {
  content: ""; display: inline-block; width: 7px; height: 7px; margin: 0 7px 3px 0; border-radius: 50%;
  background: var(--accent); vertical-align: middle;
}
.item .summary {
  grid-column: 1; margin: 0; color: var(--ink-2); font-size: 14.5px; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.item .meta { grid-column: 1; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 13px; color: var(--ink-3); }
.item .meta .author { max-width: 14em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .meta .when { margin-left: auto; font-variant-numeric: tabular-nums; }
.item .film { grid-column: 1 / -1; margin-top: 6px; }
.item .star { color: #C99A00; }
.item .select-box { position: absolute; left: 4px; top: 16px; width: 18px; height: 18px; accent-color: var(--ink); }
.items.selecting .item { padding-left: 32px; }
@media (min-width: 900px) { .items.selecting .item { padding-left: 34px; } }

.platform {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.platform::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--pc, var(--ink-3)); }
.p-threads { --pc: #101010; } .p-instagram { --pc: #D62976; } .p-facebook { --pc: #1877F2; }
.p-youtube { --pc: #FF0033; } .p-twitter { --pc: #101010; } .p-reddit { --pc: #FF4500; }
.p-tiktok { --pc: #00C2C7; } .p-ptt { --pc: #2D7D46; } .p-dcard { --pc: #006AA6; }
.p-xiaohongshu { --pc: #FF2442; } .p-gmaps { --pc: #34A853; } .p-bilibili { --pc: #00A1D6; } .p-pdf { --pc: #B8322A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .p-threads, :root:not([data-theme="light"]) .p-twitter { --pc: #E6E9EF; } }
:root[data-theme="dark"] .p-threads, :root[data-theme="dark"] .p-twitter { --pc: #E6E9EF; }

.status-line { grid-column: 1; display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink-2); }
.status-line.error { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; color: var(--danger); }
.working-bar {
  grid-column: 1 / -1; height: 3px; border-radius: 3px; overflow: hidden; background: var(--rule);
}
.working-bar::after {
  content: ""; display: block; height: 100%; width: 40%; border-radius: 3px; background: var(--hl);
  animation: sweep 1.4s ease-in-out infinite;
}
@keyframes sweep { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@media (prefers-reduced-motion: reduce) { .working-bar::after { animation: none; width: 100%; opacity: .6; } }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 1px 9px; border-radius: 999px;
  background: var(--paper); border: 1px solid var(--rule); color: var(--ink-2); font-size: 13px; cursor: pointer;
}
.tag:hover { border-color: var(--rule-strong); color: var(--ink); text-decoration: none; }
.tag .x { border: 0; background: none; padding: 0 0 0 2px; cursor: pointer; color: var(--ink-3); font-size: 15px; line-height: 1; }

.list-end { padding: 24px var(--gutter); text-align: center; color: var(--ink-3); font-size: 14px; }

/* ---------- film strip (the signature) ---------- */
.film {
  position: relative; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: thin;
  padding: 12px 6px; border-radius: var(--r-sm); background-color: var(--film);
  background-image:
    radial-gradient(circle at center, var(--film-edge) 2.2px, transparent 2.6px),
    radial-gradient(circle at center, var(--film-edge) 2.2px, transparent 2.6px);
  background-size: 12px 8px, 12px 8px;
  background-repeat: repeat-x, repeat-x;
  background-position: 3px 2px, 3px calc(100% - 2px);
}
.film .frame { position: relative; flex: none; border: 0; padding: 0; background: none; cursor: pointer; }
.film .frame img { height: 72px; width: auto; border-radius: 2px; }
.film .frame span {
  position: absolute; right: 3px; bottom: 3px; padding: 0 4px; border-radius: 3px;
  background: rgba(0, 0, 0, .66); color: #fff; font-size: 11px; font-variant-numeric: tabular-nums; line-height: 1.5;
}
.film.big { padding: 14px 8px; gap: 6px; }
.film.big .frame img { height: 118px; }
.film .frame.now img { outline: 2px solid var(--hl); outline-offset: 1px; }
.item .film .frame img { height: 54px; }
.item .film { padding: 10px 5px; pointer-events: none; }

/* ---------- detail ---------- */
.detail { max-width: 760px; margin: 0 auto; padding: 8px var(--gutter) 120px; }
@media (min-width: 900px) { .detail { padding: 28px 40px 120px; } }
.detail-actions {
  position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 2px; flex-wrap: wrap;
  margin: 0 calc(var(--gutter) * -1) 8px; padding: calc(env(safe-area-inset-top) + 6px) var(--gutter) 6px;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
@media (min-width: 900px) {
  .detail-actions { margin: -28px -40px 16px; padding: 10px 32px; background: color-mix(in srgb, var(--sheet) 92%, transparent); border-bottom: 1px solid var(--rule); }
}
.detail-actions .spacer { flex: 1; }
.detail h1 {
  margin: 14px 0 10px; font-family: var(--font-display); font-weight: 700;
  font-size: clamp(26px, 5.4vw, 36px); line-height: 1.25; letter-spacing: .01em; overflow-wrap: anywhere;
}
.source-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 14px; color: var(--ink-3); }
.source-line a { color: var(--ink-2); }
.lead { margin: 18px 0 8px; font-size: 18px; line-height: 1.7; color: var(--ink); }
.section { margin-top: 30px; }
.section > h2 {
  display: flex; align-items: baseline; gap: 10px; margin: 0 0 10px;
  font-family: var(--font-display); font-size: 21px; font-weight: 700;
}
.section > h2 small { font-family: var(--font-body); font-size: 13px; font-weight: 400; color: var(--ink-3); }
.key-points { margin: 0; padding: 0; list-style: none; counter-reset: kp; }
.key-points li { position: relative; padding: 6px 0 6px 0; line-height: 1.75; }
.key-points li mark {
  background: linear-gradient(transparent 56%, var(--hl-mark) 56%, var(--hl-mark) 94%, transparent 94%);
  color: inherit; padding: 0 1px; -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.prose { font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.prose h2 { margin: 30px 0 8px; font-family: var(--font-display); font-size: 22px; font-weight: 700; }
.prose h3 { margin: 22px 0 6px; font-size: 17px; font-weight: 700; }
.prose h4 { margin: 16px 0 4px; font-size: 16px; }
.prose p { margin: 8px 0; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 8px 0; }
.prose li { margin: 3px 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { border-bottom: 1px solid var(--rule); padding: 7px 10px; text-align: left; vertical-align: top; }
.prose th { color: var(--ink-2); font-weight: 600; white-space: nowrap; }
.prose code { font-family: var(--font-mono); font-size: .9em; background: var(--paper); padding: 1px 5px; border-radius: 4px; }
.prose pre { background: var(--paper); padding: 12px; border-radius: var(--r-sm); overflow-x: auto; }
.prose blockquote { margin: 10px 0; padding: 2px 0 2px 14px; border-left: 3px solid var(--rule-strong); color: var(--ink-2); }
.prose input[type="checkbox"] { margin-right: 6px; }
.prose a.cite { font-size: 13px; font-weight: 600; padding: 0 3px; border-radius: 4px; background: var(--paper); }

.media-hero { margin: 4px 0 14px; }
.media-hero video {
  width: 100%; max-height: 72vh; border-radius: var(--r-md); background: #000; margin: 0 auto;
}
.media-hero video.portrait { width: auto; max-width: 100%; max-height: 52vh; }
@media (min-width: 900px) { .media-hero video.portrait { max-height: 64vh; } }
.media-hero .film { margin-top: 8px; }
.gallery { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x mandatory; }
.gallery button { flex: none; border: 0; padding: 0; background: none; cursor: zoom-in; scroll-snap-align: start; }
.gallery img { height: 240px; width: auto; border-radius: var(--r-sm); background: var(--rule); }
.gallery.single img { height: auto; max-height: 520px; max-width: 100%; }
.screenshot img { width: 100%; border-radius: var(--r-sm); border: 1px solid var(--rule); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 14px 0; }
.fact { padding: 10px 12px; border-radius: var(--r-md); background: var(--paper); }
.fact b { display: block; font-size: 18px; font-variant-numeric: tabular-nums; }
.fact span { font-size: 13px; color: var(--ink-3); }

.todo { list-style: none; padding: 0; margin: 0; }
.todo li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; }
.todo input { margin-top: 6px; width: 17px; height: 17px; accent-color: var(--ok); flex: none; }
.todo li.done span { color: var(--ink-3); text-decoration: line-through; }

details.fold { border-top: 1px solid var(--rule); padding: 4px 0; }
details.fold:last-of-type { border-bottom: 1px solid var(--rule); }
details.fold summary {
  display: flex; align-items: center; gap: 8px; padding: 12px 0; cursor: pointer; list-style: none;
  font-weight: 600; color: var(--ink);
}
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::after { content: "＋"; margin-left: auto; color: var(--ink-3); }
details.fold[open] summary::after { content: "－"; }
details.fold summary small { font-weight: 400; color: var(--ink-3); }
.fold-body { padding: 0 0 14px; font-size: 15px; line-height: 1.75; white-space: pre-wrap; color: var(--ink-2); max-height: 60vh; overflow-y: auto; }
.fold-body.md { white-space: normal; }
.comment { padding: 8px 0; border-bottom: 1px dashed var(--rule); white-space: normal; }
.comment b { color: var(--ink); font-weight: 600; margin-right: 6px; }

.note-box { margin-top: 10px; }
.saved-hint { font-size: 13px; color: var(--ink-3); margin-top: 4px; min-height: 1.3em; }

.state-card {
  margin: 18px 0; padding: 16px 18px; border-radius: var(--r-md); border: 1px solid var(--rule);
  background: var(--paper);
}
.state-card.error { border-color: color-mix(in srgb, var(--danger) 40%, var(--rule)); }
.state-card h3 { margin: 0 0 6px; font-size: 16px; }
.state-card p { margin: 4px 0 12px; color: var(--ink-2); font-size: 15px; }

.inline-edit { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.inline-edit .field { width: auto; flex: 1; min-width: 140px; min-height: 36px; padding: 6px 10px; }
select.field { min-height: 36px; padding: 6px 10px; width: auto; }

/* ---------- pages (ask, digests, settings, login) ---------- */
.page { max-width: 760px; margin: 0 auto; padding: 8px var(--gutter) 120px; }
@media (min-width: 900px) { .page { padding: 40px 40px 120px; } }
.page h1 { font-family: var(--font-display); font-size: clamp(28px, 5vw, 38px); margin: 10px 0 6px; line-height: 1.25; }
.page .intro { color: var(--ink-2); margin: 0 0 22px; }
.page h2 { font-family: var(--font-display); font-size: 22px; margin: 34px 0 10px; }
.card { padding: 16px 18px; border: 1px solid var(--rule); border-radius: var(--r-md); background: var(--sheet); margin: 10px 0; }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card p { margin: 4px 0 10px; color: var(--ink-2); font-size: 15px; }
.steps { margin: 6px 0 0; padding-left: 1.3em; color: var(--ink-2); font-size: 15px; }
.steps li { margin: 6px 0; }
.copy-row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.copy-row code {
  flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; padding: 9px 11px; border-radius: var(--r-sm);
  background: var(--paper); border: 1px solid var(--rule); font-family: var(--font-mono); font-size: 13px;
}
.bookmarklet {
  display: inline-block; padding: 8px 14px; border-radius: var(--r-md); background: var(--hl); color: var(--hl-ink);
  font-weight: 600; text-decoration: none;
}
.answer { margin-top: 18px; }
.qa { padding: 18px 0; border-top: 1px solid var(--rule); }
.qa .q { font-family: var(--font-display); font-size: 20px; font-weight: 700; margin: 0 0 8px; }
.cited { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.digest-row { display: flex; align-items: center; gap: 10px; padding: 14px 0; border-top: 1px solid var(--rule); }
.digest-row a { font-weight: 600; color: var(--ink); }
.digest-row .when { margin-left: auto; font-size: 13px; color: var(--ink-3); white-space: nowrap; }
.muted { color: var(--ink-3); }
.ok-text { color: var(--ok); }

.login-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px var(--gutter); }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { font-family: var(--font-display); font-size: 40px; margin: 0 0 6px; }
.login-card p { color: var(--ink-2); margin: 0 0 22px; }
.login-card form { display: grid; gap: 10px; }
.login-card .err { color: var(--danger); font-size: 14px; min-height: 1.4em; margin: 0; }

/* ---------- empty state ---------- */
.empty { padding: 36px var(--gutter) 40px; }
@media (min-width: 900px) { .empty { padding: 40px 18px; } }
.empty h2 { font-family: var(--font-display); font-size: 24px; margin: 0 0 8px; }
.empty p { color: var(--ink-2); margin: 0 0 8px; }
.empty ul { margin: 12px 0 0; padding-left: 1.2em; color: var(--ink-2); }
.detail-empty { display: grid; place-items: center; height: 100%; color: var(--ink-3); padding: 40px; text-align: center; }
.detail-empty p { max-width: 22em; }

/* ---------- bottom bars, sheets, toast ---------- */
.select-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: center; gap: 8px;
  padding: 10px var(--gutter) calc(env(safe-area-inset-bottom) + 10px);
  background: var(--sheet); border-top: 1px solid var(--rule);
}
.select-bar .count { margin-right: auto; font-size: 15px; }
@media (min-width: 900px) { .select-bar { left: var(--sidebar); right: auto; width: var(--list); } }

.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(10, 14, 20, .38); }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 82vh; overflow-y: auto;
  padding: 18px var(--gutter) calc(env(safe-area-inset-bottom) + 20px);
  background: var(--sheet); border-radius: var(--r-lg) var(--r-lg) 0 0;
}
@media (min-width: 640px) {
  .sheet { left: 50%; bottom: auto; top: 12vh; width: 440px; transform: translateX(-50%); border-radius: var(--r-lg); }
}
.sheet h2 { margin: 0 0 12px; font-family: var(--font-display); font-size: 22px; }
.sheet .group { margin: 14px 0; }
.sheet .group h3 { margin: 0 0 8px; font-size: 14px; color: var(--ink-3); font-weight: 600; }
.sheet .chips { padding: 0; flex-wrap: wrap; overflow: visible; }
.sheet .row { display: flex; gap: 8px; margin-top: 14px; }
.sheet-list { list-style: none; margin: 0; padding: 0; }
.sheet-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.sheet-list label { display: flex; align-items: center; gap: 10px; flex: 1; cursor: pointer; }

.lightbox { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(5, 7, 10, .92); cursor: zoom-out; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 22px); z-index: 70;
  transform: translateX(-50%); max-width: calc(100vw - 32px);
  padding: 11px 16px; border-radius: var(--r-md); background: var(--ink); color: var(--paper);
  font-size: 15px; box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
}
.toast a { color: var(--hl); margin-left: 10px; font-weight: 600; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--rule-strong); border-top-color: var(--ink); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }
