/*
 * MyLoads dark theme: the look of the live myloads.io (Softr) app and the old PHP pages (css/styles.css):
 * dark background, neon pink / purple accents from the MyLoads.io logo (#ff14ae pink, #8062ff purple).
 * Dark only: every color is set here and the page does not follow the viewer's light setting.
 * Text colors are chosen for WCAG AA (4.5:1) on the surfaces they sit on.
 * Print documents (rate con, invoice, statement) use their own inline styles and stay white.
 */
:root {
  color-scheme: dark;
  --bg: #0b0b12;          /* page */
  --card: #14141f;        /* cards, tables */
  --card-2: #1c1b2b;      /* table header, hover, inputs */
  --line: #2c2a40;
  --line-2: #3d3a58;
  --ink: #ece9f5;         /* body text: 15:1 on --card */
  --muted: #aaa6c2;       /* secondary text: 7:1 on --card */
  --pink: #ff14ae;        /* logo pink (accents, borders, glow) */
  --purple: #8062ff;      /* logo purple (accents, borders, glow) */
  --pink-text: #ff5cc6;   /* pink used as text: 6:1 on --card */
  --purple-text: #b9a6ff; /* purple used as text / links: 8:1 on --card */
  --btn-a: #c4087f;       /* primary button gradient: white text stays above 4.5:1 */
  --btn-b: #6243e6;
  --glow-pink: 0 0 14px rgba(255, 20, 174, .45);
  --glow-purple: 0 0 14px rgba(128, 98, 255, .45);
  --good: #3fdc97; --warn: #ffb547; --bad: #ff6b7f;
  --brand: var(--pink);   /* kept for views that reference it inline */
  --radius: 10px;
  font-size: 14px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  background: radial-gradient(1200px 500px at 85% -10%, rgba(128, 98, 255, .12), transparent 60%),
              radial-gradient(900px 400px at -10% 0%, rgba(255, 20, 174, .08), transparent 60%), var(--bg);
  background-attachment: fixed;
}
a { color: var(--purple-text); text-decoration: none; }
a:hover { color: #d9cdff; text-decoration: underline; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }
h1 { font-size: 1.55rem; margin: 0 0 .9rem; letter-spacing: -.01em; }
h2 { font-size: 1.15rem; margin: 1.25rem 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
.card > h2:first-child, .card > h3:first-child { margin-top: .1rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.neg { color: var(--bad); font-weight: 600; }
code { background: var(--card-2); padding: .1rem .35rem; border-radius: 5px; overflow-wrap: anywhere; }

/* ---------- top header (logo, menu with dropdowns, user) ---------- */
.top {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem; padding: .55rem 1.25rem;
  background: rgba(11, 11, 18, .92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 20, 174, .25), 0 6px 24px rgba(0, 0, 0, .35);
}
.brand { display: flex; align-items: center; flex: none; }
.brand img { display: block; height: 42px; width: auto; filter: drop-shadow(0 0 6px rgba(255, 20, 174, .35)); }
.menu { display: flex; align-items: center; gap: .15rem; flex: 1; flex-wrap: wrap; }
.menu .top-link, .menu summary {
  display: flex; align-items: center; gap: .35rem; padding: .5rem .75rem; border-radius: 8px;
  color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; list-style: none; user-select: none;
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: ""; width: .45em; height: .45em; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-2px); opacity: .7; }
.menu details[open] > summary::after { transform: rotate(-135deg) translateY(-1px); }
.menu .top-link:hover, .menu summary:hover { background: var(--card-2); text-decoration: none; color: #fff; }
.menu .top-link.on, .menu details.on > summary {
  color: #fff; background: rgba(255, 20, 174, .12); box-shadow: inset 0 -2px 0 var(--pink), var(--glow-pink);
}
.menu details { position: relative; }
.dd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; min-width: 220px; z-index: 40;
  display: flex; flex-direction: column; padding: .35rem;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 12px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .55), var(--glow-purple);
}
.dd-menu a { padding: .55rem .75rem; border-radius: 7px; color: var(--ink); white-space: nowrap; }
.dd-menu a:hover { background: var(--card-2); text-decoration: none; color: #fff; }
.dd-menu a.on { background: rgba(255, 20, 174, .14); color: #fff; box-shadow: inset 3px 0 0 var(--pink); }
.who { display: flex; gap: .6rem; align-items: center; font-size: .85rem; flex: none; }
.who-name { white-space: nowrap; }
.menu-btn { display: none; }
button.link { background: none; border: 0; color: var(--purple-text); cursor: pointer; padding: 0; font: inherit; }

/* Header and side menu stay at every desktop width (> 760px). Narrow desktops: no user name, smaller gaps,
   the side menu shows icons only. Phones (<= 760px): see "phones: compact top bar" below. */
@media (min-width: 761px) { .phone-only { display: none !important; } } /* phone-only parts of the header */
@media (max-width: 1100px) {
  .top { padding: .5rem 1rem; gap: .5rem; }
  .menu .top-link, .menu summary { padding: .5rem .55rem; }
  .who-name { display: none; }
}
@media (max-width: 900px) and (min-width: 761px) {
  .brand img { height: 34px; }
  .menu .top-link, .menu summary { padding: .45rem .4rem; font-size: .95rem; }
}

/* ---------- left side menu: Create Load + Company (expands to labels, collapses to icons) ---------- */
.shell { display: block; }
.shell.has-side { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; }
.side {
  position: sticky; top: 59px; height: calc(100vh - 59px); overflow-y: auto; width: 220px;
  display: flex; flex-direction: column; gap: .9rem; padding: .9rem .7rem;
  background: rgba(20, 20, 31, .7); border-right: 1px solid var(--line);
  transition: width .18s ease;
}
.side.collapsed { width: 64px; padding-inline: .55rem; }
.side-toggle {
  align-self: flex-end; width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink); cursor: pointer; font: inherit; font-size: 1.2rem; line-height: 1;
}
.side-toggle:hover { border-color: var(--pink); box-shadow: var(--glow-pink); }
.side.collapsed .side-toggle { align-self: center; }
.side.collapsed .side-toggle span { display: inline-block; transform: rotate(180deg); }
.side-sec { display: flex; flex-direction: column; gap: .15rem; }
.side-h { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; padding: .35rem .6rem .25rem; }
.side-link { display: flex; align-items: center; gap: .65rem; padding: .45rem .55rem; border-radius: 9px; color: var(--ink); font-weight: 600; white-space: nowrap; }
.side-link:hover { background: var(--card-2); color: #fff; text-decoration: none; }
.side-link.on { background: rgba(255, 20, 174, .12); box-shadow: inset 3px 0 0 var(--pink); color: #fff; }
.side-link .ic { flex: 0 0 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--card-2); color: var(--purple-text); font-weight: 700; }
.side-link .lbl { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-cta, .side-cta:hover { background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); color: #fff; box-shadow: var(--glow-pink); }
.side-cta.on { box-shadow: var(--glow-pink), inset 0 0 0 1px rgba(255, 255, 255, .5); }
.side-cta .ic { background: rgba(255, 255, 255, .18); color: #fff; font-size: 1.15rem; }
.side.collapsed .side-h, .side.collapsed .lbl { display: none; }
.side.collapsed .side-link { justify-content: center; padding: .4rem 0; }
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
@media (max-width: 1100px) and (min-width: 761px) { /* narrow desktop: the side menu keeps its place, as icons */
  .side { width: 64px; padding-inline: .55rem; }
  .side .side-h, .side .lbl, .side-toggle { display: none; }
  .side .side-link { justify-content: center; padding: .4rem 0; }
}

main { padding: 1.5rem 1.25rem 3rem; max-width: 1500px; margin: 0 auto; width: 100%; min-width: 0; } /* width: a grid item with auto margins would shrink to its content */
@media (max-width: 600px) { main { padding: 1rem 16px 2.5rem; } }

/* ---------- cards & layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin-bottom: 1rem; min-width: 0; }
.narrow { max-width: 560px; margin: 2rem auto; }
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); margin-bottom: 1rem; }
.cols-2 { display: grid; gap: 1rem; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.cols-2 > * { min-width: 0; }
@media (max-width: 900px) { .cols-2 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: .75rem 1rem; flex-wrap: wrap; margin-bottom: .25rem; }
.spread > h1 { margin-bottom: .6rem; }
.card .spread { flex-wrap: nowrap; padding: .3rem 0; margin: 0; border-bottom: 1px dashed var(--line); }
.card .spread:last-child { border-bottom: 0; }
.card .spread > :last-child { text-align: right; }

/* ---------- KPI tiles ---------- */
.kpi { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1.05rem; color: var(--ink); position: relative; overflow: hidden; }
.kpi::before { content: ""; position: absolute; inset: 0 0 auto; height: 2px; background: linear-gradient(90deg, var(--pink), var(--purple)); opacity: .8; }
a.kpi:hover { border-color: var(--purple); text-decoration: none; box-shadow: var(--glow-purple); }
.kpi .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.kpi .big { font-size: 1.65rem; font-weight: 700; margin: .2rem 0; font-variant-numeric: tabular-nums; }
.kpi dl { display: grid; grid-template-columns: auto auto; gap: .15rem .75rem; margin: 0; font-size: .9rem; }
.kpi dt { color: var(--muted); }
.kpi dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); margin-bottom: 1rem; -webkit-overflow-scrolling: touch; }
.card .table-wrap { margin-bottom: 0; }
table.data { width: 100%; border-collapse: collapse; background: var(--card); }
table.data th, table.data td { padding: .6rem .7rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.data th { font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; background: var(--card-2); position: sticky; top: 0; white-space: nowrap; }
table.data th.num { text-align: right; }
table.data tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .015); }
table.data tbody tr:hover td { background: rgba(128, 98, 255, .08); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td a { font-weight: 600; }
@media (max-width: 700px) {
  .table-wrap > table.data td { white-space: nowrap; }   /* phones: one line per value, the table scrolls sideways */
  table.data th, table.data td { padding: .55rem .6rem; }
}
table.kv { border-collapse: collapse; width: 100%; }
table.kv th { width: 40%; color: var(--muted); font-weight: 500; text-align: left; padding: .3rem .5rem .3rem 0; vertical-align: top; }
table.kv td { padding: .3rem 0; overflow-wrap: anywhere; }
/* QA M5: money cells in key/value cards may wrap (the notes after the amount, e.g. "(receivable … − payable … charges)",
   pushed the Rates card to ~450 px on a 390 px phone). The amount itself has no spaces, so it stays on one line. */
table.kv td.num { white-space: normal; }
table.kv td.num .small { display: inline-block; }

/* ---------- tabs (Load Tracker and friends) ---------- */
.tabs { display: flex; gap: .35rem; margin-bottom: 1rem; flex-wrap: wrap; padding-bottom: .1rem; }
.tabs a {
  padding: .45rem .95rem; border: 1px solid var(--line-2); border-radius: 999px;
  color: var(--ink); background: var(--card); font-weight: 600; white-space: nowrap;
}
.tabs a:hover { border-color: var(--purple); text-decoration: none; color: #fff; }
.tabs a.on { color: #fff; border-color: var(--pink); background: linear-gradient(135deg, rgba(196, 8, 127, .55), rgba(98, 67, 230, .55)); box-shadow: var(--glow-pink); }
.tabs .count { background: rgba(255, 255, 255, .14); color: #fff; border-radius: 10px; padding: 0 .45rem; font-size: .75rem; margin-left: .3rem; }
@media (max-width: 600px) {
  .tabs { flex-wrap: nowrap; overflow-x: auto; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
}

/* ---------- forms ---------- */
label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: .7rem; font-weight: 500; }
input, select, textarea {
  display: block; width: 100%; margin-top: .25rem; padding: .55rem .65rem;
  border: 1px solid var(--line-2); border-radius: 8px; font: inherit; color: var(--ink); background: var(--card-2);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pink); box-shadow: 0 0 0 3px rgba(255, 20, 174, .2); }
input::placeholder, textarea::placeholder { color: #8d89a8; }
input[type=date]::-webkit-calendar-picker-indicator { filter: invert(.85); }
input[type=file] { padding: .4rem; }
textarea { min-height: 80px; }
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin: 0 .4rem 0 0; accent-color: var(--pink); }
label.check { display: flex; align-items: center; color: var(--ink); }
.form-grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; margin-bottom: 1rem; padding: .85rem 1rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.filters label { margin: 0; min-width: 140px; flex: 1 1 140px; }
.stops-table input, .stops-table select { margin: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .5rem 1rem; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--card-2); color: var(--ink); cursor: pointer; font: inherit; font-weight: 600; line-height: 1.2;
  transition: border-color .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:hover { text-decoration: none; border-color: var(--purple); color: #fff; box-shadow: var(--glow-purple); }
.btn.primary { background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); border-color: transparent; color: #fff; box-shadow: var(--glow-pink); }
.btn.primary:hover { filter: brightness(1.12); }
.btn.small { padding: .25rem .7rem; font-size: .82rem; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); border-color: rgba(255, 107, 127, .45); }
.btn.danger:hover { border-color: var(--bad); box-shadow: 0 0 12px rgba(255, 107, 127, .35); }
form.inline { display: inline; }

/* ---------- flash, badges ---------- */
.flash { padding: .7rem 1rem; border-radius: 8px; margin-bottom: 1rem; background: rgba(63, 220, 151, .1); color: #8ff0c2; border: 1px solid rgba(63, 220, 151, .4); }
.flash.error { background: rgba(255, 107, 127, .1); color: #ffadb8; border-color: rgba(255, 107, 127, .45); }
.flash.warn { background: rgba(255, 181, 71, .1); color: #ffd08a; border-color: rgba(255, 181, 71, .45); }
.errors { color: var(--bad); }
.badge { display: inline-block; padding: .15rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 700; white-space: nowrap; background: rgba(255, 255, 255, .1); color: #dcd8ec; border: 1px solid rgba(255, 255, 255, .12); vertical-align: middle; }
.st-book { background: rgba(255, 209, 102, .14); color: #ffd98a; border-color: rgba(255, 209, 102, .4); }
.st-carrier-booked, .st-reserved { background: rgba(114, 214, 255, .13); color: #9fe2ff; border-color: rgba(114, 214, 255, .4); }
.st-tendered { background: rgba(185, 166, 255, .15); color: #cdbfff; border-color: rgba(185, 166, 255, .45); }
.st-dispatched { background: rgba(255, 20, 174, .14); color: #ff8ad6; border-color: rgba(255, 20, 174, .45); }
.st-loading, .st-in-transit, .st-unloading { background: rgba(6, 214, 160, .13); color: #6ff0cb; border-color: rgba(6, 214, 160, .4); }
.st-delivered { background: rgba(63, 220, 151, .14); color: #8ff0c2; border-color: rgba(63, 220, 151, .4); }
.st-not-billed { background: rgba(110, 168, 255, .15); color: #a9c9ff; border-color: rgba(110, 168, 255, .45); }
.st-claim, .st-tonu, .st-canceled { background: rgba(255, 107, 127, .13); color: #ffa3af; border-color: rgba(255, 107, 127, .45); }
.hot { color: #ff7a59; font-weight: 700; }
.warn { color: var(--warn); }
.ok { color: var(--good); }

/* ---------- login ---------- */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login { width: min(360px, 100%); padding: 1.75rem 1.5rem; box-shadow: var(--glow-purple); }
.login h1 { font-size: 1.8rem; text-align: center; }
.login h1 span { color: var(--pink-text); }
.login .logo { display: block; width: 220px; max-width: 100%; height: auto; margin: 0 auto .5rem; }
.login .btn { width: 100%; margin-top: .5rem; }

/* ---------- SOP body ---------- */
.sop { line-height: 1.55; }

/* ---------- print documents opened inside the app layout ---------- */
.doc { max-width: 820px; margin: 1.5rem auto; background: #fff; color: #1d2733; padding: 2rem 2.25rem; border: 1px solid #cfd6dd; }
.doc a { color: #4a2fc4; }
.doc header { display: flex; justify-content: space-between; border-bottom: 3px solid #1d2733; padding-bottom: .75rem; margin-bottom: 1rem; }
.doc h1 { font-size: 1.4rem; margin: 0; }
.doc .boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.doc .box { border: 1px solid #cfd6dd; padding: .6rem .75rem; }
.doc .box h4 { margin: 0 0 .3rem; font-size: .75rem; text-transform: uppercase; color: #55606c; letter-spacing: .5px; }
.doc .terms { font-size: .78rem; color: #3b4652; margin-top: 1.25rem; }
.doc .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 2rem; }
.doc .sign div { border-top: 1px solid #333; padding-top: .3rem; font-size: .8rem; }
.noprint { text-align: center; margin: 1rem; }
@media print {
  .noprint, .top { display: none; }
  html, body { background: #fff; color: #000; }
  .doc { border: 0; margin: 0; max-width: none; }
}

/* ---------- Beta mode (src/beta.php, MYLOADS_MODE=beta) ---------- */
.beta-badge {
  display: inline-flex; align-items: center; flex: none; padding: .2rem .55rem; border-radius: 6px;
  font-size: .78rem; font-weight: 800; letter-spacing: .12em; color: #111;
  background: var(--warn); box-shadow: 0 0 10px rgba(255, 181, 71, .45);
}
.live-btn { flex: none; white-space: nowrap; border-color: var(--warn); color: var(--warn); font-weight: 700; }
.live-btn:hover { border-color: var(--warn); color: #fff; box-shadow: 0 0 12px rgba(255, 181, 71, .4); }
.beta-btn { flex: none; white-space: nowrap; font-weight: 700; }
.beta-banner {
  display: flex; align-items: center; gap: 1rem; justify-content: space-between; flex-wrap: wrap;
  padding: .6rem 1rem; margin-bottom: 1rem; border-radius: 8px;
  background: rgba(255, 181, 71, .1); color: #ffd9a0; border: 1px solid rgba(255, 181, 71, .45);
}
.beta-banner p { margin: 0; flex: 1 1 320px; }
.beta-banner form { margin: 0; flex: none; }
.beta-login { display: flex; align-items: center; justify-content: center; gap: .6rem; margin: .25rem 0 .5rem; }
@media (max-width: 1100px) {
  .beta-badge, .live-btn, .beta-btn { order: 1; }
}

/* ---------- Work items: My Work, Overview, Everyone's queue, load checklist (src/workitems.php) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.greet { margin: -.35rem 0 1rem; font-size: 1.05rem; display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; }
.greet-counts { color: var(--muted); }
.greet-counts strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.greet-counts strong.neg { color: var(--bad); }
.viewas { margin: 0; }
.viewas select { width: auto; max-width: 100%; margin: 0; padding-block: .35rem; }
.empty { color: var(--muted); margin: .5rem 0; }
.pill { display: inline-block; padding: 0 .45rem; border-radius: 999px; font-size: .72rem; font-weight: 700; border: 1px solid var(--line-2); color: var(--muted); line-height: 1.5; }
.pill-bad { color: #ffadb8; border-color: rgba(255, 107, 127, .5); background: rgba(255, 107, 127, .1); }
.count-pill { display: inline-block; min-width: 1.6rem; text-align: center; padding: 0 .4rem; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line-2); font-weight: 700; font-size: .8rem; }
.chips { margin-bottom: .6rem; }
.chips a { padding: .3rem .8rem; font-size: .9rem; }

.work-list { list-style: none; margin: 0; padding: 0; }
.wi { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: .2rem .75rem; align-items: start; padding: .6rem .1rem; border-bottom: 1px solid var(--line); }
.wi:last-child { border-bottom: 0; }
.wi-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: .4rem; background: var(--line-2); }
.wi-overdue .wi-dot { background: var(--bad); box-shadow: 0 0 8px rgba(255, 107, 127, .6); }
.wi-today .wi-dot { background: var(--warn); }
.wi-upcoming .wi-dot { background: var(--purple-text); opacity: .55; }
.wi-title { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; }
.wi-title:hover { color: #fff; }
.wi-meta { color: var(--muted); display: flex; flex-wrap: wrap; gap: .1rem .4rem; align-items: center; margin-top: .1rem; }
.wi-type { color: var(--purple-text); }
.wi-side { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; text-align: right; }
.wi-due { white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.wi-overdue .wi-due { color: var(--bad); font-weight: 600; }
.wi-today .wi-due { color: var(--warn); }
.btn.tick { gap: .3rem; }
.btn[disabled] { opacity: .45; cursor: not-allowed; box-shadow: none; }
.wi-meta .badge { font-size: .68rem; padding: .05rem .45rem; }
.wi-cust::before, .wi-owner::before { content: "· "; }
.wi-meta > .badge + .wi-owner::before, .wi-meta > .badge + .wi-cust::before { content: ""; }
.work-list.compact .wi { padding: .4rem 0; }
.work-list.compact .wi-meta .badge, .work-list.compact .wi-cust, .work-list.compact .wi-type, .work-list.compact .pill-bad { display: none; }
.work-list.compact .wi-owner::before { content: ""; }
.work-list.compact .wi-title { font-weight: 500; font-size: .92rem; }
@media (max-width: 600px) {
  .wi { grid-template-columns: 10px minmax(0, 1fr); }
  .wi-side { grid-column: 2; flex-direction: row; align-items: center; justify-content: flex-start; text-align: left; }
}

/* Strip under the list: my loads this week / A/R and A/P */
.strip { display: flex; flex-wrap: wrap; align-items: stretch; gap: .5rem; padding: .7rem .9rem; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 1rem; }
.strip > a, .strip > div { display: flex; flex-direction: column; gap: .1rem; padding: .25rem .9rem .25rem 0; margin-right: .4rem; border-right: 1px solid var(--line); color: var(--ink); min-width: 0; }
.strip > :last-child { border-right: 0; }
.strip > a:hover { text-decoration: none; }
.strip > a:hover strong { color: #fff; text-shadow: var(--glow-purple); }
.strip .label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.strip strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.strip-status { flex-direction: row !important; flex-wrap: wrap; align-items: center; gap: .3rem !important; flex: 1 1 220px; }
@media (max-width: 600px) { .strip > a, .strip > div { border-right: 0; flex: 1 1 40%; } .strip-status { flex-basis: 100%; } }

/* Manager Overview */
.cols-ov { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.cols-ov > * { min-width: 0; }
@media (max-width: 1000px) { .cols-ov { grid-template-columns: minmax(0, 1fr); } }
.tiles { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1rem; }
@media (max-width: 1000px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 420px) { .tiles { gap: .6rem; } .tiles .kpi { padding: .75rem .8rem; } .tiles .kpi .big { font-size: 1.3rem; } }
.tiles .kpi .big.neg { color: var(--bad); }
.na-group { padding: .5rem 0 .4rem; border-bottom: 1px dashed var(--line); }
.na-group:last-child { border-bottom: 0; }
.na-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.na-head a { color: var(--ink); }
table.data.team td { vertical-align: middle; }
table.data.team td:first-child a { white-space: nowrap; }
table.data.team th, table.data.team td { padding: .5rem .45rem; }
table.data.team th:first-child, table.data.team td:first-child { padding-left: .7rem; }

/* Load checklist (load page) */
.checklist { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(165px, 100%), 1fr)); gap: .5rem; }
.cl-stage { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .6rem; background: var(--card-2); min-width: 0; }
.cl-stage.current { border-color: var(--pink); box-shadow: inset 0 2px 0 var(--pink); }
.cl-stage.done { opacity: .75; }
.cl-stage h3 { margin: 0 0 .35rem; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); display: flex; justify-content: space-between; gap: .4rem; }
.cl-stage ul { list-style: none; margin: 0; padding: 0; }
.cl-step { display: grid; grid-template-columns: 1.1rem minmax(0, 1fr); gap: .1rem .35rem; font-size: .86rem; padding: .18rem 0; }
.cl-mark { font-weight: 700; color: var(--muted); }
.cl-step.ok .cl-mark { color: var(--good); }
.cl-step.ok .cl-label { color: var(--muted); }
.cl-who { grid-column: 2; font-size: .76rem; color: var(--muted); overflow-wrap: anywhere; }
.cl-who .neg { font-weight: 600; }
.cl-who .warn { font-weight: 600; }
table.data.team td.num { text-align: right; }

/* ---------- logins, My account, API tokens (2026-11-20) ---------- */
.login-links { text-align: center; margin-top: 1rem; }
.login hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
.qr { background: #fff; display: inline-block; padding: 6px; border-radius: 8px; line-height: 0; }
.qr svg { width: 200px; height: 200px; }
code.secret, code.token { word-break: break-all; font-size: .95rem; }
.token-once, .codes-card { border-color: rgba(255, 181, 71, .55); }
.codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: .3rem 1rem; list-style: none; padding: 0; font-size: 1.05rem; }
.sec-page form.inline, .inline-form { display: inline-flex; gap: .4rem; align-items: end; flex-wrap: wrap; margin: .15rem .15rem .15rem 0; }
.sec-page td.actions form.inline select { width: auto; padding: .2rem; font-size: .8rem; }
.sec-actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .5rem; }
fieldset.scopes { border: 1px solid var(--line); border-radius: 8px; padding: .5rem .75rem; margin: .5rem 0; }
fieldset.scopes label.check { gap: .4rem; flex-wrap: wrap; }
.badge.ok { color: #8ff0c2; border-color: rgba(63, 220, 151, .45); }
.badge.warn { color: #ffd08a; border-color: rgba(255, 181, 71, .45); }

/* ---------- 2026-11-20 simplification: phones, cards, snapshot Home, tracker search ---------- */

/* Phones (<= 760px): compact top bar (logo, + Load, Menu), a full-height slide-in panel and a bottom tab bar. */
@media (max-width: 760px) {
  .top { flex-wrap: nowrap; padding: .45rem 12px; gap: .45rem; }
  .brand img { height: 32px; }
  .who { display: none; }
  .beta-badge { padding: .15rem .4rem; font-size: .7rem; }
  .live-btn, .beta-btn { display: none; }
  .new-load { display: inline-flex; margin-left: auto; min-height: 44px; padding-inline: .9rem; }
  .menu-btn {
    display: inline-flex; align-items: center; gap: .4rem; min-height: 44px;
    padding: .45rem .85rem; border-radius: 999px; border: 1px solid var(--line-2); background: var(--card);
    color: var(--ink); font: inherit; font-weight: 600; cursor: pointer;
  }
  .top > .menu-btn:first-of-type { margin-left: auto; }
  .new-load + .menu-btn { margin-left: 0; }
  .menu-btn[aria-expanded="true"] { border-color: var(--pink); box-shadow: var(--glow-pink); }
  .menu {
    position: fixed; inset: 0 0 0 auto; z-index: 60; width: min(340px, 88vw); height: 100vh; height: 100dvh;
    display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: .1rem;
    padding: .5rem .75rem calc(1.5rem + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain;
    background: var(--card); border-left: 1px solid var(--line-2); box-shadow: -18px 0 40px rgba(0, 0, 0, .55);
  }
  html.js .menu:not(.open) { display: none; } /* closed: not rendered at all (an off-screen panel would widen the page) */
  .menu.open { animation: panel-in .2s ease; }
  html:not(.js) .menu { position: static; width: auto; height: auto; box-shadow: none; }
  .nav-backdrop:not([hidden]) { position: fixed; inset: 0; z-index: 55; background: rgba(0, 0, 0, .55); }
  body.nav-open { overflow: hidden; }
  .panel-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .25rem 0 .5rem; border-bottom: 1px solid var(--line); margin-bottom: .25rem; }
  .panel-who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .panel-close { width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card-2); color: var(--ink); font: inherit; font-size: 1.1rem; cursor: pointer; flex: none; }
  .menu .top-link, .menu summary { min-height: 48px; padding: .7rem .75rem; font-size: 1rem; }
  .menu details.on > summary, .menu .top-link.on { box-shadow: inset 3px 0 0 var(--pink); }
  .menu summary::after { margin-left: auto; }
  .dd-menu { position: static; min-width: 0; box-shadow: none; border: 0; border-left: 1px solid var(--line-2); border-radius: 0; margin: 0 0 .35rem 1rem; padding: 0 0 0 .35rem; background: transparent; }
  .dd-menu a { min-height: 44px; display: flex; align-items: center; padding: .55rem .75rem; white-space: normal; }
  .menu .side-group { display: flex; flex-direction: column; gap: .1rem; border-top: 1px solid var(--line); padding-top: .35rem; margin-top: .25rem; }
  .menu .top-link.cta { background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); color: #fff; box-shadow: var(--glow-pink); justify-content: center; }
  .panel-out { margin-top: .75rem; }
  .panel-out .btn { width: 100%; }
  .shell.has-side { display: block; }
  .side { display: none; }
  main { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
    padding: .25rem .25rem calc(.25rem + env(safe-area-inset-bottom)); background: var(--bg); border-top: 1px solid var(--line);
    box-shadow: 0 -1px 0 rgba(255, 20, 174, .25);
  }
  .tabbar a, .tabbar button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; min-height: 52px;
    color: var(--muted); font: inherit; font-size: .75rem; font-weight: 600; background: none; border: 0; border-radius: 10px; cursor: pointer;
  }
  .tabbar .ic { font-size: 1.25rem; line-height: 1; }
  .tabbar a.on, .tabbar a:hover, .tabbar button[aria-expanded="true"] { color: #fff; text-decoration: none; background: rgba(255, 20, 174, .12); }
  .tabbar .tb-create .ic { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: #fff; background: linear-gradient(135deg, var(--btn-a), var(--btn-b)); box-shadow: var(--glow-pink); }
  /* touch targets */
  .btn { min-height: 44px; }
  .btn.small { min-height: 40px; padding: .45rem .85rem; }
  .tabs a { min-height: 44px; display: inline-flex; align-items: center; }
  input, select { min-height: 44px; }
  label.check { min-height: 44px; }
}
@keyframes panel-in { from { transform: translateX(100%); } to { transform: none; } }
@media (max-width: 760px) and (prefers-reduced-motion: reduce) { .menu.open { animation: none; } }
@media print { .tabbar, .nav-backdrop { display: none !important; } }

/* "More details" toggles on forms */
details.more { margin: .25rem 0 .75rem; border: 1px dashed var(--line-2); border-radius: 8px; padding: .4rem .75rem; }
details.more > summary { cursor: pointer; font-weight: 600; color: var(--purple-text); padding: .35rem 0; min-height: 36px; }
details.more[open] > summary { margin-bottom: .5rem; }
details.more-inline > summary { cursor: pointer; color: var(--purple-text); white-space: nowrap; }
details.more-inline label { margin: .35rem 0 0; min-width: 120px; }

/* Tracker: one search box */
.searchbar { display: flex; gap: .5rem; align-items: center; margin: -.25rem 0 .75rem; max-width: 640px; }
.searchbar input { margin: 0; flex: 1; }
.tabs a .count { font-variant-numeric: tabular-nums; }

/* Load list cells */
table.load-cards .place { display: block; font-weight: 600; }
table.load-cards .when { display: block; color: var(--muted); font-size: .85rem; white-space: nowrap; }
table.load-cards .c-load a { font-size: 1rem; }
table.load-cards .c-load .hot { font-size: .7rem; margin-left: .25rem; }
table.load-cards .c-load .pill { margin-left: .25rem; vertical-align: middle; }

/* Phones (<= 600px): every table becomes stacked cards; no sideways scrolling. */
@media (max-width: 600px) {
  .table-wrap { overflow: visible; border: 0; background: transparent; border-radius: 0; }
  table.data, table.data > tbody, table.data > tfoot, table.data > tbody > tr, table.data > tfoot > tr { display: block; width: 100%; }
  table.data { background: transparent; }
  table.data > thead { display: none; }
  table.data > tbody > tr, table.data > tfoot > tr {
    background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: .55rem .8rem; margin-bottom: .6rem;
  }
  table.data > tbody > tr > td, table.data > tbody > tr > th, table.data > tfoot > tr > td, table.data > tfoot > tr > th {
    display: flex; gap: .75rem; justify-content: space-between; align-items: baseline; text-align: right;
    padding: .25rem 0; border: 0; background: transparent !important; white-space: normal; overflow-wrap: anywhere; min-width: 0;
  }
  table.data td[data-label]::before { content: attr(data-label); flex: none; max-width: 45%; text-align: left; color: var(--muted); font-size: .8rem; font-weight: 600; }
  table.data td[data-label=""]::before { display: none; }
  table.data td:empty { display: none; }
  table.data > tbody > tr > td:first-child { font-weight: 600; }
  table.data td.num { text-align: right; }
  table.data tbody tr:hover td { background: transparent; }
  .table-wrap > table.data td { white-space: normal; }
  table.data tr.empty-row td::before { display: none; }
  table.data td > form, table.data td > details { text-align: left; }
  /* forms inside stacked tables (stops on the load form): full-width fields */
  table.stops-table > tbody > tr > td { display: block; text-align: left; }
  table.stops-table td[data-label]::before { display: block; max-width: none; margin-bottom: .15rem; }
  table.stops-table td[data-label="More"]::before, table.stops-table td[data-label=""]::before { display: none; }

  /* Load cards: Load # + status / customer / Pickup -> Delivery / carrier · rate */
  table.load-cards > tbody > tr {
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .15rem .75rem;
    grid-template-areas: "load status" "cust cust" "pu del" "carr rate";
  }
  table.load-cards > tbody > tr.empty-row { display: block; }
  table.load-cards > tbody > tr > td { display: block; text-align: left; padding: .1rem 0; }
  table.load-cards td::before { display: none !important; }
  table.load-cards .c-load { grid-area: load; font-size: 1.05rem; }
  table.load-cards .c-status { grid-area: status; justify-self: end; }
  table.load-cards .c-cust { grid-area: cust; font-weight: 600; }
  table.load-cards .c-pu { grid-area: pu; }
  table.load-cards .c-del { grid-area: del; position: relative; padding-left: 1.1rem; }
  table.load-cards .c-del::after { content: "→"; position: absolute; left: 0; top: .1rem; color: var(--pink-text); font-weight: 700; }
  table.load-cards .c-carr { grid-area: carr; color: var(--muted); }
  table.load-cards .c-rate { grid-area: rate; justify-self: end; font-weight: 700; }
  table.load-cards .when { white-space: normal; }
  .searchbar { margin-top: 0; }
}

/* Home snapshot: up to 6 big count tiles, then one "Needs attention now" list */
.home-head h1 { margin-bottom: .4rem; }
.snap-tiles { display: grid; gap: .85rem; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: .5rem 0 1rem; }
.snap-tiles.n4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.snap-tiles.n1, .snap-tiles.n2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.snap-tile { display: flex; flex-direction: column; gap: .15rem; padding: 1rem 1.1rem; min-height: 120px; }
.snap-tile .big { font-size: 2.4rem; line-height: 1.05; margin: 0; }
.snap-tile.has .big { color: #fff; text-shadow: var(--glow-pink); }
.snap-tile:not(.has) .big { color: var(--muted); }
.snap-tile .label { font-size: .85rem; color: var(--ink); text-transform: none; letter-spacing: 0; font-weight: 700; }
@media (max-width: 1000px) { .snap-tiles, .snap-tiles.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .snap-tiles { gap: .6rem; }
  .snap-tile { min-height: 0; padding: .6rem .75rem; }
  .snap-tile .big { font-size: 1.7rem; }
  .snap-tile .label { font-size: .8rem; }
  .snap-tile .small { display: none; }
}
.attention .spread { border-bottom: 0; }
.na-list { list-style: none; margin: 0; padding: 0; }
.na-item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: .2rem .75rem; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); min-height: 52px; }
.na-item:last-child { border-bottom: 0; }
.na-item .wi-dot { margin-top: 0; }
.na-title { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.na-title:hover { color: #fff; }
.na-due { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wi-overdue .na-due { color: var(--bad); font-weight: 600; }
.wi-today .na-due { color: var(--warn); }
.na-act { justify-self: end; }
@media (max-width: 600px) {
  .na-item { grid-template-columns: 10px minmax(0, 1fr) auto; grid-template-areas: "dot title act" "dot due act"; row-gap: 0; }
  .na-item .wi-dot { grid-area: dot; align-self: start; margin-top: .45rem; }
  .na-title { grid-area: title; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .na-due { grid-area: due; }
  .na-act { grid-area: act; }
}

/* Load page: checklist first; one column on phones */
@media (max-width: 600px) {
  .checklist { grid-template-columns: minmax(0, 1fr); }
  .card { padding: .85rem .9rem; }
  .card .spread { flex-wrap: wrap; }
}
/* Load page on narrow screens: one column, in working order (checklist, actions, details, stops, rates, the rest). */
@media (max-width: 900px) {
  .load-page { display: flex; flex-direction: column; gap: 0; }
  .load-page > div { display: contents; }
  .load-page > div > * { order: 10; }
  .load-page #checklist { order: 1; }
  .load-page .lp-actions { order: 2; }
  .load-page .lp-details { order: 3; }
  .load-page .lp-stops { order: 4; }
  .load-page .lp-rates { order: 5; }
}

@media (max-width: 760px) {
  .desk-only { display: none !important; }
  /* checklist on phones: finished stages fold to their heading, so the open steps are on screen first */
  .cl-stage.done:not(.current) ul { display: none; }
  .cl-stage.done:not(.current) h3 { margin: 0; }
}

/* Integrations hub (views/integrations.php) */
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1rem; margin: 1rem 0; }
.int-card h2 { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.int-card dl { display: grid; grid-template-columns: max-content 1fr; gap: .2rem .75rem; margin: .5rem 0; }
.int-card dd { margin: 0; overflow-wrap: anywhere; }
.int-card .row { display: flex; flex-wrap: wrap; gap: .4rem; margin: .5rem 0; }
.int-events { padding-left: 1rem; margin: .25rem 0; }
.badge.bad { color: #ffb3b3; border-color: rgba(255, 99, 99, .45); }
@media (max-width: 600px) { .int-grid { grid-template-columns: 1fr; } }

/* Texts (src/texting.php, views/texts.php, views/_texts_tab.php) */
.sms-log { display: flex; flex-direction: column; gap: .35rem; margin: .5rem 0; max-height: 28rem; overflow-y: auto; }
.sms-msg { max-width: 85%; padding: .45rem .65rem; border-radius: var(--radius); border: 1px solid var(--line); overflow-wrap: anywhere; }
.sms-msg.in { align-self: flex-start; background: var(--card-2); }
.sms-msg.out { align-self: flex-end; background: var(--card); border-color: var(--purple); }
.sms-msg.st-blocked, .sms-msg.st-failed, .sms-msg.st-discarded { opacity: .65; }
.sms-msg.st-draft, .sms-msg.st-scheduled { border-style: dashed; }
.sms-approve textarea, .sms-quick textarea { width: 100%; }
.sms-proposal { margin: .35rem 0; }
tr.unread td:first-child strong { color: var(--pink-text); }
/* ---------- Inbox (views/inbox.php, src/inbox.php) ---------- */
.ib-filters { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .5rem; }
.ib-filters input[type=search] { flex: 1 1 14rem; width: auto; }
.ib-filters select { width: auto; }
.ib-toolbar { flex-wrap: wrap; gap: .4rem; align-items: center; margin-bottom: .4rem; }
.ib-toolbar select, .ib-toolbar input { width: auto; }
.ib-list tr.ib-unread td a { font-weight: 700; }
.ib-list tr.ib-open { outline: 2px solid rgba(106,169,255,.7); }
.ib-views { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.ib-views .pill.on { font-weight: 700; text-decoration: underline; }
.pill.ib-to { font-size: .75rem; }
.ib-msg { border-top: 1px solid rgba(255,255,255,.12); padding: .6rem 0; }
.ib-msg.ib-out { padding-left: .8rem; border-left: 3px solid rgba(106,169,255,.6); }
.ib-body { margin: .4rem 0; overflow-wrap: anywhere; }
.ib-att { margin: .2rem 0; }
.ib-compose { margin-top: .6rem; }
.ib-compose summary { cursor: pointer; font-weight: 600; }
.ib-side form.ib-one { display: flex; flex-wrap: wrap; gap: .3rem; align-items: center; margin: .3rem 0; }
.ib-side form.ib-one select, .ib-side form.ib-one input { width: auto; }
.ib-loadrow { padding: .25rem 0; border-bottom: 1px solid rgba(255,255,255,.08); }
.inline-check { display: inline-flex; gap: .25rem; align-items: center; margin-right: .6rem; }
@media (max-width: 700px) { .ib-cols { display: block; } }
/* ---------- document scanning (src/docscan.php, views/scans.php, views/scan_review.php) ---------- */
.drop-zone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.2rem; text-align: center; margin: .5rem 0 1rem; }
.drop-zone.over { border-color: var(--purple); background: rgba(127, 90, 240, .06); }
.linkish { color: var(--purple); cursor: pointer; text-decoration: underline; }
.scan-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.scan-doc { position: sticky; top: .5rem; }
.scan-doc iframe { width: 100%; height: 78vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.scan-doc img { max-width: 100%; border: 1px solid var(--line); border-radius: var(--radius); }
.scan-field { display: block; margin: .35rem 0; padding: .3rem .4rem; border-radius: 6px; }
.scan-field input, .scan-field select { width: 100%; }
.scan-field.low, tr.low { background: rgba(255, 196, 0, .18); outline: 1px solid rgba(255, 170, 0, .6); }
.scan-field.missing { opacity: .85; }
.confirm-row { border-top: 1px solid var(--line); padding-top: .6rem; }
form.resolve { display: flex; gap: .3rem; flex-wrap: wrap; }
form.resolve input { min-width: 9rem; }
ul.plain { list-style: none; padding: 0; margin: .3rem 0 0; }
ul.plain li { padding: .2rem 0; border-bottom: 1px dashed var(--line); }
@media (max-width: 900px) { .scan-split { grid-template-columns: 1fr; } .scan-doc { position: static; } .scan-doc iframe { height: 60vh; } }

/* ---- Team Chat, Bot Room, AI Assistants (src/chat.php, views/chat.php, views/botroom.php, views/assistants.php) ---- */
.nap-banner { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; padding: .7rem 1rem; margin-bottom: 1rem; border-radius: 8px;
  background: rgba(110, 168, 255, .12); border: 1px solid rgba(110, 168, 255, .45); color: #cfe0ff; }
.chat-duty { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); }
.chat-duty.nap { color: #a9c9ff; }
.chat-pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px rgba(63, 220, 151, .2); }
.chat-wrap { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 1rem; align-items: start; }
.chat-side { display: flex; flex-direction: column; gap: .1rem; }
.chat-ch { display: flex; align-items: center; gap: .4rem; padding: .3rem .5rem; border-radius: 8px; color: var(--ink); overflow-wrap: anywhere; }
.chat-ch.on { background: var(--card-2); font-weight: 700; }
.chat-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); flex: none; }
.chat-dot.on { background: var(--good); }
.chat-head { display: flex; flex-wrap: wrap; gap: .25rem .75rem; align-items: baseline; padding-bottom: .5rem; border-bottom: 1px solid var(--line); }
.chat-stream { max-height: 60vh; overflow-y: auto; padding: .5rem 0; display: flex; flex-direction: column; gap: .6rem; }
.chat-msg { display: grid; grid-template-columns: 2rem minmax(0, 1fr); gap: .6rem; }
.chat-msg.draft { opacity: .85; border-left: 3px dashed var(--warn); padding-left: .4rem; }
.chat-msg.sys .chat-text { color: var(--muted); font-style: italic; }
.bot-av { display: inline-grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%; background: var(--card-2); border: 2px solid var(--c, var(--line-2)); font-size: .95rem; }
.chat-meta { display: flex; flex-wrap: wrap; gap: .2rem .5rem; align-items: center; }
.chat-tag { font-size: .7rem; font-weight: 700; padding: 0 .4rem; border-radius: 999px; border: 1px solid var(--line-2); color: var(--purple-text, var(--muted)); }
.chat-tag.esc { color: var(--warn); border-color: var(--warn); }
.chat-text { overflow-wrap: anywhere; line-height: 1.45; }
.chat-compose { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem; align-items: end; margin-top: .5rem; }
.chat-approve, .draft { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin: .35rem 0; }
.draft textarea, .chat-approve textarea { width: 100%; }
.room-ev { padding: .55rem .1rem; border-bottom: 1px solid var(--line); }
.room-ev.k-refusal .badge, .room-ev.k-escalation .badge { color: #ffadb8; border-color: rgba(255, 107, 127, .5); }
.room-ev.k-nap .badge, .room-ev.k-wake .badge { color: #a9c9ff; }
.lesson { padding: .45rem 0; border-bottom: 1px dashed var(--line); }
@media (max-width: 760px) { .chat-wrap { grid-template-columns: 1fr; } }

/* ---------- builder L: Help Center, Ctrl+K palette, exception board ---------- */
.search-btn, .help-btn { display: inline-flex; align-items: center; gap: .3rem; flex: none; color: var(--ink); border: 1px solid var(--line-2); border-radius: 999px;
  padding: .3rem .7rem; font-size: .85rem; background: var(--card-2); }
.search-btn:hover, .help-btn:hover { border-color: var(--purple); text-decoration: none; color: #fff; }
.help-btn { width: 2rem; height: 2rem; justify-content: center; padding: 0; font-weight: 700; }
.search-btn kbd { font-size: .7rem; }
kbd { display: inline-block; padding: 0 .35rem; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; font-size: .78rem; font-family: inherit; background: var(--card-2); color: var(--ink); }
@media (max-width: 760px) { .search-hint { display: none; } .search-btn { width: 2rem; height: 2rem; justify-content: center; padding: 0; } }
.palette { position: fixed; inset: 0; z-index: 200; background: rgba(5, 5, 10, .7); display: flex; justify-content: center; align-items: flex-start; padding: 10vh 16px 16px; }
.palette[hidden] { display: none; }
.palette-box { width: 100%; max-width: 640px; background: var(--card); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--glow-purple); overflow: hidden; }
.palette-box input { width: 100%; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: .9rem 1rem; font-size: 1.05rem; background: var(--card); color: var(--ink); }
.palette-list { list-style: none; margin: 0; padding: .3rem 0; max-height: 55vh; overflow-y: auto; }
.palette-group { padding: .5rem 1rem .2rem; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.palette-list a { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem 1rem; color: var(--ink); }
.palette-list a.on, .palette-list a:hover { background: rgba(128, 98, 255, .18); text-decoration: none; }
.palette-empty { padding: .8rem 1rem; }
.palette-foot { margin: 0; padding: .5rem 1rem; border-top: 1px solid var(--line); }
body.palette-open { overflow: hidden; }
.help-search .grow, .ask .grow { flex: 1 1 18rem; min-width: 0; }
.help-hits, .help-list { padding-left: 1.2rem; }
.help-hits li, .help-list li { margin-bottom: .6rem; }
mark { background: rgba(255, 20, 174, .3); color: #fff; border-radius: 2px; padding: 0 .1rem; }
.help-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 1rem; align-items: start; }
@media (max-width: 900px) { .help-layout { grid-template-columns: minmax(0, 1fr); } }
.help-body h2 { margin-top: 1.4rem; border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.help-body li { margin-bottom: .3rem; }
.help-body code { background: var(--card-2); padding: 0 .3rem; border-radius: 4px; }
.help-body pre { background: var(--card-2); padding: .75rem; border-radius: 6px; overflow-x: auto; }
.help-body blockquote { margin: .5rem 0; padding: .3rem 1rem; border-left: 3px solid var(--purple); color: var(--muted); }
.help-side ul { padding-left: 1rem; margin: .3rem 0; }
.help-feedback textarea { width: 100%; margin-bottom: .4rem; }
.ask-source { border-top: 1px dashed var(--line); padding-top: .5rem; margin-top: .5rem; }
.ask-source h3 { font-size: 1rem; }
.ask-ai { border: 1px solid var(--purple); border-radius: 8px; padding: .5rem .8rem; margin: .6rem 0; }
.exc-home { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 1rem; align-items: center; }
@media (max-width: 760px) { .exc-home { grid-template-columns: minmax(0, 1fr); } }
.exc-top { list-style: none; margin: 0; padding: 0; }
.exc-top li { padding: .25rem 0; border-bottom: 1px dashed var(--line); }
.exc-top li:last-child { border-bottom: 0; }
.exc-bad .exc-badge { color: #ffb3b3; border-color: rgba(255, 99, 99, .45); }
.exc-warn .exc-badge { color: #ffd08a; border-color: rgba(255, 181, 71, .45); }
.exc-types { margin-bottom: .75rem; }
.chip { display: inline-block; padding: .25rem .7rem; border: 1px solid var(--line-2); border-radius: 999px; font-size: .85rem; color: var(--ink); }
.chip.on { border-color: var(--pink); background: rgba(196, 8, 127, .35); }
.det-accruing td { background: rgba(255, 181, 71, .06); }

/* Batch actions (src/batch.php, views/_batch_bar.php, public/batch.js) */
.bsel-cell { width: 2.2rem; text-align: center; }
.bsel, .bsel-all { width: 1.05rem; height: 1.05rem; accent-color: var(--pink); cursor: pointer; }
.batchbar { position: sticky; bottom: .75rem; z-index: 30; margin: .9rem 0; padding: .65rem .85rem; border-radius: var(--radius);
  background: rgba(20, 20, 31, .97); border: 1px solid var(--purple); box-shadow: var(--glow-purple);
  display: flex; flex-wrap: wrap; gap: .5rem .75rem; align-items: center; }
.js .batchbar.empty { display: none; }
.batchbar .bb-count { font-weight: 700; white-space: nowrap; }
.batchbar .bb-count strong { color: var(--pink-text); }
.batchbar label { display: inline-flex; gap: .35rem; align-items: center; font-size: .85rem; color: var(--muted); }
.batchbar select, .batchbar input[type=text], .batchbar input[type=date] { max-width: 15rem; }
.batchbar .bb-note { flex-basis: 100%; margin: 0; color: var(--muted); font-size: .78rem; }
.batchbar .bb-allnote { color: var(--warn); font-size: .82rem; }
.js .batchbar [data-param][hidden] { display: none; }
.wi .bsel { margin: .2rem .5rem 0 0; flex: none; }
.progress { height: .7rem; border-radius: 999px; background: var(--card-2); border: 1px solid var(--line); overflow: hidden; }
.progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--btn-a), var(--btn-b)); }
.bj-ok { color: var(--good); }
.bj-skipped { color: var(--muted); }
.bj-failed { color: var(--bad); }
.bj-pending { color: var(--warn); }
@media (max-width: 600px) {
  .batchbar { bottom: 4.2rem; }   /* above the phone tab bar */
  .load-cards td.bsel-cell { text-align: left; }
}
/* Calls + scorecards (src/phone.php, src/scorecards.php, views/_call_pop.php, views/_calls_tab.php) */
.call-pop { position: fixed; right: 16px; bottom: 76px; z-index: 60; max-width: min(360px, calc(100vw - 32px)); }
.call-pop-card { background: var(--card); color: var(--ink); border: 1px solid var(--line-2); border-left: 4px solid var(--purple);
  border-radius: 8px; padding: 10px 12px; margin-top: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .4); font-size: .9rem; }
.call-pop-card div { margin-top: 4px; }
.call-row { padding: 4px 0; border-bottom: 1px solid var(--line); }
.call-row:last-child { border-bottom: 0; }
.scorecard h2 .badge { font-size: .85rem; vertical-align: middle; }
/* Order intake review (views/intake_review.php): source left, draft loads right, confidence per field */
.ik-split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 1rem; align-items: start; }
@media (max-width: 960px) { .ik-split { grid-template-columns: minmax(0, 1fr); } }
.ik-src { position: sticky; top: .5rem; }
.ik-src pre { white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow: auto; font-size: .82rem; margin: 0; }
.ik-src table td.hl { background: rgba(255, 214, 0, .25); }
.ik-fields { display: grid; gap: .5rem .8rem; grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); }
.ik-fields label, .ik-stops td { font-size: .85rem; }
.cf { display: inline-block; margin-left: .3rem; padding: 0 .4rem; border-radius: 999px; font-size: .7rem; font-weight: 700; border: 1px solid var(--line-2); vertical-align: middle; }
.cf-hi { color: #8ff0c2; border-color: rgba(63, 220, 151, .45); }
.cf-mid { color: #ffd08a; border-color: rgba(255, 181, 71, .45); }
.cf-lo { color: #ffb3b3; border-color: rgba(255, 99, 99, .45); }
.cf-none { color: var(--muted); }
.ik-mid input, .ik-mid select { border-color: rgba(255, 181, 71, .7); }
.ik-lo input, .ik-lo select, .ik-none input, .ik-none select { border-color: rgba(255, 99, 99, .7); }
.ik-draft.ik-done { opacity: .65; }
.ik-stops input, .ik-stops select { min-width: 6rem; }
.sg-reasons { margin: .2rem 0 0 1rem; padding: 0; font-size: .85rem; }

/* Builder U: ads, plan banner, usage meters */
.ml-ad { border: 1px dashed var(--line-2); border-radius: var(--radius); padding: .6rem .9rem; margin: 0 0 1rem; background: rgba(255, 255, 255, .02); max-width: 28rem; }
.ml-ad-loads_sidebar { float: right; margin-left: 1rem; width: 18rem; }
@media (max-width: 900px) { .ml-ad-loads_sidebar { float: none; width: auto; margin-left: 0; } }
.ml-ad-label { display: block; font-size: .7rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ml-ad p { margin: .3rem 0; }
.plan-banner { padding: .6rem 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid rgba(255, 181, 71, .45); background: rgba(255, 181, 71, .08); }
.plan-banner.over { border-color: rgba(255, 107, 127, .45); background: rgba(255, 107, 127, .08); }
.meter { height: .5rem; border-radius: 999px; background: var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; background: #3fdc97; }
.meter.warn > span { background: #ffb547; }
.meter.over > span { background: #ff6b7f; }
.perms .check { display: block; }
.pill.ok { color: #8ff0c2; border-color: rgba(63, 220, 151, .5); }
