/*
 * Pistn CRM
 *
 * One light surface everywhere. The earlier build split dark index views from
 * light detail views, which made the app feel like two products stitched
 * together — the seam showed every time you clicked into a lead.
 *
 * Red is the Pistn logo colour (#EC0000) softened for screen use. It stays
 * scarce: the hero card, the primary button, the active nav item, urgency.
 * Nothing else.
 */

:root {
  /* Brand — the logo red, lifted slightly so it holds contrast on a dark
     surface. The deep pair still carries the hero gradient. */
  --red:        #e5484d;
  --red-hover:  #ef5b60;
  --red-deep:   #a8252c;
  --red-tint:   rgba(229, 72, 77, 0.15);
  --red-ring:   rgba(229, 72, 77, 0.30);

  /* Surfaces. Depth comes from stepped backgrounds and hairlines, not shadow —
     a drop shadow on a dark ground reads as mud. */
  --ground:     #131417;
  --card:       #1b1d22;
  --card-alt:   #212429;
  --line:       #2b2e35;
  --line-soft:  #23262c;

  /* Text */
  --ink:        #eceef2;
  --ink-2:      #b6bac4;
  --muted:      #868b98;
  --faint:      #646977;

  /* Signals, brightened for a dark ground */
  --amber:      #f0a63a;
  --amber-tint: rgba(240, 166, 58, 0.14);
  --go:         #35c98a;
  --go-tint:    rgba(53, 201, 138, 0.14);
  --blue:       #6d9ef7;
  --blue-tint:  rgba(109, 158, 247, 0.14);
  --violet:     #a887f0;
  --violet-tint:rgba(168, 135, 240, 0.14);

  --body: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --data: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --r:    14px;
  --r-sm: 9px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.30);
  --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.36), 0 14px 34px rgba(0, 0, 0, 0.30);

  --side-w: 232px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--body);
  font-size: 14px;
  line-height: 1.55;
  background: var(--ground);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; border-radius: 4px; }

.mono, .num { font-family: var(--data); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }

/* ══ Shell ══════════════════════════════════════════════════════════════ */
.app { display: flex; min-height: 100vh; }

.side {
  width: var(--side-w);
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 20px; }

/* Drawn rather than loaded: no image request, crisp at any density. */
.side-mark {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: linear-gradient(150deg, var(--red) 0%, var(--red-deep) 100%);
  position: relative;
  flex-shrink: 0;
}
.side-mark::after {
  content: "";
  position: absolute;
  inset: 8px 7px;
  background: #fff;
  clip-path: polygon(0 0, 100% 0, 100% 42%, 38% 42%, 38% 100%, 0 100%);
}

.side-name { font-size: 15.5px; font-weight: 800; letter-spacing: -0.2px; }
.side-name span { color: var(--muted); font-weight: 600; }

.side-nav { flex: 1; padding: 0 12px; overflow-y: auto; }

.side-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 14px 10px 7px;
}

.side-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-2);
  position: relative;
  margin-bottom: 2px;
}
.side-item:hover { background: var(--line-soft); color: var(--ink); }

.side-item[aria-current="page"] { background: var(--red-tint); color: #f4787c; font-weight: 600; }
.side-item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: -12px; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--red);
}

.side-item-label { flex: 1; }

.side-icon { width: 17px; height: 17px; flex-shrink: 0; stroke-width: 1.8; }

.side-badge {
  min-width: 20px; height: 19px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--red);
  color: #fff;
  font-family: var(--data);
  font-size: 11px;
  display: grid;
  place-items: center;
}

.side-foot { padding: 14px 16px 16px; border-top: 1px solid var(--line); }
.side-user { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--red) 0%, var(--red-deep) 100%);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.side-user-text { min-width: 0; line-height: 1.3; }
.side-user-text strong { display: block; font-size: 13px; font-weight: 600; }
.side-user-text span {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.side-signout {
  width: 100%;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
}
.side-signout:hover { background: var(--line-soft); color: var(--ink); }

.side-scrim { display: none; }
.side-open { display: none; }

/* ══ Main ═══════════════════════════════════════════════════════════════ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 26px;
  position: sticky;
  top: 0;
  background: var(--ground);
  z-index: 20;
}

.topsearch { flex: 1; max-width: 460px; }
.topsearch input {
  width: 100%;
  font-family: var(--body);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 16px;
}
.topsearch input::placeholder { color: var(--faint); }
.topsearch input:focus { outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--red-ring); }

.topbar-date { margin-left: auto; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.shell { padding: 4px 26px 56px; max-width: 1400px; }
.shell-wide { max-width: none; }
/* Kept as a hook so views need no edits; the split surface is gone. */
.paper-shell { display: contents; }

/* ══ Sections ═══════════════════════════════════════════════════════════ */
.section { margin-bottom: 28px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.section-title { font-size: 15px; font-weight: 700; letter-spacing: -0.2px; white-space: nowrap; }
.section-rule { flex: 1; }
.section-note { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.section-note.is-warn { color: var(--amber); font-weight: 600; }

/* ══ Cards ══════════════════════════════════════════════════════════════ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow);
}

/* ══ Hero — the one filled, saturated thing on the page ═════════════════ */
.upnext {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 22px;
  border-radius: var(--r);
  background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
  color: #fff;
  box-shadow: none;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}
.upnext::after {
  content: "";
  position: absolute;
  right: -60px; top: -110px;
  width: 340px; height: 340px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.16) 0%, rgba(255,255,255,0) 70%);
  pointer-events: none;
}
.upnext:hover { filter: brightness(1.06); }

.upnext-count { font-size: 40px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; position: relative; }
.upnext-label { flex: 1; position: relative; }
.upnext-label strong { display: block; font-size: 15px; font-weight: 600; }
.upnext-label span { font-size: 13px; color: rgba(255, 255, 255, 0.78); }

.upnext-go {
  position: relative;
  font-size: 12.5px;
  font-weight: 700;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  white-space: nowrap;
}
.upnext:hover .upnext-go { background: rgba(255, 255, 255, 0.26); }

/* ══ Bay strip ══════════════════════════════════════════════════════════ */
.bays { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; }

.bay {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 15px 16px 14px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bay:hover { box-shadow: var(--shadow-lift); }

/* A quiet fill proportional to the count — pipeline shape at a glance,
   without six saturated blocks competing with the hero card. */
.bay-fill {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(to top, rgba(229, 72, 77, 0.20), rgba(229, 72, 77, 0));
  transition: height 260ms ease;
}

.bay-name {
  position: relative;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.bay-count {
  position: relative;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  font-variant-numeric: tabular-nums;
}
.bay.is-empty .bay-count { color: var(--faint); }

/* ══ Queue rows ═════════════════════════════════════════════════════════ */
.queue {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.queue-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}
.queue-row:last-child { border-bottom: 0; }
.queue-row:hover { background: var(--card-alt); }

.queue-kind {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--line-soft);
  padding: 3px 8px;
  border-radius: 5px;
  width: 62px;
  text-align: center;
  flex-shrink: 0;
}
.queue-name { flex: 1; font-weight: 500; }
.queue-where { color: var(--muted); font-size: 12.5px; }
.queue-due { font-family: var(--data); font-size: 12px; color: var(--muted); white-space: nowrap; }
.queue-due.is-overdue { color: var(--amber); font-weight: 500; }

/* ══ Holds ══════════════════════════════════════════════════════════════ */
.hold {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: var(--r);
  margin-bottom: 8px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
}
.hold:hover { box-shadow: var(--shadow-lift); }
.hold-flag { color: var(--amber); flex-shrink: 0; }
.hold-text { flex: 1; }
.hold-go { font-size: 12px; font-weight: 600; color: var(--red); white-space: nowrap; }

/* ══ Tables ═════════════════════════════════════════════════════════════ */
.sheet-scroll {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.sheet { width: 100%; border-collapse: collapse; font-size: 13.5px; }

.sheet thead th {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
  padding: 12px 16px;
  background: var(--card-alt);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.sheet tbody td {
  padding: 0 16px;
  height: 46px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.sheet tbody tr:last-child td { border-bottom: 0; }
.sheet tbody tr:hover td { background: var(--card-alt); }
.sheet .mono, .sheet .num { font-size: 12.5px; }
.sheet-paper tr.is-revoked td { opacity: 0.5; }

.sheet-link { font-weight: 600; }
.sheet-link:hover { color: var(--red); }
.is-missing { color: var(--faint); font-style: italic; }
.is-warn-text { color: var(--amber); }

/* ══ Chips ══════════════════════════════════════════════════════════════ */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--line-soft);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.chip-new            { background: var(--line-soft);   color: var(--ink-2); }
.chip-contacted      { background: var(--blue-tint);   color: var(--blue); }
.chip-demo_scheduled { background: var(--violet-tint); color: var(--violet); }
.chip-proposal_sent  { background: var(--amber-tint);  color: var(--amber); }
.chip-won            { background: var(--go-tint);     color: var(--go); }
.chip-lost           { background: var(--line-soft);   color: var(--faint); }

.chip-P0 { background: var(--red-tint);   color: #f4787c; }
.chip-P1 { background: var(--amber-tint); color: var(--amber); }
.chip-P2 { background: var(--line-soft);  color: var(--muted); }

/* ══ Buttons ════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 17px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--line-soft); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-hover); border-color: var(--red-hover); }
.btn-primary:disabled:hover { background: var(--red); }

.linkish {
  background: none;
  border: 0;
  color: var(--muted);
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
  padding: 4px;
}
.linkish:hover { color: var(--red); }

/* ══ Forms ══════════════════════════════════════════════════════════════ */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }

.field input[type="text"], .field input[type="email"], .field input[type="password"],
.field input[type="date"], .field input[type="number"], .field input[type="search"],
.field select, .field textarea,
input.filter-search, select.filter-select {
  width: 100%;
  font-family: var(--body);
  font-size: 13.5px;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}

.field input:focus, .field select:focus, .field textarea:focus,
.filter-search:focus, .filter-select:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-ring);
}

.field input[type="number"] { width: 7rem; }
.field input:disabled, .field textarea:disabled, .field select:disabled {
  background: var(--card-alt); color: var(--muted);
}
.field-hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.field-row { display: flex; gap: 14px; }
.field-row .field { flex: 1; min-width: 0; }

.checkbox-row {
  display: inline-flex !important;
  align-items: center;
  gap: 9px;
  font-size: 13.5px !important;
  font-weight: 500 !important;
  color: var(--ink) !important;
  margin-bottom: 0 !important;
  cursor: pointer;
}

input[type="submit"] {
  font-family: var(--body);
  font-size: 13px;
  font-weight: 600;
  padding: 9px 17px;
  border-radius: 999px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
  cursor: pointer;
}
input[type="submit"]:hover { background: var(--red-hover); border-color: var(--red-hover); }

.compose { font-family: var(--body); line-height: 1.62; min-height: 320px; resize: vertical; }

/* ══ Filters ════════════════════════════════════════════════════════════ */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.filter-search { flex: 1; min-width: 220px; }
.filter-select { width: auto !important; }

/* ══ Tabs ═══════════════════════════════════════════════════════════════ */
.tabs, .subnav { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }

.tab, .subnav a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 8px 15px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
}
.tab:hover, .subnav a:hover { background: var(--line-soft); }
.tab.is-on, .subnav a[aria-current="page"] {
  background: var(--red-tint);
  border-color: transparent;
  color: #f4787c;
}
.tab-count { font-family: var(--data); font-size: 11.5px; color: var(--muted); }
.tab.is-on .tab-count { color: #f4787c; }

/* ══ Board ══════════════════════════════════════════════════════════════ */
.board { display: grid; grid-template-columns: repeat(6, minmax(196px, 1fr)); gap: 12px; align-items: start; }
.column { min-width: 0; }

.column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  margin-bottom: 9px;
  border-top: 2px solid var(--muted);
}
.column-new            { border-top-color: var(--muted); }
.column-contacted      { border-top-color: var(--blue); }
.column-demo_scheduled { border-top-color: var(--violet); }
.column-proposal_sent  { border-top-color: var(--amber); }
.column-won            { border-top-color: var(--go); }
.column-lost           { border-top-color: var(--faint); }

.column-name { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.column-count { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.column-body { min-height: 90px; display: flex; flex-direction: column; gap: 8px; padding-bottom: 6px; }

.work-order {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 13px;
  cursor: grab;
  box-shadow: var(--shadow);
}
.work-order:hover { box-shadow: var(--shadow-lift); }
.work-order:active { cursor: grabbing; }
.work-order.is-dragging { opacity: 0.35; }

.work-order-name { font-weight: 600; font-size: 13px; display: block; }
.work-order-where { font-size: 12px; color: var(--muted); margin-top: 2px; }
.work-order-foot { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.work-order-hold { color: var(--amber); font-size: 12px; }
.column-more { font-size: 12px; color: var(--muted); padding: 6px 2px; text-align: center; }

/* ══ Lead detail ════════════════════════════════════════════════════════ */
.lead-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.lead-name { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; line-height: 1.15; }
.lead-where { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.lead-chips { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding-top: 5px; }
.lead-chips form { margin: 0; }

.bay-buttons { display: flex; flex-wrap: wrap; gap: 7px; }
.bay-buttons form { margin: 0; }
.bay-buttons .btn.is-current, .bay-buttons .btn:disabled {
  background: var(--red); border-color: var(--red); color: #fff; opacity: 1; cursor: default;
}

/* ══ Timeline ═══════════════════════════════════════════════════════════ */
.timeline { list-style: none; }
.timeline-item { position: relative; padding: 0 0 18px 20px; border-left: 1px solid var(--line); }
.timeline-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -4.5px; top: 5px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--card);
  border: 2px solid var(--faint);
}
.timeline-status_change::before { border-color: var(--red); }
.timeline-email::before, .timeline-email_replied::before { border-color: var(--go); }

.timeline-top { display: flex; align-items: baseline; gap: 10px; }
.timeline-kind { font-size: 10.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.timeline-when { font-family: var(--data); font-size: 11.5px; color: var(--faint); }
.timeline-body { font-size: 13.5px; margin-top: 3px; }
.timeline-who { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* ══ Outbox ═════════════════════════════════════════════════════════════ */
.bulk-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 10px;
  flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.bulk-all { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; }
.bulk-count { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

.messages { display: flex; flex-direction: column; gap: 9px; }

.message {
  display: flex;
  gap: 13px;
  padding: 15px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  box-shadow: var(--shadow);
}
.message:hover { box-shadow: var(--shadow-lift); }
.message.is-blocked { border-left: 3px solid var(--amber); }

.message-pick { flex-shrink: 0; padding-top: 2px; }
.message-body { flex: 1; min-width: 0; }
.message-top { display: flex; align-items: baseline; gap: 12px; }
.message-subject { font-weight: 600; font-size: 14px; flex: 1; }
.message-subject:hover { color: var(--red); }
.message-when { font-family: var(--data); font-size: 11.5px; color: var(--faint); white-space: nowrap; }
.message-meta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.message-preview { font-size: 12.5px; color: var(--faint); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-blocked { font-size: 12.5px; color: var(--amber); margin-top: 7px; font-weight: 500; }

/* ══ Tasks ══════════════════════════════════════════════════════════════ */
.task-row {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 8px;
  font-size: 13.5px;
  box-shadow: var(--shadow);
}
.task-row.is-overdue { border-left: 3px solid var(--amber); }
.task-row.is-p0 { border-left: 3px solid var(--red); }

.task-check { flex-shrink: 0; display: flex; }
.task-check form { margin: 0; }
.task-check button {
  width: 19px; height: 19px;
  border: 1.5px solid var(--faint);
  border-radius: 50%;
  background: none;
  cursor: pointer;
  padding: 0;
}
.task-check button:hover { border-color: var(--go); background: var(--go-tint); }

.task-title { flex: 1; }
.task-shop { color: var(--muted); font-size: 12.5px; }
.task-due { font-family: var(--data); font-size: 12px; color: var(--muted); white-space: nowrap; }
.task-due.is-overdue { color: var(--amber); font-weight: 500; }

/* ══ Sequences ══════════════════════════════════════════════════════════ */
.step-list { list-style: none; border-top: 1px solid var(--line); }
.step-list li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13.5px;
}
.step-list li:last-child { border-bottom: 0; }
.step-when { font-family: var(--data); font-size: 11.5px; color: var(--muted); width: 84px; flex-shrink: 0; }
.step-subject { flex: 1; font-weight: 500; }
.step-mode { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* ══ Tokens & runs ══════════════════════════════════════════════════════ */
.token-reveal {
  background: var(--card-alt);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-size: 13px;
  word-break: break-all;
  user-select: all;
}
.run-rejections { padding: 10px 16px 13px !important; height: auto !important; background: var(--card-alt); }
.run-rejection {
  display: inline-block;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  margin: 2px 5px 2px 0;
}
.status-line { display: flex; align-items: center; gap: 12px; font-size: 13.5px; flex-wrap: wrap; }

/* ══ Flash ══════════════════════════════════════════════════════════════ */
.flash {
  padding: 13px 17px;
  border-radius: var(--r-sm);
  margin-bottom: 16px;
  font-size: 13.5px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 3px solid var(--muted);
}
.flash-alert  { background: var(--red-tint); border-color: var(--line); border-left-color: var(--red); }
.flash-notice { background: var(--go-tint); border-color: var(--line); border-left-color: var(--go); }

/* ══ Empty ══════════════════════════════════════════════════════════════ */
.empty {
  padding: 46px 22px;
  text-align: center;
  color: var(--muted);
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--r);
  font-size: 13.5px;
}

/* ══ Auth ═══════════════════════════════════════════════════════════════ */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--ground); }
.auth-card {
  width: 100%;
  max-width: 390px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px;
  box-shadow: var(--shadow-lift);
}
.auth-brand { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; margin-bottom: 4px; }
.auth-sub { font-size: 13.5px; color: var(--muted); margin-bottom: 24px; }

/* ══ Pager ══════════════════════════════════════════════════════════════ */
.pager { margin-top: 18px; font-size: 13px; display: flex; gap: 9px; align-items: center; }
.pager a { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-weight: 600; }
.pager a:hover { background: var(--line-soft); }
.pager .pager-at { color: var(--muted); }

/* ══ Utils ══════════════════════════════════════════════════════════════ */
.stack-sm > * + * { margin-top: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }

/* ══ Motion ═════════════════════════════════════════════════════════════ */
@keyframes edge-flash {
  from { box-shadow: inset 3px 0 0 var(--red), var(--shadow); }
  to   { box-shadow: inset 3px 0 0 transparent, var(--shadow); }
}
.just-changed { animation: edge-flash 1.1s ease-out; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ══ Responsive ═════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .bays { grid-template-columns: repeat(3, 1fr); }
  .board { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
}

@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

@media (max-width: 820px) {
  .side {
    position: fixed;
    left: 0; top: 0; bottom: 0;
    z-index: 60;
    transform: translateX(-100%);
    transition: transform 200ms ease;
    box-shadow: var(--shadow-lift);
  }
  .app.is-open .side { transform: translateX(0); }
  .app.is-open .side-scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 50;
  }
  .side-open {
    display: grid;
    place-items: center;
    width: 38px; height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--card);
    font-size: 15px;
    cursor: pointer;
  }
  .topbar { padding: 14px 18px; }
  .shell { padding: 4px 18px 48px; }
  .topbar-date { display: none; }
  .bays { grid-template-columns: repeat(2, 1fr); }
  .board { grid-template-columns: 1fr; }
  .field-row { flex-direction: column; gap: 0; }
  .lead-head { flex-direction: column; }
  .queue-where { display: none; }
  .sheet-scroll { overflow-x: auto; }
}
