:root {
  color-scheme: light dark;
  --bg: #F5F2F0; --surface: #FFFFFF; --ink: #14110F; --muted: #6B635C; --line: #DDD6CF;
  --accent: #D97824; --on-accent: #14110F; --bar: #000000; --on-bar: #F5F2F0; --danger: #B3261E;
  --st-requested: #B85A0C; --st-requested-bg: #FBE8D4;
  --st-progress: #2F5F99; --st-progress-bg: #DDE8F5;
  --st-done: #2A7048; --st-done-bg: #DBEFE2;
  --f-display: "Space Grotesk", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  --radius: 6px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F0D0C; --surface: #1A1715; --ink: #F5F2F0; --muted: #A39A92; --line: #2E2926;
    --accent: #E8883A; --danger: #F2837B;
    --st-requested: #F0A263; --st-requested-bg: #3A2412;
    --st-progress: #8DB6EB; --st-progress-bg: #1C2B40;
    --st-done: #7FD0A0; --st-done-bg: #16301F;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-display); font-size: 15px; line-height: 1.5; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.mono { font-family: var(--f-mono); font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.note { color: var(--muted); font-size: 13.5px; }
.error { color: var(--danger); font-size: 14px; margin: 8px 0 0; min-height: 1.4em; }

.bar { position: sticky; top: 0; z-index: 20; background: var(--bar); color: var(--on-bar); padding-top: env(safe-area-inset-top, 0px); }
.bar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-block: 12px; flex-wrap: wrap; }
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand b { font-size: 22px; letter-spacing: -.02em; }
.brand b i { font-style: normal; color: var(--accent); }
.brand span { color: #A39A92; }
#bar-right { display: flex; align-items: center; gap: 12px; color: #cfc7bf; font-size: 14px; }
#bar-right button { background: transparent; border: 1px solid #44403c; color: #cfc7bf; padding: 5px 12px; border-radius: var(--radius); }

main.wrap { padding-block: 28px 64px; }
h1 { font-size: clamp(26px, 4vw, 38px); line-height: 1.1; letter-spacing: -.025em; margin: 6px 0 4px; text-wrap: balance; }
h2 { font-size: 20px; margin: 0 0 12px; letter-spacing: -.01em; }
.sub { color: var(--muted); margin: 0; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { color: var(--accent); }
.summary { display: flex; gap: 22px; flex-wrap: wrap; }
.summary b { display: block; font-size: 26px; line-height: 1; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filters, .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 999px; font-size: 13.5px; }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn { border: 1px solid var(--ink); background: transparent; padding: 9px 16px; border-radius: var(--radius); font-weight: 500; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.card .open { display: block; border: 0; padding: 0; background: none; width: 100%; text-align: left; }
.thumb { display: block; width: 100%; aspect-ratio: 3/2; object-fit: cover; background: var(--line); }
.thumb.none { display: grid; place-items: center; color: var(--muted); }
.card .meta { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; }
.card .name { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); }
.card .name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pick { position: absolute; top: 8px; left: 8px; width: 22px; height: 22px; accent-color: var(--accent); cursor: pointer; }
.pill { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-ready { color: var(--muted); border: 1px solid var(--line); }
.s-requested { color: var(--st-requested); background: var(--st-requested-bg); }
.s-progress { color: var(--st-progress); background: var(--st-progress-bg); }
.s-done { color: var(--st-done); background: var(--st-done-bg); }
.empty { padding: 40px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }

.login { max-width: 400px; margin: 40px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.login h1 { font-size: 28px; margin: 0; }
label.f { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 9px 11px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }

.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: flex; justify-content: flex-end; }
.panel { background: var(--bg); width: min(980px, 100%); height: 100%; overflow-y: auto; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.viewer { background: #000; display: flex; flex-direction: column; justify-content: center; padding: 16px; gap: 12px; color: #A39A92; }
.viewer img { width: 100%; max-height: 70vh; object-fit: contain; border-radius: 4px; }
.viewer .thumb.none { aspect-ratio: 16/9; background: #1a1715; }
.side { padding: 20px max(18px, env(safe-area-inset-right, 0px)) 24px 20px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.top h3 { margin: 0; font-size: 20px; letter-spacing: -.01em; overflow-wrap: anywhere; }
.close { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); width: 36px; height: 36px; flex: none; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-variant-numeric: tabular-nums; }
.thread { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.thread li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 12px; overflow-wrap: anywhere; }
.thread li.pro { border-left: 3px solid var(--accent); }
.thread .who { color: var(--muted); display: block; margin-bottom: 2px; }
@media (max-width: 760px) { .panel { grid-template-columns: 1fr; } .viewer img { max-height: 44vh; } }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 22px; }
.cols { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 860px) { .cols { grid-template-columns: 1fr; } }
.box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; margin-bottom: 18px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 560px; }
th { text-align: left; color: var(--muted); font-weight: 400; padding: 0 10px 8px 0; }
td { padding: 10px 10px 10px 0; border-top: 1px solid var(--line); vertical-align: top; }
td .thumb { width: 64px; border-radius: 3px; }
td a { color: inherit; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.drop { border: 1.5px dashed var(--muted); border-radius: var(--radius); padding: 22px 14px; text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.drop.over { border-color: var(--accent); background: var(--st-requested-bg); }
.up { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; margin: 8px 0 0; }
.up span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--accent); }
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 11px 16px; border-radius: 8px; z-index: 60; max-width: calc(100% - 32px); box-shadow: 0 6px 24px rgba(0,0,0,.3); }
