:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1d2330; --muted: #6b7385; --line: #e2e5eb;
  --accent: #2f6fde; --accent-ink: #fff; --ok: #1f8a4c; --bad: #c2372f; --warn: #a86b00;
  --radius: 10px; --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 2px 8px rgba(20, 30, 50, .05);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14171d; --panel: #1c2028; --ink: #e6e9ef; --muted: #959cab; --line: #2c323d;
          --accent: #5b8ff0; --ok: #46b97a; --bad: #e0675f; --warn: #d39a32; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
       font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; }
a { color: var(--accent); }
.muted { color: var(--muted); font-weight: 400; }
.sep { color: var(--muted); margin: 0 .2em; }

header.top { position: sticky; top: 0; z-index: 5; display: flex; flex-wrap: wrap; gap: .5rem 1.25rem; align-items: center;
             padding: .6rem 1.25rem; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.tabs { display: flex; gap: .25rem; }
.tabs a { padding: .35rem .7rem; border-radius: 999px; color: var(--ink); text-decoration: none; white-space: nowrap; }
@media (max-width: 640px) { .tabs a { padding: .3rem .5rem; } .tabs { gap: 0; } }
.tabs a.on { background: var(--accent); color: var(--accent-ink); }
.badge { display: inline-block; min-width: 1.5em; padding: 0 .4em; border-radius: 999px; background: var(--line);
         color: var(--ink); font-size: 12px; text-align: center; }
.tabs a.on .badge { background: rgba(255, 255, 255, .25); color: inherit; }
.filter { display: flex; gap: .5rem; flex: 1; }
.filter input[type=search] { flex: 1; min-width: 10rem; max-width: 22rem; }
.logout { margin-left: auto; }

input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea { background: var(--panel); border: 1px solid var(--line); border-radius: 7px; padding: .35rem .5rem; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--panel); border-radius: 7px; padding: .35rem .8rem; }
button:hover { border-color: var(--muted); }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.small { padding: .1rem .5rem; font-size: 13px; }
button.link { border: 0; background: none; color: var(--accent); padding: 0; }
button:disabled { opacity: .5; cursor: progress; }

main { max-width: 1100px; margin: 0 auto; padding: 1rem 1.25rem 4rem; }
.pagehead h1 { margin: .5rem 0 .2rem; font-size: 1.5rem; }
.hint { color: var(--muted); margin: 0 0 1rem; font-size: 13.5px; }
kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 .3em; font-size: 12px; }
.empty { padding: 3rem; text-align: center; color: var(--muted); background: var(--panel); border-radius: var(--radius); }

.project > h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
.group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .9rem; box-shadow: var(--shadow); }
.group > summary { cursor: pointer; padding: .6rem .9rem; display: flex; align-items: center; gap: .5rem; list-style: none; }
.group > summary::-webkit-details-marker { display: none; }
.group > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
.group[open] > summary::before { transform: rotate(90deg); }
.group .bulk { margin-left: auto; display: flex; gap: .35rem; }
.label { text-transform: uppercase; letter-spacing: .04em; font-size: 11px; color: var(--muted); }
.screen { border-top: 1px solid var(--line); padding: .3rem .9rem .6rem; }
.screen > h3 { font-size: .95rem; margin: .5rem 0; display: flex; align-items: center; gap: .5rem; }
.screen > h3 button { margin-left: auto; }

.card { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "main shots" "actions actions"; gap: .4rem 1rem;
        padding: .75rem .9rem; margin: .5rem 0; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); outline: none; }
.card.focus { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 35%, transparent); }
.card-main { grid-area: main; min-width: 0; }
.card .text { white-space: pre-wrap; margin: 0 0 .5rem; font-size: 15.5px; overflow-wrap: anywhere; }
.card .ctx { font-size: 13px; margin-bottom: .3rem; }
.card .ctx .proj { background: var(--line); border-radius: 4px; padding: 0 .35em; margin-right: .4em; }
.card .ctx .grp { font-weight: 600; }
.meta { display: flex; flex-wrap: wrap; gap: .15rem 1.1rem; margin: 0; font-size: 12.5px; color: var(--muted); }
.meta div { display: flex; gap: .35em; min-width: 0; }
.meta dt { font-weight: 600; }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.review-line { font-size: 13px; margin: .5rem 0 0; }
.files { font-size: 13px; margin: .4rem 0 0; }
.shots { grid-area: shots; display: flex; gap: .4rem; align-items: flex-start; }
.shot img { display: block; max-height: 150px; max-width: 120px; border-radius: 6px; border: 1px solid var(--line); }
.actions { grid-area: actions; display: flex; gap: .4rem; justify-content: flex-end; }
.actions:empty { display: none; }
@media (max-width: 640px) {
  .card { grid-template-columns: 1fr; grid-template-areas: "main" "shots" "actions"; }
  .group .bulk { display: none; }
}

.st { display: inline-block; border-radius: 4px; padding: 0 .4em; font-size: 12px; font-weight: 600; }
.st-open { background: var(--line); }
.st-approved { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.st-processed { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); }
.st-rejected { background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }

.history h2.day { font-size: 1rem; margin: 1.4rem 0 .3rem; color: var(--muted); }
.more { text-align: center; }
.timeline { font-size: 14px; }

table.reasons { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: var(--radius); overflow: hidden; }
table.reasons th, table.reasons td { text-align: left; padding: .45rem .6rem; border-bottom: 1px solid var(--line); }
table.reasons .num { text-align: right; }
table.reasons input { width: 100%; }
table.reasons tr.archived { opacity: .55; }
.new-reason { display: flex; flex-wrap: wrap; gap: .6rem; align-items: flex-end; margin-top: 1.5rem; }
.new-reason h2 { width: 100%; font-size: 1rem; margin: 0; }
.new-reason label { display: flex; flex-direction: column; font-size: 13px; }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); max-width: 34rem; width: 92vw; }
dialog::backdrop { background: rgba(10, 14, 22, .45); }
dialog h2 { margin-top: 0; font-size: 1.1rem; }
dialog label { display: flex; flex-direction: column; gap: .2rem; margin: .6rem 0; font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: .3rem 0; }
.chip { border-radius: 999px; padding: .1rem .6rem; font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .8rem; }
.error { color: var(--bad); }
#lightbox { max-width: 96vw; width: auto; padding: .5rem; }
#lightbox img { max-width: 92vw; max-height: 86vh; display: block; }
#lightbox form { text-align: right; margin-top: .3rem; }

#toast { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
         padding: .55rem 1rem; border-radius: 8px; box-shadow: var(--shadow); z-index: 20; }
#toast button.link { color: var(--bg); text-decoration: underline; font-weight: 600; }

form.login { max-width: 22rem; margin: 12vh auto; background: var(--panel); padding: 1.5rem; border-radius: var(--radius);
             box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .8rem; }
form.login h1 { margin: 0; font-size: 1.3rem; }
form.login label { display: flex; flex-direction: column; gap: .2rem; font-size: 13.5px; }
