/* CertKeeper — "Harbor" palette */
:root {
  --ink: #0E2A3B;
  --ink-2: #1D3F55;
  --ink-soft: #4A6476;
  --muted: #7C8F9C;
  --line: #E2E6E3;
  --paper: #F6F4EF;
  --card: #FFFFFF;
  --teal: #12A594;
  --teal-dark: #0C7F72;
  --teal-tint: #DDF4EF;
  --amber: #F5A524;
  --amber-tint: #FEF1D8;
  --orange: #E8772E;
  --orange-tint: #FCE6D6;
  --coral: #E5484D;
  --coral-tint: #FCE3E3;
  --sky: #3B82C4;
  --sky-tint: #E1EEF9;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(14, 42, 59, .06), 0 6px 20px rgba(14, 42, 59, .06);
  --font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar: 248px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font); color: var(--ink); background: var(--paper);
  font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased;
}
a { color: var(--teal-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; font-weight: 800; }
h2 { font-size: 1.1rem; font-weight: 800; }
h3 { font-size: .95rem; font-weight: 700; }
.mono { font-family: var(--mono); font-size: .86em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink); color: #DDE7EC; padding: 20px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; }
.brand img { width: 36px; height: 36px; }
.brand-name { font-weight: 800; font-size: 1.22rem; letter-spacing: -.02em; }
.brand-name span { color: var(--teal); }
.brand-tag { font-size: .72rem; color: #9FB4C0; display: block; font-weight: 600; letter-spacing: .02em; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: #C9D7DE; font-weight: 600; text-decoration: none; margin-bottom: 2px;
}
.nav a svg { width: 20px; height: 20px; flex: none; }
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--teal); color: #fff; }
.nav .badge { margin-left: auto; background: var(--coral); color: #fff; font-size: .72rem; padding: 1px 7px; border-radius: 99px; }
.sidebar-foot { margin-top: auto; font-size: .78rem; color: #9FB4C0; padding: 10px 8px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-foot button { margin-top: 8px; width: 100%; }

.main { min-width: 0; display: flex; flex-direction: column; }
.demo-banner {
  background: repeating-linear-gradient(-45deg, var(--amber-tint), var(--amber-tint) 12px, #FDE9C2 12px, #FDE9C2 24px);
  color: #6B4A06; font-size: .84rem; font-weight: 600; padding: 7px 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  border-bottom: 1px solid #F3D9A4;
}
.demo-banner b { background: #6B4A06; color: #FEF1D8; padding: 1px 8px; border-radius: 6px; letter-spacing: .06em; font-size: .72rem; }
.demo-banner button { margin-left: auto; background: transparent; border: 1px solid #C99A3E; color: #6B4A06; border-radius: 8px; padding: 2px 10px; cursor: pointer; font-weight: 700; font-size: .78rem; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgba(246,244,239,.92);
  backdrop-filter: blur(6px); position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line);
}
.topbar .mobile-brand { display: none; align-items: center; gap: 8px; font-weight: 800; }
.topbar .mobile-brand img { width: 28px; height: 28px; }
.topbar .spacer { flex: 1; }
.acting { display: flex; align-items: center; gap: 8px; font-size: .84rem; color: var(--ink-soft); }
.acting select { padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); background: #fff; font-weight: 600; }
.content { padding: 24px 28px 48px; max-width: 1240px; width: 100%; }
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--ink-soft); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: .84rem; color: var(--muted); margin-bottom: 8px; }
.crumbs a { color: var(--ink-soft); }

.bottom-nav { display: none; }

/* ---------- Cards / grid ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid #ECEEEA; padding: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.card-head .right { margin-left: auto; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.kpi { display: flex; flex-direction: column; gap: 6px; position: relative; overflow: hidden; text-decoration: none !important; color: inherit; transition: transform .12s, box-shadow .12s; }
a.kpi:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(14,42,59,.10); }
.kpi .label { font-size: .8rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .05em; }
.kpi .value { font-size: 2.1rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }
.kpi .sub { font-size: .82rem; color: var(--muted); }
.kpi::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--accent, var(--teal)); }
.kpi.overdue { --accent: var(--coral); }
.kpi.d30 { --accent: var(--orange); }
.kpi.d60 { --accent: var(--amber); }
.kpi.d90 { --accent: var(--sky); }
.kpi.overdue .value { color: var(--coral); }

.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; color: var(--ink-soft); margin: 26px 0 10px; }

/* ---------- Pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 700; white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok { background: var(--teal-tint); color: var(--teal-dark); }
.pill.d90 { background: var(--sky-tint); color: #23649F; }
.pill.d60 { background: var(--amber-tint); color: #93620A; }
.pill.d30 { background: var(--orange-tint); color: #A44D14; }
.pill.overdue { background: var(--coral-tint); color: #B1262B; }
.pill.neutral { background: #EEF1F2; color: var(--ink-soft); }
.pill.neutral::before { display: none; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 600; color: var(--ink-soft); background: #F0F2F0; border-radius: 7px; padding: 2px 8px; }

/* ---------- Buttons / forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--ink); padding: 9px 14px; border-radius: 10px; font-weight: 700; cursor: pointer; font-size: .9rem; text-decoration: none !important;
  transition: background .12s, border-color .12s, transform .05s;
}
.btn:hover { border-color: #C9D2CF; background: #FAFBFA; }
.btn:active { transform: translateY(1px); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover { background: var(--teal-dark); }
.btn.dark { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.danger { color: #B1262B; border-color: #F2C3C4; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.sm { padding: 5px 10px; font-size: .8rem; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: .8rem; font-weight: 700; color: var(--ink-soft); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid #D7DDDA; border-radius: 10px; background: #fff; outline: none;
}
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(18,165,148,.18); }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 18px; color: var(--muted); }
.search input { padding-left: 38px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; padding: 6px 12px; border-radius: 99px; font-size: .82rem; font-weight: 700; cursor: pointer; color: var(--ink-soft); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip .n { opacity: .65; margin-left: 4px; }
.seg { display: inline-flex; background: #EBEEEC; padding: 4px; border-radius: 12px; gap: 4px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 700; cursor: pointer; color: var(--ink-soft); display: inline-flex; gap: 6px; align-items: center; }
.seg button svg { width: 17px; height: 17px; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.check { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: #fff; }
.check input { margin-top: 3px; accent-color: var(--teal); width: 16px; height: 16px; }
.check b { display: block; font-size: .9rem; }
.check span { font-size: .8rem; color: var(--muted); }

/* ---------- Lists / tables ---------- */
.list { display: flex; flex-direction: column; }
.list-row {
  display: grid; grid-template-columns: 2.2fr 1.3fr 1.5fr 1.1fr 24px; gap: 14px; align-items: center;
  padding: 13px 16px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none !important;
}
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: #F9FAF8; }
.list-head { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; color: var(--muted); padding-top: 10px; padding-bottom: 10px; }
.list-row .title { font-weight: 700; }
.list-row .meta { font-size: .8rem; color: var(--muted); }
.list-row .chev { color: #B6C0C4; width: 18px; }
.list.people .list-row { grid-template-columns: 2.2fr 1.2fr 1fr 1.2fr 24px; }
.flush { padding: 0; overflow: hidden; }
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.who > div { min-width: 0; }
.who .title, .who .meta { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .8rem; color: #fff; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 1.1rem; }
.icon-box { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--teal-tint); color: var(--teal-dark); flex: none; }
.icon-box svg { width: 20px; height: 20px; }
.icon-box.truck { background: var(--sky-tint); color: #23649F; }
.icon-box.yard { background: #ECE8F7; color: #5B4A9E; }
.icon-box.vendor { background: var(--amber-tint); color: #93620A; }
.icon-box.person { background: #F0EAE4; color: #7A5536; }

table.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 800; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl-wrap { overflow-x: auto; }

.dl { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: .9rem; margin: 0; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* Attention list */
.attn { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--line); color: inherit; text-decoration: none !important; }
.attn:last-child { border-bottom: 0; }
.attn .grow { flex: 1; min-width: 0; }
.attn .grow .t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attn .grow .m { font-size: .8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.days { font-weight: 800; font-size: .86rem; text-align: right; white-space: nowrap; }

/* Bar chart */
.bars { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 34px; gap: 10px; align-items: center; font-size: .86rem; }
.bar-row .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 10px; background: #EEF1EF; border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--teal); border-radius: 99px; }
.bar-row .n { text-align: right; font-weight: 800; }
.stackbar { display: flex; height: 14px; border-radius: 99px; overflow: hidden; background: #EEF1EF; margin: 6px 0 12px; }
.stackbar i { display: block; height: 100%; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--ink-soft); }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; background: var(--c); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 15px; top: 6px; bottom: 6px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 18px 46px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline .dot { position: absolute; left: 4px; top: 0; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid var(--teal); color: var(--teal-dark); }
.timeline .dot svg { width: 12px; height: 12px; }
.timeline .dot.cert { border-color: var(--amber); color: #93620A; }
.timeline .dot.move { border-color: var(--sky); color: #23649F; }
.timeline .dot.warn { border-color: var(--coral); color: #B1262B; }
.timeline .dot.reg { border-color: var(--ink-soft); color: var(--ink-soft); }
.timeline .t { font-weight: 700; }
.timeline .m { font-size: .82rem; color: var(--muted); }
.timeline .d { font-size: .86rem; color: var(--ink-soft); margin-top: 2px; }

/* Progress */
.progress { height: 8px; background: #EEF1EF; border-radius: 99px; overflow: hidden; margin: 10px 0 4px; }
.progress > i { display: block; height: 100%; background: var(--c, var(--teal)); }

/* Tool hero */
.hero { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.hero .icon-box { width: 56px; height: 56px; border-radius: 14px; }
.hero .icon-box svg { width: 30px; height: 30px; }
.big-days { font-size: 2.2rem; font-weight: 800; letter-spacing: -.03em; line-height: 1; }

/* QR */
.qr-wrap { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr { width: 168px; height: 168px; padding: 6px; background: #fff; border: 1px solid var(--line); border-radius: 12px; flex: none; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-meta { min-width: 0; flex: 1; }
.payload { font-family: var(--mono); font-size: .78rem; background: #F2F4F2; padding: 6px 8px; border-radius: 7px; overflow-wrap: anywhere; display: block; margin: 4px 0 10px; }

/* Scan screen */
.scan-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 16px; align-items: start; }
.viewfinder {
  position: relative; aspect-ratio: 4 / 3; border-radius: 18px; overflow: hidden;
  background: radial-gradient(ellipse at 30% 20%, #2C4A5E, #0B1C27 70%); display: grid; place-items: center; color: #CFE3EA;
}
.viewfinder .frame { width: 56%; aspect-ratio: 1; position: relative; }
.viewfinder .frame::before, .viewfinder .frame::after,
.viewfinder .frame i::before, .viewfinder .frame i::after { content: ""; position: absolute; width: 34px; height: 34px; border: 4px solid var(--teal); }
.viewfinder .frame::before { top: 0; left: 0; border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
.viewfinder .frame::after { top: 0; right: 0; border-left: 0; border-bottom: 0; border-radius: 0 10px 0 0; }
.viewfinder .frame i::before { bottom: 0; left: 0; border-right: 0; border-top: 0; border-radius: 0 0 0 10px; }
.viewfinder .frame i::after { bottom: 0; right: 0; border-left: 0; border-top: 0; border-radius: 0 0 10px 0; }
.viewfinder .scanline { position: absolute; left: 6%; right: 6%; height: 3px; background: linear-gradient(90deg, transparent, var(--teal), transparent); box-shadow: 0 0 14px var(--teal); animation: scan 2.2s ease-in-out infinite; }
.viewfinder .ghost-qr { position: absolute; inset: 16%; opacity: .16; }
.viewfinder .ghost-qr svg { width: 100%; height: 100%; }
.viewfinder .hint { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; font-size: .84rem; font-weight: 600; opacity: .85; }
.viewfinder .sim { position: absolute; top: 12px; left: 12px; font-size: .7rem; font-weight: 800; letter-spacing: .08em; background: rgba(245,165,36,.92); color: #3D2A03; padding: 3px 8px; border-radius: 6px; }
.viewfinder.flash::after { content: ""; position: absolute; inset: 0; background: rgba(18,165,148,.45); animation: flash .5s ease-out forwards; }
@keyframes scan { 0%, 100% { top: 22%; } 50% { top: 76%; } }
@keyframes flash { from { opacity: 1; } to { opacity: 0; } }
.nfc-pad { display: grid; place-items: center; }
.nfc-pad .rings { position: relative; width: 120px; height: 120px; display: grid; place-items: center; }
.nfc-pad .rings span { position: absolute; inset: 0; border: 3px solid var(--teal); border-radius: 50%; opacity: 0; animation: ring 2.4s ease-out infinite; }
.nfc-pad .rings span:nth-child(2) { animation-delay: .8s; }
.nfc-pad .rings span:nth-child(3) { animation-delay: 1.6s; }
.nfc-pad .rings svg { width: 54px; height: 54px; color: var(--teal); }
@keyframes ring { 0% { transform: scale(.4); opacity: .9; } 100% { transform: scale(1.5); opacity: 0; } }
.tag-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag-chip { font-family: var(--mono); font-size: .76rem; border: 1px dashed #9FC9C1; background: #F3FBF9; color: var(--teal-dark); border-radius: 8px; padding: 4px 8px; cursor: pointer; }
.tag-chip:hover { background: var(--teal-tint); }
.target-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; max-height: 260px; overflow: auto; padding: 2px; }
.target { display: flex; gap: 10px; align-items: center; border: 1.5px solid var(--line); border-radius: 11px; padding: 9px 10px; cursor: pointer; background: #fff; text-align: left; }
.target .avatar, .target .icon-box { width: 30px; height: 30px; font-size: .7rem; }
.target .icon-box svg { width: 16px; height: 16px; }
.target b { display: block; font-size: .84rem; line-height: 1.2; }
.target small { color: var(--muted); font-size: .74rem; }
.target.on { border-color: var(--teal); background: #F1FBF8; box-shadow: 0 0 0 3px rgba(18,165,148,.15); }
.target[disabled] { opacity: .4; cursor: not-allowed; }
.callout { border-radius: 12px; padding: 12px 14px; font-size: .88rem; display: flex; gap: 10px; align-items: flex-start; }
.callout svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.callout.warn { background: var(--coral-tint); color: #8E1E22; }
.callout.info { background: var(--sky-tint); color: #1E527F; }
.callout.ok { background: var(--teal-tint); color: #0A5F55; }
.callout.amber { background: var(--amber-tint); color: #6B4A06; }

/* Alerts */
.lead-chips .chip.on { background: var(--teal); border-color: var(--teal); }
.recipients { display: flex; flex-wrap: wrap; gap: 6px; }
.recipient { display: inline-flex; align-items: center; gap: 6px; background: #F0F2F0; border-radius: 99px; padding: 2px 9px 2px 2px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.recipient .avatar { width: 20px; height: 20px; font-size: .55rem; }
.preview { font-size: .88rem; background: #F7F8F6; border: 1px solid var(--line); border-radius: 12px; padding: 14px; white-space: pre-wrap; font-family: var(--font); }

/* Modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(14,42,59,.45); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.modal header { padding: 18px 20px 0; display: flex; align-items: center; }
.modal header button { margin-left: auto; }
.modal .body { padding: 16px 20px; }
.modal footer { padding: 0 20px 18px; display: flex; gap: 8px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
.toast-host { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 120; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: .9rem; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: rise .2s; display: flex; gap: 8px; align-items: center; }
.toast svg { width: 18px; height: 18px; color: var(--teal); }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* Print label */
.print-label { display: none; }
@media print {
  body.print-tool-label * { visibility: hidden; }
  body.print-tool-label .print-label, body.print-tool-label .print-label * { visibility: visible; }
  body.print-tool-label .print-label { display: flex; position: fixed; top: 0; left: 0; gap: 12px; align-items: center; border: 1px solid #000; padding: 10px; width: 3.5in; font-family: var(--font); }
  .print-label svg { width: 1.2in; height: 1.2in; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .scan-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .topbar { padding: 10px 16px; }
  .topbar .mobile-brand { display: flex; }
  .topbar h1 { display: none; }
  .acting .lbl { display: none; }
  .content { padding: 16px 16px 100px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  h1 { font-size: 1.35rem; }
  .kpi .value { font-size: 1.7rem; }
  .list-row, .list.people .list-row { grid-template-columns: 1fr auto; row-gap: 6px; }
  .list-row > .c-hide { display: none; }
  .list-row .chev { display: none; }
  .list-head { display: none; }
  .bar-row { grid-template-columns: 96px 1fr 28px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 50; background: #fff; border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); justify-content: space-around;
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .66rem; font-weight: 700; color: var(--muted); text-decoration: none; padding: 4px 6px; border-radius: 10px; min-width: 52px; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.active { color: var(--teal-dark); }
  .bottom-nav a.scan-tab svg { background: var(--teal); color: #fff; border-radius: 12px; padding: 6px; width: 38px; height: 38px; margin-top: -16px; box-shadow: 0 6px 16px rgba(18,165,148,.4); }
  .toast-host { bottom: 86px; }
  .qr { width: 140px; height: 140px; }
}
@media (max-width: 420px) {
  .g-4 { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { padding: 14px; }
  .demo-banner button { margin-left: 0; }
}

/* Mobile: keep the "acting as" picker inside the viewport */
.acting { min-width: 0; }
@media (max-width: 820px) {
  .acting select { max-width: 46vw; text-overflow: ellipsis; }
  .main { min-width: 0; overflow-x: hidden; }
}

/* ---------- Settings, tracker, holder promo ---------- */
.settings-link { display: none; width: 36px; height: 36px; flex: none; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink-soft); }
.settings-link svg { width: 20px; height: 20px; }
.settings-link.active { color: var(--teal-dark); border-color: var(--teal); }
.icon-box.bt { background: var(--sky-tint); color: #23649F; }
.preview-box { margin-top: 16px; padding: 12px 14px; background: #F4F6F4; border-radius: 12px; overflow-wrap: anywhere; }
.holder-promo { background: linear-gradient(160deg, #fff 55%, var(--teal-tint)); }
.promo-list { margin: 0; padding-left: 18px; color: var(--ink-soft); display: grid; gap: 4px; }
.nav a span:not(.badge) { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 820px) {
  .settings-link { display: inline-flex; }
  .bottom-nav a { min-width: 0; flex: 1 1 0; }
  .bottom-nav a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 420px) {
  .topbar { gap: 8px; }
  .acting select { max-width: 40vw; }
}
@media (max-width: 340px) {
  .topbar .mobile-brand > span { display: none; }
}

/* ---- CertKeeper v1 additions (auth screen, forms) ---- */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--navy, #0E2A3B); }
.auth-card { background: #fff; border-radius: 18px; width: 100%; max-width: 420px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.25); }
.auth-card .brand { color: var(--ink, #0B1B2B); margin-bottom: 18px; }
.auth-card .brand-name { color: var(--ink, #0B1B2B); }
.auth-card .err { color: var(--coral, #E5484D); font-weight: 700; min-height: 1.2em; margin: 6px 0; }
.auth-switch { margin-top: 14px; text-align: center; }
.user-chip { display: inline-flex; gap: 8px; align-items: center; font-size: .85rem; }
.role-tag { text-transform: capitalize; }

/* QR label sheet (Oct 22, 2026) */
.label-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(2.6in, 1fr)); gap: 10px; }
.qr-label { display: flex; gap: 10px; align-items: center; border: 1px dashed var(--line, #ccc); border-radius: 8px; padding: 8px; background: #fff; color: #000; break-inside: avoid; }
.qr-label svg { width: 1.1in; height: 1.1in; flex: none; }
.qr-label .l-name { font-weight: 700; font-size: 13px; }
.qr-label .l-meta { font-size: 11px; font-family: monospace; }
.file-link { display: inline-flex; gap: 4px; align-items: center; font-size: 12px; }
.thumb { max-width: 120px; max-height: 80px; border-radius: 6px; border: 1px solid var(--line, #ddd); }
@media print {
  body.printing-labels * { visibility: hidden; }
  body.printing-labels .label-sheet, body.printing-labels .label-sheet * { visibility: visible; }
  body.printing-labels .label-sheet { position: absolute; top: 0; left: 0; width: 100%; }
  body.printing-labels .qr-label { border: 1px solid #000; }
}

/* Oct 22 (7:06 PM): reports, compliance, truck QR */
.report { background: #fff; color: #111; border-radius: 12px; padding: 22px; }
.report h1 { margin: 0 0 4px; font-size: 1.4rem; }
.report .r-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: .9rem; color: #333; margin: 6px 0 14px; }
.report table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.report th, .report td { text-align: left; padding: 7px 6px; border-bottom: 1px solid #ddd; }
.report th { font-size: .72rem; text-transform: uppercase; color: #555; }
.rating { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; color: #fff; font-weight: 700; font-size: .78rem; }
.rating.green { background: var(--teal, #13805E); } .rating.yellow { background: var(--orange, #D9770B); } .rating.red { background: var(--coral, #C2412D); }
.score-big { font-size: 3rem; font-weight: 800; line-height: 1; }
.matrix td.cell { text-align: center; font-weight: 700; font-size: .75rem; }
.matrix .c-ok { color: var(--teal, #13805E); } .matrix .c-missing, .matrix .c-overdue { color: #fff; background: var(--coral, #C2412D); border-radius: 6px; }
.matrix .c-d30 { color: var(--orange, #D9770B); } .matrix .c-d60, .matrix .c-d90 { color: var(--amber, #B98900); } .matrix .c-na { color: #aaa; }
.sticker { display: inline-flex; flex-direction: column; align-items: center; gap: 6px; border: 2px solid #0E2A3B; border-radius: 14px; padding: 14px 16px; background: #fff; color: #0E2A3B; text-align: center; }
.sticker img { width: 2.2in; height: 2.2in; }
.sticker .s-title { font-weight: 800; font-size: 1.1rem; } .sticker .s-sub { font-size: .78rem; }
.avatar-lg { width: 96px; height: 96px; border-radius: 16px; object-fit: cover; background: #E3EAF0; }
@media print {
  body.print-page .sidebar, body.print-page .topbar, body.print-page .bottom-nav, body.print-page .demo-banner, body.print-page .no-print, body.print-page .toast-host { display: none !important; }
  body.print-page .app { display: block; } body.print-page .content { padding: 0; max-width: none; }
  body.print-page .report { padding: 0; border-radius: 0; box-shadow: none; }
  body.print-sticker .app, body.print-sticker .bottom-nav, body.print-sticker .modal header, body.print-sticker .modal footer, body.print-sticker .modal [data-err], body.print-sticker .no-print { display: none !important; }
  body.print-sticker .modal-bg { position: static; background: none; } body.print-sticker .modal { box-shadow: none; border: 0; }
}

/* ======================================================================
   v2 design layer (Oct 22, 2026 7:26 PM): calm neutral palette, three status
   colors, icon buttons, mobile-first tab bar. Later rules override earlier ones.
   ====================================================================== */
:root {
  --ink: #17212B; --ink-2: #26323E; --ink-soft: #55616D; --muted: #7A8590;
  --line: #E5E8EC; --paper: #F5F6F8; --card: #FFFFFF;
  /* brand/accent toned down to slate so statuses stand out */
  --teal: #2E4A62; --teal-dark: #22394D; --teal-tint: #EDF1F5;
  --sky: #5A7488; --sky-tint: #EEF2F5;
  /* the three status colors (text on tint passes WCAG AA, >= 5.9:1) */
  --ok-bg: #E8F5EC; --ok-fg: #1B6337; --ok-dot: #2FA55E;
  --due-bg: #FDF4D9; --due-fg: #6F5200; --due-dot: #E2A600;
  --bad-bg: #FDECEC; --bad-fg: #A12329; --bad-dot: #E0484E;
  --amber: var(--due-dot); --amber-tint: var(--due-bg); --orange: var(--due-dot); --orange-tint: var(--due-bg);
  --coral: var(--bad-dot); --coral-tint: var(--bad-bg);
  --radius: 16px; --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(23,33,43,.05), 0 4px 14px rgba(23,33,43,.05);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}
body { font-size: 15px; letter-spacing: -.005em; }
h1 { letter-spacing: -.02em; font-weight: 700; }
h2 { font-weight: 650; }
.card { border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.sidebar { background: #17212B; }
.nav a.active, .nav a.on { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 3px 0 0 #fff; }
.icon-box { background: var(--teal-tint); color: var(--teal); border-radius: 12px; }
.icon-box.vendor, .icon-box.bt { background: var(--teal-tint); color: var(--teal); }
.btn.primary { background: var(--ink); border-color: var(--ink); }
.btn.primary:hover { background: #000; }
a { color: var(--teal); }
.demo-banner { background: #F0F2F5 !important; color: var(--ink-soft); }
.timeline .dot { border-color: var(--line); color: var(--ink-soft); }
.timeline .dot.cert { border-color: var(--due-dot); color: var(--due-fg); }
.timeline .dot.warn { border-color: var(--bad-dot); color: var(--bad-fg); }

/* Status pills: soft tint, darker text, small dot */
.pill { gap: 6px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: .75rem; font-weight: 650; letter-spacing: .01em; line-height: 1.5; }
.pill::before { width: 7px; height: 7px; }
.pill.green, .pill.ok, .pill.d60, .pill.d90 { background: var(--ok-bg); color: var(--ok-fg); }
.pill.green::before, .pill.ok::before, .pill.d60::before, .pill.d90::before { background: var(--ok-dot); }
.pill.yellow, .pill.d30 { background: var(--due-bg); color: var(--due-fg); }
.pill.yellow::before, .pill.d30::before { background: var(--due-dot); }
.pill.red, .pill.overdue, .pill.missing { background: var(--bad-bg); color: var(--bad-fg); }
.pill.red::before, .pill.overdue::before, .pill.missing::before { background: var(--bad-dot); }
.pill.neutral { background: #EEF0F3; color: var(--ink-soft); }
.kpi::after { background: var(--accent, var(--line)); }
.kpi.overdue { --accent: var(--bad-dot); } .kpi.d30 { --accent: var(--due-dot); } .kpi.d60, .kpi.d90, .kpi.ok { --accent: var(--ok-dot); }
.kpi.overdue .value { color: var(--bad-fg); }
.nav .badge { background: var(--bad-dot); }
.callout.warn { background: var(--bad-bg); color: var(--bad-fg); border-color: #F5C9CB; }
.matrix td.cell { text-align: center; }

/* Icon buttons */
.btn.icon { width: 36px; height: 36px; padding: 0; justify-content: center; flex: none; border-radius: 10px; color: var(--ink-soft); }
.btn.icon svg { width: 18px; height: 18px; }
.btn.icon:hover { color: var(--ink); }
.btn.icon.danger { color: var(--bad-fg); }
.btn:focus-visible, a:focus-visible { outline: 3px solid #7FA6C6; outline-offset: 2px; }
.actions, .row { gap: 8px; }
.list-card .attn:last-child { border-bottom: 0; }

/* Mobile-first: 44px tap targets, sticky header, tab bar with a big centered Scan */
@media (max-width: 820px) {
  .btn { min-height: 44px; }
  .btn.icon { width: 44px; height: 44px; }
  .btn.sm { min-height: 40px; }
  .input, select.input { min-height: 44px; font-size: 16px; }
  .topbar { position: sticky; top: 0; background: rgba(245,246,248,.86); backdrop-filter: saturate(1.6) blur(14px); -webkit-backdrop-filter: saturate(1.6) blur(14px); padding: 10px 16px calc(10px); padding-top: calc(10px + env(safe-area-inset-top)); }
  .content { padding: 14px 16px calc(110px + env(safe-area-inset-bottom)); }
  .page-head { gap: 10px; }
  .page-head p { font-size: .9rem; }
  .card { padding: 14px; }
  .attn { padding: 12px 0; min-height: 56px; }
  .bottom-nav {
    background: rgba(255,255,255,.94); backdrop-filter: saturate(1.6) blur(16px); -webkit-backdrop-filter: saturate(1.6) blur(16px);
    border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); align-items: flex-end;
  }
  .bottom-nav a { min-height: 48px; justify-content: center; font-size: .68rem; font-weight: 600; color: var(--muted); gap: 3px; }
  .bottom-nav a svg { width: 24px; height: 24px; }
  .bottom-nav a.on, .bottom-nav a.active { color: var(--ink); }
  .bottom-nav a.on svg { stroke-width: 2.4; }
  .bottom-nav a.scan-tab { position: relative; }
  .bottom-nav a.scan-tab svg { width: 60px; height: 60px; padding: 16px; margin-top: -30px; border-radius: 50%; background: var(--ink); color: #fff; box-shadow: 0 8px 22px rgba(23,33,43,.35), 0 0 0 5px var(--paper); }
  .bottom-nav a.scan-tab span { font-weight: 700; color: var(--ink); }
  .toast-host { bottom: calc(100px + env(safe-area-inset-bottom)); }
  .tbl-wrap { margin: 0 -14px; padding: 0 14px; }
}

/* Optional dark mode (follows the phone setting) */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #E8ECF0; --ink-2: #D0D6DC; --ink-soft: #A7B0B9; --muted: #8C96A0; --line: #2A333C; --paper: #0F1418; --card: #171D23;
    --teal: #9DB7CC; --teal-dark: #C3D4E2; --teal-tint: #1F2A33;
    --ok-bg: #12301F; --ok-fg: #8FDDAE; --ok-dot: #3CC173;
    --due-bg: #33290A; --due-fg: #F3D27A; --due-dot: #E9B320;
    --bad-bg: #3A1517; --bad-fg: #FFAAAD; --bad-dot: #F2575C;
    --shadow: none;
  }
  body:not(.print-page) { background: var(--paper); color: var(--ink); }
  .card, .modal, .auth-card, .settings-link { background: var(--card); color: var(--ink); }
  .btn { background: #1E252C; border-color: var(--line); color: var(--ink); }
  .btn.primary { background: #E8ECF0; border-color: #E8ECF0; color: #0F1418; }
  .btn.ghost { background: transparent; }
  .input, select.input, textarea.input { background: #11171C; color: var(--ink); border-color: var(--line); }
  .pill.neutral { background: #232B33; color: var(--ink-soft); }
  .topbar { background: rgba(15,20,24,.86); }
  .bottom-nav { background: rgba(23,29,35,.94); }
  .bottom-nav a.scan-tab svg { background: #E8ECF0; color: #0F1418; box-shadow: 0 8px 22px rgba(0,0,0,.5), 0 0 0 5px var(--paper); }
  .tbl th, .tbl td { border-color: var(--line); }
  .demo-banner { background: #1B2228 !important; color: var(--ink-soft); }
  .report { background: #fff; color: #111; }
}

.tool-card { align-items: flex-start; }
.tool-card .grow { min-width: 0; }
.tool-card .t { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tool-card .m { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-line { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.attn > svg, .list-card svg.chev { width: 18px; height: 18px; flex: none; color: var(--muted); }
.icon-box svg { width: 20px; height: 20px; }

/* v3 (Oct 22, 7:45 PM): count tiles + six-tab bottom bar */
.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.tiles:not(:has(.storage)) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 76px; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); text-decoration: none; font: inherit; text-align: left; cursor: pointer; box-shadow: var(--shadow); }
.tile .tile-n { font-size: 1.7rem; font-weight: 750; line-height: 1; letter-spacing: -.02em; }
.tile .tile-l { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; color: var(--ink-soft); }
.tile .tile-l svg { width: 15px; height: 15px; }
.tile .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.tile .dot.green { background: var(--ok-dot); } .tile .dot.yellow { background: var(--due-dot); } .tile .dot.red { background: var(--bad-dot); }
.tile.green { background: var(--ok-bg); border-color: transparent; } .tile.green .tile-n, .tile.green .tile-l { color: var(--ok-fg); }
.tile.yellow { background: var(--due-bg); border-color: transparent; } .tile.yellow .tile-n, .tile.yellow .tile-l { color: var(--due-fg); }
.tile.red { background: var(--bad-bg); border-color: transparent; } .tile.red .tile-n, .tile.red .tile-l { color: var(--bad-fg); }
.tile.storage { background: var(--teal-tint); border-style: dashed; border-color: #C9D3DC; }
.tile.on { outline: 2.5px solid var(--ink); outline-offset: 1px; }
.tile:hover { filter: brightness(.98); }
.tool-card[hidden] { display: none; }
@media (max-width: 820px) {
  /* horizontal scroll strip on phones: tiles stay readable and the storage tile is one swipe away */
  .tiles, .tiles:not(:has(.storage)) { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 8px; margin: 0 -14px 14px; padding: 2px 14px 6px; scrollbar-width: none; }
  .tiles::-webkit-scrollbar { display: none; }
  .tile { flex: 0 0 calc((100% - 24px) / 3.3); min-width: 96px; scroll-snap-align: start; min-height: 72px; padding: 10px 12px; }
  .tile .tile-n { font-size: 1.5rem; }
  /* six tabs: equal 1fr columns, 44px+ targets, Scan raised in slot 3 */
  .bottom-nav { display: grid; grid-template-columns: repeat(var(--nav-cols, 6), minmax(0, 1fr)); padding-left: 2px; padding-right: 2px; }
  .bottom-nav a { min-width: 0; min-height: 50px; padding: 4px 0; font-size: .62rem; }
  .bottom-nav a svg { width: 22px; height: 22px; }
  .bottom-nav a.scan-tab svg { width: 56px; height: 56px; padding: 15px; margin-top: -28px; }
}
@media (prefers-color-scheme: dark) { .tile.storage { border-color: #3A4652; } .tile.on { outline-color: #E8ECF0; } }

/* v4 (Oct 22, 8:01 PM): compact count tiles — all 4 in one row at 360-390px; slim storage row; bottom bar has one equal column per tab (--nav-cols, set in app.js) */
.tiles, .tiles:not(:has(.storage)) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; overflow: visible; margin: 0 0 10px; padding: 0; }
.tile.slim { flex-direction: row; align-items: center; gap: 8px; min-height: 44px; padding: 8px 12px; margin: 0 0 16px; border-radius: 12px; text-decoration: none; color: var(--ink); }
.tile.slim > svg { width: 18px; height: 18px; flex: none; }
.tile.slim .tile-l { flex: 1; font-size: .85rem; }
.tile.slim .tile-n { font-size: 1.05rem; }
@media (max-width: 760px) {
  .tiles, .tiles:not(:has(.storage)) { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin: 0 0 10px; padding: 0; overflow: visible; }
  .tile { flex: initial; min-width: 0; min-height: 56px; padding: 8px 8px 7px; gap: 3px; border-radius: 12px; }
  .tile .tile-n { font-size: 20px; }
  .tile .tile-l { font-size: 11px; gap: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tile .dot { width: 6px; height: 6px; flex: none; }
  .tile.slim { min-height: 44px; padding: 8px 12px; }
  .tile.slim .tile-n { font-size: 1.05rem; }
  .tile.slim .tile-l { font-size: .85rem; }
  .bottom-nav { grid-template-columns: repeat(var(--nav-cols, 6), minmax(0, 1fr)); }
  .bottom-nav a { font-size: .6rem; }
}

/* v4b (Oct 22, 8:04 PM): blue Total tile (soft tint + dark blue text, AA) and Scan as a normal, equal tab */
.tile.neutral { background: #E7F0FB; border-color: transparent; }
.tile.neutral .tile-n, .tile.neutral .tile-l { color: #1D4E89; }
.tile.neutral .dot { background: #2F6FBF; }
.tile.neutral.on { outline-color: #1D4E89; }
.bottom-nav a.scan-tab svg, .bottom-nav a.scan-tab svg { width: 22px; height: 22px; padding: 0; margin: 0; border-radius: 0; background: none; color: inherit; box-shadow: none; }
.bottom-nav a.scan-tab span { font-weight: inherit; color: inherit; }
@media (max-width: 760px) { .bottom-nav a.scan-tab svg { width: 22px; height: 22px; padding: 0; margin: 0; background: none; box-shadow: none; } }
@media (prefers-color-scheme: dark) {
  .tile.neutral { background: #16263A; }
  .tile.neutral .tile-n, .tile.neutral .tile-l { color: #A9CBF5; }
  .tile.neutral .dot { background: #6EA8EE; }
  .tile.neutral.on { outline-color: #A9CBF5; }
  .bottom-nav a.scan-tab svg { background: none; color: inherit; box-shadow: none; }
}

/* v4c (Oct 22, 8:05 PM): My truck action row: Scan a tool | QR thumbnail | Download report */
.mt-actions { display: flex; gap: 8px; align-items: stretch; margin: 0 0 14px; }
.mt-actions .btn.primary { flex: 1 1 auto; justify-content: center; min-height: 48px; }
.mt-actions .btn:not(.primary) { flex: none; min-height: 48px; }
.qr-thumb { flex: none; width: 48px; height: 48px; padding: 3px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.qr-thumb img { width: 100%; height: 100%; display: block; }

/* v5 (Oct 22, 8:09 PM): My truck header = truck title + rating, action row, then counts */
.mt-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 10px; }
.mt-head h1 { margin: 0; font-size: 1.5rem; }
.mt-actions .qr-btn { width: 48px; height: 48px; flex: none; }
.mt-actions .qr-btn svg { width: 22px; height: 22px; }
/* v5b (8:10 PM): Enter button in the My truck action row */
.mt-actions .btn { padding-left: 12px; padding-right: 12px; gap: 6px; }
.ec-pick { border: 1px solid var(--line); border-radius: 12px; background: var(--card, #fff); margin-bottom: 6px; cursor: pointer; font: inherit; color: inherit; }
@media (max-width: 380px) { .mt-actions { gap: 6px; } .mt-actions .btn { padding-left: 10px; padding-right: 10px; } .mt-actions .qr-btn { width: 44px; } }
/* v6 (8:16 PM): no truck summary card; last-verified line + truck switcher */
.mt-head { margin-bottom: 2px; }
.mt-verified { margin: 0 0 10px; }
.truck-switch { display: flex; overflow-x: auto; margin: 0 0 10px; max-width: 100%; scrollbar-width: none; }
.truck-switch button { white-space: nowrap; }
.truck-switch button.on { background: var(--paper, #fff); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
/* v7: pending / problem badges, review queue, problem report, dashboards */
.pill.pend{background:#FFF4D6;color:#7A5A00;border:1px solid #F0D58A}
.pill .ic,.pill svg{width:12px;height:12px;vertical-align:-2px;margin-right:3px}
h1 .pill{font-size:12px;vertical-align:middle;margin-left:6px}
.issue-seg{display:flex;gap:6px;margin-bottom:12px;flex-wrap:wrap}
.issue-seg button{flex:1;min-width:70px;padding:9px 6px;border:1px solid var(--line,#d6dde3);border-radius:10px;background:#fff;font:inherit;font-weight:600;cursor:pointer}
.issue-seg button.on{background:#0E2A3B;color:#fff;border-color:#0E2A3B}
.rep-room{border:1px solid var(--line,#d6dde3);border-radius:12px;padding:10px;margin-top:10px}
.rep-head{display:flex;align-items:center;gap:8px}.rep-head .muted{margin-left:auto}
.rep-head svg{width:18px;height:18px}
.rep-tool{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px dashed var(--line,#e2e7eb);margin-top:8px}
.rep-tool .t{font-weight:600}.rep-tool .m{font-size:12px;color:#5b6b78}
.rv-item{display:flex;gap:12px;align-items:flex-start;padding:12px 14px;border-bottom:1px solid var(--line,#e8edf1)}
.rv-item:last-child{border-bottom:0}
.rv-main{flex:1;min-width:0}.rv-main .t{font-weight:700}.rv-main .m{font-size:12px;color:#5b6b78;margin-top:3px}
.rv-acts{display:flex;flex-direction:column;gap:6px}
@media (max-width:560px){.rv-item{flex-direction:column}.rv-acts{flex-direction:row}}
.badge[hidden]{display:none!important}
.bottom-nav a{position:relative}
.tab-badge{position:absolute;top:2px;right:calc(50% - 20px);min-width:16px;height:16px;padding:0 4px;border-radius:8px;background:#C8102E;color:#fff;font-size:10px;line-height:16px;text-align:center}
.dash-flags{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-top:14px}
.flag-card{display:flex;align-items:center;gap:10px;padding:10px 12px;text-decoration:none;color:inherit}
.flag-card .t{font-weight:700;font-size:14px}.flag-card .m{font-size:12px;color:#5b6b78}
.flag-n{font-size:22px}
@media (max-width:420px){.flag-card .icon-box{display:none}}
/* 8:56 PM: single tool-type combobox */
.tpick{position:relative}
.tpick-box{position:relative}.tpick-box>svg{position:absolute;left:12px;top:50%;transform:translateY(-50%);width:18px;height:18px;color:#6b7b88;pointer-events:none}
.tpick-box .input{padding-left:38px}
.tpick-list{position:absolute;z-index:30;left:0;right:0;top:calc(100% + 4px);max-height:min(300px,45vh);overflow:auto;background:#fff;border:1px solid var(--line,#d6dde3);border-radius:12px;box-shadow:0 12px 28px rgba(14,42,59,.18);-webkit-overflow-scrolling:touch}
.tpick-g{position:sticky;top:0;background:#F3F6F8;font-size:11px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:#5b6b78;padding:6px 12px}
.tpick-o{display:flex;justify-content:space-between;gap:8px;align-items:center;padding:12px;min-height:44px;cursor:pointer;border-top:1px solid #eef2f5}
.tpick-o.act,.tpick-o:hover{background:#EAF6F4}.tpick-o.sel{font-weight:700}
.tpick-empty{padding:12px}
@media (prefers-color-scheme:dark){.tpick-list{background:#132631;border-color:#2a3f4c}.tpick-g{background:#0f1f28;color:#9fb2bf}.tpick-o{border-color:#1e3340}.tpick-o.act,.tpick-o:hover{background:#17343a}}
/* 8:56 PM: names are "<type> · SN <serial>"; wrap instead of cutting off the SN */
.tool-card .t,.attn .t,.list-row .title{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;overflow-wrap:anywhere}

/* Inline icons in list meta lines (e.g. location kind on Dashboard). */
svg.inline { width: 16px; height: 16px; display: inline-block; vertical-align: -3px; flex: none; }
/* 9:06 PM: tool-type thumbnails */
.tthumb{flex:none;width:44px;height:44px;border-radius:10px;background:#EEF4F6;border:1px solid var(--line,#dfe6ea);display:inline-flex;align-items:center;justify-content:center;overflow:hidden;color:#1F6B7E}
.tthumb img{width:100%;height:100%;object-fit:cover}.tthumb svg{width:26px;height:26px}
@media (prefers-color-scheme:dark){.tthumb{background:#16303a;border-color:#2a3f4c;color:#7fd3df}}

/* 9:15 PM: picture in the create-type form, thumbs in picker rows */
.typic{display:flex;gap:12px;align-items:center}.typic p{margin:0 0 8px}
.tthumb.lg{width:72px;height:72px;flex:none}.tthumb.lg svg{width:40px;height:40px}
.tpick-n{display:flex;align-items:center;gap:10px}.tpick-o .tthumb{width:32px;height:32px}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}

/* Supervisor dashboard (Oct 22 2026): compact KPIs, inline SVG/CSS charts, lazy sections. Mobile-first. */
.kpi-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi.kpi-sm { padding: 12px 14px 12px 18px; gap: 3px; }
.kpi.kpi-sm .value { font-size: 1.6rem; }
.kpi.kpi-sm .label { font-size: .72rem; }
.kpi.kpi-sm .sub { font-size: .76rem; }
.kpi .sub b.bad { color: var(--bad-fg); }
.chart-row { display: grid; grid-template-columns: 1fr; gap: 14px; }
.chart-card .card-head { margin-bottom: 6px; }
.donut-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.donut-wrap .legend { display: grid; gap: 4px; flex: 1; min-width: 120px; }
svg.donut { width: 132px; height: 132px; flex: none; }
svg.donut circle { transform-origin: center; }
.donut-n { font-size: 9px; font-weight: 800; fill: var(--ink, #0E2A3B); }
.donut-l { font-size: 3.6px; fill: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.big-n { font-size: 1.8rem; font-weight: 800; letter-spacing: -.02em; }
.stackbar.tall { height: 22px; border-radius: 8px; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(0, 7.5rem) 1fr 2.6rem; align-items: center; gap: 10px; color: inherit; text-decoration: none !important; }
.hbar-l { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.hbar-l > * { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 12px; background: #EEF1EF; border-radius: 99px; overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: 99px; background: var(--ok-dot, var(--teal)); }
.hbar-track i.yellow { background: var(--due-dot, var(--orange)); }
.hbar-track i.red { background: var(--bad-dot, var(--coral)); }
.hbar-v { font-weight: 700; text-align: right; font-size: .85rem; }
.see-all { margin-top: 10px; width: 100%; justify-content: center; }
.dash-more { margin-top: 14px; padding: 0; }
.dash-more > summary { list-style: none; display: flex; align-items: center; gap: 10px; padding: 14px 16px; cursor: pointer; }
.dash-more > summary::-webkit-details-marker { display: none; }
.dash-more > summary svg { width: 18px; height: 18px; flex: none; transition: transform .15s; }
.dash-more[open] > summary svg { transform: rotate(90deg); }
.dash-more-body { padding: 0 16px 16px; }
.dash-more-body:empty::before { content: "Loading…"; color: var(--muted); font-size: .85rem; }
.dash-more-body > .grid.g-2 { margin-top: 0 !important; }
@media (min-width: 760px) {
  .kpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chart-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Dashboard serial / tool-code search (Oct 22 2026). */
.dash-actions { align-items: center; }
.dash-search { min-width: 220px; flex: 1 1 240px; }
.ds-card { margin-bottom: 14px; }
.ds-card .card-head { display: flex; align-items: center; gap: 8px; }
.ds-card .card-head h2 { flex: 1; font-size: 1rem; margin: 0; overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .dash-actions { width: 100%; margin-left: 0; }
  .dash-search { flex: 1 1 100%; min-width: 0; order: -1; }
}

/* 9:21 PM: single tool QR sticker */
.tool-sticker svg{width:2in;height:2in}.tool-sticker .s-title{margin-top:4px}

/* Add-tool form: inline "+ New category" / "+ New type" (Oct 22 2026). */
.lbl-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.add-inline { padding: 4px 8px; font-size: .8rem; color: var(--teal); white-space: nowrap; }
.add-inline svg { width: 14px; height: 14px; }

/* 9:30 PM: tool counts per type (supervisors) */
.tcount { display: inline-flex; flex-direction: column; align-items: center; min-width: 52px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: 800 1.05rem/1.1 inherit; color: var(--ink); cursor: default; }
button.tcount { cursor: pointer; } button.tcount:hover { border-color: var(--ink); }
.tcount small { font-size: .66rem; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .03em; }
.mpills { display: inline-flex; gap: 3px; margin-top: 3px; }
.mp { font-style: normal; font-size: .66rem; font-weight: 800; min-width: 16px; padding: 0 4px; border-radius: 99px; text-align: center; line-height: 15px; }
.mp.red { background: var(--bad-bg, #fde2e1); color: var(--bad-fg, #9b1c1c); } .mp.yellow { background: var(--due-bg); color: var(--due-fg); } .mp.green { background: var(--ok-bg); color: var(--ok-fg); }
.tsum { margin: -4px 0 10px; } .tsum .mp { font-size: .78rem; line-height: 20px; padding: 0 8px; }
.ttl { display: flex; flex-direction: column; max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.ttl-row { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.ttl-row:last-child { border-bottom: 0; } .ttl-row:hover { background: #f7f8fa; } .ttl-row .grow { flex: 1; min-width: 0; } .ttl-row .m { margin-top: 2px; overflow-wrap: anywhere; }
.chip.grp { display: inline-flex; align-items: center; gap: 6px; } .chip.grp input { margin: 0; accent-color: #fff; }
.grp-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: #f4f6f9; border-top: 1px solid var(--line); flex-wrap: wrap; }
.grp-head .mpills { margin: 0; } .grp-head .right { margin-left: auto; }

/* 9:34 PM (Antonio): compact, sideways-scrolling tool cards on My truck; serials never wrap */
.nw { white-space: nowrap; }
.tool-card { display: block; border-bottom: 1px dashed var(--line); }
.tool-card:last-child { border-bottom: 0; }
.tc-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; scrollbar-width: thin; }
.tc-track:focus-visible { outline: 2px solid var(--accent, #2b7); outline-offset: 2px; }
.tc-main, .tc-more { flex: 0 0 100%; scroll-snap-align: start; min-width: 0; box-sizing: border-box; }
.tc-main { display: flex; align-items: center; gap: 12px; padding: 10px 2px; min-height: 60px; }
.tc-main .grow { flex: 1; min-width: 0; }
.tc-main .t { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; }
.tc-sub { display: flex; align-items: center; gap: 8px; margin-top: 4px; white-space: nowrap; overflow: hidden; font-size: .82rem; }
.tc-sub .mono { color: var(--muted); }
.tc-more-btn { flex: none; width: 40px; height: 44px; border: 0; background: transparent; color: var(--muted); cursor: pointer; border-radius: 10px; display: grid; place-items: center; }
.tc-more-btn:hover { background: rgba(127,127,127,.12); }
.tc-more-btn svg { width: 20px; height: 20px; }
.tc-more { padding: 8px 4px 10px 12px; border-left: 3px solid var(--line); display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.tc-dl { display: grid; grid-template-columns: auto auto 1fr; gap: 4px 14px; margin: 0; font-size: .82rem; }
.tc-dl dt { color: var(--muted); font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; }
.tc-dl dd { margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.tc-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.tc-acts .btn { min-height: 40px; padding: 6px 10px; font-size: .82rem; }
.mt-rate { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mt-score { font-weight: 700; font-size: .9rem; white-space: nowrap; }
@media (min-width: 900px) { .tc-main, .tc-more { flex-basis: 50%; } .tc-more-btn { display: none; } .tc-track { overflow-x: visible; } }
.tc-more { padding: 6px 2px 8px 10px; gap: 6px; }
.tc-acts { flex-wrap: nowrap; }
.tc-acts .btn { flex: 1 1 0; min-width: 0; flex-direction: column; gap: 2px; min-height: 46px; padding: 4px 4px; font-size: .74rem; line-height: 1.1; white-space: nowrap; justify-content: center; }
.tc-acts .btn svg { width: 18px; height: 18px; margin: 0; }
.mt-actions .btn { white-space: nowrap; }
.mt-actions .qr-btn { width: auto; height: auto; padding-left: 10px; padding-right: 10px; }
.mt-actions .qr-btn svg { width: 18px; height: 18px; }
@media (max-width: 400px) { .mt-actions { gap: 6px; } .mt-actions .btn { padding-left: 8px; padding-right: 8px; font-size: .84rem; gap: 4px; } .mt-actions .btn svg { width: 16px; height: 16px; } }
.g-cat { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) minmax(0, 1fr); }
.tacts { display: inline-flex; gap: 6px; align-items: center; }
@media (max-width: 1100px) { .g-cat { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .g-cat > .card:nth-child(2) { grid-column: 1 / -1; order: -1; } }
@media (max-width: 760px) {
  .g-cat { grid-template-columns: minmax(0, 1fr); }
  .g-cat .attn { flex-wrap: wrap; }
  .g-cat .attn .grow { flex: 1 1 0; min-width: 0; }
  .g-cat .tacts { flex-basis: 100%; justify-content: flex-end; }
}
.tool-card .tc-main .t { white-space: nowrap !important; overflow: hidden !important; text-overflow: ellipsis !important; }
.mt-head h1 { white-space: nowrap; }
.mt-actions { overflow-x: auto; scrollbar-width: none; }
@media (max-width: 400px) { .mt-actions .btn:not(.primary) svg { display: none; } .mt-actions .btn { flex: 1 1 auto; justify-content: center; } }
.grp-head { padding: 8px 16px; gap: 6px 10px; } .grp-head b { font-size: .92rem; } .grp-head .btn.sm { padding: 4px 10px; font-size: .78rem; }
@media (max-width: 760px) { .grp-head .right { margin-left: 0; } }

/* 9:39 PM (Antonio): truck crews with one leader */
.lead-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px; background: #FDF4D9; color: #6F5200; font-size: .72rem; font-weight: 700; white-space: nowrap; vertical-align: middle; }
.lead-badge svg { width: 12px; height: 12px; fill: currentColor; }
.avatar.sm { width: 34px; height: 34px; font-size: .8rem; display: inline-grid; place-items: center; border-radius: 50%; background: #3B82C4; color: #fff; font-weight: 700; flex: none; }
.crew-card .attn { padding: 8px 0; min-height: 0; }
.crew-ed { display: flex; flex-direction: column; gap: 6px; max-height: 52vh; overflow-y: auto; margin: 4px 0; }
.crew-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 6px 8px; }
.crew-row.on { border-color: #3B82C4; background: rgba(59,130,196,.07); }
.crew-on { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; cursor: pointer; min-height: 44px; }
.crew-on input, .crew-lead input { width: 20px; height: 20px; flex: none; accent-color: #3B82C4; }
.crew-on span { min-width: 0; display: flex; flex-direction: column; }
.crew-on b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crew-on small { color: var(--muted); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crew-lead { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; font-size: .8rem; font-weight: 600; min-height: 36px; flex: none; }
.crew-lead:has(input:checked) { background: #FDF4D9; border-color: #E2A600; color: #6F5200; }
.mt-crew { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 12px; }
.crew-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; background: rgba(127,127,127,.12); font-size: .8rem; font-weight: 600; white-space: nowrap; }
.crew-chip.lead { background: #FDF4D9; color: #6F5200; }
.crew-chip svg { width: 13px; height: 13px; fill: currentColor; }
