/* SpotLock theme — chain-of-custody verification surface.
   Switched from forced dark-amber (legacy) to inheriting the user's
   selected theme (sandstone by default). The .mode-spotlock class is
   still toggled on the body when the SpotLock tab is active, but it no
   longer overrides color variables — structural CSS below uses var(--accent)
   etc. so the existing palette flows through. Keep .mode-spotlock as a
   selector hook for SpotLock-only structural overrides (cards, tables,
   tile strips). */

/* Legacy dark-mode contrast forcing rules removed 2026-05-11 — sandstone
   inherits naturally now. If we ever re-introduce a dark theme for
   SpotLock specifically, re-add the overrides under a separate selector
   like [data-theme="spotlock-dark"] body.mode-spotlock. */

/* Sticky modal header with always-reachable close X. Sticks to the top of
   the modal's scroll container so the X is one click away no matter how
   far down a tall form is scrolled. Dark surface bg + faint bottom border
   to separate from scrolling content. */
body.mode-spotlock .modal .sl-modal-header,
.modal .sl-modal-header {
  position: sticky;
  top: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 18px 4px 14px 0;
  margin: 0 0 14px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  z-index: 5;
}
body.mode-spotlock .modal .sl-modal-header h2,
.modal .sl-modal-header h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}
body.mode-spotlock .modal .sl-modal-close,
.modal .sl-modal-close {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: background-color .12s, color .12s, border-color .12s;
}
body.mode-spotlock .modal .sl-modal-close:hover,
.modal .sl-modal-close:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--accent);
}

/* Radio + checkbox inputs in dark-mode modals MUST opt out of app.css's
   width:100% rule which is meant for text inputs/selects/textareas. Without
   this, my radio dot blows out to full row width and squeezes the option
   label text into a ~30px right column (one char per line). */
body.mode-spotlock .modal input[type="radio"],
body.mode-spotlock .modal input[type="checkbox"] {
  width: auto !important;
  padding: 0 !important;
  background: transparent !important;
  border: 1px solid var(--border) !important;
  flex-shrink: 0;
  margin: 0;
  accent-color: var(--accent);
}
/* Inner option labels for radio/checkbox groups inside .form-group must NOT
   inherit the field-label rule's uppercase/font-size:10px/letter-spacing.
   Apply via class so we don't accidentally restyle the field label itself. */
body.mode-spotlock .modal .form-group label.sl-opt,
body.mode-spotlock .modal label.sl-opt {
  display: flex;
  font-size: 12.5px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  margin-bottom: 0;
  color: var(--text) !important;
  cursor: pointer;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 0;
  line-height: 1.4;
}

/* ===========================================================================
   SpotLock Dashboard — BI layout
   Modeled on the approved mockup at SpotLock/SpotLock dashboard - driver
   verification overview.png. Dense flat tiles + 2-col main grid + 4-col
   bottom strip. No hero numbers, no gradient chrome.
   =========================================================================== */

.spotlock-shell {
  padding: 16px 18px 32px;
  font-size: 12px;
}

/* Top toolbar */
.sl-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.sl-h2 {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 2px;
  color: var(--text);
  letter-spacing: -0.2px;
}
.sl-subhead {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* KPI ribbon */
.sl-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.sl-kpi-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 11px 14px 10px;
  position: relative;
}
/* Attention + positive variants: keep the chrome flat. The color cue
   lives on the value (numeric color) per BI convention (Looker / Datadog).
   No accent borders, no inset rules — the colored number itself signals
   the state. */
.sl-kpi-label {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .55px;
  line-height: 1.2;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sl-kpi-icon {
  width: 14px;
  height: 14px;
  opacity: .65;
}
.sl-kpi-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.05;
  letter-spacing: -0.4px;
  font-variant-numeric: tabular-nums;
}
.sl-kpi--attention .sl-kpi-value { color: var(--accent); }
.sl-kpi--positive .sl-kpi-value { color: var(--success, #15803d); }
.sl-kpi-sub {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}

/* Main 2-col grid */
.sl-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.85fr) minmax(280px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}
.sl-col-main { min-width: 0; }
.sl-col-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
@media (max-width: 1100px) {
  .sl-main-grid { grid-template-columns: 1fr; }
}

/* Bottom 4-col grid */
.sl-bottom-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 1100px) {
  .sl-bottom-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  .sl-bottom-grid { grid-template-columns: 1fr; }
}

/* Card primitive */
.sl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.sl-card-header {
  padding: 11px 14px 9px;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: .15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sl-card-link {
  font-size: 10px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.sl-card-link:hover { color: var(--accent-hover); }
.sl-card-count {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 8px;
  margin-left: 5px;
  font-variant-numeric: tabular-nums;
}
.sl-card-body {
  padding: 12px 14px;
  flex: 1;
  min-width: 0;
}
.sl-card-body--flush {
  padding: 0;
}
.sl-empty-tiny {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  padding: 20px 12px;
  font-style: italic;
}

/* Recent DVF Cases table */
.sl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.sl-table thead th {
  text-align: left;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
/* Sort icon — stacked triangle pair. Inactive arrows show muted; the
   one matching the current direction lights up in accent color. BI-
   standard look matching Tableau/Looker/Datadog. */
.sl-sort-icon {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  margin-left: 4px;
  line-height: 1;
  position: relative;
  top: -1px;
}
.sl-sort-icon .up,
.sl-sort-icon .dn {
  font-size: 7px;
  line-height: 7px;
  color: var(--border);
  transition: color 120ms;
}
.sl-sort-icon .dn { margin-top: 1px; }
.sl-sort-icon.active-up .up { color: var(--accent); }
.sl-sort-icon.active-dn .dn { color: var(--accent); }
.sl-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.sl-table tbody tr {
  transition: background-color .1s;
  cursor: pointer;
}
.sl-table tbody tr:hover {
  background: var(--surface-2);
}
.sl-table tbody tr:last-child td {
  border-bottom: none;
}
.sl-table-cell-strong {
  font-weight: 600;
  color: var(--text);
}
.sl-table-cell-muted {
  color: var(--text-muted);
  font-size: 10.5px;
}
.sl-table-empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--text-muted);
  font-size: 11px;
}

/* Status pills — color-coded by lifecycle phase */
.sl-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 11px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .35px;
  text-transform: uppercase;
  line-height: 14px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.sl-pill::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sl-pill--neutral { background: rgba(148,163,184,.10); color: #94a3b8; }
.sl-pill--neutral::before { background: #94a3b8; }
.sl-pill--info    { background: rgba(56,189,248,.13); color: #38bdf8; }
.sl-pill--info::before { background: #38bdf8; }
.sl-pill--warn    { background: rgba(245,158,11,.14); color: #fbbf24; }
.sl-pill--warn::before { background: #fbbf24; }
.sl-pill--review  { background: rgba(168,85,247,.14); color: #c084fc; }
.sl-pill--review::before { background: #c084fc; }
.sl-pill--ok      { background: rgba(34,197,94,.14); color: #4ade80; }
.sl-pill--ok::before { background: #4ade80; }
.sl-pill--bad     { background: rgba(239,68,68,.14); color: #f87171; }
.sl-pill--bad::before { background: #f87171; }
.sl-pill--done    { background: rgba(255,255,255,.04); color: #6e7586; }
.sl-pill--done::before { background: #6e7586; }

/* Donut chart (Case Status Distribution) */
.sl-donut-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sl-donut-svg {
  flex-shrink: 0;
  width: 100px;
  height: 100px;
}
.sl-donut-center-num {
  font-size: 20px;
  font-weight: 700;
  fill: var(--text);
  font-variant-numeric: tabular-nums;
}
.sl-donut-center-lbl {
  font-size: 8px;
  font-weight: 600;
  fill: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
}
.sl-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
  font-size: 10.5px;
}
.sl-donut-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.sl-donut-legend-row .swatch {
  width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0;
}
.sl-donut-legend-row .lbl {
  flex: 1;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sl-donut-legend-row .num {
  font-weight: 700;
  color: var(--text);
}

/* Repository Snapshot */
.sl-repo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.sl-repo-stat {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 9px 10px;
}
.sl-repo-stat-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}
.sl-repo-stat-lbl {
  font-size: 9.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-top: 4px;
}

/* Activity feed */
.sl-activity {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.sl-activity-row {
  display: flex;
  gap: 9px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.sl-activity-row:last-child { border-bottom: none; }
.sl-activity-icon {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
  font-size: 10px;
  font-weight: 700;
}
.sl-activity-body {
  flex: 1;
  min-width: 0;
}
.sl-activity-line {
  font-size: 11px;
  color: var(--text);
  line-height: 1.4;
  word-wrap: break-word;
}
.sl-activity-line .actor { color: var(--text-muted); }
.sl-activity-line .what { font-weight: 600; }
.sl-activity-meta {
  font-size: 9.5px;
  color: var(--text-muted);
  margin-top: 2px;
  display: flex;
  gap: 6px;
  align-items: center;
}

/* Integration status */
.sl-int-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}
.sl-int-row:last-child { border-bottom: none; }
.sl-int-name {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; color: var(--text);
}
.sl-int-dot {
  width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}
.sl-int-dot--ok   { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,.45); }
.sl-int-dot--warn { background: #fbbf24; box-shadow: 0 0 6px rgba(251,191,36,.45); }
.sl-int-dot--bad  { background: #f87171; box-shadow: 0 0 6px rgba(248,113,113,.45); }
.sl-int-state {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .4px;
}

/* Compact mini-tables (My Queue, Escalations) */
.sl-mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.sl-mini-table tbody td {
  padding: 7px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}
.sl-mini-table tbody tr {
  transition: background-color .1s;
  cursor: pointer;
}
.sl-mini-table tbody tr:hover { background: var(--surface-2); }
.sl-mini-table tbody tr:last-child td { border-bottom: none; }
.sl-mini-cell-load {
  font-weight: 600;
  color: var(--text);
}
.sl-mini-cell-meta {
  color: var(--text-muted);
  font-size: 10px;
  text-align: right;
  white-space: nowrap;
}

/* Verified-by-SpotLock badge — same component used in carrier.html, brought
   into the broker app via this stylesheet so DVF surfaces can reuse it. */
.sl-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 14px;
  vertical-align: middle;
}
.sl-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.sl-badge--verified   { background: #dcfce7; color: #15803d; }
.sl-badge--verified::before { background: #15803d; }
.sl-badge--pending    { background: #fef3c7; color: #92400e; }
.sl-badge--pending::before  { background: #d97706; }
.sl-badge--expired    { background: #f1f1ec; color: #6b6b66; }
.sl-badge--expired::before  { background: #6b6b66; }
.sl-badge--unverified { background: #f8f8f5; color: #8a8a85; border: 1px dashed #d6d6cf; padding: 1px 7px; }
.sl-badge--unverified::before { background: transparent; border: 1px solid #8a8a85; width: 5px; height: 5px; }

/* Dark-theme overrides for the badge inside .mode-spotlock */
body.mode-spotlock .sl-badge--verified   { background: rgba(34, 197, 94, 0.12); color: #4ade80; }
body.mode-spotlock .sl-badge--verified::before { background: #4ade80; }
body.mode-spotlock .sl-badge--pending    { background: rgba(245, 158, 11, 0.14); color: #fbbf24; }
body.mode-spotlock .sl-badge--pending::before  { background: #fbbf24; }
body.mode-spotlock .sl-badge--expired    { background: rgba(255, 255, 255, 0.04); color: #6e7586; }
body.mode-spotlock .sl-badge--expired::before  { background: #6e7586; }
body.mode-spotlock .sl-badge--unverified { background: rgba(255, 255, 255, 0.03); color: #6e7586; border: 1px dashed rgba(255, 255, 255, 0.10); }
body.mode-spotlock .sl-badge--unverified::before { border-color: #6e7586; background: transparent; }
