/* Talladega Downs Maintenance -- mobile-first. Base styles target phones;
   min-width queries add the desktop kanban/two-column layouts. */
:root {
  --bg: #f1f5f9; --surface: #ffffff; --surface-2: #f8fafc; --text: #0f172a; --muted: #64748b;
  --line: #e2e8f0; --brand: #0f172a; --accent: #2563eb; --accent-text: #ffffff;
  --hud: #dc2626; --p1: #ea580c; --p2: #d97706; --p3: #2563eb; --p4: #6b7280;
  --good: #15803d; --bad: #b91c1c; --info: #1d4ed8;
  --radius: 12px; --shadow: 0 1px 2px rgb(15 23 42 / .06), 0 1px 3px rgb(15 23 42 / .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1120; --surface: #111a2e; --surface-2: #16213a; --text: #e2e8f0; --muted: #94a3b8;
    --line: #1f2c47; --brand: #020617; --accent: #3b82f6;
    --hud: #ef4444; --p1: #f97316; --p2: #f59e0b; --p3: #3b82f6; --p4: #9ca3af;
    --good: #22c55e; --bad: #f87171; --info: #60a5fa;
    --shadow: 0 1px 2px rgb(0 0 0 / .4);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
h1 { font-size: 1.4rem; margin: .4rem 0 .6rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
h3 { font-size: .95rem; margin: 1rem 0 .4rem; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.empty { color: var(--muted); font-style: italic; margin: .5rem 0; }

/* ---- top bar + tabs ---- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: .5rem; padding: .55rem 16px; padding-top: max(.55rem, env(safe-area-inset-top));
  background: var(--brand); color: #fff; }
.brand { display: flex; align-items: center; gap: .55rem; color: inherit; text-decoration: none; font-weight: 700; min-width: 0; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: var(--hud); color: #fff; font-weight: 800; letter-spacing: -.5px; flex: none; }
.brand-text { line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text small { display: block; font-weight: 500; opacity: .7; font-size: .75rem; }
.brand.big { justify-content: center; margin-bottom: 1rem; color: var(--text); }
.who { display: flex; align-items: center; gap: .5rem; }
.who .chip { display: none; background: rgb(255 255 255 / .1); color: #fff; }
.who form { margin: 0; }
.topbar .btn.ghost { color: #fff; border-color: rgb(255 255 255 / .3); }
.tabs { display: flex; gap: .25rem; overflow-x: auto; padding: .45rem 12px; background: var(--surface);
  border-bottom: 1px solid var(--line); scrollbar-width: none; position: sticky; top: 50px; z-index: 9; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; padding: .5rem .85rem; border-radius: 999px; text-decoration: none; color: var(--text);
  font-weight: 600; font-size: .92rem; }
.tabs a.on { background: var(--accent); color: var(--accent-text); }

.wrap { padding: 14px 16px 40px; max-width: 1500px; margin: 0 auto; }

/* ---- buttons + forms ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; min-height: 44px;
  padding: .55rem 1rem; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text); font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.go { border-color: var(--good); color: var(--good); }
.btn.go.primary { background: var(--good); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 34px; padding: .3rem .7rem; font-size: .88rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: default; }
input, select, textarea { width: 100%; min-height: 44px; padding: .55rem .7rem; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text); font: inherit; font-size: 16px; }
textarea { min-height: 0; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 1px; }
label { display: grid; gap: .3rem; font-weight: 600; font-size: .92rem; }
.stack { display: grid; gap: .75rem; }
.stack-lg { display: grid; gap: 14px; align-content: start; }
.inline { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.inline > input, .inline > select { flex: 1 1 160px; width: auto; }
.inline > .qty { flex: 0 1 90px; }
.form-grid { display: grid; gap: .75rem; }

/* ---- flashes ---- */
.flash { padding: .75rem 1rem; border-radius: 10px; margin: 0 0 12px; border: 1px solid; }
.flash.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); background: color-mix(in srgb, var(--bad) 8%, var(--surface)); }
.flash.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 8%, var(--surface)); }
.flash.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 35%, transparent); background: color-mix(in srgb, var(--info) 7%, var(--surface)); }

/* ---- priority colors ---- */
.p-hud { --pc: var(--hud); } .p-1 { --pc: var(--p1); } .p-2 { --pc: var(--p2); }
.p-3 { --pc: var(--p3); } .p-4 { --pc: var(--p4); }
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 6px; font-size: .75rem; font-weight: 700;
  letter-spacing: .02em; text-transform: uppercase; color: #fff; background: var(--pc, var(--p4)); white-space: nowrap; }
.badge.status { background: var(--surface-2); color: var(--text); border: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0 .8rem; }

/* ---- technician chips ---- */
.chip { display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .6rem; border-radius: 999px;
  font-size: .85rem; font-weight: 600; background: color-mix(in srgb, var(--c, var(--muted)) 14%, var(--surface));
  color: var(--text); border: 1px solid color-mix(in srgb, var(--c, var(--muted)) 45%, transparent); text-decoration: none; white-space: nowrap; }
.chip .dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--c, var(--muted)); flex: none; }
.chip em { font-style: normal; opacity: .7; font-size: .78rem; }
.chip.sel { outline: 2px solid var(--accent); }
.chip.unassigned { border-style: dashed; color: var(--muted); background: transparent; }

/* ---- cards ---- */
.list { display: grid; gap: 10px; }
.card { display: block; padding: .75rem .85rem; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--line); border-left: 6px solid var(--pc, var(--line)); box-shadow: var(--shadow);
  color: var(--text); text-decoration: none; }
.card:hover { border-color: var(--pc, var(--accent)); }
.card.p-hud { background: color-mix(in srgb, var(--hud) 6%, var(--surface)); }
.card-top { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.card-title { font-weight: 700; margin: .35rem 0 .3rem; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; font-size: .85rem; }
.unit { font-weight: 700; font-size: .85rem; }
.src { font-size: .7rem; font-weight: 700; padding: .05rem .35rem; border-radius: 4px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--muted); }
.count { display: inline-block; min-width: 1.6rem; padding: 0 .45rem; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); font-size: .8rem; text-align: center; color: var(--muted); vertical-align: middle; }

/* ---- board ---- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.stat { display: grid; padding: .7rem .85rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line);
  color: var(--text); text-decoration: none; box-shadow: var(--shadow); }
.stat b { font-size: 1.6rem; line-height: 1.1; }
.stat span { font-size: .8rem; color: var(--muted); font-weight: 600; }
.stat.hud { border-left: 6px solid var(--hud); } .stat.hud b { color: var(--hud); }
.stat.warn b { color: var(--p1); } .stat.good b { color: var(--good); }
.toolbar { display: grid; gap: .3rem; margin-bottom: 10px; }
.techs { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .3rem; }
.columns { display: grid; gap: 14px; margin-bottom: 14px; }
.col { display: grid; gap: 10px; align-content: start; }
.col h2 { margin: .3rem 0 0; display: flex; align-items: center; gap: .4rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow); margin-bottom: 14px; }
.stack-lg > .panel { margin-bottom: 0; }
details.panel summary { cursor: pointer; font-weight: 700; }
details.panel[open] summary { margin-bottom: .6rem; }

/* ---- work order page ---- */
.backlink { display: inline-block; margin-bottom: .4rem; text-decoration: none; font-weight: 600; }
.wo-head { background: var(--surface); border: 1px solid var(--line); border-left: 8px solid var(--pc); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.wo-head h1 { margin: .4rem 0; overflow-wrap: anywhere; }
.wo-grid { display: grid; gap: 14px; }
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.checklist li { display: flex; align-items: center; gap: .6rem; padding: .3rem 0; border-bottom: 1px solid var(--line); }
.checklist li:last-child { border-bottom: 0; }
.checklist form { margin: 0; }
.check { width: 44px; height: 44px; flex: none; border-radius: 10px; border: 2px solid var(--line); background: var(--surface);
  color: #fff; font-size: 1.3rem; font-weight: 800; cursor: pointer; }
.checklist li.done .check { background: var(--good); border-color: var(--good); }
.checklist li.done .ctext { text-decoration: line-through; color: var(--muted); }
.status-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.status-btns input { display: none; }
.feed { list-style: none; margin: .8rem 0 0; padding: 0; display: grid; gap: .55rem; font-size: .92rem; }
.feed li { padding-left: .6rem; border-left: 3px solid var(--line); }
.feed li.act-note { border-left-color: var(--accent); }
.feed li.act-status, .feed li.act-assigned { border-left-color: var(--good); }
.feed small { display: block; }
.kv { display: grid; grid-template-columns: minmax(90px, 35%) 1fr; gap: .35rem .75rem; margin: 0; font-size: .9rem; }
.kv dt { font-weight: 700; color: var(--muted); overflow-wrap: anywhere; }
.kv dd { margin: 0; }

/* ---- tables ---- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tbl th, .tbl td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl th { font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.tbl tr.low td { background: color-mix(in srgb, var(--p1) 7%, transparent); }
.tbl tr.sel td { background: color-mix(in srgb, var(--accent) 9%, transparent); }
.tbl tr.pending td { background: color-mix(in srgb, var(--p2) 9%, transparent); }
.tbl td.actions { display: flex; gap: .4rem; justify-content: flex-end; }
.tbl td.actions form { margin: 0; }
.okc { color: var(--good); } .badc { color: var(--bad); }
.hide-sm { display: none; }

/* ---- projects ---- */
.bar { height: 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); overflow: hidden; margin: .4rem 0; }
.bar.big { height: 14px; }
.bar i { display: block; height: 100%; background: var(--good); }

/* ---- auth ---- */
body.auth { min-height: 100vh; display: grid; place-items: center; }
.auth-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px 20px; box-shadow: var(--shadow); }

/* ---------- tablet ---------- */
@media (min-width: 640px) {
  .stats { grid-template-columns: repeat(5, 1fr); }
  .who .chip { display: inline-flex; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid .span2, .form-grid > input[type=hidden] + .span2 { grid-column: span 2; }
  .status-btns { grid-template-columns: repeat(3, 1fr); }
  .hide-sm { display: table-cell; }
  .list.cols2 { grid-template-columns: 1fr 1fr; }
}
/* ---------- desktop ---------- */
@media (min-width: 1000px) {
  .wrap { padding: 20px 24px 48px; }
  .columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 200px; }
  .wo-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
  .toolbar { grid-template-columns: auto 1fr; align-items: center; gap: 1rem; }
  .techs { justify-content: flex-end; flex-wrap: wrap; }
  .status-btns { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  .topbar, .tabs, form, .backlink { display: none !important; }
}

/* Grid/flex children must be allowed to shrink below their content width,
   otherwise nowrap chips and long rows push the page wider than a phone. */
.wrap, .columns, .col, .list, .toolbar, .stats, .wo-grid, .stack-lg { min-width: 0; }
.columns, .list, .toolbar, .wo-grid { grid-template-columns: minmax(0, 1fr); }
.stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.col > *, .list > *, .toolbar > *, .wo-grid > *, .stats > * { min-width: 0; }
body { overflow-x: hidden; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
@media (min-width: 1000px) {
  .columns { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wo-grid { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .toolbar { grid-template-columns: auto minmax(0, 1fr); }
}
/* Inputs/selects have an intrinsic minimum width; let them shrink in rows. */
.inline > *, .panel, .stack-lg > * { min-width: 0; }
.inline > select { max-width: 100%; }
.checklist .ctext { min-width: 0; overflow-wrap: anywhere; }
.stack, .stack-lg { grid-template-columns: minmax(0, 1fr); }
.form-grid { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.src.closed { color: var(--good); border-color: color-mix(in srgb, var(--good) 50%, transparent); }
.update-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem .9rem; margin: 0 0 12px; }
.update-bar form { margin: 0; }
.update-bar .muted { font-size: .88rem; flex: 1 1 240px; min-width: 0; }
@media (max-width: 639px) { .update-bar form, .update-bar .btn { width: 100%; } }
/* Work type tag + hazard side notes */
.type { font-size: .75rem; font-weight: 700; padding: .12rem .5rem; border-radius: 6px; white-space: nowrap;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text); }
.hazards { border: 1px solid color-mix(in srgb, var(--p2) 55%, transparent); border-left: 6px solid var(--p2);
  background: color-mix(in srgb, var(--p2) 9%, var(--surface)); border-radius: var(--radius); padding: 12px 14px; }
.hazards h3 { margin: 0 0 .4rem; font-size: .98rem; }
.hazards ul { margin: 0; padding-left: 1.1rem; display: grid; gap: .3rem; font-size: .92rem; }
.hazards .fine { margin: .5rem 0 0; font-size: .75rem; color: var(--muted); }
.hazards[hidden] { display: none; }
/* Two-up fields that stack on phones */
.two { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; }
@media (min-width: 420px) { .two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Accept + time on job */
.accept-bar { display: grid; gap: .4rem; margin: 0 0 14px; }
.btn.big { min-height: 56px; font-size: 1.1rem; }
.clock { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .3rem .8rem; margin: 0 0 14px;
  padding: .7rem .9rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); }
.clock.running { border-color: color-mix(in srgb, var(--good) 55%, transparent); }
.clock .muted { font-size: .85rem; }
.edited { font-size: .82rem; font-weight: 600; color: var(--p2); }
/* Back office */
.signoff input { border-color: color-mix(in srgb, var(--p2) 60%, var(--line)); }
.onetime .pw { display: inline-block; margin: .3rem 0; padding: .3rem .6rem; border-radius: 8px; background: var(--surface);
  color: var(--text); font-size: 1.1rem; letter-spacing: .03em; user-select: all; overflow-wrap: anywhere; }
.onetime p { margin: .4rem 0 0; }
.downloads { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.downloads .btn { justify-content: flex-start; text-align: left; white-space: normal; }
.fine { font-size: .8rem; }
/* Team list */
.people { display: grid; gap: 8px; margin-bottom: 14px; }
.person { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem .8rem;
  padding: .65rem .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.person.pending { border-color: color-mix(in srgb, var(--p2) 60%, transparent); }
.person-main { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; min-width: 0; }
.person-main .muted { font-size: .85rem; overflow-wrap: anywhere; }
.person-actions { display: flex; gap: .4rem; }
.person-actions form { margin: 0; }
.phone { font-weight: 600; font-size: .9rem; white-space: nowrap; }
.st-pending { color: var(--p2); } .st-disabled { color: var(--bad); } .st-active { color: var(--good); }
/* Long names wrap instead of pushing the layout wider than a phone.
   The tech filter row and top bar keep one line (they scroll / have room). */
.chip { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.techs .chip, .who .chip { white-space: nowrap; }
.person > * { min-width: 0; }
.person-main { flex: 1 1 220px; }
.techs .chip { max-width: none; flex: none; }
/* "Who's working?" picker */
.picker .names { display: grid; gap: .5rem; margin: .8rem 0; }
.picker .names form { margin: 0; }
.name-btn { justify-content: flex-start; gap: .7rem; min-height: 56px; text-align: left; flex-wrap: wrap; }
.name-btn .initial { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--accent); color: var(--accent-text); font-weight: 800; }
.name-btn .nm { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; font-size: 1.05rem; }
.name-btn .inuse { font-size: .75rem; font-weight: 600; color: var(--p2); }
.new-user { margin: .6rem 0 1rem; }
.new-user > summary { list-style: none; cursor: pointer; }
.new-user > summary::-webkit-details-marker { display: none; }
.new-user[open] > summary { margin-bottom: .7rem; }
.who-name { font-weight: 700; font-size: .9rem; max-width: 34vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-row { display: flex; align-items: center; gap: .55rem; font-weight: 500; }
.check-row input { width: 22px; min-height: 22px; height: 22px; flex: none; }
/* Fixed, greyed "TDD-" username prefix */
.prefixed { display: flex; align-items: stretch; min-width: 0; }
.prefixed .prefix { display: grid; place-items: center; padding: 0 .7rem; border: 1px solid var(--line); border-right: 0;
  border-radius: 10px 0 0 10px; background: var(--surface-2); color: var(--muted); font-weight: 700;
  user-select: none; cursor: not-allowed; flex: none; }
.prefixed input { border-radius: 0 10px 10px 0; flex: 1 1 auto; min-width: 0; width: auto; }
.prefixed.readonly output { display: flex; align-items: center; padding: 0 .7rem; min-height: 44px; flex: 1 1 auto;
  min-width: 0; border: 1px solid var(--line); border-radius: 0 10px 10px 0; background: var(--surface-2);
  font-weight: 700; overflow-wrap: anywhere; }
.username-preview { display: grid; gap: .3rem; }
.big-username { font-size: 1.2rem; }
/* Board search + filter chips */
.finder { display: grid; gap: .5rem; margin: 0 0 12px; min-width: 0; }
.searchbar { display: flex; gap: .5rem; min-width: 0; }
.searchbar input[type=search] { flex: 1 1 auto; min-width: 0; width: auto; }
.chiprow { display: flex; align-items: center; gap: .35rem; overflow-x: auto; padding-bottom: .25rem;
  scrollbar-width: thin; min-width: 0; }
.rowlabel { flex: none; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); min-width: 4.2rem; }
.fchip { flex: none; display: inline-flex; align-items: center; gap: .3rem; min-height: 34px; padding: .2rem .7rem;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: .85rem; font-weight: 600; text-decoration: none; white-space: nowrap; }
.fchip em { font-style: normal; font-size: .75rem; color: var(--muted); }
.fchip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.fchip.on em { color: var(--accent-text); opacity: .85; }
.results { margin: 0; font-size: .9rem; }
.card[hidden] { display: none; }
@media (min-width: 1000px) { .chiprow { flex-wrap: wrap; overflow-x: visible; } }
/* Locked back-office checklist step (HUD record) */
.checklist li.locked { background: color-mix(in srgb, var(--p2) 7%, transparent); border-radius: 8px; padding: .4rem .5rem; }
.checklist .lockbox { display: grid; place-items: center; font-size: 1rem; color: var(--muted); cursor: not-allowed; }
.checklist li.locked.done .lockbox { background: var(--good); border-color: var(--good); color: #fff; }
.signoff-step { display: grid; gap: .4rem; width: 100%; min-width: 0; }
.signoff-step .inline { margin: 0; }
.signed { display: block; color: var(--good); font-weight: 600; }
.hud-signoff { border-left: 6px solid var(--hud); }
/* Repair type picker on the job page + quick type on the board */
.type-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .55rem; min-width: 0; }
.type-pick { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin: 0; min-width: 0; flex: 1 1 260px; }
.type-pick label { font-size: .8rem; color: var(--muted); }
.type-pick select { flex: 1 1 160px; width: auto; min-width: 0; min-height: 36px; padding: .3rem .6rem; }
.quick-type-wrap { display: grid; gap: .35rem; min-width: 0; }
.quick-type { display: flex; gap: .4rem; margin: 0; min-width: 0; }
.quick-type select { flex: 1 1 auto; width: auto; min-width: 0; min-height: 36px; padding: .3rem .6rem; }
/* Rename */
.rename { margin: -.2rem 0 .3rem; }
.rename > summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--accent); width: max-content; }
.rename[open] > summary { margin-bottom: .5rem; }
/* Collapsible tag groups (board Unassigned column + techs' Open jobs) */
.tag-group { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.col .tag-group + .tag-group, .tag-group + .tag-group { margin-top: 8px; }
.tag-group > summary { display: flex; align-items: center; gap: .5rem; min-height: 44px; padding: .45rem .75rem;
  cursor: pointer; font-weight: 700; list-style: none; }
.tag-group > summary::-webkit-details-marker { display: none; }
.tag-group > summary::before { content: "▸"; display: inline-block; width: 1em; color: var(--muted); transition: transform .15s; }
.tag-group[open] > summary::before { transform: rotate(90deg); }
.tag-group[data-group="HUD"] > summary { color: var(--hud); }
.glabel { overflow-wrap: anywhere; min-width: 0; }
.group-items { display: grid; gap: 8px; padding: 0 8px 8px; min-width: 0; }
.group-items > * { min-width: 0; }
.tag-group[hidden] { display: none; }
/* Tech requests */
.req-form { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.req-form input { flex: 1 1 180px; min-width: 0; width: auto; min-height: 36px; padding: .3rem .6rem; }
.req-state { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin-top: .5rem; }
.req-state form { margin: 0; }
.req-history { margin: 0; padding-left: 1.1rem; display: grid; gap: .3rem; font-size: .92rem; }
.req-history .st-approved b { color: var(--good); }
/* Admin: job requests panel */
.requests { border-left: 6px solid var(--accent); }
.request { display: grid; gap: .5rem; padding: .6rem .7rem; border: 1px solid var(--line); border-left: 5px solid var(--pc, var(--line));
  border-radius: var(--radius); background: var(--surface-2); min-width: 0; }
.request-main { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .6rem; min-width: 0; overflow-wrap: anywhere; }
.request-actions { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0; }
.request-actions input { flex: 1 1 160px; min-width: 0; width: auto; min-height: 36px; padding: .3rem .6rem; }

/* Materials: free-text name + qty + unit */
.materials-form { display: grid; grid-template-columns: minmax(0, 1fr) 5.5rem 5.5rem auto; gap: .5rem; margin-top: .6rem; }
.materials-form input[name=material] { min-width: 0; }
@media (max-width: 479px) {
  .materials-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; }
  .materials-form input[name=material] { grid-column: 1 / -1; }
}

/* Filter bubbles: each filter is a pill with its count in a round badge.
   HUD / Emergency / High carry their priority colour (they double as the key). */
.bubbles { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; min-width: 0; }
.bubble { display: inline-flex; align-items: center; gap: .45rem; min-height: 36px; padding: .2rem .3rem .2rem .8rem;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  font-size: .86rem; font-weight: 600; text-decoration: none; box-shadow: var(--shadow); max-width: 100%; }
.bubble .bl { overflow-wrap: anywhere; }
.bubble .n { display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.6rem; padding: 0 .35rem;
  border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: .78rem; font-weight: 800; }
.bubble[class*="p-"] { border-color: color-mix(in srgb, var(--pc) 55%, transparent);
  background: color-mix(in srgb, var(--pc) 10%, var(--surface)); }
.bubble[class*="p-"] .n { background: var(--pc); border-color: var(--pc); color: #fff; }
.bubble:hover { border-color: var(--accent); }
.bubble.on { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.bubble.on .n { background: var(--accent-text); color: var(--accent); border-color: var(--accent-text); }
.bubble-gap { width: .6rem; }

/* Header notification bell */
.bell { position: relative; margin: 0; }
.bell > summary { list-style: none; cursor: pointer; display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 999px; color: #fff; border: 1px solid rgb(255 255 255 / .25); position: relative; }
.bell > summary::-webkit-details-marker { display: none; }
.bell[open] > summary, .bell > summary:hover { background: rgb(255 255 255 / .12); }
.bell-count { position: absolute; top: -5px; right: -6px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--hud); color: #fff; font-size: .72rem; font-weight: 800; line-height: 20px;
  text-align: center; border: 2px solid var(--brand); }
.bell-menu { position: fixed; top: 58px; right: 12px; width: min(360px, calc(100vw - 24px)); max-height: 70vh;
  overflow-y: auto; z-index: 30; background: var(--surface); color: var(--text); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: 0 10px 30px rgb(0 0 0 / .25); padding: .4rem; }
.bell-head { margin: .2rem .4rem .4rem; font-weight: 800; display: flex; align-items: center; gap: .4rem; }
.bell-item { display: grid; gap: .1rem; padding: .55rem .6rem; border-radius: 10px; color: var(--text);
  text-decoration: none; border-left: 4px solid var(--line); min-width: 0; }
.bell-item + .bell-item { margin-top: .3rem; }
.bell-item:hover, .bell-item:focus-visible { background: var(--surface-2); }
.bell-item.k-request { border-left-color: var(--accent); }
.bell-item.k-hud_signoff { border-left-color: var(--hud); }
.bell-item.k-signup { border-left-color: var(--p2); }
.bi-kind { font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.bi-text { font-weight: 600; overflow-wrap: anywhere; }
.bell-empty { margin: .4rem; color: var(--good); font-weight: 600; }
/* Wherever the bell sends you: scroll clear of the sticky header and flash it */
.request:target, li.locked:target, .person:target { scroll-margin-top: 120px; outline: 3px solid var(--accent);
  outline-offset: 2px; animation: target-flash 1.6s ease-out 2; }
@keyframes target-flash { 0% { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); } 100% { } }
@media (max-width: 420px) {
  .topbar { gap: .35rem; padding-left: 12px; padding-right: 12px; }
  .brand-text small { display: none; }
  .who { gap: .35rem; }
  .who-name { max-width: 22vw; }
}
