/* TMF Production Tracker — built for a 1080p TV / Teams share first, laptop second.
   Spacing scale: 4 / 8 / 12 / 16 / 24 / 32 (x --scale). Type ramp: 14 / 16 / 18 / 22 / 28. */

:root {
  --scale: 1;
  --bg: #E8EAEC;
  --surface: #FFFFFF;
  --surface-2: #F3F4F5;
  --ink: #000000;
  --muted: #474C52;
  --line: #C5CAD0;
  --line-strong: #8D949B;
  --accent: #F58220;          /* Victaulic Orange: structural accents only, never text */
  --danger: #A61B1B;
  --warn-bg: #FFF1D6;
  --focus: #1F5FBF;
  --topbar: #2A2F35;
  --topbar-ink: #FFFFFF;
  --s1: calc(4px * var(--scale)); --s2: calc(8px * var(--scale)); --s3: calc(12px * var(--scale));
  --s4: calc(16px * var(--scale)); --s5: calc(24px * var(--scale)); --s6: calc(32px * var(--scale));
  --t-sm: calc(14px * var(--scale)); --t-base: calc(16px * var(--scale)); --t-md: calc(18px * var(--scale));
  --t-lg: calc(22px * var(--scale)); --t-xl: calc(28px * var(--scale));
  --radius: 4px;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1A1E22; --surface: #23282D; --surface-2: #2B3137; --ink: #F1F3F4; --muted: #B9BFC5;
    --line: #3C444B; --line-strong: #69727B; --danger: #FF8A80; --warn-bg: #3D3220; --focus: #8AB4FF;
    --topbar: #101316; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1A1E22; --surface: #23282D; --surface-2: #2B3137; --ink: #F1F3F4; --muted: #B9BFC5;
  --line: #3C444B; --line-strong: #69727B; --danger: #FF8A80; --warn-bg: #3D3220; --focus: #8AB4FF;
  --topbar: #101316; color-scheme: dark;
}
html { scroll-padding-top: env(safe-area-inset-top, 0px); }
*, *::before, *::after { box-sizing: inherit; }
[hidden] { display: none !important; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--t-base)/1.4 Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-variant-numeric: tabular-nums;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: var(--s2); z-index: 20; }
.skip:focus { left: var(--s2); }
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 10;
  display: flex; align-items: center; gap: var(--s5); flex-wrap: wrap;
  background: var(--topbar); color: var(--topbar-ink);
  padding: var(--s2) var(--s5); border-bottom: 4px solid var(--accent);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--topbar); }
.brand { display: flex; align-items: baseline; gap: var(--s4); }
.brand h1 { margin: 0; font-size: var(--t-lg); font-weight: 700; }
.meeting { margin: 0; font-size: var(--t-md); }
.tabs { display: flex; gap: var(--s1); }
.tabs a {
  color: var(--topbar-ink); text-decoration: none; font-size: var(--t-md); font-weight: 700;
  padding: var(--s2) var(--s4); border-bottom: 4px solid transparent; margin-bottom: calc(-1 * var(--s2) - 4px);
}
.tabs a[aria-current="page"] { border-bottom-color: var(--accent); }
.tabs a:hover { background: rgba(255,255,255,.08); }
.tools { margin-left: auto; display: flex; align-items: center; gap: var(--s2); }
.icon-btn {
  min-width: 44px; min-height: 40px; border: 1px solid rgba(255,255,255,.35); background: transparent;
  color: var(--topbar-ink); border-radius: var(--radius); cursor: pointer; font-weight: 700;
}
.icon-btn:hover { background: rgba(255,255,255,.12); }
.who { font-size: var(--t-sm); opacity: .9; }

.banner { background: var(--warn-bg); border-bottom: 1px solid var(--line-strong); padding: var(--s3) var(--s5); display: flex; gap: var(--s4); align-items: center; }
main { padding: var(--s4) var(--s5) var(--s6); outline: none; }
.loading, .empty { color: var(--muted); font-size: var(--t-md); padding: var(--s6) 0; }

/* ---------- buttons & fields ---------- */
.btn {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px;
  padding: var(--s2) var(--s4); border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); font-weight: 700;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #000; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.link { border: 0; background: none; padding: var(--s1) var(--s2); text-decoration: underline; font-weight: 400; min-height: 32px; }
.field { display: flex; flex-direction: column; gap: var(--s1); }
.field > span { font-size: var(--t-sm); font-weight: 700; color: var(--muted); }
input[type=text], input[type=search], input[type=email], input[type=date], select, textarea {
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface);
  padding: var(--s2) var(--s3); min-height: 40px;
}
.check { display: inline-flex; align-items: center; gap: var(--s2); min-height: 40px; }
.check input { width: 20px; height: 20px; }

/* ---------- board toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-bottom: var(--s4); }
.toolbar input[type=search] { width: min(320px, 100%); }
.filter-chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.fchip {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s3);
  border: 2px solid var(--st); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 700; font-size: var(--t-sm);
}
.fchip[aria-pressed="true"] { background: var(--st); color: #fff; }
.fchip .n { font-weight: 400; }
.progress { margin-left: auto; font-size: var(--t-md); font-weight: 700; }
.progress small { font-weight: 400; color: var(--muted); font-size: var(--t-sm); }

/* ---------- board ---------- */
.project { background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--ink); margin-bottom: var(--s4); border-radius: 0 0 var(--radius) var(--radius); }
.project-head { display: flex; align-items: baseline; gap: var(--s4); flex-wrap: wrap; padding: var(--s2) var(--s4); border-bottom: 1px solid var(--line); }
.project-head h2 { margin: 0; font-size: var(--t-lg); }
.pnum { font-size: var(--t-md); font-weight: 700; color: var(--muted); }
.contact { color: var(--muted); }
.project-head .actions { margin-left: auto; display: flex; gap: var(--s1); }

.seq {
  display: grid; align-items: stretch;
  grid-template-columns: minmax(190px, 15%) minmax(170px, 14%) minmax(130px, 10%) minmax(0, 1fr) minmax(0, 0.8fr);
  border-bottom: 1px solid var(--line);
}
.seq:last-child { border-bottom: 0; }
.seq > * { padding: var(--s2) var(--s3); min-width: 0; }
.seq-head { position: sticky; top: var(--topbar-h, 0px); z-index: 5; background: var(--surface-2); border: 1px solid var(--line); border-bottom: 2px solid var(--line-strong); margin-bottom: var(--s2); }
.colhead { font-size: var(--t-sm); color: var(--muted); font-weight: 700; padding: var(--s2) var(--s3); }

/* The status tag: the one bold element — reads across the room like a shop traveler tag. */
.tag {
  display: flex; min-height: calc(64px * var(--scale)); flex-direction: column; justify-content: center; gap: var(--s1);
  background: var(--st); color: #fff; border: 0; text-align: left; cursor: pointer;
  font-size: var(--t-md); font-weight: 700; border-radius: 0;
}
.tag:hover { filter: brightness(1.08); }
.tag .subs { display: flex; flex-wrap: wrap; gap: var(--s1); font-size: var(--t-sm); font-weight: 400; }
.tag .subs span { background: rgba(0,0,0,.28); padding: 1px var(--s2); border-radius: 3px; }
.where { display: flex; flex-direction: column; gap: var(--s1); }
.where .sname { font-weight: 700; font-size: var(--t-md); overflow-wrap: anywhere; }
.where .row { display: flex; align-items: center; gap: var(--s1); flex-wrap: wrap; }
.where select { min-height: 34px; padding: var(--s1) var(--s2); max-width: 100%; flex: 1 1 120px; }
.due { display: flex; flex-direction: column; gap: var(--s1); }
.due .date { font-size: var(--t-md); font-weight: 700; }
.due .was { text-decoration: line-through; color: var(--muted); font-size: var(--t-sm); }
.due .late { color: var(--danger); font-weight: 700; font-size: var(--t-sm); }
.flags { display: flex; gap: var(--s1); flex-wrap: wrap; }
.flag { font-size: var(--t-sm); border: 1px solid var(--line-strong); padding: 0 var(--s2); border-radius: 3px; font-weight: 700; }
.flag.high { border-color: var(--danger); color: var(--danger); }
.note { display: flex; flex-direction: column; gap: var(--s1); }
.note textarea { width: 100%; min-height: calc(44px * var(--scale)); resize: vertical; font-size: var(--t-md); line-height: 1.35; padding: var(--s1) var(--s2); }
.note.missing textarea { border-style: dashed; background: var(--surface-2); }
.note .meta { display: flex; gap: var(--s3); align-items: center; font-size: var(--t-sm); color: var(--muted); }
.note .meta:empty { display: none; }
.note .meta .btn.link, .where .btn.link { min-height: 28px; padding: 0 var(--s1); font-size: var(--t-sm); }
.last { color: var(--muted); font-size: var(--t-base); overflow-wrap: anywhere; border-left: 1px solid var(--line); }
.last b { display: block; font-size: var(--t-sm); }

/* ---------- dialog ---------- */
dialog { border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--ink); width: min(760px, 94vw); max-height: 90vh; }
dialog::backdrop { background: rgba(0,0,0,.55); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: var(--s3) var(--s5); border-bottom: 3px solid var(--accent); }
.dlg-head h2 { margin: 0; font-size: var(--t-lg); }
.dlg-body { padding: var(--s4) var(--s5); display: grid; gap: var(--s4); overflow: auto; max-height: calc(90vh - 140px); }
.dlg-foot { display: flex; gap: var(--s2); justify-content: flex-end; padding: var(--s3) var(--s5); border-top: 1px solid var(--line); }
.dlg-foot .left { margin-right: auto; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s2); }
.status-opt {
  min-height: 56px; border: 3px solid var(--st); background: var(--surface); border-radius: var(--radius);
  font-size: var(--t-md); font-weight: 700; cursor: pointer; text-align: left; padding: var(--s2) var(--s3);
}
.status-opt[aria-checked="true"] { background: var(--st); color: #fff; }
.sub-grid { display: flex; flex-wrap: wrap; gap: var(--s2); }
.sub-opt { min-height: 44px; padding: 0 var(--s4); border: 2px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 700; }
.sub-opt[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s3); }
.history { margin: 0; padding: 0; list-style: none; display: grid; gap: var(--s2); }
.history li { border-left: 3px solid var(--line-strong); padding-left: var(--s3); }
.history .when { font-size: var(--t-sm); color: var(--muted); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 700; margin-bottom: var(--s2); font-size: var(--t-md); }
.seq-list { display: grid; gap: var(--s2); }
.seq-list .row { display: flex; gap: var(--s2); }
.seq-list .row input { flex: 1; }

/* ---------- completed ---------- */
table.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
table.list th, table.list td { text-align: left; padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { background: var(--surface-2); font-size: var(--t-sm); color: var(--muted); }
.table-wrap { overflow-x: auto; }
.pill { display: inline-block; background: var(--st); color: #fff; padding: 1px var(--s2); border-radius: 3px; font-weight: 700; font-size: var(--t-sm); white-space: nowrap; }

/* ---------- dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.kpi { background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--k, var(--line-strong)); padding: var(--s3) var(--s4); }
.kpi .v { font-size: calc(44px * var(--scale)); font-weight: 700; line-height: 1.05; }
.kpi .l { font-size: var(--t-md); }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(460px, 100%), 1fr)); gap: var(--s4); }
.panel { background: var(--surface); border: 1px solid var(--line); padding: var(--s4); min-width: 0; }
.panel h2 { margin: 0 0 var(--s1); font-size: var(--t-lg); }
.panel .sub { margin: 0 0 var(--s3); color: var(--muted); font-size: var(--t-sm); }
.hbars { display: grid; grid-template-columns: max-content 1fr max-content; gap: var(--s2) var(--s3); align-items: center; }
.hbars .lbl { font-weight: 700; }
.hbars .track { background: var(--surface-2); height: calc(22px * var(--scale)); }
.hbars .bar { height: 100%; background: var(--c, var(--line-strong)); min-width: 2px; }
.hbars .num { font-weight: 700; font-size: var(--t-md); text-align: right; }
.vbars { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s2); align-items: end; height: calc(220px * var(--scale)); border-bottom: 2px solid var(--line-strong); }
.vbars .col { display: flex; flex-direction: column; align-items: stretch; justify-content: flex-end; height: 100%; }
.vbars .bar { background: var(--c, #1F5FBF); min-height: 2px; }
.vbars .num { text-align: center; font-weight: 700; font-size: var(--t-md); }
.vlabels { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s2); text-align: center; font-size: var(--t-sm); color: var(--muted); padding-top: var(--s1); }
.vlabels .now { color: var(--ink); font-weight: 700; }

/* ---------- admin ---------- */
.admin { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); align-items: start; }
.admin h3 { margin: var(--s3) 0 var(--s2); font-size: var(--t-md); display: flex; align-items: center; gap: var(--s2); }
.edit-list { list-style: none; margin: 0 0 var(--s2); padding: 0; display: grid; gap: var(--s2); }
.edit-list li { display: flex; gap: var(--s2); align-items: center; }
.edit-list li input { flex: 1; }
.edit-list li.inactive input { text-decoration: line-through; color: var(--muted); }
.add-row { display: flex; gap: var(--s2); }
.add-row input { flex: 1; }

.toast {
  position: fixed; bottom: calc(var(--s5) + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%);
  background: var(--ink); color: var(--surface); padding: var(--s3) var(--s5); border-radius: var(--radius);
  font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.error { background: var(--danger); color: #fff; }

/* Laptop / tablet: stack the note columns under the row. */
@media (max-width: 1100px) {
  .seq { grid-template-columns: minmax(160px, 30%) 1fr 1fr; }
  .seq .note, .seq .last { grid-column: 1 / -1; border-left: 0; }
  .colhead.c-note, .colhead.c-last { display: none; }
}
@media (max-width: 640px) {
  .topbar { padding: var(--s2) var(--s3); gap: var(--s2); }
  .tools .who { display: none; }
  main { padding: var(--s3); }
  .seq { grid-template-columns: 1fr 1fr; }
  .seq .tag { grid-column: 1 / -1; }
  .seq-head { display: none; }
  .progress { margin-left: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
