/* Bonggis Studio. Tokens and rules: see DESIGN.md. Black, gold and red; large type; status is
   always a word, never colour alone. Red is used for text only where it passes 4.5:1. */
:root {
  --ground: #F7F5F0; --surface: #FFFFFF; --surface-2: #EFECE4; --ink: #141210; --ink-2: #3A3631; --muted: #5E5850; --line: #E2DED5;
  --accent: #9E1219; --btn: #141210; --btn-ink: #FFFFFF; --btn-hover: #2C2925; --accent-soft: #F8E6E5;
  --gold: #E3B341; --gold-ink: #141210; --gold-soft: #FBF1D6; --warn: #7A5A00;
  --danger: #B42318; --danger-soft: #FBE5E3; --success: #146C43; --success-soft: #E0F2E8;
  --brand-deep: #0A0A0A; --brand-red: #D71920;
  --shadow-sm: 0 2px 6px rgba(20, 18, 16, 0.07); --shadow-md: 0 8px 20px rgba(20, 18, 16, 0.10);
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 20px; --s6: 24px; --s8: 32px; --s10: 40px; --s12: 48px;
  --radius: 10px; --radius-lg: 14px; --ease: cubic-bezier(0.22, 1, 0.36, 1); --dur: 140ms;
  --font: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #0A0A0A; --surface: #161514; --surface-2: #242220; --ink: #F4F1EA; --ink-2: #D5D0C6; --muted: #A8A196; --line: #2E2B28;
    --accent: #E3B341; --btn: #E3B341; --btn-ink: #0A0A0A; --btn-hover: #F0C65E; --accent-soft: #2B2412;
    --gold-soft: #2B2412; --warn: #F2CF6B; --danger: #F28B82; --danger-soft: #3A1D1B; --success: #7BD88F; --success-soft: #16301F;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4); --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 90px; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 18px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 3px; }
h1 { font-size: clamp(28px, 3vw, 34px); font-weight: 700; line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 var(--s3); text-wrap: balance; }
h2 { font-size: 22px; font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; margin: 0 0 var(--s3); text-wrap: balance; }
h3 { font-size: 19px; margin: 0 0 var(--s2); }
p { margin: 0 0 var(--s3); max-width: 64ch; }
.lede { font-size: 20px; color: var(--ink-2); }
.muted { color: var(--muted); }
.small { font-size: 16px; }
code, .mono { font-family: Consolas, "SFMono-Regular", Menlo, monospace; font-size: 15px; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-2); padding: var(--s3); border-radius: var(--radius); font-size: 14px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: var(--s3) var(--s4); z-index: 10; }
.skip:focus { left: var(--s4); top: var(--s4); }

/* top bar */
.strip { height: 4px; background: linear-gradient(90deg, var(--brand-deep) 0 40%, var(--brand-red) 40% 70%, var(--gold) 70% 100%); }
.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: var(--s3) var(--s6); padding: var(--s3) var(--s6); background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: inline-flex; align-items: baseline; gap: var(--s3); text-decoration: none; color: var(--ink); min-height: 44px; align-items: center; }
.wordmark { font-weight: 800; font-size: 24px; letter-spacing: 0.02em; }
.wordmark .bang { color: var(--brand-red); }
.brand .tag { font-weight: 600; font-size: 12px; letter-spacing: 0.28em; text-transform: uppercase; color: var(--muted); padding-left: var(--s3); border-left: 1px solid var(--line); }
.env-badge { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; background: var(--gold); color: var(--gold-ink); padding: 2px 8px; border-radius: 999px; }
.top nav { display: flex; gap: var(--s2) var(--s5); align-items: center; flex-wrap: wrap; }
.top nav a, .top nav button.linklike { color: var(--ink); text-decoration: none; font-weight: 500; min-height: 44px; display: inline-flex; align-items: center; position: relative; font-size: 17px; }
.top nav a[aria-current] { color: var(--accent); font-weight: 600; }
.top nav a[aria-current]::after { content: ""; position: absolute; left: 0; right: 0; bottom: 4px; height: 2px; background: var(--accent); }
.top nav form { margin: 0; }
.bell { font-variant-numeric: tabular-nums; }
.top nav .n { background: var(--brand-red); color: #fff; border-radius: 999px; font-size: 13px; font-weight: 700; padding: 0 7px; margin-left: 4px; }
main { max-width: 1160px; margin: 0 auto; padding: var(--s8) var(--s6) 80px; }
footer { color: var(--muted); font-size: 15px; text-align: center; padding: var(--s6) var(--s4) var(--s8); }
@media (max-width: 560px) { main { padding: var(--s5) var(--s4) 64px; } .top { padding: var(--s2) var(--s4); } .brand .tag { display: none; } .top nav { gap: var(--s1) var(--s4); } }

section { margin-bottom: var(--s10); }
.titlebar { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s6); }
.titlebar p { margin: 0; }
.eyebrow { font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.crumb { font-size: 16px; color: var(--muted); margin-bottom: var(--s2); }
.flash { background: var(--gold-soft); color: var(--ink); border-left: 5px solid var(--gold); padding: var(--s3) var(--s4); border-radius: var(--radius); margin-bottom: var(--s6); font-weight: 600; }
.errorbox { background: var(--danger-soft); border-left: 5px solid var(--danger); padding: var(--s3) var(--s4); border-radius: var(--radius); margin-bottom: var(--s5); }
.devbox { background: var(--gold-soft); border-left: 5px solid var(--gold); padding: var(--s3) var(--s4); border-radius: var(--radius); margin-top: var(--s5); word-break: break-all; font-size: 16px; }

/* forms */
.stack { display: flex; flex-direction: column; gap: var(--s4); }
.row { display: flex; gap: var(--s3); flex-wrap: wrap; align-items: center; }
.field label, .field legend { display: block; font-weight: 600; margin-bottom: var(--s1); font-size: 17px; }
.help { color: var(--muted); font-size: 16px; margin-top: var(--s1); }
fieldset { border: 0; padding: 0; margin: 0; }
input[type=text], input[type=email], input[type=number], input[type=url], input[type=date], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: 48px; font: inherit; padding: var(--s3) 14px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--ink-2); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
textarea { resize: vertical; min-height: 120px; }
label.check { display: flex; align-items: flex-start; gap: var(--s3); min-height: 48px; padding: var(--s2) 0; font-weight: 600; }
label.check input { width: 24px; height: 24px; margin-top: 2px; flex: none; accent-color: var(--btn); }
label.check .help { font-weight: 400; margin: 0; }
button, .button { font: inherit; font-weight: 600; min-height: 48px; padding: var(--s3) var(--s5); border-radius: var(--radius); border: 1.5px solid var(--ink); background: transparent; color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease); }
button:hover, .button:hover { background: var(--surface-2); }
button.primary, .button.primary { background: var(--btn); color: var(--btn-ink); border-color: var(--btn); }
button.primary:hover, .button.primary:hover { background: var(--btn-hover); border-color: var(--btn-hover); }
button.danger { border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: var(--danger-soft); }
button.linklike { background: none; border: none; padding: var(--s2) 0; min-height: 0; color: var(--accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* cards, lists, tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s5) var(--s6); box-shadow: var(--shadow-sm); }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s5); }
@media (max-width: 760px) { .cols { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: var(--s2) var(--s5); margin: 0; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 480px) { .kv { grid-template-columns: 1fr; gap: 0; } .kv dd { margin-bottom: var(--s3); } }
.list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-lg); overflow: hidden; }
.list > li { padding: var(--s4) var(--s5); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: var(--s4); align-items: center; flex-wrap: wrap; }
.list > li:last-child { border-bottom: 0; }
.list .t { font-weight: 600; }
.list .m { color: var(--muted); font-size: 16px; }
.list > li.unread { border-left: 4px solid var(--gold); }
.tbl-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); }
table { width: 100%; border-collapse: collapse; font-size: 16px; }
th, td { text-align: left; padding: var(--s3) 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); font-weight: 700; }
tr:last-child td { border-bottom: none; }
td.num { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  table.stack thead { display: none; }
  table.stack tr { display: block; border-bottom: 1px solid var(--line); padding: var(--s2) 0; }
  table.stack td { display: block; border: none; padding: var(--s1) 14px var(--s1) 120px; position: relative; min-height: 32px; }
  table.stack td::before { content: attr(data-label); position: absolute; left: 14px; top: 7px; width: 100px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
}

/* status pills: colour plus a word */
.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; background: var(--surface-2); color: var(--ink-2); }
.pill.ok, .pill.s-done, .pill.s-published, .pill.s-approved { background: var(--success-soft); color: var(--success); }
.pill.warn, .pill.s-queued, .pill.s-in_review { background: var(--gold-soft); color: var(--warn); }
.pill.bad, .pill.s-dead, .pill.s-failed, .pill.s-changes_requested { background: var(--danger-soft); color: var(--danger); }
.pill.s-running { background: var(--accent-soft); color: var(--accent); }
.rolelist { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--s4); margin-bottom: var(--s6); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s4) var(--s5); }
.stat-n { font-size: 32px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--muted); font-size: 16px; margin-top: var(--s2); }

/* sign-in */
body.plain main { max-width: none; padding: 0; }
.signin { display: grid; grid-template-columns: 1fr 1fr; min-height: calc(100vh - 60px); }
.signin-brand { background: var(--brand-deep); color: #F4F1EA; padding: var(--s12) var(--s10); display: flex; flex-direction: column; justify-content: center; gap: var(--s5); }
.signin-brand .wordmark { font-size: 44px; color: #fff; }
.signin-brand h2 { font-size: clamp(28px, 3.2vw, 40px); font-weight: 600; line-height: 1.2; color: #fff; }
.signin-brand p { color: rgba(244, 241, 234, 0.82); font-size: 19px; max-width: 34ch; }
.signin-brand .tagline { color: var(--gold); font-weight: 700; letter-spacing: 0.22em; text-transform: uppercase; font-size: 13px; }
.signin-form { padding: var(--s12) var(--s10); display: flex; flex-direction: column; justify-content: center; }
.signin-form .stack { max-width: 440px; }
.signin-card { max-width: 620px; margin: var(--s8) auto; padding: var(--s8); }
@media (max-width: 760px) {
  .signin { grid-template-columns: 1fr; min-height: 0; }
  .signin-brand { padding: var(--s8) var(--s6); }
  .signin-brand p { display: none; }
  .signin-form { padding: var(--s8) var(--s6); }
  .signin-card { margin: var(--s4); padding: var(--s6); }
}

/* page furniture */
.subnav { gap: var(--s5); margin: calc(-1 * var(--s3)) 0 var(--s6); }
.subnav a { min-height: 44px; display: inline-flex; align-items: center; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.subnav a[aria-current] { color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 6px; }
a.statlink { text-decoration: none; color: inherit; }
a.statlink:hover { border-color: var(--ink-2); }
.remove-access { margin-top: var(--s5); padding-top: var(--s5); border-top: 1px solid var(--line); }

/* filters */
.filters { align-items: flex-end; margin-bottom: var(--s6); }
.filters .field { min-width: 180px; flex: 1 1 180px; max-width: 280px; }
.filters label.check { min-height: 48px; padding: 0; align-items: center; }

/* item stages (words always shown with the colour) */
.pill.s-idea, .pill.s-in_production, .pill.s-captioning, .pill.s-draft { background: var(--surface-2); color: var(--ink-2); }
.pill.s-scheduled, .pill.s-manual_pending { background: var(--accent-soft); color: var(--accent); }
.pill.s-manual_done, .pill.s-published { background: var(--success-soft); color: var(--success); }
.pill.s-missed { background: var(--danger-soft); color: var(--danger); }
.pill.s-skipped { background: var(--surface-2); color: var(--muted); }

/* calendar week */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--s3); }
@media (max-width: 1100px) { .week { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .week { grid-template-columns: 1fr; } }
.day { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--s3); min-width: 0; }
.day.today { border: 2px solid var(--gold); }
.day-head { font-size: 17px; margin: 0 0 var(--s3); display: flex; gap: var(--s2); align-items: baseline; flex-wrap: wrap; }
.day-head span { font-weight: 500; color: var(--muted); }
.entries { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--s2); }
.entry > a, .entry > div { display: flex; flex-direction: column; gap: 2px; padding: var(--s2) var(--s3); border-radius: var(--radius); border-left: 5px solid var(--pc); background: var(--surface-2); color: var(--ink); text-decoration: none; min-height: 48px; }
.entry > a:hover { outline: 2px solid var(--ink-2); }
.entry.open > a, .entry.open > div { background: transparent; border: 1.5px dashed var(--line); border-left: 5px solid var(--pc); color: var(--muted); }
.e-top { font-size: 14px; display: flex; gap: var(--s2); align-items: baseline; }
.e-time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.e-pillar { font-weight: 700; }
.e-title { font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.entry .pill { align-self: flex-start; font-size: 12px; padding: 1px 8px; }

/* post page */
.next-step { display: flex; justify-content: space-between; align-items: center; gap: var(--s4); flex-wrap: wrap; margin-bottom: var(--s5); background: var(--gold-soft); border-color: transparent; }
.next-step p { margin: 0; }
.variant { margin-bottom: var(--s5); border-left: 5px solid var(--line); }
.variant.s-in_review { border-left-color: var(--gold); }
.variant.s-changes_requested, .variant.s-failed, .variant.s-missed { border-left-color: var(--danger); }
.variant.s-approved, .variant.s-scheduled, .variant.s-manual_done, .variant.s-published { border-left-color: var(--success); }
.variant.s-manual_pending { border-left-color: var(--accent); }
.v-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); flex-wrap: wrap; }
.v-head h2 { margin: 0; }
.variant details, .review-item details { margin-top: var(--s4); }
details > summary { cursor: pointer; color: var(--accent); font-weight: 600; min-height: 44px; display: flex; align-items: center; }
details[open] > summary { margin-bottom: var(--s3); }
.variant .row input[type=url], .variant .row input[type=text], .variant .row input[type=datetime-local] { flex: 1 1 260px; width: auto; }
.problems { background: var(--danger-soft); border-radius: var(--radius); padding: var(--s3) var(--s3) var(--s3) var(--s8); margin: var(--s4) 0 0; font-size: 16px; }
.decide { display: flex; gap: var(--s4); align-items: flex-start; flex-wrap: wrap; margin-top: var(--s4); padding-top: var(--s4); border-top: 1px solid var(--line); }
.decide details { flex: 1 1 260px; margin: 0; }
.caption-text { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 64ch; font-size: 18px; }
.tags { color: var(--accent); overflow-wrap: anywhere; }
.plain { list-style: none; margin: 0; padding: 0; }
.plain li { padding: var(--s2) 0; border-bottom: 1px solid var(--line); }
.plain li:last-child { border-bottom: 0; }
.plat-row { display: flex; gap: var(--s3); align-items: center; flex-wrap: wrap; }
.plat-row label.check { flex: 0 0 160px; }
.plat-row select { flex: 1 1 200px; width: auto; }
.note-inline { background: var(--gold-soft); border-radius: var(--radius); padding: var(--s3) var(--s4); margin: 0; }
.review-version { padding-top: var(--s4); margin-top: var(--s4); border-top: 1px solid var(--line); }
.review-item { margin-bottom: var(--s5); }
.pill.big { font-size: 16px; padding: 6px 14px; }
