:root {
  --bg: #f4f2ee; --card: #fff; --ink: #1d232b; --soft: #5d6875; --line: #dfdbd3;
  --accent: #1f5f8b; --accent-ink: #fff; --good: #2c7a4b; --warn: #a15c00; --private: #8a2c2c;
  --private-bg: #fbeeee; --shared-bg: #e8f3ec;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 -apple-system, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 1px solid var(--line); background: var(--card); border-radius: 7px; padding: 6px 12px; }
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.quiet { border-color: transparent; background: none; color: var(--accent); padding: 4px 6px; }
button.danger { color: var(--private); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 22px 28px 90px; }
.top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.top h1 { font-size: 24px; flex: 1; }
.brand { font-weight: 700; letter-spacing: .02em; color: var(--accent); text-decoration: none; }
.banner { background: #1d232b; color: #fff; padding: 10px 28px; font-size: 14px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
a.card { text-decoration: none; color: inherit; display: block; }
a.card:hover { border-color: var(--accent); }
.card h2 { font-size: 17px; margin-bottom: 4px; }
.muted { color: var(--soft); }
.small { font-size: 13px; }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: #e6eef4; color: var(--accent); white-space: nowrap; }
.pill.done { background: var(--shared-bg); color: var(--good); }
.pill.private { background: var(--private-bg); color: var(--private); }
.pill.shared { background: var(--shared-bg); color: var(--good); }

.begin { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px 22px; margin-bottom: 18px; }
.begin div b { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--soft); font-weight: 600; }
.begin .wide { grid-column: 1 / -1; white-space: pre-wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 16px; text-decoration: none; color: var(--soft); border-bottom: 3px solid transparent; font-weight: 600; }
.tabs a.on { color: var(--accent); border-color: var(--accent); }
.tabs a span { font-weight: 400; font-size: 12px; margin-left: 4px; }
.bar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.bar .grow { flex: 1; }

/* The history log: a line down the page, oldest at the top, growing downward. */
.timeline { position: relative; margin-left: 200px; padding-left: 26px; border-left: 2px solid var(--line); }
.tl { position: relative; margin-bottom: 14px; }
.tl::before { content: ""; position: absolute; left: -33px; top: 14px; width: 12px; height: 12px; border-radius: 50%; background: var(--accent); border: 2px solid var(--bg); }
.tl.auto::before { background: #b9b3a7; width: 8px; height: 8px; left: -31px; top: 12px; }
.tl .when { position: absolute; left: -226px; width: 180px; text-align: right; top: 9px; font-size: 13px; color: var(--soft); }
.tl .box { background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; }
.tl.auto .box { background: none; border: none; padding: 6px 0; color: var(--soft); font-size: 14px; }
.tl .head { display: flex; gap: 8px; align-items: center; }
.tl .head h3 { font-size: 15px; flex: 1; }
.tl .body { white-space: pre-wrap; margin-top: 4px; }
.tl-end { margin-left: 226px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--soft); background: #faf9f6; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.private, td.private { background: var(--private-bg); }
tfoot td { font-weight: 700; background: #faf9f6; }
td.act { white-space: nowrap; text-align: right; width: 1%; }
.totals { display: flex; gap: 14px; margin-bottom: 14px; }
.totals .card { flex: 1; padding: 12px 16px; }
.totals b { display: block; font-size: 22px; }

.filegroup { margin-bottom: 20px; }
.filegroup h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--soft); margin-bottom: 6px; }
.file { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; margin-bottom: 6px; }
.file .thumb { width: 44px; height: 44px; border-radius: 6px; background: #ece9e2; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--soft); overflow: hidden; flex: none; cursor: pointer; }
.file .thumb img { width: 100%; height: 100%; object-fit: cover; }
.file .name { flex: 1; min-width: 0; cursor: pointer; }
.file .name b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hint { border: 2px dashed var(--line); border-radius: 10px; padding: 14px; text-align: center; color: var(--soft); margin-bottom: 16px; }

#drop-veil { position: fixed; inset: 0; background: rgba(31, 95, 139, .88); z-index: 50; display: grid; place-items: center; color: #fff; font-size: 30px; font-weight: 700; }
#drop-veil[hidden], #intake[hidden] { display: none; }
#drop-veil div { border: 3px dashed #fff; border-radius: 18px; padding: 50px 70px; pointer-events: none; }
#intake { position: fixed; right: 20px; bottom: 20px; width: 360px; max-height: 50vh; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.18); padding: 12px 14px; z-index: 40; }
#intake h3 { font-size: 14px; margin-bottom: 6px; display: flex; }
#intake h3 span { flex: 1; }
#intake .row { display: flex; gap: 8px; font-size: 13px; padding: 3px 0; }
#intake .row span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-ready { color: var(--good); font-weight: 600; }
.st-fail { color: var(--private); font-weight: 600; }

.modal { position: fixed; inset: 0; background: rgba(20, 24, 30, .6); z-index: 60; display: grid; place-items: center; padding: 24px; }
.sheet { background: var(--card); border-radius: 12px; width: 560px; max-width: 100%; max-height: 100%; overflow: auto; padding: 20px 22px; }
.sheet h2 { font-size: 19px; margin-bottom: 14px; }
.sheet label { display: block; margin-bottom: 11px; font-size: 13px; font-weight: 600; color: var(--soft); }
.sheet label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 15px; font-weight: 400; }
.sheet input:not([type=checkbox]), .sheet select, .sheet textarea { display: block; width: 100%; margin-top: 3px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.sheet textarea { min-height: 110px; resize: vertical; }
.sheet .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.sheet .foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }
.sheet .foot .grow { flex: 1; }
.err { color: var(--private); margin-bottom: 8px; }

.viewer { background: #14181e; color: #fff; border-radius: 12px; width: min(1200px, 100%); height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.viewer header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #1d232b; }
.viewer header .t { flex: 1; min-width: 0; }
.viewer header .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer header button, .viewer header a.btn { background: #2b333d; border: 1px solid #3b4551; color: #fff; border-radius: 7px; padding: 6px 12px; text-decoration: none; font-size: 14px; }
.viewer .stage { flex: 1; min-height: 0; display: grid; place-items: center; background: #0d1014; }
.viewer .stage img, .viewer .stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .stage iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer .stage pre { width: 100%; height: 100%; margin: 0; overflow: auto; padding: 18px; background: #fff; color: #1d232b; font: 13px/1.5 ui-monospace, Menlo, monospace; white-space: pre-wrap; word-break: break-word; align-self: stretch; }
.viewer .stage .none { text-align: center; padding: 30px; }

@media (max-width: 900px) {
  .begin { grid-template-columns: 1fr 1fr; }
  .timeline { margin-left: 0; }
  .tl .when { position: static; width: auto; text-align: left; margin-bottom: 2px; }
  .tl-end { margin-left: 26px; }
}

a.btnlink { border: 1px solid var(--line); background: var(--card); border-radius: 7px; padding: 6px 12px; text-decoration: none; color: inherit; }
a.btnlink:hover { border-color: var(--accent); }

.door { max-width: 420px; margin: 14vh auto 0; text-align: center; padding: 0 16px; }
.door h1 { font-size: 30px; margin-bottom: 8px; }
.door p { margin: 0 0 20px; }
.door .big, .big { font-size: 18px; padding: 10px 22px; }
.door a.btnlink.primary { display: inline-block; background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.door input.code { display: block; width: 100%; font-size: 34px; letter-spacing: .3em; text-align: center; padding: 10px; margin-bottom: 14px; border: 1px solid var(--line); border-radius: 9px; font-variant-numeric: tabular-nums; }
.sheet.wide { width: 720px; }
.linkrow { border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; margin-bottom: 10px; }
.linkrow.off { opacity: .6; }
.linkrow .head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.linkrow .head b { flex: 1; }
.linkrow .kv { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.linkrow .kv span { width: 40px; }
.linkrow code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 14px ui-monospace, Menlo, monospace; }
.linkrow code.big { font-size: 22px; letter-spacing: .15em; }
.linkrow .foot { justify-content: flex-start; }
.newlink { display: flex; gap: 10px; margin-top: 14px; }
.newlink input { flex: 1; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; }
