html, body { margin: 0; }
[hidden] { display: none !important; }
img { max-width: 100%; }
/* Layout: an office filing desk. One sticky bar picks who is signed in, each request is a numbered file with a stamped status. */
:root {
  --bg: #eef2f4;
  --surface: #ffffff;
  --sunken: #e3e9ed;
  --line: #cfd8de;
  --ink: #14283a;
  --muted: #586b7a;
  --accent: #0b6e63;
  --accent-soft: #d6efe9;
  --on-accent: #ffffff;
  --amber: #8f5a00;
  --amber-soft: #fbeccb;
  --blue: #1d5a9e;
  --blue-soft: #dceafa;
  --red: #b3261e;
  --red-soft: #fbe2df;
  --grey-soft: #e1e6ea;
  --bar: #14283a;
  --bar-ink: #eef2f4;
  --bar-muted: #9fb2c1;
  --bar-field: #24405a;
  --shade: rgba(16, 30, 44, .66);
  --thumb-ink: #ffffff;
  --tm-a: #0b6e63; --tm-b: #0d3f52;
  --cr-a: #1d5a9e; --cr-b: #1b2f66;
  --ie-a: #a4590c; --ie-b: #6a2b12;
  --ntn-a: #6b3fa0; --ntn-b: #33205e;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101a22; --surface: #18252f; --sunken: #0c151c; --line: #2d3f4c; --ink: #e8eff3; --muted: #9db0bd;
    --accent: #3cc2ad; --accent-soft: #123c38; --on-accent: #06211e;
    --amber: #f2bd5c; --amber-soft: #3d2e10; --blue: #8fc0f5; --blue-soft: #15304e;
    --red: #ff9b92; --red-soft: #47201d; --grey-soft: #26343e;
    --bar: #0c151c; --bar-ink: #e8eff3; --bar-muted: #8ba0af; --bar-field: #1d2c37; --shade: rgba(0,0,0,.72);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101a22; --surface: #18252f; --sunken: #0c151c; --line: #2d3f4c; --ink: #e8eff3; --muted: #9db0bd;
  --accent: #3cc2ad; --accent-soft: #123c38; --on-accent: #06211e;
  --amber: #f2bd5c; --amber-soft: #3d2e10; --blue: #8fc0f5; --blue-soft: #15304e;
  --red: #ff9b92; --red-soft: #47201d; --grey-soft: #26343e;
  --bar: #0c151c; --bar-ink: #e8eff3; --bar-muted: #8ba0af; --bar-field: #1d2c37; --shade: rgba(0,0,0,.72);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
body { background: var(--bg); color: var(--ink); font: 400 15px/1.5 var(--body); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bar); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h2 { font: 700 1.5rem/1.2 var(--display); text-wrap: balance; }
h3 { font: 700 1.05rem/1.3 var(--display); }

.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)); }
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--bar); color: var(--bar-ink); }
.topbar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; padding-block: 10px; }
.brand { font: 700 1.15rem/1 var(--display); }
.brand span { color: var(--bar-muted); font-weight: 600; }
.switch { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.seg { display: flex; background: var(--bar-field); border-radius: 8px; padding: 3px; }
.seg button { border: 0; background: none; color: var(--bar-muted); padding: 6px 12px; border-radius: 6px; font-weight: 600; font-size: .875rem; }
.seg button[aria-pressed="true"] { background: var(--bar-ink); color: var(--bar); }
.who { background: var(--bar-field); color: var(--bar-ink); border: 0; border-radius: 8px; padding: 8px 10px; font-size: .875rem; max-width: 190px; }
.demo-note { background: var(--amber-soft); color: var(--amber); font-size: .8125rem; font-weight: 500; }
.demo-note .wrap { display: flex; flex-wrap: wrap; gap: 4px 14px; justify-content: space-between; align-items: center; padding-block: 6px; }
.linkish { border: 0; background: none; padding: 0; color: inherit; font-weight: 700; text-decoration: underline; }

main.wrap { padding-block: 22px 56px; display: grid; gap: 18px; }
.head { display: grid; gap: 4px; }
.muted { color: var(--muted); }
.small { font-size: .8125rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 9px 13px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.count { display: inline-block; min-width: 20px; padding: 0 5px; margin-left: 5px; border-radius: 10px; background: var(--amber-soft); color: var(--amber); font: 600 .75rem/20px var(--mono); text-align: center; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px; display: grid; gap: 14px; min-width: 0; }
.new-grid { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; align-items: start; }
.steps { display: grid; gap: 16px; min-width: 0; }
.aside { position: sticky; top: 76px; }
.step-title { display: flex; gap: 10px; align-items: center; }
.step-no { width: 26px; height: 26px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--ink); color: var(--bg); font: 600 .8125rem var(--mono); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); padding: 8px 13px; border-radius: 8px; font-weight: 600; display: grid; text-align: left; gap: 0; }
.chip small { font-weight: 500; color: var(--muted); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.chip:disabled { cursor: not-allowed; background: var(--sunken); color: var(--muted); }

.vid-section { display: grid; gap: 8px; }
.vid-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(135px, 1fr)); gap: 10px; }
.vid { border: 2px solid var(--line); background: var(--surface); border-radius: 10px; padding: 0; overflow: hidden; display: grid; min-width: 0; }
.vid.sel { border-color: var(--accent); }
.vid-pick { border: 0; background: none; padding: 0; text-align: left; display: grid; width: 100%; }
.vid-meta { padding: 8px 9px 4px; display: grid; gap: 1px; min-width: 0; }
.vid-meta b { font-size: .875rem; line-height: 1.25; overflow-wrap: anywhere; }
.vid-foot { padding: 0 9px 8px; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.thumb { position: relative; aspect-ratio: 4 / 3; max-width: 100%; color: var(--thumb-ink); display: flex; align-items: flex-end; padding: 8px; overflow: hidden; }
.thumb.tm { background: linear-gradient(var(--ang, 135deg), var(--tm-a), var(--tm-b)); }
.thumb.cr { background: linear-gradient(var(--ang, 135deg), var(--cr-a), var(--cr-b)); }
.thumb.ie { background: linear-gradient(var(--ang, 135deg), var(--ie-a), var(--ie-b)); }
.thumb.ntn { background: linear-gradient(var(--ang, 135deg), var(--ntn-a), var(--ntn-b)); }
.thumb b { font: 700 .95rem/1.1 var(--display); position: relative; overflow-wrap: anywhere; }
.thumb::before { content: ""; position: absolute; top: 50%; left: 50%; width: 0; height: 0; margin: -19px 0 0 -9px; border-left: 22px solid var(--thumb-ink); border-block: 14px solid transparent; opacity: .28; }
.fmt { position: absolute; top: 7px; right: 7px; font: 600 .6875rem var(--mono); border: 1px solid var(--thumb-ink); border-radius: 4px; padding: 0 4px; }
.mini { width: 78px; flex: none; border-radius: 7px; aspect-ratio: 4 / 3; padding: 5px; }
.mini b { font-size: .6875rem; }
.mini .fmt { display: none; }
.mini::before { margin: -11px 0 0 -5px; border-left-width: 13px; border-block-width: 8px; }

.field { display: grid; gap: 4px; min-width: 0; }
.field label { font-weight: 600; font-size: .875rem; }
.input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 10px; }
textarea.input { min-height: 68px; resize: vertical; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn { border: 1px solid var(--line); background: var(--surface); padding: 8px 13px; border-radius: 8px; font-weight: 600; font-size: .875rem; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.block { width: 100%; padding-block: 11px; font-size: .9375rem; }
.btn.tiny { padding: 3px 8px; font-size: .75rem; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.sum { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.sum li { display: grid; gap: 1px; padding-bottom: 8px; border-bottom: 1px dashed var(--line); }
.sum .miss { color: var(--amber); font-size: .8125rem; font-weight: 600; }

.file { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: grid; gap: 12px; min-width: 0; }
.file-top { display: flex; gap: 12px; align-items: flex-start; }
.file-info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.file-info b { overflow-wrap: anywhere; }
.fileno { font: 600 .75rem var(--mono); color: var(--muted); }
.stack { display: grid; gap: 10px; }
.stamp { flex: none; font: 600 .6875rem/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; padding: 5px 7px; border: 1.5px solid currentColor; border-radius: 4px; }
.st-pending { color: var(--amber); background: var(--amber-soft); }
.st-approved { color: var(--blue); background: var(--blue-soft); }
.st-live { color: var(--accent); background: var(--accent-soft); }
.st-rejected { color: var(--red); background: var(--red-soft); }
.st-stopped { color: var(--muted); background: var(--grey-soft); }
.track { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.track span { font-size: .75rem; color: var(--muted); border-top: 3px solid var(--line); padding-top: 4px; }
.track span.on { color: var(--ink); border-top-color: var(--accent); font-weight: 600; }
.note { background: var(--sunken); border-radius: 7px; padding: 7px 10px; font-size: .875rem; overflow-wrap: anywhere; }
.note.bad { background: var(--red-soft); color: var(--red); }
.budget-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.budget-row .field { width: 150px; }
.budget-row .row { margin-left: auto; }
.money { position: relative; }
.money span { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); font: 500 .8125rem var(--mono); }
.money input { padding-left: 32px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.err { color: var(--red); font-size: .8125rem; font-weight: 600; }
.phase { color: var(--muted); font-size: .8125rem; }

.statline { display: grid; grid-template-columns: repeat(4, 1fr); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.statline div { padding: 11px 14px; border-left: 1px solid var(--line); }
.statline div:first-child { border-left: 0; }
.statline b { display: block; font: 600 1.35rem/1.2 var(--mono); }
.statline span { color: var(--muted); font-size: .8125rem; }
.group-title { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.empty { border: 1px dashed var(--line); border-radius: 10px; padding: 18px; color: var(--muted); text-align: center; }

.table-box { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
table { border-collapse: collapse; width: 100%; font-size: .875rem; }
th, td { padding: 6px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
th { font-size: .75rem; font-weight: 700; color: var(--muted); background: var(--sunken); }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--surface); font-weight: 600; }
th:first-child { background: var(--sunken); }
tfoot td { font-weight: 700; background: var(--sunken); font-family: var(--mono); }
tfoot td:first-child { background: var(--sunken); font-family: var(--body); }
td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.cell { width: 88px; border: 1px solid transparent; background: none; border-radius: 5px; padding: 3px 5px; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.cell:hover { border-color: var(--line); }
.cell:focus { background: var(--surface); }
.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: .875rem; }
.hist li { border-bottom: 1px dashed var(--line); padding-bottom: 6px; overflow-wrap: anywhere; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 600; }
.vid.off { opacity: .6; }

.modal { position: fixed; inset: 0; z-index: 20; background: var(--shade); display: grid; place-items: center; padding: 16px; }
.modal-box { background: var(--surface); border-radius: 12px; overflow: hidden; width: min(440px, 100%); }
.modal-box .thumb { aspect-ratio: 16 / 10; padding: 16px; }
.modal-box .thumb b { font-size: 1.4rem; }
.modal-body { padding: 14px 16px; display: grid; gap: 10px; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 15px; border-radius: 8px; font-weight: 600; font-size: .875rem; max-width: calc(100% - 32px); }

@media (max-width: 840px) {
  .new-grid { grid-template-columns: minmax(0, 1fr); }
  .aside { position: static; }
  .switch { margin-left: 0; width: 100%; }
  .who { flex: 1; max-width: none; min-width: 0; }
}
@media (max-width: 520px) {
  .statline { grid-template-columns: 1fr 1fr; }
  .statline div:nth-child(3) { border-left: 0; }
  .statline div:nth-child(n+3) { border-top: 1px solid var(--line); }
  .two { grid-template-columns: 1fr; }
  .budget-row .row { margin-left: 0; }
  .file-top { flex-wrap: wrap; }
}

/* Additions for the real app */
a { color: inherit; }
.brand { text-decoration: none; }
.who { text-decoration: none; }
.btn-bar { background: none; border: 1px solid var(--bar-muted); color: var(--bar-ink); border-radius: 8px; padding: 7px 10px; font-size: .875rem; }
.switch form { margin: 0; }
.tabs a { padding: 9px 13px; font-weight: 600; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; text-decoration: none; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.flashmsg { background: var(--accent-soft); color: var(--accent); border-radius: 8px; padding: 9px 13px; font-weight: 600; }
.flashmsg.bad { background: var(--red-soft); color: var(--red); }
.auth { max-width: 400px; width: 100%; margin: 24px auto; }
label.chip { cursor: pointer; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
label.chip small { grid-column: 2; }
label.chip input { margin: 0; }
label.chip.off { cursor: not-allowed; background: var(--sunken); color: var(--muted); }
label.chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); }
a.chip { text-decoration: none; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); }
.vid-pick { cursor: pointer; position: relative; }
.vid-pick input { position: absolute; top: 8px; left: 8px; z-index: 2; width: 18px; height: 18px; accent-color: var(--accent); }
.vid:has(input:checked) { border-color: var(--accent); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.thumb:has(img) b { text-shadow: 0 1px 4px var(--shade); }
.thumb:has(img)::before { display: none; }
.thumb .fmt { background: var(--shade); z-index: 1; }
details > summary { list-style: none; width: fit-content; cursor: pointer; }
details > summary::-webkit-details-marker { display: none; }
.issue-form { margin-top: 10px; }
details.file > summary.person { width: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
details.file[open] > summary.person { margin-bottom: 10px; }
.toggle { align-self: end; padding-bottom: 8px; }
.progress { height: 8px; border-radius: 4px; background: var(--sunken); overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.modal video { display: block; width: 100%; max-height: 70vh; background: var(--ink); }
.row.spread { justify-content: space-between; display: flex; }
.grow { flex: 1; width: auto; min-width: 160px; }
