:root {
  --bg:        #f6f7f9;
  --panel:     #ffffff;
  --border:    #e6e9ef;
  --text:      #131a26;
  --muted:     #66718a;
  --accent:    #2f6df6;
  --accent-2:  #1f5ae0;
  --warn:      #b46a17;
  --danger:    #c0392b;
  --ok:        #1a7f4b;
  --shadow:    0 1px 2px rgba(16,24,40,0.05);
  --shadow-md: 0 6px 20px rgba(16,24,40,0.10);
  --row:       #f8fafc;
  --dist-blue: #1e4084;
  /* Corporate chrome */
  --sidebar-bg:     #121826;
  --sidebar-ink:    #aab4c8;
  --sidebar-ink-2:  #6b768c;
  --sidebar-active: #ffffff;
  --brand-red:      #c8102e;
  --radius:    10px;
  --radius-sm: 7px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: var(--bg); color: var(--text);
             font: 14px/1.5 "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
             -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
::selection { background: rgba(47,109,246,0.18); }

/* ===== App shell: fixed dark sidebar + main column ===== */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar { width: 240px; flex-shrink: 0; background: var(--sidebar-bg); color: var(--sidebar-ink);
           display: flex; flex-direction: column; transition: width 0.16s ease; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px;
                  font-weight: 700; font-size: 15px; letter-spacing: 0.2px; color: #fff; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.nav-ic { width: 20px; text-align: center; font-size: 14px; flex-shrink: 0; opacity: 0.92; }
.nav-tx { white-space: nowrap; overflow: hidden; }

/* Collapsed (icon-only) sidebar */
.app-shell.nav-collapsed .sidebar { width: 64px; }
.app-shell.nav-collapsed .brand-text,
.app-shell.nav-collapsed .nav-tx,
.app-shell.nav-collapsed .nav-group-label { display: none; }
.app-shell.nav-collapsed .sidebar .brand { justify-content: center; padding: 18px 0 14px; }
.app-shell.nav-collapsed .nav { padding: 6px 8px 16px; }
.app-shell.nav-collapsed .nav button { justify-content: center; padding: 10px 0; }
.app-shell.nav-collapsed .nav-ic { width: auto; font-size: 16px; }

.nav-toggle { background: none; border: 1px solid var(--border); border-radius: 8px; width: 34px; height: 34px;
              color: var(--muted); font-size: 15px; line-height: 1; display: inline-flex; align-items: center;
              justify-content: center; flex-shrink: 0; }
.nav-toggle:hover { background: #f3f5f8; color: var(--text); }

.sidebar-foot { padding: 8px 10px; border-top: 1px solid rgba(255,255,255,0.08); }
.nav-collapse-btn { width: 100%; background: rgba(255,255,255,0.06); color: var(--sidebar-ink); border: none;
                    border-radius: 7px; padding: 8px; font-size: 12px; font-weight: 500; }
.nav-collapse-btn:hover { background: rgba(255,255,255,0.12); color: #fff; }
.sidebar .brand .logo-dot { width: 22px; height: 22px; border-radius: 6px; background: var(--brand-red);
                  display: inline-flex; align-items: center; justify-content: center; color: #fff;
                  font-size: 12px; font-weight: 800; flex-shrink: 0; }
.sidebar .brand .sub { display: block; font-weight: 400; font-size: 11px; color: var(--sidebar-ink-2);
                  letter-spacing: 0.04em; text-transform: uppercase; margin-top: 1px; }

.nav { display: flex; flex-direction: column; gap: 1px; padding: 6px 10px 16px; overflow-y: auto; flex: 1; }
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 8px; }
.nav-group-label { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em;
                   color: var(--sidebar-ink-2); padding: 14px 12px 5px; }
.nav button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
              background: none; border: none; color: var(--sidebar-ink); padding: 8px 12px;
              border-radius: var(--radius-sm); font-weight: 500; font-size: 13.5px; line-height: 1.2;
              transition: background 0.12s, color 0.12s; }
.nav button:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-badge { margin-left: auto; background: var(--brand-red); color: #fff; font-size: 10px; font-weight: 700;
             min-width: 18px; height: 18px; line-height: 18px; border-radius: 9px; padding: 0 5px;
             text-align: center; box-shadow: 0 0 0 2px rgba(200,16,46,0.25); }
.nav button.active { background: rgba(47,109,246,0.16); color: var(--sidebar-active); font-weight: 600;
                     box-shadow: inset 2px 0 0 var(--accent); }
.nav button .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.5; flex-shrink: 0; }

.main-area { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

.topbar { background: var(--panel); border-bottom: 1px solid var(--border); padding: 0 20px;
          height: 54px; display: flex; align-items: center; gap: 16px; flex-shrink: 0; }
.topbar .app-title { font-weight: 650; font-size: 15px; color: var(--text); }
.brand { font-weight: 700; }
.spacer { flex: 1; }
.user-pill { background: #eef1f6; color: var(--text); padding: 5px 12px; border-radius: 999px;
             font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 7px; }
.user-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.hubspot-status { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); }
.hubspot-status.ok { background: #e7f6ee; color: var(--ok); border-color: #bfe6cf; }
.hubspot-status.bad { background: #fdeceA; color: var(--danger); border-color: #f2c4bd; }

main { padding: 20px; flex: 1; overflow: auto; }
/* Embedded comms frames fill the content area edge-to-edge. */
.frame-section { margin: -20px; height: calc(100vh - 54px); }
.frame-section.active { display: block; }
.frame-section iframe { width: 100%; height: 100%; border: 0; display: block; }
.section { display: none; }
.section.active { display: block; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
         box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 15px; font-weight: 650; letter-spacing: 0.1px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.muted { color: var(--muted); }
.flex { display: flex; }
.flex.col { flex-direction: column; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 180px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 7px; background: white;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(47,109,246,0.14);
}
.field textarea { min-height: 64px; resize: vertical; }
.btn { padding: 8px 13px; border: 1px solid var(--border); background: white; color: var(--text);
       border-radius: 7px; font-weight: 500; transition: background 0.12s, border-color 0.12s, box-shadow 0.12s; }
.btn:hover { background: #f3f5f8; }
.btn:active { box-shadow: inset 0 1px 2px rgba(16,24,40,0.10); }
.btn.primary { background: var(--accent); color: white; border-color: var(--accent); box-shadow: 0 1px 2px rgba(47,109,246,0.25); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { background: var(--danger); color: white; border-color: #8d2f23; }
.btn.warn { background: var(--warn); color: white; border-color: #8d6822; }
.btn.ok { background: var(--ok); color: white; border-color: #1d5a2c; }
.btn.small { padding: 4px 8px; font-size: 12px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11px; background: #eef2f7;
       color: var(--muted); border: 1px solid var(--border); }
.tag.ok { background: #def2e1; color: var(--ok); border-color: #b8d9c0; }
.tag.warn { background: #faecd4; color: var(--warn); border-color: #e8d2a0; }
.tag.bad { background: #f7d9d4; color: var(--danger); border-color: #e6b1a8; }

table.tbl { width: 100%; border-collapse: collapse; background: white; }
table.tbl th, table.tbl td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left;
                              vertical-align: top; }
table.tbl th { background: var(--row); color: var(--muted); font-weight: 600; font-size: 12px; }
table.tbl tr:hover { background: var(--row); }

.schedule-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.schedule-range-label { font-size: 16px; font-weight: 650; color: var(--text); margin: 2px 0 2px; }
.grid-wrap { background: white; border: 1px solid var(--border); border-radius: 6px; overflow: auto;
             box-shadow: var(--shadow); }
.grid { display: grid; position: relative; min-height: 600px; }
.grid .col-header { position: sticky; top: 0; z-index: 3; background: var(--row);
                    padding: 8px 10px; border-bottom: 1px solid var(--border); font-weight: 600;
                    border-right: 1px solid var(--border); text-align: center; }
.grid .time-col-header { background: var(--row); border-right: 1px solid var(--border); }
.grid .time-cell { font-size: 11px; color: var(--muted); padding: 2px 6px;
                   border-bottom: 1px dashed #eef0f4; border-right: 1px solid var(--border); }
/* Half-hour cells stripe slightly to show the 30-min mark */
.grid .time-cell.half { color: #aab1bb; }
/* Current-time indicator: shade elapsed time + a red "now" line on today */
.grid .past-shade { position: absolute; background: rgba(99, 110, 130, 0.10); z-index: 1; pointer-events: none; }
.grid .now-line { position: absolute; height: 0; border-top: 2px solid #e8413a; z-index: 6; pointer-events: none; }
.grid .now-dot { position: absolute; left: -4px; top: -4px; width: 9px; height: 9px; border-radius: 50%; background: #e8413a; }
.grid .now-time { position: absolute; left: 4px; top: -17px; font-size: 10px; font-weight: 700; color: #e8413a;
                  background: rgba(255, 255, 255, 0.9); padding: 0 4px; border-radius: 6px; line-height: 15px; white-space: nowrap; }
/* Keep appointment cards above the shade overlay */
.grid .card, .grid .offblock, .grid .travel { z-index: 2; }
.grid .slot { border-bottom: 1px dashed #f0f2f5; border-right: 1px solid var(--border);
              position: relative; cursor: pointer; }
.grid .slot.hour-mark { border-bottom: 1px dashed #d8dde5; }
.grid .slot:hover { background: #f3f8ff; }

.grid .card { position: absolute; left: 4px; right: 4px; z-index: 2;
              background: #e7f0fb; border: 1px solid #b6d0ef; border-left: 4px solid var(--accent);
              border-radius: 4px; padding: 4px 6px; font-size: 12px; overflow: hidden; cursor: pointer; }
.grid .card.storm { background: #ffefe7; border-color: #f0c0a3; border-left-color: #c97a3a; }
.grid .card.cash  { background: #e8f5ec; border-color: #b6dac0; border-left-color: var(--ok); }
.grid .card .ttl { font-weight: 600; }
.grid .card .sub { color: var(--muted); font-size: 11px; }

.grid .travel {
  position: absolute; left: 0; right: 0; z-index: 1;
  background: repeating-linear-gradient(45deg,
              rgba(120,130,150,0.05) 0 6px,
              rgba(120,130,150,0.12) 6px 12px);
  border-top:    1px dashed rgba(120,130,150,0.25);
  border-bottom: 1px dashed rgba(120,130,150,0.25);
  font-size: 10px; color: rgba(95, 107, 122, 0.85);
  padding: 1px 4px; white-space: nowrap; overflow: hidden;
  display: flex; align-items: center; justify-content: flex-end;
  pointer-events: auto;
}
.grid .travel:hover { z-index: 4; background: rgba(245, 247, 250, 0.98); color: var(--text);
                      font-weight: 600; box-shadow: 0 1px 4px rgba(0,0,0,0.08); }

.grid .offblock {
  position: absolute; left: 0; right: 0; z-index: 1;
  background: repeating-linear-gradient(135deg, rgba(192, 137, 43, 0.10) 0 8px, rgba(192, 137, 43, 0.18) 8px 16px);
  border-top: 1px solid rgba(192, 137, 43, 0.35);
  border-bottom: 1px solid rgba(192, 137, 43, 0.35);
  pointer-events: none;
  color: rgba(192, 137, 43, 0.95); font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}

.modal-backdrop { position: fixed; inset: 0; background: rgba(20,28,40,0.45); display: none;
                  align-items: flex-start; justify-content: center; z-index: 50; padding: 60px 16px; }
.modal-backdrop.show { display: flex; }
.modal { background: white; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,0.25);
         padding: 16px 18px; width: 100%; max-width: 720px; max-height: 80vh; overflow: auto; }
.modal h2 { margin: 0 0 10px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px; background: white;
        cursor: pointer; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.chip .repdot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip.selected { background: var(--accent); color: white; border-color: var(--accent-2); }
.chip:hover { background: #eef4fb; }
.chip.selected:hover { background: var(--accent-2); }
.chip.selected .repdot { box-shadow: 0 0 0 1px white; }

/* -------- Ranked visit suggestions (each one shows why) -------- */
.slot-list { display: flex; flex-direction: column; gap: 6px; }
.slot-card { display: flex; gap: 9px; align-items: flex-start; padding: 8px 10px; background: white;
             border: 1px solid var(--border); border-radius: 6px; cursor: pointer; font-size: 12px; }
.slot-card:hover { background: #eef4fb; }
.slot-card.selected { background: #eef4fb; border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.slot-card .repdot { width: 9px; height: 9px; border-radius: 50%; margin-top: 3px; flex: 0 0 auto; }
.slot-card .slot-main { flex: 1; min-width: 0; }
.slot-card .slot-when { font-weight: 600; }
.slot-card .slot-why { color: var(--muted); margin-top: 2px; line-height: 1.45; }
.slot-badge { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
              padding: 2px 6px; border-radius: 4px; white-space: nowrap; flex: 0 0 auto; }
.slot-badge.best  { background: #e6f4ec; color: #0a7a4f; }
.slot-badge.early { background: #eef2f7; color: var(--muted); }

/* -------- Appointment wizard: one-screen scheduling cockpit -------- */
.awiz-backdrop { align-items: center; padding: 2vh 2vw; }
.awiz-modal { background: #fff; width: min(1300px, 96vw); height: 94vh; border-radius: 10px;
              display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.32); }
.awiz-head { display: flex; justify-content: space-between; align-items: center; gap: 12px;
             padding: 11px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.awiz-head h2 { font-size: 17px; }
.awiz-head input[type="number"], .awiz-head select { padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font: inherit; }
.awiz-body { flex: 1; display: grid; grid-template-columns: 360px 1fr; min-height: 0; }
.awiz-recs { border-right: 1px solid var(--border); overflow-y: auto; padding: 10px; background: #fafbfc; }
.awiz-right { display: grid; grid-template-rows: 1fr auto; min-height: 0; }
.awiz-map { min-height: 240px; background: #eef2f7; }
.awiz-day { border-top: 1px solid var(--border); max-height: 42%; overflow: auto; padding: 8px 10px; background: #fff; }
.awiz-foot { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); }
.awiz-rec { border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; margin-bottom: 8px; cursor: pointer; background: #fff; }
.awiz-rec:hover { border-color: var(--accent); }
.awiz-rec.sel { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #f2f7ff; }
.awiz-rec .r-top { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; }
.awiz-rec .r-when { font-size: 12.5px; margin-top: 3px; }
.awiz-rec .r-why { color: var(--muted); font-size: 11.5px; margin-top: 3px; line-height: 1.42; }
.awiz-rec .repdot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
.awiz-badge { font-size: 9.5px; font-weight: 700; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; margin-left: auto; }
.awiz-badge.best { background: #e6f4ec; color: #0a7a4f; }
.awiz-badge.early { background: #eef2f7; color: var(--muted); }
.awiz-day-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.awiz-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.awiz-seg button { border: none; background: #fff; color: var(--muted); font: inherit; font-size: 11.5px;
                   padding: 3px 10px; cursor: pointer; }
.awiz-seg button + button { border-left: 1px solid var(--border); }
.awiz-seg button.active { background: var(--accent); color: #fff; }
.awiz-dayrow { display: grid; grid-template-columns: 118px 1fr; gap: 6px; align-items: center; margin-bottom: 4px; }
.awiz-3d-row { display: grid; grid-template-columns: 118px repeat(3, 1fr); gap: 6px; align-items: center; margin-bottom: 4px; }
.awiz-3d-head { position: sticky; top: 0; background: #fff; z-index: 1; padding-bottom: 3px; }
.awiz-3d-daylbl { font-size: 11px; font-weight: 600; color: var(--muted); text-align: center; }
.awiz-3d-row.sel .nm { color: var(--accent); }
.awiz-dayrow.sel .nm { color: var(--accent); }
.awiz-dayrow .nm { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.awiz-track { position: relative; height: 26px; background: #f5f7fb; border-radius: 4px; border: 1px solid #eef1f5; }
.awiz-blk { position: absolute; top: 3px; height: 18px; border-radius: 3px; font-size: 10px; color: #fff;
            overflow: hidden; padding: 1px 4px; box-sizing: border-box; white-space: nowrap; line-height: 16px; }
.awiz-ghost2 { position: absolute; top: 1px; height: 22px; border: 2px dashed #b46a00;
               background: rgba(255,193,7,0.4); border-radius: 3px; box-sizing: border-box; z-index: 2; }
@media (max-width: 900px) { .awiz-body { grid-template-columns: 1fr; } .awiz-recs { max-height: 40%; } }

/* -------- Confirmations: night-before scheduling review -------- */
.rec-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px; border: 1px solid var(--border);
            border-radius: 6px; margin-bottom: 8px; }
.rec-item .rec-body { flex: 1; min-width: 0; }
.rec-item .rec-msg { font-size: 13px; }
.rec-item .rec-sub { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.rec-sev { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
           padding: 2px 6px; border-radius: 4px; white-space: nowrap; align-self: center; }
.rec-sev.high { background: #fdecea; color: #b3261e; }
.rec-sev.medium { background: #fff4e5; color: #b3541e; }
.rec-sev.low { background: #eef2f7; color: var(--muted); }
.rec-empty { padding: 20px; text-align: center; color: var(--ok); font-size: 14px; }

/* -------- Confirmations: live call-claim indicators -------- */
tr.conf-claimed { background: #fff5f5; }
tr.conf-mine { background: #eef6ff; }
.conf-claim-badge { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 600; color: #c0392b; white-space: nowrap; }
.conf-claim-badge.mine { color: #1769aa; }
.conf-banner { padding: 8px 10px; border-radius: 6px; font-size: 12px; margin: 6px 0; }
.conf-banner.warn { background: #fff3f3; border: 1px solid #f2c2c2; color: #a3341f; }
.conf-banner.mine { background: #eaf4ff; border: 1px solid #bcd9f5; color: #1769aa; }

/* -------- Schedule Command: "preview a visit" what-if bar -------- */
.disp-preview-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
                    margin-top: 10px; padding: 8px 10px; background: #f5f8ff;
                    border: 1px dashed #b9c8e6; border-radius: 6px; }
.disp-preview-bar input[type="text"] { padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font: inherit; }
.disp-preview-note-far { color: #b3541e; font-weight: 600; }

/* -------- Schedule Command: simulate-a-visit (ghost block + sim bar) -------- */
.disp-sim-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
                margin-top: 10px; padding: 9px 12px; background: #fff7ea;
                border: 1px solid #f0d9a8; border-radius: 6px; font-size: 13px; }
.disp-sim-bar .grow { flex: 1; min-width: 180px; }
.disp-sim-bar input[type="number"] { padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font: inherit; }
.disp-board.sim-armed .disp-track { cursor: copy; }
.disp-board.sim-armed .disp-track:hover { background: rgba(216,27,96,0.04); }
.disp-ghost { position: absolute; top: 8px; height: 74px; border-radius: 5px; padding: 5px 8px; box-sizing: border-box;
              border: 2px dashed #b46a00; background: rgba(255,193,7,0.28); color: #5a3d00;
              font-size: 12px; line-height: 1.3; overflow: hidden; pointer-events: none; z-index: 5; }
.disp-ghost .j1 { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.disp-ghost .j2 { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* -------- Schedule Command: dispatch board (reps as rows, time left→right) -------- */
.disp-board { border: 1px solid var(--border); border-radius: 6px; background: white; overflow-x: auto; }
.disp-row { display: grid; grid-template-columns: 200px 1fr; border-bottom: 1px solid var(--border); }
.disp-row:last-child { border-bottom: 0; }
.disp-head { background: #f5f7fb; }
.disp-rep { padding: 8px 10px; border-right: 1px solid var(--border); background: white; }
.disp-head .disp-rep { background: #f5f7fb; font-size: 11px; font-weight: 600; color: var(--muted);
                       text-transform: uppercase; letter-spacing: 0.04em; }
.disp-rep-name { font-weight: 600; font-size: 13px; display: flex; align-items: center; gap: 6px; }
.disp-rep-name .repdot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.disp-rep-sub { color: var(--muted); font-size: 11px; margin-top: 3px; }
.disp-track { position: relative; height: 100px; min-width: 660px; }
.disp-head .disp-track { height: 24px; }
.disp-tick { position: absolute; top: 0; bottom: 0; border-left: 1px solid #eef1f5; }
.disp-tick.hour { border-left-color: #e3e8ef; }
.disp-ticklabel { position: absolute; top: 5px; font-size: 11px; color: var(--muted); padding-left: 3px; }
.disp-job { position: absolute; top: 8px; height: 74px; border-radius: 5px; padding: 5px 8px; color: white;
            font-size: 12px; overflow: hidden; cursor: pointer; box-sizing: border-box; line-height: 1.28;
            box-shadow: 0 1px 3px rgba(0,0,0,0.22); }
.disp-job:hover { filter: brightness(1.06); box-shadow: 0 2px 6px rgba(0,0,0,0.28); }
/* Wrap so the full name + property address show; width comes from the zoom slider. */
.disp-job .j1, .disp-job .j3 { white-space: normal; overflow: hidden; overflow-wrap: anywhere; }
.disp-job .j1 { font-weight: 700; font-size: 12px; }
.disp-job .j3 { opacity: 0.93; font-size: 11px; margin-top: 2px; }
.disp-job.unconfirmed { box-shadow: 0 1px 3px rgba(0,0,0,0.22), inset 0 0 0 2px rgba(255,255,255,0.6); }
.disp-off { position: absolute; top: 8px; height: 74px; border-radius: 5px; box-sizing: border-box;
            border: 1px solid var(--border); font-size: 11px; color: var(--muted); padding: 5px 8px;
            display: flex; align-items: center; overflow: hidden; white-space: nowrap;
            background: repeating-linear-gradient(45deg, #e8ecf2, #e8ecf2 6px, #dde3ea 6px, #dde3ea 12px); }
.disp-leg { position: absolute; top: 84px; height: 15px; font-size: 10.5px; color: var(--muted);
            display: flex; align-items: center; justify-content: center; white-space: nowrap; }
.disp-leg::before { content: ''; position: absolute; left: 2px; right: 2px; top: 50%; border-top: 1px dashed #b9c2cf; }
.disp-leg span { position: relative; background: white; padding: 0 4px; }
.disp-leg.far span { color: #b3541e; font-weight: 700; }
.disp-now { position: absolute; top: 0; bottom: 0; border-left: 2px solid #d33; z-index: 3; }
.disp-empty { padding: 18px; color: var(--muted); text-align: center; font-size: 13px; }
.disp-split { display: grid; grid-template-columns: 1fr 330px; gap: 12px; align-items: start; }
.disp-map-wrap { position: relative; }
.disp-map { width: 100%; height: 460px; border: 1px solid var(--border); border-radius: 6px; background: #eef2f7; }
.disp-map-badge { position: absolute; top: 10px; left: 10px; z-index: 2; background: rgba(255,255,255,0.94);
                  border: 1px solid var(--border); border-radius: 6px; padding: 5px 11px; font-size: 13px;
                  font-weight: 600; color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,0.14); pointer-events: none; }
/* Day strip: quick "days in advance" navigator */
.disp-daystrip { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; }
.disp-daypill { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 1px;
                min-width: 52px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px;
                background: #fff; cursor: pointer; line-height: 1.15; }
.disp-daypill:hover { background: #eef4fb; border-color: var(--accent); }
.disp-daypill.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.disp-daypill .dp-wd { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; opacity: 0.85; }
.disp-daypill .dp-dt { font-size: 13px; font-weight: 700; }
.disp-daypill.today .dp-wd { color: var(--brand-red); }
.disp-daypill.active.today .dp-wd { color: #ffd9d9; }
.disp-list { height: 460px; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px;
             background: var(--panel); padding: 6px; }
@media (max-width: 1100px) {
  .disp-split { grid-template-columns: 1fr; }
  .disp-map { height: 340px; }
  .disp-list { height: 260px; }
}

#map, #territoryMap { width: 100%; height: 600px; border: 1px solid var(--border); border-radius: 6px; background: #eef2f7; }

/* -------- Map view: calendar/agenda + map split -------- */
.map-split { display: grid; grid-template-columns: 340px 1fr; gap: 12px; align-items: start; }
.map-agenda { height: 600px; overflow-y: auto; background: var(--panel); border: 1px solid var(--border);
              border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; }
.map-agenda .agenda-empty { color: var(--muted); padding: 16px; text-align: center; font-size: 13px; }
.map-agenda .day-h { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase;
                     letter-spacing: 0.05em; padding: 9px 8px 5px; position: sticky; top: 0; background: var(--panel);
                     border-bottom: 1px solid var(--border); }
.appt-item { display: flex; gap: 9px; align-items: flex-start; padding: 8px; border-radius: 8px; cursor: pointer; }
.appt-item:hover { background: #eef4fb; }
.appt-item.active { background: #e3edfb; box-shadow: inset 2px 0 0 var(--accent); }
.appt-item .dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.1); }
.appt-item .t { font-weight: 600; font-size: 12px; min-width: 58px; flex-shrink: 0; color: var(--text); }
.appt-item .body .nm { font-size: 13px; font-weight: 600; }
.appt-item .body .meta { color: var(--muted); font-size: 12px; }
@media (max-width: 920px) {
  .map-split { grid-template-columns: 1fr; }
  .map-agenda { height: auto; max-height: 280px; }
}

.split { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: 12px; }
.split > .left, .split > .right { background: white; border: 1px solid var(--border); border-radius: 6px;
                                   padding: 10px; }
.conf-detail .kv { display: grid; grid-template-columns: 130px 1fr; gap: 4px 12px; margin-bottom: 8px; }
.conf-detail .kv > div:nth-child(odd) { color: var(--muted); font-size: 12px; }
.conf-detail .ext-link { color: var(--accent); text-decoration: none; font-weight: 600; }
.conf-detail .ext-link:hover { text-decoration: underline; }
.conf-detail h3 { margin: 0 0 4px; font-size: 18px; }
.conf-detail .section-title { font-size: 12px; color: var(--muted); text-transform: uppercase;
                              letter-spacing: 0.5px; margin: 8px 0 4px; }

.contact-pick-row { padding: 6px 8px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; gap: 8px; }
.contact-pick-row:last-child { border-bottom: none; }
.contact-pick-row:hover { background: #f3f8ff; }
.contact-pick-row .nm { font-weight: 600; }
.contact-pick-row .sub { color: var(--muted); font-size: 12px; }
.contact-pick-row .pick { margin-left: auto; }

.toast-stack { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px;
               z-index: 100; }
.toast { padding: 10px 14px; border-radius: 6px; box-shadow: var(--shadow); background: white;
         border-left: 4px solid var(--accent); min-width: 220px; }
.toast.error { border-left-color: var(--danger); }
.toast.ok    { border-left-color: var(--ok); }
.toast .ttl { font-weight: 600; margin-bottom: 2px; }

.loading-bar { height: 3px; background: var(--accent); width: 0%; transition: width 0.2s; position: fixed;
               top: 0; left: 0; z-index: 200; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px;
       background: #eef2f7; padding: 1px 4px; border-radius: 3px; }
.hint { color: var(--muted); font-size: 12px; }
/* Text automations editor */
.auto-card { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px; background: #fff; }
.auto-head { display: flex; align-items: center; gap: 6px; font-weight: 600; font-size: 13px; margin-bottom: 6px; cursor: pointer; }
.auto-body { width: 100%; box-sizing: border-box; min-height: 60px; resize: vertical; font: inherit; font-size: 13px;
  padding: 7px 9px; border: 1px solid var(--border); border-radius: 6px; }
/* "Why this rep" routing chip in the schedule modal */
.why-rep { margin: 8px 0 2px; font-size: 12.5px; line-height: 1.4; padding: 7px 10px;
           border-radius: 8px; background: #eef4ff; border: 1px solid #cfe0ff; color: #22314d; }
.why-rep:empty { display: none; }
.why-rep b { color: #1a3f7a; }
.why-rep .why-override { color: var(--warn, #b26a00); font-weight: 600; }
.divider { height: 1px; background: var(--border); margin: 10px 0; }
/* Guided call-in script: walks the office through the call, question by question. */
.call-script { margin: 8px 0 12px; padding: 10px 12px; border-radius: 10px;
               background: #eef4ff; border: 1px solid #c7dafc; border-left: 3px solid #2f6fd0; }
.call-script .cs-head { display: flex; align-items: baseline; gap: 8px; }
.call-script .cs-step { font-size: 11px; font-weight: 700; letter-spacing: .04em;
                        text-transform: uppercase; color: #2f6fd0; }
.call-script .cs-title { font-weight: 650; font-size: 13.5px; color: #14315e; }
.call-script .cs-say { margin: 6px 0 9px; font-size: 14px; line-height: 1.45; color: #14315e; }
.call-script .cs-say::before { content: '“'; } .call-script .cs-say::after { content: '”'; }
.call-script .cs-actions { display: flex; align-items: center; gap: 8px; }
/* Field(s) the current script step is asking about. */
.cs-focus input, .cs-focus select, .cs-focus textarea {
  outline: 2px solid #2f6fd0; outline-offset: 1px; background: #fbfdff;
}

/* Non-blocking "missing / incomplete info" flags on the booking form. */
.sched-flags { margin: 0 0 10px; font-size: 12.5px; line-height: 1.45; padding: 8px 11px;
               background: #fff7e6; border: 1px solid #f0d08a; border-left: 3px solid #d99a1c;
               border-radius: 8px; color: #6b4c07; }
.sched-flags b { color: #8a5a00; }

/* -------- Workspace dashboards -------- */
.dash { display: flex; flex-direction: column; gap: 18px; max-width: 1100px; }
.dash-head h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -0.2px; }
.dash-head p { color: var(--muted); margin: 4px 0 0; font-size: 13.5px; }
.dash-section-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
                      color: var(--muted); font-weight: 600; margin-bottom: -6px; }
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
       padding: 16px 18px; box-shadow: var(--shadow); }
.kpi .v { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.1; }
.kpi .l { color: var(--muted); font-size: 13px; margin-top: 4px; }
.kpi.accent { border-top: 3px solid var(--accent); }
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
        padding: 16px; box-shadow: var(--shadow); cursor: pointer; text-align: left; display: block;
        text-decoration: none; color: inherit; width: 100%; font: inherit;
        transition: box-shadow 0.12s, transform 0.12s, border-color 0.12s; }
.tile:hover { box-shadow: var(--shadow-md); border-color: #cfd6e2; transform: translateY(-1px); }
.tile .ic { font-size: 22px; }
.tile .t { font-weight: 650; margin-top: 10px; font-size: 14.5px; }
.tile .d { color: var(--muted); font-size: 12.5px; margin-top: 3px; }

/* -------- Distribution sheet (Bella Construction style) -------- */
.dist-sheet { background: white; border: 1px solid var(--border); border-radius: 6px; overflow: auto;
              box-shadow: var(--shadow); }
.dist-sheet table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dist-sheet th, .dist-sheet td { border: 1px solid #cfd6e1; padding: 3px 6px; vertical-align: middle; }
.dist-sheet .month-banner td { background: var(--dist-blue); color: white; font-weight: 700;
                                text-align: center; font-size: 14px; padding: 6px; }
.dist-sheet .ch-banner td { background: var(--dist-blue); color: white; font-weight: 700; text-align: center; }
.dist-sheet .rep-cell { background: #f3f5f8; font-weight: 600; min-width: 140px; }
.dist-sheet .x-cell  { width: 18px; text-align: center; color: var(--text); }
.dist-sheet .x-cell.cash { background: #e8f5ec; }
.dist-sheet .x-cell.storm { background: #ffefe7; }
.dist-sheet .total { background: #eef2f7; font-weight: 700; text-align: center; }
.dist-sheet .ytd   { background: #d6e4fa; font-weight: 700; text-align: center; }
.dist-sheet .title-cell td { background: white; text-align: center; font-weight: 700; font-size: 16px;
                              color: var(--dist-blue); padding: 6px; }
.dist-sheet .subtitle-cell td { background: white; text-align: center; font-style: italic;
                                  color: var(--muted); padding: 2px; }

/* Territory map per-rep zone list */
.zone-row { display: flex; gap: 8px; align-items: center; padding: 4px 6px; border-bottom: 1px solid #eef0f4; }
.zone-row .swatch { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; }
.zone-row .nm  { font-weight: 600; }
.zone-row .meta { color: var(--muted); font-size: 12px; }
.zone-row .del { margin-left: auto; }

/* ── Signed-in identity: the pill is now a person, and a button ─────────── */
.user-pill { border: 1px solid transparent; cursor: pointer; font: inherit; font-size: 12.5px; }
.user-pill:hover { background: #e3e8f0; border-color: var(--border); }
/* The green dot said "connected". With a photo present it's redundant noise
   next to the person's own face, so it only shows when there's no photo. */
.user-pill:has(.user-photo:not([hidden]))::before { display: none; }
.user-photo { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.user-name { font-weight: 600; }
.user-role {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em;
  background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 1px 6px; color: var(--muted);
}

.nav-home { margin-bottom: 4px; }

/* ── My Day ─────────────────────────────────────────────────────────────── */
.home-hero { display: flex; align-items: center; gap: 14px; }
.home-photo { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; }
.home-cards { display: flex; flex-wrap: wrap; gap: 12px; }
.home-card {
  flex: 1 1 170px; min-width: 170px; text-align: left; background: var(--card, #fff);
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; cursor: pointer;
  display: flex; flex-direction: column; gap: 2px; font: inherit;
}
.home-card:hover { border-color: var(--accent, #2266cc); box-shadow: 0 2px 8px rgba(16,36,58,.07); }
.home-card-ic { font-size: 18px; }
.home-card-n { font-size: 28px; font-weight: 800; line-height: 1.1; color: var(--muted); }
/* A zero stays grey — only a number someone has to DO something about is
   given the ink. */
.home-card-n.has { color: var(--text); }
.home-card-l { font-weight: 600; }
.home-card-h { font-size: 12px; color: var(--muted); }

.profile-head { display: flex; align-items: center; gap: 12px; }
.profile-photo { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }

/* -------- Confirmations: whole queue fits one screen -------- */
/* The panel fills the viewport under the top bar (54px) and main's 20px
   padding; the visit list and the detail pane each scroll on their own, so
   working down a long day never scrolls the page away from the list. */
#tab-confirmations.active { display: flex; flex-direction: column; height: calc(100vh - 54px - 40px); }
#tab-confirmations > .panel { flex: 1; min-height: 0; margin-bottom: 0; display: flex; flex-direction: column; }
#tab-confirmations .split { flex: 1; min-height: 0; }
#tab-confirmations .split > .left,
#tab-confirmations .split > .right { min-height: 0; overflow-y: auto; }
#tab-confirmations .split > .right { padding-top: 0; }
#tab-confirmations #confList thead th { position: sticky; top: 0; z-index: 1; background: white; padding-top: 10px; }

/* -------- Schedule Command: portrait wall view (27" turned on its side) -------- */
/* Map takes the top half, the per-rep timelines the bottom half; the board is
   fit to the screen width (no sideways scroll) and rows stretch to fill. */
.disp-board { --row-h: 100px; }
.disp-track { height: var(--row-h); }
.disp-job, .disp-off, .disp-ghost { height: calc(var(--row-h) - 26px); }
.disp-leg { top: calc(var(--row-h) - 16px); }
.disp-job .j2 { opacity: 0.93; font-size: 11px; margin-top: 2px; font-weight: 600; }

/* Shared by Portrait + Side-by-side: the tab fills the screen under the top
   bar, the map box stretches, and the rep board scrolls inside its own box. */
#tab-dispatch.disp-fill.active { display: flex; height: calc(100vh - 54px - 40px); gap: 12px; }
#tab-dispatch.disp-fill > .panel { margin-bottom: 0; min-height: 0; min-width: 0; display: flex; flex-direction: column; }
#tab-dispatch.disp-fill .disp-split { flex: 1; min-height: 0; grid-template-columns: 1fr; }
#tab-dispatch.disp-fill .disp-map-wrap { height: 100%; }
#tab-dispatch.disp-fill .disp-map { height: 100%; }
#tab-dispatch.disp-fill .disp-list { display: none; }
#tab-dispatch.disp-fill .disp-board { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; }
#tab-dispatch.disp-fill .disp-board .disp-head,
#tab-dispatch.disp-compact .disp-board .disp-head { position: sticky; top: 0; z-index: 4; }
#tab-dispatch.disp-fill .disp-row { grid-template-columns: 170px 1fr; }
#tab-dispatch.disp-fill #dispZoom,
#tab-dispatch.disp-compact #dispZoom { opacity: 0.4; pointer-events: none; }

/* Portrait: map top half, reps bottom half. */
#tab-dispatch.disp-portrait.active { flex-direction: column; }
#tab-dispatch.disp-portrait > .panel:first-child { flex: 0 0 50%; }
#tab-dispatch.disp-portrait > .panel:last-child { flex: 1; }

/* Side-by-side: map left, schedule right (wide landscape screens). */
#tab-dispatch.disp-side.active { flex-direction: row; }
#tab-dispatch.disp-side > .panel:first-child { flex: 0 0 33%; }
#tab-dispatch.disp-side > .panel:last-child { flex: 1; }
#tab-dispatch.disp-side .disp-daystrip { flex-wrap: wrap; }
#tab-dispatch.disp-side .disp-row { grid-template-columns: 112px 1fr; }
#tab-dispatch.disp-side .disp-rep { padding: 6px 8px; }
#tab-dispatch.disp-side .disp-rep-name { font-size: 12.5px; }
#tab-dispatch.disp-side .disp-rep-sub { font-size: 10.5px; }
#tab-dispatch.disp-side .disp-preview-bar { display: none; }
#tab-dispatch.disp-side .disp-job { padding: 4px 5px; line-height: 1.2; }
#tab-dispatch.disp-side .disp-job .j1 { font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#tab-dispatch.disp-side .disp-job .j2 { font-size: 11px; margin-top: 1px; white-space: nowrap; }
#tab-dispatch.disp-side .disp-job .j3 { font-size: 10.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#tab-dispatch.disp-side .disp-leg { font-size: 10px; }

/* Compact: laptop-size screens. Smaller map, no sideways scroll, tighter rows. */
#tab-dispatch.disp-compact .panel { padding: 10px 12px; margin-bottom: 10px; }
#tab-dispatch.disp-compact .disp-split { grid-template-columns: 1fr 260px; }
#tab-dispatch.disp-compact .disp-map, #tab-dispatch.disp-compact .disp-list { height: 200px; }
#tab-dispatch.disp-compact .btn { padding: 4px 9px; font-size: 12px; }
#tab-dispatch.disp-compact .panel h2 { font-size: 13.5px; }
#tab-dispatch.disp-compact .panel > .row.between .hint:not(#dispDayLabel) { display: none; }
#tab-dispatch.disp-compact .divider { margin: 6px 0; }
#tab-dispatch.disp-compact .disp-daystrip { padding-bottom: 4px; }
#tab-dispatch.disp-compact .disp-daypill { padding: 2px 8px; }
#tab-dispatch.disp-compact .disp-daypill .dp-dt { font-size: 12px; }
#tab-dispatch.disp-compact .disp-board { --row-h: 82px; overflow-x: hidden; max-height: calc(100vh - 54px - 120px); overflow-y: auto; }
#tab-dispatch.disp-compact .disp-row { grid-template-columns: 120px 1fr; }
#tab-dispatch.disp-compact .disp-rep { padding: 6px 8px; }
#tab-dispatch.disp-compact .disp-rep-sub { display: none; }
#tab-dispatch.disp-compact .disp-job { padding: 3px 6px; }
#tab-dispatch.disp-compact .disp-job .j1 { font-size: 11px; }
#tab-dispatch.disp-compact .disp-job .j3 { font-size: 10px; }
#tab-dispatch.disp-compact .disp-preview-bar { display: none; }

#dispLayout { align-items: center; }
#dispLayout .lbl { font-size: 12px; color: var(--muted); margin-right: 6px; }
#dispLayout .btn { padding: 5px 10px; font-size: 12.5px; }

/* -------- Cancellations: sales manager Rebound board -------- */
.seg { display: inline-flex; gap: 0; }
.seg .btn { border-radius: 0; margin: 0; }
.seg .btn:first-child { border-radius: 6px 0 0 6px; }
.seg .btn:last-child { border-radius: 0 6px 6px 0; }
.seg .btn + .btn { margin-left: -1px; }
.seg .btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

#tab-cancellations.rebound.active { display: flex; flex-direction: column; height: calc(100vh - 54px - 40px); }
#tab-cancellations.rebound > .panel { flex: 1; min-height: 0; margin-bottom: 0; display: flex; flex-direction: column; }
.canx-rebound { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 10px; }
.canx-kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.canx-kpi { flex: 1; min-width: 120px; border: 1px solid var(--border); border-radius: 6px; padding: 8px 12px; background: #fafbfd; }
.canx-kpi .n { font-size: 20px; font-weight: 700; }
.canx-kpi .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.canx-filters select, .canx-filters input { padding: 6px 8px; border: 1px solid var(--border); border-radius: 4px; font: inherit; }
.canx-split { flex: 1; min-height: 0; grid-template-columns: minmax(320px, 1fr) minmax(0, 1.4fr); }
.canx-split > .left, .canx-split > .right { min-height: 0; overflow-y: auto; }
.canx-split > .left { padding: 0; }
.canx-item { padding: 10px 12px; border-bottom: 1px solid var(--border); cursor: pointer; }
.canx-item:hover { background: #f5f8fd; }
.canx-item.sel { background: #eaf2ff; box-shadow: inset 3px 0 0 var(--accent); }
.canx-item .t1 { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }
.canx-item .t2 { font-size: 12px; color: var(--muted); margin-top: 2px; }
.canx-item .t3 { font-size: 12px; margin-top: 4px; color: #555; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag.st-new { background: #fdecea; color: #b3261e; border-color: #f2c4bd; }
.tag.st-working { background: #fff4d6; color: #8a5a00; border-color: #ecd59a; }
.tag.st-rebooked { background: #def2e1; color: var(--ok); border-color: #b8d9c0; }
.tag.st-lost { background: #eceff3; color: #5b6573; }
.canx-actions { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.canx-notes { margin-top: 10px; border-top: 1px solid var(--border); }
.canx-note { padding: 8px 0; border-bottom: 1px dashed var(--border); font-size: 13px; white-space: pre-wrap; }
.canx-note .who { font-size: 11.5px; color: var(--muted); margin-bottom: 2px; }
.canx-note.sys { color: var(--muted); font-size: 12px; }
.canx-orig { background: #f7f8fa; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; font-size: 12.5px; white-space: pre-wrap; max-height: 160px; overflow: auto; }
#dispLayout .lbl + .btn { border-radius: 6px 0 0 6px; }
#tab-dispatch.disp-fill .disp-track, #tab-dispatch.disp-compact .disp-track { min-width: 0; }


/* -------- Drive time: real blocks of time ahead of each visit -------- */
.disp-drive { position: absolute; top: 8px; height: calc(var(--row-h) - 26px); box-sizing: border-box;
  border-radius: 5px; border: 1px dashed var(--c); z-index: 1; pointer-events: auto;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--c) 22%, white) 0 6px, color-mix(in srgb, var(--c) 8%, white) 6px 12px);
  display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.disp-drive span { font-size: 10.5px; font-weight: 700; color: #334; background: rgba(255,255,255,0.85);
  border-radius: 3px; padding: 0 3px; margin-bottom: 3px; white-space: nowrap; }
.disp-drive.narrow span { display: none; }
.disp-drive.tight { border-color: #d93025; border-style: solid;
  background: repeating-linear-gradient(135deg, #fbd5d1 0 6px, #fff1ef 6px 12px); z-index: 3; }
.disp-drive.tight span { color: #b3261e; }
.disp-drive.ghost:not(.tight) { border-color: #188038; border-style: solid;
  background: repeating-linear-gradient(135deg, #ccebd6 0 6px, #f0faf3 6px 12px); }
.disp-drive.ghost:not(.tight) span { color: #137333; }
.disp-job, .disp-ghost { z-index: 2; }
.disp-leg { display: none; }

/* -------- Calendar layout (Google-Calendar-style day view) -------- */
#tab-dispatch.disp-calendar.active { flex-direction: row-reverse; }
#tab-dispatch.disp-calendar > .panel:first-child { flex: 0 0 28%; }
#tab-dispatch.disp-calendar > .panel:last-child { flex: 1; }
#tab-dispatch.disp-calendar.disp-nomap > .panel:first-child { display: none; }
#tab-dispatch.disp-calendar .disp-daystrip { flex-wrap: wrap; }
#dispMapToggle { display: none; }
#tab-dispatch.disp-calendar #dispMapToggle { display: inline-flex; }
#tab-dispatch.disp-calendar .disp-board { overflow: auto; }

.dcal { display: grid; position: relative; min-width: max-content; }
.dcal-corner, .dcal-head { position: sticky; top: 0; z-index: 6; background: #fff; border-bottom: 1px solid var(--border); }
.dcal-head { padding: 6px 8px; border-left: 1px solid var(--border); text-align: center; }
.dcal-head .n { font-weight: 650; font-size: 13px; display: flex; gap: 6px; align-items: center; justify-content: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcal-head .s { font-size: 11px; color: var(--muted); margin-top: 2px; }
.dcal-gutter { position: relative; }
.dcal-hour { position: absolute; right: 6px; font-size: 10.5px; color: var(--muted); transform: translateY(-50%); }
.dcal-hour:first-child { transform: none; }
.dcal-col { position: relative; border-left: 1px solid var(--border); }
.dcal-line { position: absolute; left: 0; right: 0; border-top: 1px solid #e6e9ef; }
.dcal-line.half { border-top-style: dotted; border-top-color: #eef1f5; }
.dcal-ev { position: absolute; left: 3px; right: 6px; z-index: 2; border-radius: 6px; padding: 3px 6px;
  box-sizing: border-box; overflow: hidden; cursor: pointer; font-size: 11.5px; line-height: 1.25;
  box-shadow: 0 1px 2px rgba(0,0,0,0.18); }
.dcal-ev:hover { filter: brightness(1.06); box-shadow: 0 2px 6px rgba(0,0,0,0.28); }
.dcal-ev .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dcal-ev .w { opacity: 0.95; overflow: hidden; }
.dcal-ev .ok { font-size: 10.5px; opacity: 0.9; margin-top: 1px; }
.dcal-ev.unconfirmed { box-shadow: 0 1px 2px rgba(0,0,0,0.18), inset 0 0 0 2px rgba(255,255,255,0.6); }
.dcal-ev.ghost { background: #fff !important; color: #1a1a1a !important; border: 2px dashed #188038; cursor: default; z-index: 4; }
.dcal-ev.ghost.conflict { border-color: #d93025; background: #fff5f4 !important; }
.dcal-off { position: absolute; left: 0; right: 0; z-index: 1; background: repeating-linear-gradient(45deg, #eceff3 0 6px, #f6f7f9 6px 12px);
  color: var(--muted); font-size: 11px; padding: 3px 6px; box-sizing: border-box; overflow: hidden; }
.dcal-now { position: absolute; left: 0; right: 0; border-top: 2px solid #d93025; z-index: 5; pointer-events: none; }
.dcal-now::before { content: ''; position: absolute; left: -5px; top: -6px; width: 10px; height: 10px; border-radius: 50%; background: #d93025; }
.disp-drive.v { top: auto; left: 3px; right: 6px; height: auto; align-items: center; z-index: 1; }
.disp-drive.v span { margin: 0; }
.disp-drive.v.tight { z-index: 3; }
#tab-dispatch.disp-calendar .dcal-col { cursor: default; }
.disp-board.sim-armed .dcal-col { cursor: copy; }
.disp-board.sim-armed .dcal-col:hover { background: rgba(24,128,56,0.04); }
.canx-textbox { margin: 0 0 10px; padding: 10px; border: 1px solid #b8d9c0; background: #f3faf5; border-radius: 6px; }
