/* TeamPulse direction A "Desk". Role tokens map the shared palette; status colors are semantic and
   shared by both companies. One family (Archivo) at two widths carries the hierarchy. */

:root {
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius-ctrl: 6px;
  --radius-card: 14px;
  --topbar-h: 56px;
  --rail-w: 76px;
  --st-fadv: #2b5f9e;
  --st-fadv-bg: #e8eff8;
  --st-hired: #1e7a3c;
  --st-hired-bg: #e3f3e8;
  --st-review: #8a6400;
  --st-review-bg: #fbf1c7;
  --focus: var(--accent);
}

html[data-brand="jcruz"] {
  --chrome: var(--jc-charcoal);
  --chrome-2: var(--jc-charcoal-2);
  --chrome-line: var(--jc-charcoal-line);
  --chrome-text: var(--jc-band);
  --chrome-muted: #9a9ea8;
  --page: var(--jc-band);
  --surface: #ffffff;
  --strip: #f1f0ed;
  --line: #e6e4df;
  --line-strong: #cfccc5;
  --text: var(--jc-charcoal);
  --body: var(--jc-body);
  --muted: #6e717a;
  --accent: var(--jc-red);
  --accent-hover: var(--jc-red-deep);
  --accent-tint: var(--jc-red-tint);
  --on-accent: var(--jc-on-red);
  --urgent: var(--jc-red-deep);
  --urgent-tint: var(--jc-red-tint);
  --bar: var(--jc-body);
  --focus-on-chrome: var(--jc-red);       /* red on charcoal, about 4.6:1 */
}

html[data-brand="keptstaffed"] {
  --chrome: var(--ks-olive);
  --chrome-2: var(--ks-olive-deep);
  --chrome-line: var(--ks-olive-border);
  --chrome-text: var(--ks-on-olive-soft);
  --chrome-muted: #c9ceb8;
  --page: var(--ks-cream);
  --surface: #ffffff;
  --strip: #f1efe4;
  --line: var(--ks-border);
  --line-strong: #cbc6ae;
  --text: var(--ks-ink);
  --body: var(--ks-body);
  --muted: #656a55;                       /* about 5.6:1 on white, 5.1:1 on the cream page; #777c66 was 4.0:1 */
  --accent: var(--ks-teal);
  --accent-hover: var(--ks-teal-hover);
  --accent-tint: #e3f3f1;
  --on-accent: #ffffff;
  --urgent: var(--ks-error);
  --urgent-tint: #f8e5e3;                 /* derived from --ks-error, hue about 6 degrees, not peach */
  --bar: var(--ks-body);
  --focus-on-chrome: var(--ks-teal-on-olive);   /* pale teal on olive, about 6.5:1; plain teal was 1.7:1 */
}

/* ---------- base ---------- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 400 15px/1.45 var(--font);
  font-stretch: normal;
  overflow-x: hidden;
}
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.rail :focus-visible, .phone-view :focus-visible { outline-color: var(--focus-on-chrome); }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 50; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-ctrl); }
.skip-link:focus { left: 8px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.figure {
  font-stretch: condensed;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}
.num { font-variant-numeric: tabular-nums; }

/* ---------- chrome: rail (desktop) / bottom bar (phone) ---------- */

.rail {
  position: fixed; left: 0; top: 0; bottom: 0; width: var(--rail-w);
  background: var(--chrome); color: var(--chrome-text);
  display: flex; flex-direction: column; align-items: stretch;
  z-index: 20;
}
.rail-band {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  padding: 12px 10px 14px; border-bottom: 1px solid var(--chrome-line);
}
/* The company's logo slot: a quiet placeholder mark (its initials in the company color on a tinted square) beside the
   company name until each company uploads a logo. It changes with the company switch (app.js sets the initials). */
.tp-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: color-mix(in srgb, var(--accent) 16%, var(--chrome)); color: var(--focus-on-chrome);
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--chrome));
  font-stretch: condensed; font-weight: 800; font-size: 15px; letter-spacing: 0;
}
.rail-company { font-size: 12px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; color: var(--chrome-text); margin-top: 2px; }
.tp-name { font-size: 11px; line-height: 1.25; font-weight: 500; color: var(--chrome-muted); }
.rail-group { padding: 10px 6px 4px; }
.rail-group-label { font-size: 12px; color: var(--chrome-muted); padding: 0 6px 4px; }
.rail-item {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px;
  width: 100%; padding: 8px 4px 7px; border: 0; border-radius: 8px; background: transparent;
  color: var(--chrome-muted); font-size: 12px; font-weight: 500; text-decoration: none; line-height: 1.2;
}
.rail-label { text-align: center; }
.rail-item svg { width: 22px; height: 22px; }
.rail-item:hover { color: var(--chrome-text); background: var(--chrome-2); text-decoration: none; }
.rail-item.is-active { color: var(--chrome-text); }
.rail-item.is-active::before {
  content: ""; position: absolute; left: -6px; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.rail-item.is-later { cursor: default; }   /* no opacity: chrome-muted on the chrome is about 6.8:1 (JCruz) and 5:1 (Kept Staffed); at 55% it was 2.6:1 */
.rail-item.is-later:hover { background: transparent; color: var(--chrome-muted); }
.rail-item .later-tag { display: block; font-size: 11px; color: var(--chrome-muted); margin-top: 1px; }
.rail-badge {
  position: absolute; top: 4px; right: 10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; text-align: center;
  font-variant-numeric: tabular-nums;
}
.rail-spacer { flex: 1; }
.rail-viewer { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px 16px; border-top: 1px solid var(--chrome-line); font-size: 11px; color: var(--chrome-muted); }
.avatar {
  display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%;
  background: var(--line); color: var(--text); font-size: 11px; font-weight: 700; letter-spacing: 0;
}
.rail-viewer .avatar { background: var(--chrome-2); color: var(--chrome-text); border: 1px solid var(--chrome-line); }

/* ---------- work area ---------- */

.work { margin-left: var(--rail-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 15; height: var(--topbar-h);
  display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: var(--page); border-bottom: 1px solid var(--line);
}
.topbar .tp-mark { display: none; }
.module-name { font-weight: 600; font-size: 15px; white-space: nowrap; }
.module-name small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.topbar-spacer { flex: 1; }

.find { position: relative; width: 260px; }
.find-input {
  width: 100%; height: 34px; padding: 0 12px 0 32px; border: 1px solid var(--line-strong); border-radius: var(--radius-ctrl);
  background: var(--surface); font-size: 14px;
}
.find-input::placeholder { color: var(--muted); }
.find svg { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.find-results {
  position: absolute; left: 0; top: 38px; z-index: 30; width: 400px; max-width: calc(100vw - 48px); background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--radius-ctrl); padding: 4px; max-height: 320px; overflow: auto;
}
.find-result { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 8px; border: 0; background: transparent; border-radius: 4px; font-size: 14px; white-space: nowrap; }
.find-result > span:first-child { font-weight: 600; }
.find-result:hover { background: var(--page); }
.find-result .find-status { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.find-empty { padding: 8px 10px; font-size: 13px; color: var(--muted); }

.company-switch {
  display: inline-flex; padding: 3px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface);
}
.company-option {
  border: 0; background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13px; font-weight: 500; color: var(--body);
  white-space: nowrap;
}
.company-option.is-active { background: var(--chrome); color: var(--chrome-text); }
.company-option:not(.is-active):hover { color: var(--text); }

.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-ctrl); background: var(--surface); color: var(--text);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .count {
  position: absolute; top: -6px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700; line-height: 18px; font-variant-numeric: tabular-nums;
}
.phone-view-toggle {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-ctrl); background: var(--surface); font-size: 13px; font-weight: 500;
}
.phone-view-toggle svg { width: 16px; height: 16px; }
.phone-view-toggle.is-on { background: var(--chrome); color: var(--chrome-text); border-color: var(--chrome); }

/* The popover floats, so it keeps a surface, a border and a radius even though layout panels have none */
.alerts-popover, .alerts-popover.panel {
  position: absolute; right: 24px; top: calc(var(--topbar-h) + 6px); z-index: 30; width: 360px; max-width: calc(100vw - 32px);
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-card); padding: 6px;
}
.alerts-popover .panel-title { padding: 8px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.alerts-popover .alert-item { padding: 10px; }
.alerts-popover .panel-empty { padding: 12px 10px 14px; }

.screen { flex: 1; width: 100%; max-width: 1280px; padding: 20px 24px 48px; }

/* ---------- screen heads ---------- */

.screen-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.screen-title { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.screen-sub { color: var(--body); font-size: 14px; margin-top: 2px; }
.screen-sub strong { color: var(--text); font-weight: 600; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; color: var(--body); margin-bottom: 10px; }
.back-link svg { width: 16px; height: 16px; }
.back-link:hover { color: var(--text); }

/* ---------- layout: primary column + side column ---------- */

.desk-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1180px) {
  .desk-grid { grid-template-columns: minmax(560px, 1fr) 320px; gap: 24px; }
  /* The side column is the lighter margin of the desk: a hairline on its left, smaller titles, no boxes */
  .desk-grid:not(.is-stacked) > .side, .dash-grid > .side { border-left: 1px solid var(--line); padding-left: 20px; }
}
.primary { min-width: 0; }
.side { min-width: 0; display: grid; gap: 22px; }

/* Without a side column (phone, tablet, or the phone view docked) the three Home panels sit as one compact ruled row of figures
   above the queue, closed; an open one drops to a full-width section under the row, so the queue still starts in the first screen */
.desk-grid.is-stacked .side { display: flex; flex-wrap: wrap; gap: 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.desk-grid.is-stacked .side .panel { flex: 1 1 auto; min-width: 0; }
.desk-grid.is-stacked .side .panel:not([open]) + .panel:not([open]) { border-left: 1px solid var(--line); }
.desk-grid.is-stacked .side .panel[open] { flex: 1 0 100%; order: 1; border-top: 1px solid var(--line); padding-top: 10px; }
.desk-grid.is-stacked .side .panel:not([open]) .panel-body { display: none; }   /* a closed cell's hidden body gets no layout at the cell's width */
.desk-grid.is-stacked .side .panel:not([open]) .panel-title {
  display: flex; align-items: center; gap: 6px; padding: 0 6px 0 8px; min-height: 44px; border-bottom: 0;
}
.desk-grid.is-stacked .side .panel:first-child:not([open]) .panel-title { padding-left: 0; }
.desk-grid.is-stacked .side .panel:not([open]) .panel-title .count {
  order: -1; margin: 0; font-stretch: condensed; font-weight: 700; font-size: 21px; line-height: 1; letter-spacing: -0.02em;
}
.desk-grid.is-stacked .side .panel:not([open]) .panel-title .pt-label { font-size: 12.5px; font-weight: 500; color: var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk-grid.is-stacked .side .panel:not([open]) .panel-title .caret { margin-left: auto; width: 14px; height: 14px; flex: none; }
.desk-grid.is-stacked .side .panel:not([open]):hover { background: var(--surface); }

/* Panels are ruled sections on the page, not boxes: the applicant card is the only card */
.panel { background: transparent; border: 0; border-radius: 0; }
.panel > summary { list-style: none; cursor: pointer; }
.panel > summary::-webkit-details-marker { display: none; }
.panel-title {
  display: flex; align-items: center; gap: 8px; padding: 0 0 8px; font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--line-strong);
}
.panel-title .count { margin-left: auto; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.panel-title .caret { width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
details.panel[open] .panel-title .caret { transform: rotate(180deg); }
.panel-body { padding: 0 0 4px; }
.panel-empty { padding: 12px 0 14px; color: var(--muted); font-size: 14px; }

/* ---------- chips, pills, buttons ---------- */

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; border: 1px solid transparent;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1;
}
.chip-new { background: var(--text); color: var(--surface); }
.chip-touch { background: var(--surface); color: var(--text); border-color: var(--line-strong); }
.chip-fadv { background: var(--st-fadv-bg); color: var(--st-fadv); }
.chip-hired { background: var(--st-hired-bg); color: var(--st-hired); }
.chip-closed { background: var(--strip); color: var(--muted); }
.chip-dnh { background: var(--urgent-tint); color: var(--urgent); }
.status-control { cursor: pointer; }
.status-control svg { width: 12px; height: 12px; margin-right: -3px; }
.status-control:hover { filter: brightness(.96); }
.status-wrap { position: relative; display: inline-block; }
.status-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 25; min-width: 230px; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 10px; padding: 6px; display: grid; gap: 1px;
}
.status-menu .menu-group { font-size: 11px; color: var(--muted); padding: 6px 10px 2px; }
.status-menu .menu-head { display: none; }
.menu-backdrop { display: none; }
.status-option {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left;
  padding: 7px 10px; border: 0; background: transparent; border-radius: 6px; font-size: 14px;
}
.status-option:hover { background: var(--page); }
.status-option.is-current { font-weight: 700; }
.status-option .tick { width: 14px; height: 14px; color: var(--accent); }
/* DO NOT HIRE asks for its reason in the same menu before it applies (the tracker pairs the status with a DNH Reason) */
.status-menu.is-dnh { min-width: 300px; }
.dnh-form { display: grid; gap: 8px; padding: 8px 10px 6px; }
.dnh-form label { font-size: 14px; font-weight: 600; }
.dnh-form label .hint { display: block; font-size: 13px; font-weight: 400; color: var(--muted); margin-top: 2px; }
.dnh-form input[type="text"] { height: 38px; width: 100%; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--radius-ctrl); background: var(--surface); font-size: 14px; }
.dnh-form .action-inline { padding-top: 2px; }

.loc-pill, .type-pill, .lang-pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 5px; font-size: 12px; font-weight: 600;
  white-space: nowrap; line-height: 1;
}
.loc-pill { background: var(--strip); color: var(--body); border: 1px solid var(--line); }
.type-pill { background: var(--accent-tint); color: var(--accent-hover); }
.lang-pill { background: var(--surface); color: var(--body); border: 1px solid var(--line-strong); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: var(--radius-ctrl); border: 1px solid var(--line-strong); background: var(--surface); color: var(--text);
  font-size: 14px; font-weight: 500; white-space: nowrap;
}
.btn:hover { border-color: var(--text); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-small { height: 30px; padding: 0 10px; font-size: 13px; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--body); }
.btn-ghost:hover { border-color: var(--line-strong); }
.btn-later { color: var(--muted); border-color: transparent; background: transparent; padding-left: 8px; padding-right: 8px; }
.btn-later:hover { border-color: var(--line-strong); }
.btn-later .later { font-size: 11px; font-weight: 400; padding: 1px 5px; border: 1px dashed var(--line); border-radius: 4px; color: var(--muted); }
.btn-later:hover .later { border-color: var(--line-strong); }

/* ---------- location filter ---------- */

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; max-width: 100%; }
.location-filter, .dash-location-filter {
  display: flex; gap: 6px; overflow-x: auto; padding: 2px; margin: -2px; scrollbar-width: none; max-width: 100%; min-width: 0;
}
.filters .location-filter { flex: 0 1 auto; }
.location-filter::-webkit-scrollbar, .dash-location-filter::-webkit-scrollbar { display: none; }
/* When the strip overflows, fade its right edge so it reads as scrollable, not clipped (classes set by app.js) */
.location-filter.can-scroll:not(.at-end), .dash-location-filter.can-scroll:not(.at-end) {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
}
.who-select {
  height: 32px; padding: 0 30px 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--text);
  font-size: 13px; font-weight: 500; appearance: none; -webkit-appearance: none; max-width: 100%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e717a' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px 14px;
}
.who-select.is-active { background-color: var(--text); color: var(--surface); border-color: var(--text); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); }
.location-option {
  display: inline-flex; align-items: baseline; gap: 6px; height: 32px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--surface); font-size: 13px; font-weight: 500; white-space: nowrap;
  align-items: center;
}
.location-option .n { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 600; }
.location-option.is-active { background: var(--text); color: var(--surface); border-color: var(--text); }
.location-option.is-active .n { color: var(--surface); opacity: .8; }

/* ---------- follow-up queue ---------- */

/* The queue sits as ruled rows directly on the page: a heavy rule at its head, hairlines between rows, no wrapper. A row
   lifts to white on hover. Overflow stays visible so a status menu opened on the last row is never clipped. */
.queue { background: transparent; border: 0; border-radius: 0; }
.queue-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 2px solid var(--text); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.queue-list > .queue-row:last-child, .queue-empty { border-bottom: 1px solid var(--line); }
.queue-head .sort-note { font-size: 13px; color: var(--muted); }
.hint-info { display: none; }   /* phone only: the rest of the hint opens from it */
.queue-row {
  position: relative; display: grid; grid-template-columns: 72px minmax(0, 1fr) auto auto;
  grid-template-areas: "timer main tags status" "timer meta meta actions";
  column-gap: 14px; row-gap: 6px; align-items: center; padding: 12px 8px 12px 0; border-top: 1px solid var(--line);
  cursor: pointer;
}
.queue-row:first-of-type { border-top: 0; }
.queue-row:hover { background: var(--surface); }
.queue-row.is-cleared { cursor: default; }
.queue-row.is-cleared:hover { background: transparent; }
.timer { align-self: start; display: flex; flex-direction: column; align-items: flex-end; text-align: right; padding-top: 1px; }
.queue-row .timer { grid-area: timer; }
.timer-figure { font-size: 36px; color: var(--text); }
.timer.is-over .timer-figure { color: var(--urgent); }
.timer-unit { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.2; white-space: nowrap; }
.timer.is-over .timer-unit { color: var(--urgent); }
.timer.is-today .timer-figure { font-size: 20px; padding-top: 6px; }
.timer.is-done .timer-figure { font-size: 20px; padding-top: 6px; color: var(--st-hired); }
.timer.is-done .timer-unit { color: var(--st-hired); }
.queue-open {
  grid-area: main; display: block; width: 100%; text-align: left; border: 0; background: transparent; padding: 0; min-width: 0;
}
.queue-name { display: block; font-size: 16px; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-tags { grid-area: tags; display: flex; align-items: center; gap: 6px; }
.queue-status { grid-area: status; justify-self: end; }
.queue-meta { grid-area: meta; font-size: 13px; color: var(--body); line-height: 1.4; min-width: 0; }
.queue-meta .stalled { color: var(--urgent); font-weight: 600; }
.queue-actions { grid-area: actions; display: flex; gap: 6px; justify-self: end; flex-wrap: wrap; justify-content: flex-end; }
.queue-row.is-cleared .queue-name, .queue-row.is-cleared .queue-meta { color: var(--muted); }
.cleared-note { grid-area: meta; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--st-hired); }
.cleared-note .undo { border: 0; background: transparent; color: var(--accent); font-weight: 600; padding: 0; font-size: 13px; }
.queue-empty { padding: 28px 0; color: var(--muted); text-align: center; }

@media (prefers-reduced-motion: no-preference) {
  .queue-row.just-cleared { animation: settle .35s ease-out; }
  @keyframes settle { from { background: var(--st-hired-bg); } to { background: transparent; } }
}

/* ---------- side panels ---------- */

.task-item { display: grid; grid-template-columns: 24px 44px minmax(0, 1fr) 26px; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.task-item:first-child { border-top: 0; }
.task-check { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.task-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.task-time.is-late { color: var(--urgent); font-weight: 600; }
.task-title { font-size: 14px; line-height: 1.35; min-width: 0; }
.task-title a { color: inherit; }
.task-item.is-done .task-title { color: var(--muted); text-decoration: line-through; }
.lead-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 9px 0; border-top: 1px solid var(--line); align-items: center; }
.lead-item:first-child { border-top: 0; }
.lead-open { text-align: left; border: 0; background: transparent; padding: 0; font-weight: 600; font-size: 14.5px; color: var(--text); }
.lead-open:hover { color: var(--accent); }
.lead-meta { grid-column: 1 / -1; font-size: 13px; color: var(--body); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.assign-select { height: 28px; border: 1px solid var(--line-strong); border-radius: var(--radius-ctrl); background: var(--surface); font-size: 13px; padding: 0 6px; max-width: 100%; }
.alert-item { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); width: 100%; text-align: left; border-left: 0; border-right: 0; border-bottom: 0; background: transparent; }
.alert-item:hover { background: var(--surface); }
.alert-item:first-child { border-top: 0; }
.alert-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; background: transparent; border: 1px solid var(--line-strong); }
.alert-item.is-unread .alert-dot { background: var(--accent); border-color: var(--accent); }
.alert-text { font-size: 14px; line-height: 1.35; }
.alert-text strong { font-weight: 600; }
.alert-text .alert-kind { display: block; font-size: 13px; color: var(--body); }
.alert-text .alert-kind.is-bad { color: var(--urgent); }
.alert-text .alert-kind.is-warn { color: var(--st-review); }
.alert-text .alert-kind.is-good { color: var(--st-hired); }
.alert-when { font-size: 12px; color: var(--muted); white-space: nowrap; margin-top: 2px; }

/* ---------- applicant card ---------- */

.card-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1180px) { .card-layout { grid-template-columns: minmax(560px, 1fr) 360px; gap: 24px; } }

/* overflow stays visible so the status menu (12 options) is never clipped by the card; corners are rounded on the pin and footer */
.applicant-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); }
.card-pin {
  position: sticky; top: var(--topbar-h); z-index: 6; display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line); border-radius: var(--radius-card) var(--radius-card) 0 0;
}
.card-pin .pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.card-pin .pin-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
/* Without a side column the pin also carries Log touch and the status control (app.js renders .card-quick then) */
.card-quick { display: flex; align-items: center; gap: 8px; min-width: 0; }
.card-quick .status-control { max-width: 100%; overflow: hidden; }
.card-quick .status-control > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-pills { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.field-picker-toggle { height: 32px; }
.field-picker-toggle svg { width: 15px; height: 15px; }
.field-picker-toggle .n { color: var(--muted); font-weight: 400; }
.field-picker-option.is-fixed { cursor: default; }
.field-picker-option .hint { color: var(--muted); font-size: 12.5px; }
.field-picker { padding: 14px 20px 18px; border-bottom: 1px solid var(--line); background: var(--strip); }
.field-picker-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.field-picker-head p { font-size: 13.5px; color: var(--body); }
.field-picker-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px 20px; }
.field-picker-group h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field-picker-option { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; cursor: pointer; }
.field-picker-option input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

.card-identity { padding: 18px 20px 6px; }
.card-name { font-size: 26px; font-weight: 700; letter-spacing: -0.015em; line-height: 1.15; }
/* Phone and email stay adjacent; the deferred Call and Text sit at the right of the phone line on desktop and after both lines on phone */
.card-contact { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; margin-top: 12px; align-items: center; }
.contact-line { grid-column: 1; display: flex; align-items: center; gap: 10px; font-size: 15px; color: var(--body); flex-wrap: wrap; min-width: 0; }
.contact-line a { color: var(--text); }
.contact-line svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.contact-actions { grid-column: 2; grid-row: 1; justify-self: end; display: flex; gap: 6px; }
.card-section { padding: 10px 20px 14px; border-top: 1px solid var(--line); }
.card-section h3 { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.field-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 8px 16px; padding: 7px 0; align-items: center; font-size: 15px; border-top: 1px solid var(--line); }
.field-row:first-of-type { border-top: 0; }
.field-label { color: var(--body); font-size: 14px; }
.field-value { min-width: 0; overflow-wrap: anywhere; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-value.is-over { color: var(--urgent); font-weight: 600; }
.field-value .avatar { width: 24px; height: 24px; font-size: 10.5px; }
.field-value .hint { color: var(--muted); font-size: 13px; }

.fadv-block { padding: 0; }
.fadv-summary { display: flex; align-items: center; gap: 10px; padding: 12px 20px; cursor: pointer; list-style: none; font-weight: 600; }
.fadv-summary::-webkit-details-marker { display: none; }
.fadv-summary .caret { margin-left: auto; width: 16px; height: 16px; color: var(--muted); transition: transform .15s; }
details[open] .fadv-summary .caret { transform: rotate(180deg); }
.fadv-summary .fadv-count { color: var(--body); font-weight: 500; }
.fadv-rows { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding: 0 20px 16px; }
.fadv-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px 9px; display: grid; gap: 6px; min-width: 0; }
.fadv-item .fadv-key { font-size: 13px; font-weight: 700; letter-spacing: 0.01em; }
.fadv-item .fadv-full { font-size: 12px; color: var(--muted); }
.fadv-state { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.fadv-state .dot { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid currentColor; flex: none; display: inline-grid; place-items: center; }
.fadv-state .dot svg { width: 8px; height: 8px; }
.fadv-state.st-not_started { color: var(--muted); }
.fadv-state.st-sent { color: var(--st-fadv); }
.fadv-state.st-pending { color: var(--st-fadv); }
.fadv-state.st-pending .dot { background: currentColor; }
.fadv-state.st-clear { color: var(--st-hired); }
.fadv-state.st-clear .dot { background: var(--st-hired); border-color: var(--st-hired); color: #fff; }
.fadv-state.st-needs_review { color: var(--st-review); }
.fadv-state.st-needs_review .dot { background: var(--st-review-bg); }
.fadv-state.st-failed, .fadv-state.st-positive { color: var(--urgent); }
.fadv-state.st-failed .dot, .fadv-state.st-positive .dot { background: var(--urgent); border-color: var(--urgent); color: #fff; }
.fadv-extra { padding: 0 20px 14px; display: flex; gap: 18px; flex-wrap: wrap; font-size: 14px; color: var(--body); }
.fadv-extra strong { color: var(--text); font-weight: 600; }

.note-quote { font-size: 15px; line-height: 1.5; color: var(--text); padding: 2px 0 2px 12px; border-left: 3px solid var(--line-strong); }
.note-quote .note-by { display: block; font-size: 13px; color: var(--muted); margin-top: 4px; }
.doc-list { display: grid; gap: 6px; }
.doc-item { display: flex; align-items: center; gap: 10px; font-size: 14.5px; }
.doc-item svg { width: 16px; height: 16px; color: var(--muted); flex: none; }
.doc-item .doc-when { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.card-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--strip);
  border-top: 1px solid var(--line); flex-wrap: wrap; border-radius: 0 0 var(--radius-card) var(--radius-card);
}
.card-footer .key-date { font-size: 14px; color: var(--body); }
.card-footer .key-date strong { color: var(--text); font-weight: 600; }

.card-side { display: grid; gap: 22px; }
.card-side .card-section { padding-left: 0; padding-right: 0; }
.timeline { padding: 4px 0 10px; }
.tl-item { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 4px 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.tl-item:first-child { border-top: 0; }
.tl-item .avatar { width: 26px; height: 26px; font-size: 10.5px; }
.tl-item .avatar.is-system { background: transparent; border: 1px dashed var(--line-strong); color: var(--muted); }
.tl-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); flex-wrap: wrap; }
.tl-head .tl-kind { font-weight: 600; color: var(--body); }
.tl-head .tl-kind.k-status { color: var(--st-fadv); }
.tl-head .tl-kind.k-fadv { color: var(--st-fadv); }
.tl-head .tl-kind.k-fadv.is-bad { color: var(--urgent); }
.tl-text { grid-column: 2; font-size: 14px; line-height: 1.45; }
.timeline-more { padding: 2px 0 14px; }
.actions-grid { display: grid; gap: 10px; padding: 12px 0 16px; }
.action-row { display: grid; gap: 6px; }
.action-row label { font-size: 13px; color: var(--body); }
.action-inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.action-inline input[type="date"], .action-inline select { height: 36px; border: 1px solid var(--line-strong); border-radius: var(--radius-ctrl); background: var(--surface); padding: 0 8px; font-size: 14px; min-width: 0; }
.action-later { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- messages ---------- */

/* The conversation list is the lighter column (hairline on its right), the thread the work; both start on a heavy rule */
.messages-layout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 24px; align-items: start; }
.conv-col { min-width: 0; display: grid; gap: 22px; border-top: 2px solid var(--text); padding-top: 4px; }
@media (min-width: 900px) { .conv-col { border-right: 1px solid var(--line); padding-right: 20px; } }
.conversation-list { background: transparent; border: 0; border-radius: 0; margin: 0 -10px; }
.mention-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 0 4px; }
.mention-item {
  display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 8px 0 7px; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600;
}
.mention-item svg { width: 13px; height: 13px; color: var(--muted); }
.mention-item .loc-pill { height: 18px; padding: 0 5px; font-size: 11px; }
.mention-item:hover { border-color: var(--accent); color: var(--accent); }
.conversation-item {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 2px 12px; align-items: center; width: 100%; text-align: left;
  padding: 12px 10px; border: 0; border-top: 1px solid var(--line); background: transparent; border-radius: 6px;
}
.conversation-item:first-child { border-top: 0; }
.conversation-item:hover { background: var(--surface); }
.conversation-item.is-active { background: var(--surface); box-shadow: inset 3px 0 0 var(--accent); }
.conversation-item.is-active + .conversation-item { border-top-color: transparent; }
.conv-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--body); grid-row: span 2; }
.conv-icon svg { width: 18px; height: 18px; }
.conv-icon.is-dm { border-radius: 50%; font-size: 12px; font-weight: 700; }
.conv-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conv-name.is-unread { font-weight: 700; }
.conv-preview { grid-column: 2 / span 2; font-size: 13px; color: var(--body); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.conv-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums; }
.conv-when { font-size: 12px; color: var(--muted); white-space: nowrap; }

.thread { background: transparent; border: 0; border-top: 2px solid var(--text); border-radius: 0; display: flex; flex-direction: column; min-height: 560px; max-height: calc(100vh - var(--topbar-h) - 100px); }
.thread-head { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-strong); flex-wrap: wrap; }
.thread-head h2 { font-size: 17px; font-weight: 600; }
.thread-head .members { font-size: 13px; color: var(--muted); }
.thread-head .thread-loc { margin-left: auto; }
.thread-head .thread-back { margin: 0; flex: none; }
.thread-body { flex: 1; overflow: auto; padding: 10px 0; }
.message { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 2px 12px; padding: 9px 0; }
.message .avatar { width: 30px; height: 30px; font-size: 11px; grid-row: span 2; align-self: start; margin-top: 2px; }
.message.is-mine .avatar { background: var(--chrome); color: var(--chrome-text); }
.msg-head { display: flex; gap: 8px; align-items: baseline; font-size: 13px; color: var(--muted); }
.msg-head strong { color: var(--text); font-size: 14px; font-weight: 600; }
.msg-text { font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.applicant-chip {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px 0 6px; margin: 2px 2px 0 0; border-radius: 6px;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font-size: 13px; font-weight: 600; vertical-align: middle;
}
.applicant-chip svg { width: 13px; height: 13px; color: var(--muted); }
.applicant-chip:hover { border-color: var(--accent); color: var(--accent); }
.unread-marker { display: flex; align-items: center; gap: 10px; margin: 8px 0; font-size: 12px; font-weight: 600; color: var(--accent); }
.unread-marker::before, .unread-marker::after { content: ""; flex: 1; height: 1px; background: var(--accent); opacity: .5; }
.day-marker { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0 2px; }
.composer { display: flex; gap: 8px; padding: 12px 0 0; border-top: 1px solid var(--line-strong); }
.composer-input { flex: 1; height: 40px; min-width: 0; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-ctrl); background: var(--surface); font-size: 15px; }
.composer-input::placeholder { color: var(--muted); }
.composer-send { height: 40px; }
.thread-empty { flex: 1; display: grid; place-items: center; color: var(--muted); padding: 40px; text-align: center; }

/* ---------- dashboard ---------- */

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
@media (min-width: 1180px) {
  .dash-grid { grid-template-columns: minmax(560px, 1fr) 320px; gap: 24px; }
  .dash-grid .side .panel-alerts { order: -1; }   /* alerts ride on top of the side column on desktop; hold-ups come first on phone */
}
/* The dashboard is one ruled figure sheet on the page: a section title over a heavy rule, hairlines between cells and rows,
   sub-sections on a lighter rule. Hierarchy comes from type size, rule weight and placement, not boxes. */
.sheet { background: transparent; border: 0; border-radius: 0; }
.sheet.sheet-wide { margin-top: 30px; }            /* FedEx and VA sheets span the whole work area under the grid */
.sheet-title { display: flex; align-items: baseline; gap: 10px; padding: 0 0 8px; border-bottom: 2px solid var(--text); font-weight: 600; font-size: 17px; flex-wrap: wrap; }
.sheet-title .sub { font-size: 13px; color: var(--muted); font-weight: 400; }
.sheet-title.sheet-sub { font-size: 14px; padding: 18px 0 6px; border-bottom: 1px solid var(--line-strong); }
.sheet + .sheet { margin-top: 30px; }
/* The hero figure takes the whole first row and the four location cells fill the second, so no width leaves a lone cell beside a hole;
   the 1 px gaps on the line color draw the grid's hairlines, the cells are page-colored */
.cells { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.cell { background: var(--page); padding: 14px 16px 14px; min-width: 0; }
.cell:first-child, .cell-hero + .cell { padding-left: 0; }   /* the first column aligns with the title */
.cell-figure { font-size: 28px; }
.cell-hero { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; padding-left: 0; }
.cell-hero .cell-figure { font-size: 44px; font-variant-numeric: normal; letter-spacing: -0.03em; }
.cell-hero .cell-label { margin-top: 0; font-size: 15px; }
.cell-label { font-size: 13.5px; color: var(--body); margin-top: 6px; line-height: 1.3; }
.cell-delta { display: inline-block; margin-left: 6px; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--body); }
.cell-delta.is-up { color: var(--st-hired); }
.cell-delta.is-down { color: var(--urgent); }
.cell-delta.is-flat { color: var(--muted); }
.cell-figure.is-bad { color: var(--urgent); }
.cell-figure.is-good { color: var(--st-hired); }
.bar { display: block; width: 100%; height: 8px; margin-top: 8px; }
.bar path, .bar rect { fill: var(--bar); }
.bar.is-accent path, .bar.is-accent rect { fill: var(--accent); }

.bar-rows { padding: 6px 0 4px; display: grid; gap: 2px; }
.bar-row { display: grid; grid-template-columns: 180px minmax(0, 1fr) 36px; grid-template-areas: "label bar value"; gap: 10px; align-items: center; padding: 5px 0; font-size: 14px; }
.bar-row .bar-label { grid-area: label; color: var(--body); line-height: 1.3; }   /* a status name is never ellipsized */
.bar-row .bar { grid-area: bar; margin: 0; height: 10px; }
.bar-row .bar-value { grid-area: value; text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-row.is-group-fadv .bar rect { fill: var(--st-fadv); }
.bar-row.is-group-hired .bar rect { fill: var(--st-hired); }
.bar-row.is-group-closed .bar rect { fill: var(--line-strong); }
.bar-row.is-group-new .bar rect { fill: var(--text); }
.cells-fadv { grid-template-columns: repeat(5, minmax(0, 1fr)); }

.holdup-row { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 2px 14px; padding: 10px 8px 10px 0; border-top: 1px solid var(--line); align-items: center; width: 100%; text-align: left; border-left: 0; border-right: 0; border-bottom: 0; background: transparent; }
.sheet-title + .holdup-row { border-top: 0; }
/* In the side column the hold-ups list is lighter: a panel-weight title and a smaller timer than the sheet's hero figure */
.side .holdup-row { padding: 10px 6px 10px 0; grid-template-columns: 46px minmax(0, 1fr); gap: 3px 12px; }
.side .holdup-row .timer-figure { font-size: 26px; }
.side .sheet-title { padding: 0 0 8px; font-size: 14px; border-bottom: 1px solid var(--line-strong); }
.holdup-row:hover { background: var(--surface); }
.holdup-row .timer { grid-row: span 2; }
.holdup-name { font-size: 15px; font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.holdup-reason { font-size: 13.5px; color: var(--body); }

.table-wrap { overflow-x: auto; scrollbar-width: none; }
.table-wrap::-webkit-scrollbar { display: none; }
/* While the table can still scroll sideways its right edge fades, the same cue the location strips use (classes set by app.js) */
.table-wrap.can-scroll:not(.at-end) {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 48px), transparent);
}
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
/* On phone the FedEx table becomes one stacked card per location (app.js renders both; this picks one) */
.fedex-cards { display: none; }
.data-table th, .data-table td { padding: 10px 14px; text-align: right; border-top: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.data-table th { font-weight: 500; color: var(--body); font-size: 13px; border-top: 0; }
.data-table th:first-child, .data-table td:first-child { text-align: left; padding-left: 0; font-weight: 600; position: sticky; left: 0; background: var(--page); }
.data-table td:last-child, .data-table th:last-child { padding-right: 0; }
.data-table tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.data-table td.is-bad { color: var(--urgent); font-weight: 700; }
.data-table td .flag { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--urgent); margin-left: 6px; vertical-align: middle; }
.data-table td .mini-bar { display: inline-block; vertical-align: middle; width: 56px; height: 6px; margin-right: 8px; }
.data-table td .mini-bar path { fill: var(--bar); }
.table-note { padding: 8px 0 0; font-size: 13px; color: var(--muted); }

.va-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.va-block { background: var(--page); padding: 6px 18px 8px; }
.va-block:first-child { padding-left: 0; }
.va-block:last-child { padding-right: 0; }
@media (max-width: 520px) { .va-block { padding-left: 0; padding-right: 0; } }   /* one column: both blocks align with the title */
.va-block h3 { font-size: 13.5px; color: var(--body); font-weight: 500; padding: 8px 0 4px; }
.va-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.va-row .va-name { font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.va-row .va-figures { display: flex; gap: 14px; }
.va-row .va-fig { text-align: right; }
.va-row .va-fig .figure { font-size: 20px; display: block; }
.va-row .va-fig span { display: block; font-size: 12px; color: var(--muted); margin-top: 3px; }
.va-row .bar { margin-top: 4px; height: 6px; }

/* ---------- phone view (desktop only) ---------- */

/* From 1250 px up the panel docks on the right and the work area makes room for it (body.phone-view-open,
   set by app.js). Below 1250 px it floats over the page with a dimmed backdrop, so nothing is quietly hidden. */
.phone-view { position: fixed; z-index: 40; display: flex; }
.phone-view[hidden] { display: none; }
.phone-view-panel {
  display: flex; flex-direction: column; width: 470px; max-width: 100%;
  background: var(--chrome); color: var(--chrome-text);
}
.phone-view-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; font-size: 13px; }
.phone-view-head .btn { height: 30px; padding: 0 10px; font-size: 13px; background: transparent; color: var(--chrome-text); border-color: var(--chrome-line); }
.phone-shell { flex: none; display: flex; justify-content: center; align-items: flex-start; padding: 0 16px 16px; overflow: hidden; }
/* 390 by 844 plus the 8 px border on each side, so the frame is never clipped at its right and bottom edges (fitPhone scales 406 by 860) */
.phone-bezel { width: 406px; height: 860px; border-radius: 30px; border: 8px solid #2b2d33; background: #000; overflow: hidden; transform-origin: top center; flex: none; }
.phone-frame { display: block; width: 390px; height: 844px; border: 0; background: var(--page); }
@media (min-width: 1250px) {
  .phone-view { right: 0; top: var(--topbar-h); bottom: 0; z-index: 14; }
  .phone-view-panel { height: 100%; border-left: 1px solid var(--chrome-line); }
  body.phone-view-open .work { margin-right: 470px; }
}
@media (min-width: 1250px) and (max-width: 1649px) {
  /* with the panel docked there is no room for a side column until 1650 px; the panels fall under the primary column */
  body.phone-view-open .desk-grid, body.phone-view-open .card-layout, body.phone-view-open .dash-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  body.phone-view-open .dash-grid .side .panel-alerts { order: 0; }
  body.phone-view-open .dash-grid > .side { border-left: 0; padding-left: 0; }
  body.phone-view-open .messages-layout { grid-template-columns: 280px minmax(0, 1fr); }
}
/* Inside the frame the outer page owns the company switch and the phone-view control */
html[data-frame="1"] .company-switch { display: none; }
@media (max-width: 1249px) {
  .phone-view { inset: 0; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 17, 23, .55); }
  .phone-view-panel { max-height: 100%; border-radius: 14px; border: 1px solid var(--chrome-line); overflow: hidden; }
}
/* Inside the frame the page's top-right badge must clear the bezel's rounded corner */
html[data-frame="1"] .icon-btn .count { top: -4px; right: -2px; }

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 8px); z-index: 60; max-width: calc(100vw - 32px);
  padding: 10px 16px; border-radius: 10px; background: var(--chrome); color: var(--chrome-text); font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .18s, transform .18s;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- phone layout ---------- */

@media (max-width: 899px) {
  :root { --topbar-h: 52px; }
  .rail {
    top: auto; bottom: 0; left: 0; right: 0; width: auto; height: 60px;
    flex-direction: row; align-items: stretch; border-top: 1px solid var(--chrome-line);
  }
  .rail-band, .rail-group-label, .rail-spacer, .rail-viewer { display: none; }
  .rail-group { display: contents; }
  .rail-item { flex: 1; justify-content: center; padding: 6px 2px 4px; border-radius: 0; font-size: 12px; gap: 2px; }
  .rail-item .later-tag { display: inline; margin: 0 0 0 4px; }   /* "Safety later" on one line in the bottom bar */
  .rail-item.is-active::before { left: 25%; right: 25%; top: 0; bottom: auto; height: 3px; width: auto; border-radius: 0 0 3px 3px; }
  .rail-badge { right: calc(50% - 22px); top: 2px; }
  .work { margin-left: 0; padding-bottom: 60px; }
  .topbar { background: var(--chrome); color: var(--chrome-text); border-bottom: 0; padding: 0 12px; gap: 10px; }
  .topbar :focus-visible { outline-color: var(--focus-on-chrome); }
  .topbar .tp-mark { display: inline-grid; width: 30px; height: 30px; font-size: 14px; border-radius: 7px; }
  .module-name { font-size: 14px; }
  .module-name small { display: none; }
  .find, .phone-view-toggle { display: none; }
  .company-switch { border-color: var(--chrome-line); background: var(--chrome-2); padding: 2px; }
  .company-option { min-height: 36px; padding: 0 9px; font-size: 12px; color: var(--chrome-muted); }   /* 36 px tap target in the 52 px bar */
  .company-option.is-active { background: var(--chrome-text); color: var(--chrome); }
  .company-option:not(.is-active):hover { color: var(--chrome-text); }
  .icon-btn { border-color: var(--chrome-line); background: var(--chrome-2); color: var(--chrome-text); width: 36px; height: 36px; }
  .icon-btn .count { top: -6px; right: -3px; }
  .alerts-popover { right: 12px; top: calc(var(--topbar-h) + 6px); width: calc(100vw - 24px); color: var(--text); }
  .screen { padding: 14px 16px 36px; }
  .screen-title { font-size: 20px; }
  .screen-head { gap: 10px; margin-bottom: 12px; }
  .desk-grid { gap: 14px; }

  /* One scrolling strip for every Home filter: the assignee select first (short labels, a person glyph), then the location
     pills; the strip fades at its right edge while it can still scroll (classes set by app.js) */
  .filters { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 6px; padding: 2px; margin: -2px; width: calc(100% + 4px); max-width: none; }
  .filters::-webkit-scrollbar { display: none; }
  .filters.can-scroll:not(.at-end) {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
  }
  .filters .location-filter { flex: none; overflow: visible; padding: 0; margin: 0; max-width: none; }
  .filters .who-select {
    order: -1; flex: none; width: auto; padding-left: 32px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e717a' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236e717a' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-position: left 10px center, right 10px center; background-size: 15px 15px, 14px 14px;
  }
  .filters .who-select.is-active {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21a8 8 0 0 1 16 0'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  }

  /* The hint is one short line; the info control opens the rest in place */
  .queue-head { flex-wrap: nowrap; padding: 6px 0; }
  .queue-head .sort-note { flex: 1 1 auto; min-width: 0; }
  .queue-head:not(.is-open) .sort-note-more { display: none; }
  .hint-info {
    display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; padding: 0; border-radius: 50%;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: 13px; font-weight: 700; font-style: italic;
  }
  .queue-head.is-open .hint-info { background: var(--text); color: var(--surface); border-color: var(--text); }

  .queue-row {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    grid-template-areas: "timer main main" "timer tags status" "timer meta meta" "timer actions actions";
    column-gap: 12px; row-gap: 6px; padding: 12px 0;
  }
  .timer-figure { font-size: 32px; }
  .queue-name { font-size: 16px; white-space: normal; }
  /* Tap targets: the name button's hit box is 40 px tall (padding into the row's own spacing, layout unchanged); the status chip,
     the actions and the filter pills are 36 to 38 px */
  .queue-open { padding: 10px 0; margin: -10px 0; min-height: 40px; display: flex; align-items: center; }
  .queue-open .queue-name { flex: 1 1 auto; min-width: 0; }
  .queue-tags { grid-area: tags; }
  .queue-tags .avatar { width: 22px; height: 22px; font-size: 10px; }
  .queue-status { justify-self: end; }
  .queue-status .chip { max-width: 200px; overflow: hidden; }
  .queue-status .chip span { overflow: hidden; text-overflow: ellipsis; }
  .status-control { height: 36px; padding: 0 12px; }
  .queue-actions { justify-self: start; justify-content: flex-start; margin-top: 2px; }
  .queue-actions .btn-small { height: 38px; }
  .cleared-note .undo { padding: 8px 6px; margin: -8px -6px; }
  .location-option, .who-select { height: 36px; }
  .lead-open { min-height: 36px; display: inline-flex; align-items: center; }
  .menu-backdrop { display: block; position: fixed; inset: 0; z-index: 44; background: rgba(15, 17, 23, .35); }
  .status-menu {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 45; min-width: 0; max-height: 72vh; overflow: auto;
    border-radius: 16px 16px 0 0; border: 0; padding: 8px 12px 20px;
  }
  .status-menu .menu-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 6px 8px; margin-bottom: 4px;
    border-bottom: 1px solid var(--line); font-weight: 600; font-size: 15px;
  }
  .status-menu .menu-head small { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
  .status-option { padding: 11px 10px; font-size: 15px; }
  .toast { bottom: 76px; }
  .cleared-note { grid-area: meta; }

  /* The pin is one row on phone: Log touch and the status control at the left, Fields (icon and word) at the right; the pills
     sit above the name instead (app.js) */
  .card-pin { padding: 8px 10px 8px 14px; flex-wrap: nowrap; gap: 8px; }
  .card-quick { flex: 1 1 auto; }
  .card-quick .log-touch { height: 36px; flex: none; }
  .card-quick .status-control { height: 36px; flex: 0 1 auto; max-width: 176px; }
  .card-pin .pin-right { flex: none; }
  .field-picker-toggle { height: 36px; padding: 0 9px; }
  .field-picker-toggle .n { display: none; }
  .card-identity { padding: 16px 14px 6px; }
  .card-name { font-size: 24px; }
  .card-section { padding: 10px 14px 12px; }
  .field-row { grid-template-columns: 120px minmax(0, 1fr); font-size: 14.5px; }
  .fadv-summary { padding: 12px 14px; }
  .fadv-rows { grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0 14px 14px; }
  .fadv-item .fadv-full { display: block; }   /* key, full name, state: three lines in every cell so paired cells match */
  .fadv-extra { padding: 0 14px 12px; }
  .card-footer { padding: 12px 14px; }
  .field-picker { padding: 12px 14px 14px; }
  .card-contact { grid-template-columns: minmax(0, 1fr); }
  .contact-actions { grid-column: 1; grid-row: auto; justify-self: start; margin-top: 2px; }
  .contact-actions .btn-small { height: 36px; }

  .messages-layout { grid-template-columns: minmax(0, 1fr); }
  .messages-layout.show-thread .conv-col { display: none; }
  .messages-layout.show-list .thread { display: none; }
  /* An applicant chip in a message sits on its own line at a 36 px tap height instead of inline at 24 px */
  .applicant-chip { display: flex; width: fit-content; max-width: 100%; min-height: 36px; margin: 6px 0 0; padding: 0 10px 0 8px; }
  .applicant-chip svg { width: 14px; height: 14px; }
  .mention-item { min-height: 36px; }
  .thread { min-height: 0; height: calc(100vh - var(--topbar-h) - 60px - 28px); max-height: none; }
  .messages-layout.show-thread { margin-bottom: -22px; }
  .thread-head .thread-loc { margin-left: 0; }

  .cells, .cells-fadv { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* two columns under a full-width first cell: the left column (even cells) aligns with the title, the right column is indented past the hairline */
  .cell { padding: 12px 10px 12px 0; }
  .cell:nth-child(odd):not(:first-child) { padding-left: 14px; }
  .cell-figure { font-size: 26px; }
  .cell-hero, .cell-wide { grid-column: 1 / -1; padding-left: 0; }
  /* label and figure on one line, the bar under them: a status name never truncates on phone */
  .bar-row { grid-template-columns: minmax(0, 1fr) 30px; grid-template-areas: "label value" "bar bar"; gap: 3px 10px; padding: 6px 0; font-size: 13.5px; }
  .bar-row .bar { height: 8px; }
  .sheet-title { font-size: 16px; }
  .holdup-row { padding: 10px 0; grid-template-columns: 52px minmax(0, 1fr); }
  .data-table th:first-child, .data-table td:first-child { padding-left: 14px; }
  .data-table td:last-child, .data-table th:last-child { padding-right: 14px; }
  .data-table th, .data-table td { padding: 9px 10px; }
  /* FedEx by location: one stacked card per location with all six metrics in view; the table is for desktop */
  .fedex-table { display: none; }
  .fedex-cards { display: grid; gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
  .fedex-card { background: var(--page); padding: 10px 0 12px; }
  .fedex-loc { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
  .fedex-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 10px; margin: 0; }
  .fedex-metric { min-width: 0; }
  .fedex-metric dt { font-size: 12px; color: var(--body); line-height: 1.25; }
  .fedex-metric dd { margin: 3px 0 0; font-size: 22px; font-variant-numeric: tabular-nums; }
  .fedex-metric.is-bad dd { color: var(--urgent); }
  .fedex-metric dd .flag { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--urgent); margin-left: 5px; vertical-align: middle; }
  .task-item, .lead-item, .alert-item { padding-left: 0; padding-right: 0; }
}

@media (max-width: 379px) {
  .company-option { padding: 0 7px; font-size: 11.5px; }
  /* the gutter keeps its 56 px so "days over" stays on one line; the gap and left padding give back the 6 px */
  .queue-row { grid-template-columns: 56px minmax(0, 1fr) auto; column-gap: 8px; padding-left: 7px; }
  .timer-figure { font-size: 30px; }
  .queue-status .chip { max-width: 170px; }
  /* the three strip cells size to their labels here so "Tasks today" never truncates */
  .desk-grid.is-stacked .side .panel:not([open]) { min-width: max-content; }
  .desk-grid.is-stacked .side .panel:not([open]) .panel-title { padding: 0 5px 0 7px; gap: 5px; }
  .card-quick .status-control { max-width: 142px; }
  .field-picker-toggle { padding: 0 7px; }
  /* Log touch, Call later, Text later on one line in the 242 px strip */
  .queue-actions { gap: 4px; }
  .queue-actions .log-touch { padding: 0 8px; }
  .queue-actions .btn-later { padding: 0 5px; gap: 4px; }
  .queue-actions .btn-later .later { padding: 1px 3px; }
}

@media (min-width: 900px) and (max-width: 1179px) {
  .screen { padding: 20px 20px 48px; }
}

/* ---------- frame mode (inside the desktop phone view) ---------- */

html[data-frame="1"] .phone-view-toggle { display: none; }

/* ---------- motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
