/* SquadDeck — tokens first, then layout, then components. */
:root {
  --bg: #F3F4F6;
  --surface: #FFFFFF;
  --ink: #17242B;
  --muted: #5A6A70;
  --line: #D5DAE1;
  --accent: #1F4E8C;
  --accent-ink: #FFFFFF;
  --accent-soft: #E3EBF6;
  --ok: #2E7D4F;
  --ok-soft: #E2F1E7;
  --amber: #A9640E;
  --amber-soft: #FBEFD9;
  --warn: #9A3B22;
  --warn-soft: #F7E9E4;
  --display: "Zilla Slab", Rockwell, "Roboto Slab", Georgia, serif;
  --body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11161D; --surface: #18202A; --ink: #E3EBE7; --muted: #95A6A2; --line: #2B3A40;
    --accent: #7FA8E0; --accent-ink: #0D1626; --accent-soft: #1A2A42; --ok: #6CC891; --ok-soft: #173325;
    --amber: #E3A852; --amber-soft: #33281A; --warn: #F0A08A; --warn-soft: #3A2019;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.55 var(--body); }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; text-wrap: balance; margin: 0; }
.loading { padding: 40px; color: var(--muted); }

/* shell */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-in { max-width: 1180px; margin: 0 auto; padding: 12px max(16px, env(safe-area-inset-left)); display: flex; flex-wrap: wrap; gap: 10px 24px; align-items: center; }
.brand { font-family: var(--display); font-weight: 700; font-size: 1.5rem; text-decoration: none; color: var(--ink); }
.brand span { color: var(--accent); }
nav.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
nav.tabs a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 6px 10px; border-radius: 4px; }
nav.tabs a[aria-current="page"] { color: var(--ink); background: var(--accent-soft); }
.top-right { margin-left: auto; display: flex; gap: 10px; align-items: center; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.planchip { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; background: var(--accent-soft); color: var(--accent); text-decoration: none; }
main { max-width: 1180px; margin: 0 auto; padding: 28px max(16px, env(safe-area-inset-left)) 64px; display: grid; gap: 22px; }
.pagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: end; gap: 12px; }
.pagehead h1 { font-size: 1.9rem; }
.sub { color: var(--muted); margin: 4px 0 0; max-width: 62ch; }

/* forms + buttons */
form.stack { display: grid; gap: 12px; }
label { display: grid; gap: 4px; font-size: 13px; font-weight: 600; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 8px 10px; width: 100%; }
textarea { resize: vertical; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 520px) { .row2 { grid-template-columns: 1fr; } }
.checks { display: grid; gap: 6px; }
.checks label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.checks input { width: auto; }
button, .btn { font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; border-radius: 4px; padding: 8px 14px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; display: inline-block; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--warn); }
button.small { padding: 5px 10px; font-size: 13px; }
button:disabled { opacity: .55; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.err { color: var(--warn); font-size: 13px; }
.muted { color: var(--muted); font-size: 13px; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 20px; min-width: 0; }
.panel h2 { font-size: 1.25rem; margin-bottom: 4px; }
.split { display: grid; grid-template-columns: minmax(0, 340px) minmax(0, 1fr); gap: 22px; align-items: start; }
@media (max-width: 880px) { .split { grid-template-columns: minmax(0, 1fr); } }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; }
.banner { font-size: 13px; background: var(--amber-soft); border-left: 3px solid var(--amber); padding: 10px 12px; border-radius: 0 4px 4px 0; }
.banner.bad { background: var(--warn-soft); border-color: var(--warn); }

/* auth */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.auth .panel { width: min(100%, 420px); display: grid; gap: 16px; }
.auth h1 { font-size: 2.2rem; font-weight: 700; }
.auth h1 span { color: var(--accent); }

/* grant cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 16px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.card h3 { font-size: 1.1rem; line-height: 1.2; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); }
.pill { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 2px 7px; border-radius: 3px; background: var(--accent-soft); color: var(--accent); }
.pill.ai { background: var(--amber-soft); color: var(--amber); }
.mono { font-family: var(--mono); font-size: 12px; }
.fit { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.fit b { font-variant-numeric: tabular-nums; color: var(--ink); }
dl { margin: 0; display: grid; grid-template-columns: max-content 1fr; gap: 4px 10px; font-size: 13px; }
dt { color: var(--muted); } dd { margin: 0; min-width: 0; }
.why { font-size: 13.5px; margin: 0; }
.section-title { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.section-title h2 { font-size: 1.3rem; }

/* pipeline table */
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
tr:last-child td { border-bottom: 0; }
td select, td input[type="date"] { width: auto; padding: 4px 6px; }
.due-soon { color: var(--amber); font-weight: 600; }
.due-past { color: var(--warn); font-weight: 600; }
.empty { color: var(--muted); border: 1px dashed var(--line); border-radius: 6px; padding: 20px; background: var(--surface); }

/* draft */
.draftgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
@media (max-width: 980px) { .draftgrid { grid-template-columns: minmax(0, 1fr); } }
.editor textarea { min-height: 70vh; font-family: var(--mono); font-size: 13px; line-height: 1.6; }
.doc { max-width: 70ch; }
.doc h3 { font-size: 1.15rem; margin: 1.2em 0 .3em; }
.doc h3:first-child { margin-top: 0; }
.doc p { margin: 0 0 .8em; }
.doc ul { margin: 0 0 .8em; padding-left: 1.2em; }
.fill { background: var(--amber-soft); padding: 0 3px; border-radius: 2px; font-family: var(--mono); font-size: .88em; }

/* usage + plans */
.usage { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.usage .panel b { display: block; font-size: 1.6rem; font-family: var(--display); font-variant-numeric: tabular-nums; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 14px; }
.plan { display: grid; gap: 8px; align-content: start; }
.plan.current { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.plan .price { font-family: var(--display); font-size: 2rem; font-weight: 700; }
.plan .price small { font-size: .9rem; color: var(--muted); font-family: var(--body); font-weight: 500; }
.plan ul { margin: 0; padding-left: 1.1em; font-size: 14px; }

#toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 6px; font-weight: 600; font-size: 14px; z-index: 50; max-width: calc(100vw - 32px); }

/* SquadDeck additions */
.status { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 3px; white-space: nowrap; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.warn { background: var(--amber-soft); color: var(--amber); }
.status.bad { background: var(--warn-soft); color: var(--warn); }
.status.neutral { background: var(--accent-soft); color: var(--accent); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; text-decoration: none; color: var(--ink); display: grid; gap: 2px; }
.tile b { font-family: var(--display); font-size: 1.8rem; font-variant-numeric: tabular-nums; line-height: 1.1; }
.tile span { font-size: 13px; color: var(--muted); }
.tile.bad { border-left: 4px solid var(--warn); }
.tile.warn { border-left: 4px solid var(--amber); }
.tile.good { border-left: 4px solid var(--ok); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 18px; align-items: start; }
.list { display: grid; gap: 0; }
.list > div { display: flex; gap: 10px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list > div:last-child { border-bottom: 0; }
.list .grow { flex: 1 1 200px; min-width: 0; }
.day { display: grid; gap: 8px; }
.day h3 { font-size: 1.05rem; padding-top: 6px; }
.shift { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr) auto; gap: 10px 16px; align-items: center; }
.shift.gap { border-left: 4px solid var(--amber); }
@media (max-width: 760px) { .shift { grid-template-columns: minmax(0, 1fr); } }
.shift .when { font-weight: 600; font-variant-numeric: tabular-nums; }
.crew { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--ink); display: inline-flex; gap: 6px; align-items: center; }
.chip.me { background: var(--accent); color: var(--accent-ink); }
.chip.open { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.chip.trading { outline: 2px solid var(--amber); }
.weeknav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.checkgroup { display: grid; gap: 0; }
.checkgroup h3 { font-size: 1rem; margin: 18px 0 6px; }
.citem { display: grid; grid-template-columns: minmax(0, 1fr) auto 150px; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
@media (max-width: 560px) { .citem { grid-template-columns: minmax(0, 1fr) auto; } .citem .exp { grid-column: 1 / -1; } }
.citem input { padding: 6px 8px; }
.citem .par { font-size: 12px; color: var(--muted); }
.citem.flag .nm { color: var(--warn); font-weight: 600; }
.tabsub { display: flex; gap: 6px; flex-wrap: wrap; }
.tabsub button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; }
.inline-form label { flex: 1 1 140px; }
.cell-status { display: grid; gap: 2px; }
.cell-status small { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.toggle { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.toggle input { width: auto; }
.cell-status { justify-items: start; }
.shift .actions { justify-content: flex-end; }
.shift .actions select { width: auto; max-width: 180px; padding: 5px 8px; font-size: 13px; }
@media (max-width: 760px) { .shift .actions { justify-content: flex-start; } }
/* Time clock */
.clockbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.clockbar button { min-width: 140px; padding: 12px 18px; font-size: 16px; }
/* Calendar */
.calgrid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: var(--line); gap: 1px; }
.calhead { background: var(--surface); font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px; }
.calday { background: var(--surface); border: 0; border-radius: 0; padding: 6px; min-height: 110px; display: flex; flex-direction: column; align-items: stretch; gap: 3px; text-align: left; font-weight: 400; cursor: pointer; min-width: 0; color: var(--ink); }
.calday:hover { background: var(--accent-soft); }
.calday.other { background: var(--bg); color: var(--muted); }
.calday.today .dnum { background: var(--accent); color: var(--accent-ink); border-radius: 999px; padding: 0 7px; }
.dnum { font-weight: 700; font-size: 13px; align-self: flex-start; font-variant-numeric: tabular-nums; }
.calitems { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.calshift, .caloff { font-size: 11px; padding: 1px 5px; border-radius: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--accent-soft); color: var(--ink); font-variant-numeric: tabular-nums; }
.calshift.open { background: var(--amber-soft); color: var(--amber); font-weight: 600; }
.calshift.mine { background: var(--accent); color: var(--accent-ink); }
.caloff { background: var(--ok-soft); color: var(--ok); }
.caloff.pending { background: transparent; border: 1px dashed var(--amber); color: var(--amber); }
.calcompact { display: none; font-size: 11px; color: var(--muted); }
.callegend { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 700px) {
  .calday { min-height: 64px; padding: 4px; }
  .calitems { display: none; }
  .calcompact { display: block; }
  .calhead { padding: 6px 2px; text-align: center; letter-spacing: 0; }
}
/* App shell */
.top { position: sticky; top: 0; z-index: 20; }
.appswitch { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; }
.appswitch:hover { background: var(--accent-soft); }
.appname { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--accent); }
.subnav { border-top: 1px solid var(--line); background: var(--surface); }
.subnav-in { max-width: 1180px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-left)); display: flex; gap: 2px; overflow-x: auto; scrollbar-width: thin; }
.subnav a { white-space: nowrap; text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 11px 12px 9px; border-bottom: 2px solid transparent; }
.subnav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.subnav a:hover { color: var(--ink); }
.ico { flex: none; }
/* Launcher */
.appgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.apptile { display: flex; gap: 14px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 18px; text-decoration: none; color: var(--ink); min-width: 0; }
.apptile:hover { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.appicon { width: 48px; height: 48px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.apptext { display: grid; gap: 3px; min-width: 0; }
.apptext strong { font-family: var(--display); font-size: 1.15rem; }
.appinfo { font-size: 13px; margin-top: 4px; }
/* Recruiting board */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(220px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 6px; }
.kcol { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 120px; }
.kcol h3 { font-size: .95rem; display: flex; justify-content: space-between; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 10px; display: grid; gap: 3px; text-decoration: none; color: var(--ink); font-size: 13px; }
.kcard:hover { border-color: var(--accent); }
/* Help desk thread */
.thread { display: grid; gap: 10px; }
.msg { border-left: 3px solid var(--line); padding: 4px 0 4px 12px; }
.msg p { margin: 4px 0 0; white-space: pre-wrap; }
.msg.internal { border-left-color: var(--amber); background: var(--amber-soft); padding: 8px 12px; border-radius: 0 4px 4px 0; }
@media (max-width: 760px) { .appname span, .top-right > span { display: none; } }
/* Buttons inside table cells stay in the cell (no flex on td). */
td.actions { display: table-cell; white-space: nowrap; }
td.actions > * + * { margin-left: 6px; }
.eqtable { table-layout: fixed; min-width: 640px; }
.eqtable col.c1 { width: 30%; } .eqtable col.c2 { width: 16%; } .eqtable col.c3 { width: 24%; } .eqtable col.c4 { width: 16%; } .eqtable col.c5 { width: 14%; }

/* ---------- messages & paging ---------- */
fieldset.pagebox { border: 1px solid var(--line); border-radius: 6px; padding: 10px 14px 12px; display: grid; gap: 8px; margin: 0; }
fieldset.pagebox legend { font-weight: 600; font-size: 13px; padding: 0 6px; }
.msglist { display: grid; gap: 8px; max-width: 860px; }
.msgrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 12px 14px; color: inherit; text-decoration: none; }
.msgrow:hover { border-color: var(--accent); }
.msgrow.urgent { border-left: 4px solid var(--warn); }
.msgbody p { margin: 0 0 10px; line-height: 1.55; }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); }
body.noscroll { overflow: hidden; }
.ackoverlay { position: fixed; inset: 0; z-index: 1000; background: rgba(12, 20, 30, .72); display: grid; place-items: center; padding: 16px; backdrop-filter: blur(2px); }
.ackcard { background: var(--surface); color: var(--ink); width: min(620px, 100%); max-height: calc(100vh - 32px); overflow: auto; border-radius: 10px; border-top: 6px solid var(--accent); padding: 20px 22px; box-shadow: 0 20px 60px rgba(0,0,0,.35); }
.ackoverlay.urgent .ackcard { border-top-color: var(--warn); }
.ackhead { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); display: flex; justify-content: space-between; }
.ackoverlay.urgent .ackhead { color: var(--warn); }
.ackhead span { color: var(--muted); font-weight: 500; letter-spacing: 0; text-transform: none; }
.ackcard h2 { font-family: var(--display); font-size: 24px; margin: 8px 0 2px; }
.ackcard .actions button { font-size: 16px; padding: 10px 22px; }
.ackcard p.small { font-size: 12px; margin: 8px 0 0; }

/* ---------- apps settings ---------- */
.applist { display: grid; gap: 8px; margin: 12px 0; }
.approw { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.approw input { width: auto; }
.approw.locked { opacity: .6; cursor: default; }
.approw .grow { flex: 1; }
.appicon.sm { width: 34px; height: 34px; }

/* ---------- AI Insights ---------- */
.chatlog { display: flex; flex-direction: column; gap: 10px; max-height: 60vh; overflow-y: auto; padding: 4px 2px 12px; }
.bubble { max-width: 85%; padding: 10px 14px; border-radius: 10px; line-height: 1.5; }
.bubble.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); white-space: pre-wrap; }
.bubble.assistant { align-self: flex-start; background: var(--bg); border: 1px solid var(--line); }
.bubble.assistant p, .bubble.assistant ul, .bubble.assistant ol { margin: 0 0 8px; }
.bubble.assistant > :last-child { margin-bottom: 0; }
.bubble.thinking { color: var(--muted); font-style: italic; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .45; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chipbtn { border-radius: 999px; font-size: 13px; padding: 6px 12px; }
.chatform { display: flex; gap: 10px; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 12px; }
.chatform textarea { flex: 1; resize: vertical; }
p.small { font-size: 12px; margin: 8px 0 0; }
.report { max-width: 900px; line-height: 1.55; }
.report h2 { font-family: var(--display); font-size: 26px; margin: 0 0 6px; }
.report h3 { margin: 22px 0 8px; border-bottom: 1px solid var(--line); padding-bottom: 4px; }
.report h4 { margin: 16px 0 6px; font-size: 14px; }
.report table { font-size: 13px; }
@media print {
  header.top, .subnav, .noprint, .banner, #toast { display: none !important; }
  body { background: #fff; }
  .report { border: 0; box-shadow: none; max-width: none; padding: 0; }
}

/* ---------- shift seat requirements ---------- */
.shift .reqs { font-size: 12px; margin-top: 4px; color: var(--muted); }
.shift.short { border-left: 4px solid var(--warn); }
.reqgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.reqgrid input { width: 100%; }

/* ---------- contracts, invoices, bids, integrations ---------- */
.invoice .invhead { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.invoice h2 { margin: 0 0 4px; }
.invoice h4 { margin: 12px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.invoice tfoot th { font-size: 15px; }
.bidq .q { font-weight: 600; margin: 6px 0 8px; white-space: pre-line; }
.bidq textarea { width: 100%; }
.printonly { display: none; }
.apptile.integ { cursor: default; }
.apptile.integ .appicon { font-weight: 700; font-size: 14px; }
@media print {
  .printonly { display: block; }
  .bidq { border: 0; box-shadow: none; padding: 0; break-inside: avoid; }
  .invoice input { border: 0; }
}
.report.invoice { max-width: 1000px; }
.invoice #ivLines input[name=description] { min-width: 200px !important; width: 100%; }

/* ---------- update banner, GPS (1.1) ---------- */
.banner.update { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--accent-soft); border-color: var(--accent); }
.gpsmap { position: relative; height: 260px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: linear-gradient(135deg, #e8eef3, #dfe8e0); }
.gpsgrid { position: absolute; inset: 0; background-image: linear-gradient(rgba(23,36,43,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(23,36,43,.07) 1px, transparent 1px); background-size: 40px 40px; }
.gpsdot { position: absolute; display: flex; align-items: center; gap: 2px; color: var(--accent); font-size: 12px; transform: translate(-50%, -100%); }
.gpsdot b { background: var(--surface); padding: 1px 6px; border-radius: 3px; border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
.gpsmsg { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 8px 14px; display: grid; text-align: center; font-size: 13px; max-width: 90%; }
.gpsmsg span { color: var(--muted); }
.gpsrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--line); }
.gpsrow .grow { flex: 1 1 160px; min-width: 0; }
.gpspin { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--bg); color: var(--muted); flex: none; }
.gpspin.on { background: var(--accent-soft); color: var(--accent); }
.gpsstate { font-size: 13px; }
.gpsform { flex-basis: 100%; }

/* ---------- phone layout (1.1): small screens and iPhones ---------- */
.mmenu, .tabbar { display: none; }
@media (max-width: 700px) {
  body.f-phone_layout { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  /* iOS zooms into inputs smaller than 16px */
  body.f-phone_layout input, body.f-phone_layout select, body.f-phone_layout textarea { font-size: 16px; }
  body.f-phone_layout button, body.f-phone_layout .btn { min-height: 40px; }
  body.f-phone_layout button.small, body.f-phone_layout .btn.small { min-height: 36px; }
  /* one-line header: brand, Apps, current app, menu */
  body.f-phone_layout .top { background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
  body.f-phone_layout .top-in { flex-wrap: nowrap; gap: 8px; padding: 8px max(12px, env(safe-area-inset-left)); }
  body.f-phone_layout .brand { font-size: 1.2rem; }
  body.f-phone_layout .appswitch span, body.f-phone_layout .top-right { display: none; }
  body.f-phone_layout .appname { min-width: 0; overflow: hidden; white-space: nowrap; font-size: 14px; }
  body.f-phone_layout .appname span { display: none; }
  body.f-phone_layout .mmenu { display: block; margin-left: auto; position: relative; }
  body.f-phone_layout .mmenu summary { list-style: none; cursor: pointer; font-weight: 600; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 4px; white-space: nowrap; }
  body.f-phone_layout .mmenu summary::-webkit-details-marker { display: none; }
  body.f-phone_layout .mmenu-in { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15);
    display: grid; min-width: 220px; padding: 6px; z-index: 40; }
  body.f-phone_layout .mmenu-in > * { padding: 11px 12px; text-decoration: none; color: var(--ink); border-radius: 4px; text-align: left; border: 0; background: none; font-weight: 500; }
  body.f-phone_layout .mmenu-in > span { font-size: 12px; padding-bottom: 6px; }
  body.f-phone_layout .mmenu-in a:active, body.f-phone_layout .mmenu-in button:active { background: var(--accent-soft); }
  body.f-phone_layout .subnav a { padding: 10px 10px 8px; }
  body.f-phone_layout main { padding: 16px max(12px, env(safe-area-inset-left)) 24px; gap: 16px; }
  body.f-phone_layout main > .banner:first-child, body.f-phone_layout > #app > .banner { font-size: 12px; padding: 6px 12px; }
  body.f-phone_layout .pagehead h1 { font-size: 1.5rem; }
  body.f-phone_layout .pagehead .actions { width: 100%; }
  body.f-phone_layout .panel { padding: 14px; }
  body.f-phone_layout .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  body.f-phone_layout .tile b { font-size: 1.4rem; }
  /* bottom tab bar */
  body.f-phone_layout .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line);
    padding: 4px max(4px, env(safe-area-inset-left)) calc(4px + env(safe-area-inset-bottom)); }
  body.f-phone_layout .tabbar a { flex: 1; display: grid; justify-items: center; gap: 2px; padding: 6px 0; text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 600; }
  body.f-phone_layout .tabbar a[aria-current="page"] { color: var(--accent); }
  /* tables become cards: one card per row, column names as labels */
  body.f-phone_layout .tablewrap { background: none; border: 0; overflow: visible; }
  body.f-phone_layout .tablewrap table, body.f-phone_layout .tablewrap tbody, body.f-phone_layout .tablewrap tr, body.f-phone_layout .tablewrap td { display: block; width: 100%; }
  body.f-phone_layout .tablewrap thead { display: none; }
  body.f-phone_layout .tablewrap .eqtable { min-width: 0; table-layout: auto; }
  body.f-phone_layout .tablewrap tr { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; margin-bottom: 10px; }
  body.f-phone_layout .tablewrap td { border: 0; padding: 5px 0; display: grid; grid-template-columns: 38% minmax(0, 1fr); gap: 10px; align-items: start; text-align: left !important; }
  body.f-phone_layout .tablewrap td::before { content: attr(data-label); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
  body.f-phone_layout .tablewrap td[data-label=""] { grid-template-columns: minmax(0, 1fr); }
  body.f-phone_layout .tablewrap td[data-label=""]::before { display: none; }
  body.f-phone_layout .tablewrap td:first-child { font-size: 15px; }
  body.f-phone_layout .tablewrap td.actions, body.f-phone_layout .tablewrap td .actions { white-space: normal; }
  body.f-phone_layout .tablewrap td input, body.f-phone_layout .tablewrap td select { width: 100% !important; min-width: 0 !important; }
  body.f-phone_layout .tablewrap tfoot { display: block; }
  body.f-phone_layout .tablewrap tfoot tr { display: flex; justify-content: space-between; }
  body.f-phone_layout .tablewrap tfoot th { border: 0; padding: 4px 0; }
  body.f-phone_layout .tablewrap tfoot th:empty { display: none; }
  body.f-phone_layout #toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}
@media print { .tabbar, .mmenu { display: none !important; } }
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brandmark { width: 28px; height: 28px; flex: none; }
.authbrand { display: flex; align-items: center; gap: 10px; }
@media (max-width: 700px) { body.f-phone_layout .brandmark { width: 24px; height: 24px; } body.f-phone_layout .brand { gap: 6px; } }
.brand > .bt, .authbrand > span { color: inherit; }
.brand > .bt > span, .authbrand > span > span { color: var(--accent); }
.auth h1.authbrand > span { color: var(--ink); } .auth h1.authbrand > span > span { color: var(--accent); }

/* ---------- new layout (1.2): sidebar, search, quick add, Today, Approvals ---------- */
.nl { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--surface); border-right: 1px solid var(--line); padding: 16px 12px 24px; display: flex; flex-direction: column; gap: 14px; }
.side .brand { padding: 4px 8px; }
.sideagency { margin: -6px 8px 0; font-size: 12px; color: var(--muted); line-height: 1.3; }
.sidegroup { display: grid; gap: 1px; }
.sidegroup h4 { margin: 0 8px 4px; font: 700 11px/1 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sidegroup a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 500; }
.sidegroup a:hover { background: var(--accent-soft); }
.sidegroup a[aria-current="page"] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.sidegroup a .ico { color: var(--muted); }
.sidegroup a[aria-current="page"] .ico { color: var(--accent); }
.sidegroup a span:first-of-type { flex: 1; }
.side .count, .nltop .count { min-width: 20px; padding: 0 6px; border-radius: 10px; background: var(--warn); color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.sidescrim { display: none; }
.nlmain { min-width: 0; display: flex; flex-direction: column; }
.nltop { background: var(--surface); border-bottom: 1px solid var(--line); }
.nltop .top-in { flex-wrap: nowrap; gap: 10px; }
.iconbtn { display: inline-grid; place-items: center; padding: 7px; line-height: 0; }
.menubtn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search .sico { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); line-height: 0; }
.search input { padding-left: 32px; background: var(--bg); }
.sres { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.14); z-index: 60; max-height: 60vh; overflow-y: auto; }
.sres a { display: flex; gap: 10px; align-items: flex-start; padding: 9px 12px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); font-size: 14px; }
.sres a:hover, .sres a:focus { background: var(--accent-soft); }
.sres .pill { flex: none; margin-top: 2px; }
.quick { position: relative; }
.qamenu { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.14); z-index: 60; display: grid; min-width: 220px; padding: 6px; }
.qamenu button { display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left; padding: 9px 10px; font-weight: 500; border-radius: 5px; }
.qamenu button:hover { background: var(--accent-soft); }
.umenu { margin-left: auto; position: relative; }
.umenu summary { list-style: none; cursor: pointer; font-weight: 600; font-size: 14px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 4px; white-space: nowrap; }
.umenu summary::-webkit-details-marker { display: none; }
.umenu .mmenu-in { position: absolute; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); display: grid; min-width: 220px; padding: 6px; z-index: 60; }
.umenu .mmenu-in > * { padding: 9px 12px; text-decoration: none; color: var(--ink); border-radius: 4px; text-align: left; border: 0; background: none; font-weight: 500; }
.umenu .mmenu-in > span { font-size: 12px; }
.umenu .mmenu-in a:hover, .umenu .mmenu-in button:hover { background: var(--accent-soft); }
.helpq { margin-left: auto; border: 1px solid var(--line); border-radius: 50%; width: 24px; height: 24px; display: inline-grid !important; place-items: center; padding: 0 !important; align-self: center; font-weight: 700; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; align-items: start; }
.tcard h2 { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; }
.tcard.warn { border-left: 4px solid var(--amber); }
.clockcard.on { border-left: 4px solid var(--ok); }
button.big { font-size: 16px; padding: 12px 22px; }
.attn { display: grid; gap: 2px; }
.attnrow { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.attnrow:hover { background: var(--accent-soft); }
.attnrow .status { min-width: 34px; text-align: center; }
.attnrow .ico { color: var(--muted); }
.inbox { display: grid; gap: 10px; }
.inboxitem { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; background: var(--surface); }
.inboxitem p { margin: 6px 0; }
.ibhead { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ibhead .muted { margin-left: auto; font-size: 13px; }
.plan.dim { opacity: .6; }
.plan .eyebrow, #byo .eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.tile b small { font-size: .9rem; color: var(--muted); font-family: var(--body); }
.guidelink { font-weight: 600; }
@media (max-width: 900px) {
  .nl { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: min(290px, 84vw); z-index: 80; transform: translateX(-102%); transition: transform .2s; padding-top: max(16px, env(safe-area-inset-top)); }
  body.side-open .side { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  body.side-open .sidescrim { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 70; }
  .menubtn { display: inline-grid; }
  .search { max-width: none; }
  .umenu summary { padding: 7px 8px; }
}
@media (max-width: 520px) { .umenu summary { max-width: 90px; overflow: hidden; text-overflow: ellipsis; } }
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
@media print { .side, .sidescrim, .nltop { display: none !important; } .nl { display: block; } }
/* Rig check: steppers and one-compartment-at-a-time mode */
.qtybox { display: flex; align-items: center; gap: 4px; }
.qtybox input { width: 64px; text-align: center; }
.stepbtn { padding: 4px 10px; font-size: 18px; line-height: 1; }
.stepbtns { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.stepnav { font-weight: 700; color: var(--accent); }
body.stepmode .citem { padding: 12px 0; }
body.stepmode .citem .nm { font-size: 17px; }
body.stepmode .stepbtn { min-width: 48px; min-height: 48px; font-size: 24px; }
body.stepmode .qtybox input { width: 72px; font-size: 20px; min-height: 48px; }
body.stepmode .stepbtns button { flex: 1; min-height: 52px; }

/* quote page (public/quote.html) */
.quote { max-width: 760px; margin: 0 auto; padding: 32px 16px 64px; display: grid; gap: 16px; }
.quote .card h2 { margin: 0; font-size: 26px; }
.quote .card h3 { margin: 12px 0 0; }
.quote table.qt { width: 100%; border-collapse: collapse; }
.quote table.qt td, .quote table.qt th { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.quote .r { text-align: right !important; }
.quote ol.terms { padding-left: 20px; margin: 0; font-size: 14px; color: var(--muted); display: grid; gap: 6px; }
.banner.ok { background: var(--ok-soft, #e6f4ea); border-color: var(--ok, #2e7d32); }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: 3px; }
a.btn.primary { display: inline-block; text-decoration: none; }

/* guides, SquadDeck support, getting started */
.guide { max-width: 760px; line-height: 1.6; }
.guide h2 { font-size: 1.15rem; margin: 18px 0 4px; }
.guide h2:first-child { margin-top: 0; }
.guide ol, .guide ul { padding-left: 22px; display: grid; gap: 4px; }
a.guidecard { text-decoration: none; color: var(--ink); display: grid; gap: 4px; }
a.guidecard:hover { border-color: var(--accent); }
.thread { display: grid; gap: 10px; max-width: 820px; }
.thread .msg.staff { border-left: 4px solid var(--accent); }
.gsbar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.gsbar span { display: block; height: 100%; background: var(--ok); }
.gs .list > div { align-items: center; }
.gscheck { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--line); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff; flex: none; }
.gsdone .gscheck { background: var(--ok); border-color: var(--ok); }
.gsdone .grow { color: var(--muted); text-decoration: line-through; }
button.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font: inherit; cursor: pointer; }
