/* =========================================================
   MP-Delivery — design tokens & components
   Ported from data/style1/claude-code-handoff.md
   ========================================================= */

:root {
  /* Slate */
  --slate-900:#111520; --slate-700:#232B3E; --slate-600:#2E3A54;
  --slate-500:#4A5878; --slate-400:#6B7A9A; --slate-300:#9AA3BB;
  --slate-200:#C5CADA; --slate-150:#DDE1EC; --slate-100:#ECEEF5;
  --slate-50:#F5F6FA;  --white:#fff;

  /* Indigo */
  --indigo-700:#3730A3; --indigo-600:#4338CA; --indigo-500:#4F46E5;
  --indigo-400:#6366F1; --indigo-300:#818CF8; --indigo-200:#C7D2FE;
  --indigo-100:#E0E7FF; --indigo-50:#EEF2FF;

  /* Semantic */
  --success-700:#15803D; --success-500:#22C55E; --success-300:#86EFAC; --success-100:#DCFCE7; --success-50:#F0FDF4;
  --warning-700:#B45309; --warning-500:#F59E0B; --warning-100:#FEF3C7;
  --danger-700:#B91C1C;  --danger-500:#EF4444;  --danger-400:#F87171;  --danger-100:#FEE2E2; --danger-50:#FEF2F2;
  --info-700:#0369A1;    --info-500:#0EA5E9;    --info-100:#E0F2FE;

  /* Fonts */
  --font-sans:'DM Sans', -apple-system, system-ui, Segoe UI, sans-serif;
  --font-mono:'DM Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
  --font-display:'Fraunces', Georgia, serif;

  /* Sidebar */
  --sidebar-expanded: 240px;
  --sidebar-collapsed: 56px;
  --sidebar-width: var(--sidebar-expanded);
}

* { box-sizing: border-box; }
html, body { margin:0; padding:0; }
body {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--slate-700);
  background: var(--slate-50);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--indigo-500); text-decoration: none; }
a:hover { color: var(--indigo-600); }

/* =========================================================
   Layout shell
   ========================================================= */

.layout { min-height: 100vh; }

.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-width, 240px);
  height: 100vh;
  background: var(--slate-900);
  color: var(--slate-300);
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
  z-index: 100;
  transition: width 220ms cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column;
}
.sidebar::-webkit-scrollbar { display: none; }

.sidebar-logo {
  padding: 18px 14px 14px;
  border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap; overflow: hidden;
}
.sidebar-logo .mark {
  min-width: 36px; height: 28px; padding: 0 6px;
  background: linear-gradient(135deg, var(--indigo-400), var(--indigo-500));
  border-radius: 7px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; font-family: var(--font-display); font-weight: 600; font-size: 13px;
  letter-spacing: -.02em;
  flex-shrink: 0;
}
.sidebar-name { color: #fff; font-weight: 700; font-size: 14px; letter-spacing: -.01em; line-height: 1.1; }
.sidebar-sub  { font-size: 10.5px; color: var(--slate-500); margin-top: 2px; }

/* Floating collapse-toggle pinned to the right edge of the sidebar.
   position: fixed escapes the sidebar's overflow:hidden so it's always
   visible (and clickable) regardless of collapsed/expanded state. */
.sidebar-toggle {
  position: fixed;
  top: 26px;
  left: calc(var(--sidebar-width, 240px) - 13px);
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--indigo-500);
  border: 2px solid #fff;
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 200;
  box-shadow: 0 2px 8px rgba(79,70,229,.35);
  transition: left 220ms cubic-bezier(.4,0,.2,1), background 120ms, color 120ms, transform 120ms, box-shadow 120ms;
}
.sidebar-toggle:hover {
  background: var(--indigo-600);
  box-shadow: 0 3px 12px rgba(79,70,229,.5);
  transform: scale(1.08);
}
.sidebar-toggle i {
  font-size: 12px; line-height: 1;
  transition: transform 220ms cubic-bezier(.4,0,.2,1);
}
/* Chevron flips when collapsed (sidebar is a previous sibling of the toggle) */
.sidebar.collapsed ~ .sidebar-toggle i { transform: rotate(180deg); }

/* JS-driven floating nav tooltip — appended to <body>, position: fixed,
   so it escapes .sidebar's overflow: hidden (which clips ::after pseudos). */
.nav-tip {
  position: fixed;
  transform: translateY(-50%);
  background: var(--slate-700);
  color: var(--slate-100);
  font-size: 12px; font-weight: 500;
  padding: 5px 10px; border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 120ms;
  z-index: 1000;
  box-shadow: 0 4px 10px rgba(0,0,0,.18);
}
.nav-tip.show { opacity: 1; }

.nav-section { padding: 4px 0; }
.nav-section + .nav-section { border-top: 1px solid rgba(255,255,255,.04); margin-top: 6px; padding-top: 8px; }
.nav-section-label {
  font-size: 10px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--slate-600);
  padding: 8px 20px 4px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 20px;
  font-size: 13px; color: var(--slate-400);
  cursor: pointer; user-select: none;
  border-right: 2px solid transparent;
  transition: all 120ms;
  text-decoration: none;
  white-space: nowrap; overflow: hidden;
}
.nav-item:hover { background: var(--slate-700); color: var(--slate-200); text-decoration: none; }
.nav-item.active {
  background: rgba(99,102,241,.12);
  color: #fff;
  border-right-color: var(--indigo-400);
}
.nav-icon { font-size: 14px; width: 20px; flex-shrink: 0; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--indigo-500);
  color: #fff; font-size: 10px; font-weight: 600;
  padding: 1px 6px; border-radius: 99px;
}
.nav-badge.warn { background: var(--warning-500); }

.sidebar-footer {
  margin-top: auto;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  overflow: hidden;
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-chip .avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--indigo-500); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 11px;
  flex-shrink: 0;
}
.user-name { color: #fff; font-size: 12.5px; font-weight: 500; line-height: 1.1; }
.user-role { color: var(--slate-500); font-size: 10.5px; line-height: 1.1; margin-top: 2px; }

/* Collapsed sidebar */
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-name,
.sidebar.collapsed .sidebar-sub,
.sidebar.collapsed .sidebar-logo-text,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .nav-item-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role { display: none; }
.sidebar.collapsed .nav-item {
  padding: 10px 0; justify-content: center; gap: 0;
  border-right: none; position: relative;
}
.sidebar.collapsed .nav-item.active {
  border-left: 2px solid var(--indigo-400);
}
.sidebar.collapsed .nav-item::after {
  content: attr(data-label);
  position: absolute; left: calc(100% + 8px); top: 50%;
  transform: translateY(-50%);
  background: var(--slate-700); color: var(--slate-100);
  font-size: 12px; font-weight: 500;
  padding: 5px 10px; border-radius: 5px;
  white-space: nowrap;
  opacity: 0; pointer-events: none;
  transition: opacity 120ms;
  z-index: 200;
}
.sidebar.collapsed .nav-item:hover::after { opacity: 1; }
.sidebar.collapsed .sidebar-logo {
  padding: 18px 0 14px;
  justify-content: center; align-items: center;
}
.sidebar.collapsed .sidebar-logo .mark {
  /* Tighter pill when only the mark is shown (3-char "m+p" still fits) */
  min-width: 32px; padding: 0 4px; font-size: 12px;
}
.sidebar.collapsed .sidebar-footer { padding: 14px 0; display: flex; justify-content: center; }
.sidebar.collapsed .user-chip { justify-content: center; }

/* Main */
.main {
  margin-left: var(--sidebar-width, 240px);
  display: flex; flex-direction: column;
  min-height: 100vh;
  transition: margin-left 220ms cubic-bezier(.4,0,.2,1);
}
.sidebar.collapsed ~ .main { margin-left: var(--sidebar-collapsed); }

.topbar {
  position: sticky; top: 0; z-index: 50;
  height: 56px;
  background: rgba(245,246,250,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--slate-150);
  padding: 0 32px;
  display: flex; align-items: center; gap: 12px;
}
.breadcrumbs { font-size: 13px; color: var(--slate-400); display: flex; align-items: center; gap: 6px; }
.breadcrumbs .crumb { color: var(--slate-500); }
.breadcrumbs .crumb.current { color: var(--slate-900); font-weight: 600; }
.breadcrumbs .sep { color: var(--slate-300); }

.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 6px; }

/* Global order search box (Phase 1.5) — header, left of the notification bell. */
.topbar-search { position: relative; display: flex; align-items: center; margin-right: 6px; }
.topbar-search > i { position: absolute; left: 10px; color: var(--slate-400); font-size: 12px; pointer-events: none; }
.topbar-search input { width: 300px; height: 32px; padding: 4px 30px 4px 30px; font-size: 12.5px;
                       border: 1px solid var(--slate-200); border-radius: 8px; background: #fff; color: var(--slate-900);
                       transition: width 150ms, border-color 120ms, box-shadow 120ms; }
.topbar-search input::placeholder { color: var(--slate-400); }
.topbar-search input:focus { outline: none; width: 380px; border-color: var(--indigo-400); box-shadow: 0 0 0 3px rgba(99,102,241,.12); }
.topbar-search kbd { position: absolute; right: 8px; font: 600 10.5px/1 inherit; color: var(--slate-400);
                     border: 1px solid var(--slate-200); border-radius: 4px; padding: 2px 5px; background: var(--slate-50); }
.topbar-search input:focus ~ kbd { display: none; }
@media (max-width: 900px) { .topbar-search input, .topbar-search input:focus { width: 180px; } .topbar-search kbd { display: none; } }

/* /Orders/Search results page. */
.srch-form { position: relative; display: flex; gap: 10px; align-items: center; max-width: 720px; }
.srch-form > i { position: absolute; left: 12px; color: var(--slate-400); font-size: 14px; pointer-events: none; }
.srch-form .input { padding-left: 36px; }
.srch-tabs { display: flex; gap: 4px; padding: 10px 14px 0; border-bottom: 1px solid var(--slate-100); flex-wrap: wrap; }
.srch-tab { padding: 8px 12px; font-size: 12.5px; font-weight: 600; color: var(--slate-500); text-decoration: none;
            border-bottom: 2px solid transparent; margin-bottom: -1px; }
.srch-tab:hover { color: var(--slate-900); }
.srch-tab.active { color: var(--indigo-600); border-bottom-color: var(--indigo-500); }
.srch-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px; font-size: 11px;
              background: var(--slate-100); color: var(--slate-600); text-align: center; }
.srch-tab.active .srch-count { background: var(--indigo-100); color: var(--indigo-700); }
mark.srch-hit { background: var(--warning-100); color: var(--slate-900); padding: 0 2px; border-radius: 3px; }

.icon-btn {
  width: 32px; height: 32px;
  border: 1px solid transparent; background: transparent;
  border-radius: 6px;
  color: var(--slate-500);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative;
  cursor: pointer;
}
.icon-btn:hover { background: var(--slate-100); color: var(--slate-700); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 7px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger-500); border: 2px solid var(--slate-50);
}

.content {
  padding: 28px 32px;
  flex: 1; display: flex; flex-direction: column; gap: 20px;
}

/* =========================================================
   Page header
   ========================================================= */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-title  { font-family: var(--font-display); font-weight: 600; font-size: 22px; color: var(--slate-900); margin: 0; letter-spacing: -.01em; }
.page-subtitle { color: var(--slate-400); font-size: 13px; margin-top: 4px; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-sans); font-weight: 500;
  border: none; cursor: pointer; border-radius: 6px;
  transition: all 120ms; line-height: 1;
  text-decoration: none;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-md { padding: 8px 14px; font-size: 13px; }
.btn-lg { padding: 10px 18px; font-size: 14px; }

.btn-primary  { background: var(--indigo-500); color: #fff; }
.btn-primary:hover { background: var(--indigo-600); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(79,70,229,.25); color: #fff; }
.btn-secondary{ background: #fff; color: var(--slate-700); border: 1px solid var(--slate-200); }
.btn-secondary:hover { background: var(--slate-50); }
.btn-ghost    { background: transparent; color: var(--slate-500); }
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-700); }
.btn-danger-ghost { background: transparent; color: var(--danger-700); }
.btn-danger-ghost:hover { background: var(--danger-100); }

/* =========================================================
   Cards & stat strip
   ========================================================= */
.card {
  background: #fff;
  border: 1px solid var(--slate-150);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(12,15,20,.05);
  overflow: hidden;
}
.card-head { padding: 16px 24px; border-bottom: 1px solid var(--slate-100); display: flex; align-items: center; gap: 12px; }
.card-title { font-size: 14px; font-weight: 600; color: var(--slate-900); margin: 0; }
.card-body { padding: 24px; }

.stat-strip { display: flex; gap: 14px; }
.stat-card {
  flex: 1;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid var(--slate-150);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(12,15,20,.04);
  display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: var(--indigo-50); color: var(--indigo-500);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.stat-icon.success { background: var(--success-100); color: var(--success-700); }
.stat-icon.warning { background: var(--warning-100); color: var(--warning-700); }
.stat-icon.info    { background: var(--info-100);    color: var(--info-700); }
.stat-icon.danger  { background: var(--danger-100);  color: var(--danger-700); }
.stat-num { font-size: 22px; font-weight: 600; color: var(--slate-900); letter-spacing: -.3px; line-height: 1; }
.stat-label { font-size: 11px; color: var(--slate-400); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }

/* ---- Order-list value tiles (New / Maintenance Index) ---- */
.otiles { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
/* flex (not grid) so a 5-tile row and a 6-tile row each distribute evenly across the full width */
.otile-row { display: flex; flex-wrap: wrap; gap: 10px; }
.otile {
  flex: 1 1 150px;            /* grow equally; wrap when tiles would get narrower than ~150px */
  border-radius: 10px;
  padding: 11px 14px;
  color: #fff;
  min-height: 76px;
  display: flex; flex-direction: column; justify-content: center;
  box-shadow: 0 1px 2px rgba(12,15,20,.08);
}
.otile-h   { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .92; }
.otile-sub { font-size: 11px; opacity: .85; margin-top: 1px; }
.otile-v   { font-size: 20px; font-weight: 700; line-height: 1.15; margin-top: 3px; letter-spacing: -.3px; }
.otile-c   { font-size: 11.5px; opacity: .85; margin-top: 1px; }
.otile-dual { display: flex; gap: 14px; }
.otile-dual > div { flex: 1; min-width: 0; }
.otile-dual .otile-v { font-size: 16px; }

.otile-dark, .otile-total { background: #0f172a; }   /* slate-900 */
.otile-gray       { background: #64748b; }            /* slate-500 */
.otile-awaitdev   { background: #3f3f46; }            /* zinc-700 (CCC Awaiting Device) */
.otile-inprogress { background: #16a34a; }            /* green-600 */
.otile-shipped    { background: #0ea5e9; }            /* sky-500   */
.otile-awaiting   { background: #f59e0b; color: #1f2937; }  /* amber-500, dark text */
.otile-closed     { background: #dc2626; }            /* red-600   */

/* =========================================================
   Form inputs
   ========================================================= */
.input, select.input, textarea.input {
  width: 100%;
  padding: 8px 12px;
  font-family: var(--font-sans); font-size: 13px;
  color: var(--slate-900);
  background: #fff;
  border: 1px solid var(--slate-200);
  border-radius: 6px;
  outline: none;
  transition: border-color 120ms, box-shadow 120ms;
  box-shadow: 0 1px 2px rgba(12,15,20,.03);
}
.input::placeholder { color: var(--slate-300); }
.input:focus {
  border-color: var(--indigo-400);
  box-shadow: 0 0 0 3px rgba(99,102,241,.10);
}
.input.error  { border-color: var(--danger-400); }
.input.error:focus { box-shadow: 0 0 0 3px rgba(239,68,68,.10); }
.input.mono { font-family: var(--font-mono); }
select.input {
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 16 16' fill='none' stroke='%236B7A9A' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='4 6 8 10 12 6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
}
.label { font-size: 12px; font-weight: 500; color: var(--slate-500); margin-bottom: 6px; display: block; }
.help  { font-size: 11.5px; color: var(--slate-400); margin-top: 4px; }
.help.error { color: var(--danger-700); }

.field { margin-bottom: 14px; }

/* Toggle */
.toggle {
  display: inline-block;
  width: 34px; height: 18px;
  background: var(--slate-200);
  border-radius: 99px;
  position: relative; cursor: pointer;
  transition: background 150ms;
  vertical-align: middle;
}
.toggle.on { background: var(--success-500); }
.toggle::after {
  content: '';
  width: 12px; height: 12px;
  background: #fff; border-radius: 50%;
  position: absolute; top: 3px; left: 3px;
  transition: transform 150ms;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
}
.toggle.on::after { transform: translateX(16px); }

/* =========================================================
   Badges
   ========================================================= */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 99px;
  letter-spacing: .02em;
  white-space: nowrap;
}
.badge::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; background: currentColor;
  opacity: .6; flex-shrink: 0;
}
.b-active   { background: var(--success-100); color: var(--success-700); }
.b-expiring { background: var(--warning-100); color: var(--warning-700); }
.b-expired  { background: var(--danger-100);  color: var(--danger-700); }
.b-inactive { background: var(--slate-100);   color: var(--slate-400); }
.b-customer { background: var(--info-100);    color: var(--info-700); }
.b-vendor   { background: var(--warning-100); color: var(--warning-700); }
.b-partner  { background: var(--indigo-100);  color: var(--indigo-700); }
.b-deleted  { background: var(--danger-100);  color: var(--danger-700); }
.b-pass     { background: var(--success-100); color: var(--success-700); }
.b-fail     { background: var(--danger-100);  color: var(--danger-700); }
.b-overdue  { background: var(--danger-100);  color: var(--danger-700); }
.b-due-soon { background: var(--warning-100); color: var(--warning-700); }
.b-ccc      { background: var(--indigo-100);  color: var(--indigo-700); }
.b-new      { background: var(--success-100); color: var(--success-700); }
.b-maint    { background: var(--warning-100); color: var(--warning-700); }
.b-int      { background: var(--slate-100);   color: var(--slate-500); }

/* Shipping carrier brand chip */
.carrier {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
  padding: 2px 8px; border-radius: 4px;
  white-space: nowrap;
}
.carrier.fedex   { background: #4D148C; color: white; }
.carrier.ups     { background: #351C15; color: #FFB500; }
.carrier.usps    { background: #004B97; color: white; }
.carrier.dhl     { background: #FFCC00; color: #D40511; }
.carrier.digital { background: var(--info-100); color: var(--info-700); }
.carrier.other   { background: var(--slate-100); color: var(--slate-700); }

/* Receiving reason chip */
.reason-chip {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 4px;
  background: var(--slate-100); color: var(--slate-700);
  white-space: nowrap;
}
.reason-chip.rs-rma       { background: var(--warning-100); color: var(--warning-700); }
.reason-chip.rs-sales     { background: var(--success-100); color: var(--success-700); }
.reason-chip.rs-stock     { background: var(--indigo-100);  color: var(--indigo-700); }
.reason-chip.rs-marketing { background: var(--info-100);    color: var(--info-700); }
.reason-chip.rs-loaner    { background: var(--slate-100);   color: var(--slate-600); }
.reason-chip.rs-demo      { background: var(--slate-100);   color: var(--slate-600); }
.reason-chip.rs-tradeshow { background: var(--info-100);    color: var(--info-700); }
.reason-chip.rs-warranty  { background: var(--danger-100);  color: var(--danger-700); }
.reason-chip.rs-other     { background: var(--slate-100);   color: var(--slate-500); }

/* Order subtype chip — 11 subtypes across 3 OrderTypes (matches mockup-02) */
.subtype-chip {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 4px;
  white-space: nowrap;
}
.subtype-chip.sc-std    { background: var(--success-100); color: var(--success-700); }
.subtype-chip.sc-cpx    { background: var(--info-100);    color: var(--info-700); }
.subtype-chip.sc-rnt    { background: var(--indigo-100);  color: var(--indigo-700); }
.subtype-chip.sc-smc    { background: var(--warning-100); color: var(--warning-700); }
.subtype-chip.sc-hmc-gh { background: #FBE9E7;            color: #BF360C; }
.subtype-chip.sc-hmc-us { background: var(--warning-100); color: var(--warning-700); }
.subtype-chip.sc-cal-us { background: var(--info-100);    color: var(--info-700); }
.subtype-chip.sc-cal-on { background: #E8F5E9;            color: #2E7D32; }
.subtype-chip.sc-cal-17 { background: var(--indigo-100);  color: var(--indigo-700); }
.subtype-chip.sc-rep-gh { background: #FBE9E7;            color: #BF360C; }
.subtype-chip.sc-rep-us { background: var(--warning-100); color: var(--warning-700); }

/* Role badge — colour per system role (matches mockup-11) */
.role-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 4px;
  white-space: nowrap;
}
.role-badge.rb-admin      { background: #1E1B4B;            color: #C7D2FE; }
.role-badge.rb-management { background: var(--slate-700);   color: var(--slate-200); }
.role-badge.rb-tech       { background: var(--info-100);    color: var(--info-700); }
.role-badge.rb-sales      { background: var(--indigo-100);  color: var(--indigo-700); }
.role-badge.rb-ops        { background: var(--success-100); color: var(--success-700); }
.role-badge.rb-finance    { background: var(--warning-100); color: var(--warning-700); }
.role-badge.rb-other      { background: var(--slate-100);   color: var(--slate-500); }

/* Permission cell — compact glyph (F / CE / V / —) */
.perm-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 22px; border-radius: 4px;
  font-size: 10px; font-weight: 600; letter-spacing: .02em;
}
.perm-badge.perm-full { background: var(--indigo-500);  color: white; }
.perm-badge.perm-ce   { background: var(--success-500); color: white; }
.perm-badge.perm-view { background: var(--info-100);    color: var(--info-700); }
.perm-badge.perm-none { background: var(--slate-100);   color: var(--slate-400); }

/* Permission matrix table tweaks */
table.tbl.perm-matrix th,
table.tbl.perm-matrix td { padding: 6px 8px; font-size: 12px; }

/* Shipping / Receiving log toggle (segmented control) */
.log-toggle {
  display: inline-flex; gap: 0;
  background: white; border: 1px solid var(--slate-200);
  border-radius: 8px; overflow: hidden;
  box-shadow: 0 1px 2px rgba(12,15,20,0.04);
}
.log-toggle-btn {
  padding: 7px 14px; font-size: 12.5px; font-weight: 500;
  color: var(--slate-500); cursor: pointer; transition: all 120ms;
  display: inline-flex; align-items: center; gap: 6px;
  border-right: 1px solid var(--slate-150);
  text-decoration: none;
}
.log-toggle-btn:last-child { border-right: none; }
.log-toggle-btn.active     { background: var(--indigo-500); color: white; }
.log-toggle-btn:not(.active):hover { background: var(--slate-50); }

/* Calibration type chip (square, mono-ish; no leading dot) */
.cal-type {
  display: inline-block;
  font-size: 10px; font-weight: 600;
  padding: 2px 6px; border-radius: 3px;
  letter-spacing: .03em; text-transform: uppercase;
}
.ct-nist  { background: var(--indigo-100); color: var(--indigo-700); }
.ct-17025 { background: #EDE9FE;           color: #6D28D9; }
.loc-chip {
  display: inline-block;
  font-size: 10px; font-weight: 500;
  padding: 2px 6px; border-radius: 3px;
  background: var(--slate-100); color: var(--slate-500);
}
.loc-onsite { background: var(--indigo-50); color: var(--indigo-600); }
.fw-mono   { font-family: var(--font-mono); font-size: 11px; color: var(--slate-700); }
.fw-changed{ font-family: var(--font-mono); font-size: 11px; color: var(--warning-700); font-weight: 600; }
.fw-revert-yes {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 3px;
  background: var(--warning-100); color: var(--warning-700);
}

/* Mini chips for table cells */
.chips { display: flex; gap: 4px; flex-wrap: nowrap; }
.chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-weight: 600;
  padding: 2px 7px; border-radius: 5px;
  background: var(--slate-100); color: var(--slate-500);
  white-space: nowrap;
}
.chip i { font-size: 10px; opacity: .8; }
.chip.sites    { background: var(--indigo-50);  color: var(--indigo-700); }
.chip.devices  { background: var(--success-100);color: var(--success-700); }
.chip.licenses { background: var(--info-100);   color: var(--info-700); }
.chip.orders   { background: var(--warning-100);color: var(--warning-700); }
.chip.zero     { background: var(--slate-100);  color: var(--slate-300); }
.chip.indigo   { background: var(--indigo-50);  color: var(--indigo-700); }

/* =========================================================
   Tables
   ========================================================= */
.tbl-card { background: #fff; border: 1px solid var(--slate-150); border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(12,15,20,.05); }
.tbl-toolbar { padding: 12px 16px; border-bottom: 1px solid var(--slate-100); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.tbl-toolbar .tbl-h { font-size: 13px; font-weight: 600; color: var(--slate-900); margin: 0; }
.tbl-toolbar .tbl-h-sub { font-size: 12px; font-weight: 400; color: var(--slate-500); margin-left: 2px; }
.tbl-toolbar .tbl-toolbar-spacer { flex: 1; }
.tbl-toolbar .input { height: 32px; padding: 4px 10px 4px 32px; font-size: 12.5px; }
.tbl-search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.tbl-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--slate-400); font-size: 12px; }

table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th {
  padding: 10px 14px;
  font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  color: var(--slate-400);
  text-align: left; background: var(--slate-50);
  border-bottom: 1px solid var(--slate-100);
  white-space: nowrap; user-select: none;
}
table.tbl th.sortable { cursor: pointer; }
table.tbl th.sortable:hover { color: var(--indigo-500); }
table.tbl td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--slate-50);
  vertical-align: middle;
  color: var(--slate-700);
}
table.tbl tbody tr:last-child td { border-bottom: none; }
table.tbl tbody tr:hover { background: var(--slate-50); }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr.clickable:hover { background: var(--indigo-50); }
table.tbl td.mono { font-family: var(--font-mono); font-size: 12px; }
table.tbl td.num  { text-align: right; font-variant-numeric: tabular-nums; }
/* Order overview: lines of the linked QuickBooks sales order with their item costs */
table.qb-lines tr.qb-lines-heading td { font-weight: 600; color: var(--slate-700); background: var(--slate-50); }
table.qb-lines tr.qb-lines-subtotal td { font-weight: 600; border-top: 1px solid var(--slate-200); }
table.qb-lines tfoot td { font-size: 12.5px; padding-top: 8px; padding-bottom: 8px; }
table.qb-lines tr.qb-lines-match td { font-size: 11.5px; padding-top: 0; border-top: none; }
table.qb-lines .qb-lines-desc { font-size: 12px; color: var(--slate-500); margin-top: 2px; }
table.qb-lines tfoot td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* Multi-line clamp for table cells with long free text (items, serials).
   Breaks long unbreakable tokens (comma-joined serials) so they don't blow out
   the column width, and limits height to N lines. Pair with title= for a tooltip. */
.cell-clamp1, .cell-clamp2 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.cell-clamp1 { -webkit-line-clamp: 1; }
.cell-clamp2 { -webkit-line-clamp: 2; }
/* Keep the items/serials column from stretching the row too wide */
table.tbl td.col-items { max-width: 200px; }
/* Compact serial-count chip; full list shown on hover via title= tooltip */
.serial-pill {
  display: inline-flex; align-items: center; gap: 4px; cursor: default;
  margin-top: 3px; padding: 1px 7px; border-radius: 999px;
  background: var(--slate-100); border: 1px solid var(--slate-200);
  font-size: 10.5px; font-weight: 600; color: var(--slate-600);
  white-space: nowrap;
}
.serial-pill i { font-size: 11px; color: var(--slate-400); }

/* Tom Select dropdown is rendered on <body> (dropdownParent:'body') to escape the
   form cards' overflow:hidden clipping; keep it above page content. !important
   because tom-select.min.css (z-index:10) loads after site.css in the page. */
.ts-dropdown { z-index: 1000 !important; }

/* Documents tab: Upload / Link segmented toggle (blue active pill) */
.doc-src-toggle {
    display: inline-flex;
    gap: 4px;
    margin-bottom: 4px;
    background: var(--slate-100);
    padding: 4px;
    border-radius: 8px;
}
.doc-src-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: none;
    background: transparent;
    color: var(--slate-600);
    font: inherit;
    font-weight: 600;
    font-size: 13px;
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.doc-src-btn:hover { color: var(--indigo-700); }
.doc-edit-dlg {
    width: 460px; max-width: 92vw; border: none; border-radius: 12px;
    padding: 22px 24px; box-shadow: 0 10px 40px rgba(0,0,0,.18);
}
.doc-edit-dlg::backdrop { background: rgba(15,23,42,.45); }
.doc-src-btn.active {
    background: var(--indigo-600);
    color: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}

/* Company cell with monogram */
.co-cell { display: flex; align-items: center; gap: 12px; }
.monogram {
  width: 34px; height: 34px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; font-size: 13px;
  letter-spacing: -.02em;
  flex-shrink: 0;
}
.co-name { font-weight: 600; color: var(--slate-900); font-size: 13px; }
.co-meta { font-size: 11.5px; color: var(--slate-400); margin-top: 1px; }

/* Row action icons (View / Edit / Delete) */
.row-icons { display: inline-flex; align-items: center; gap: 2px; justify-content: flex-end; }
.row-icons form { margin: 0; display: inline-flex; }
.row-icons a, .row-icons button {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--slate-500);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  padding: 0;
  transition: all 120ms;
}
.row-icons a:hover {
  background: var(--indigo-50); color: var(--indigo-600); border-color: var(--indigo-100);
}
.row-icons button:not(.danger):hover {
  background: var(--indigo-50); color: var(--indigo-600); border-color: var(--indigo-100);
}
.row-icons button.danger:hover {
  background: var(--danger-100); color: var(--danger-700); border-color: var(--danger-100);
}

/* Pagination */
.pagn { display: flex; align-items: center; justify-content: space-between;
        padding: 10px 16px; border-top: 1px solid var(--slate-100); background: var(--slate-50);
        font-size: 12px; color: var(--slate-400); }
.pagn ul { display: flex; gap: 2px; list-style: none; padding: 0; margin: 0; }
.pagn a, .pagn span.pg {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 28px;
  padding: 0 8px;
  border: 1px solid var(--slate-150); background: #fff;
  border-radius: 6px; font-size: 12px;
  color: var(--slate-700); text-decoration: none;
}
.pagn a:hover { background: var(--slate-50); }
.pagn .active a, .pagn .active span.pg { background: var(--slate-900); color: #fff; border-color: var(--slate-900); }
.pagn .disabled a { color: var(--slate-300); pointer-events: none; }

/* Filter chips */
.filter-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
  padding: 5px 10px; border-radius: 6px;
  border: 1px dashed var(--slate-200); background: transparent;
  color: var(--slate-500); cursor: pointer;
}
.fchip:hover { border-style: solid; color: var(--slate-700); }
.fchip.applied { background: var(--indigo-50); color: var(--indigo-700); border-color: var(--indigo-200); border-style: solid; }
.fchip .x { opacity: .6; margin-left: 2px; }

/* =========================================================
   Tabs
   ========================================================= */
.tab-bar { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--slate-100); padding: 0 16px; }
.tab {
  padding: 10px 16px;
  font-size: 13px; font-weight: 500;
  color: var(--slate-400);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  text-decoration: none;
  transition: all 120ms;
  white-space: nowrap;
}
.tab:hover { color: var(--slate-700); }
.tab.active { color: var(--indigo-500); border-bottom-color: var(--indigo-500); font-weight: 600; }

/* =========================================================
   Toasts
   ========================================================= */
.toast-area { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: #fff; border-left: 4px solid var(--info-500);
  padding: 12px 16px;
  border-radius: 8px; box-shadow: 0 6px 24px rgba(12,15,20,.10);
  font-size: 13px; min-width: 280px; max-width: 420px;
  display: flex; gap: 10px; align-items: flex-start;
}
.toast.success { border-left-color: var(--success-500); }
.toast.error   { border-left-color: var(--danger-500); }
.toast.warning { border-left-color: var(--warning-500); }

/* =========================================================
   Auth (login / setup) split layout
   ========================================================= */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-side {
  background: linear-gradient(140deg, var(--slate-900) 0%, #1e2543 60%, var(--indigo-700) 120%);
  color: #fff;
  padding: 56px;
  display: flex; flex-direction: column; justify-content: space-between;
}
.auth-side .brand-row { display: flex; align-items: center; gap: 12px; }
.auth-side .brand-row .mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--indigo-300), var(--indigo-500));
  border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 600; color: #fff;
}
.auth-side h1 { font-family: var(--font-display); font-weight: 600; font-size: 36px; line-height: 1.15; max-width: 26ch; }
.auth-side h1 em { color: var(--indigo-200); font-style: normal; }
.auth-side .lede { color: rgba(255,255,255,.66); font-size: 14px; line-height: 1.6; max-width: 42ch; margin-top: 14px; }
.auth-side .footnote { font-size: 12px; color: rgba(255,255,255,.45); }

.auth-form-wrap {
  display: flex; align-items: center; justify-content: center;
  background: #fff;
  padding: 56px;
}
.auth-form { width: 100%; max-width: 380px; }
.auth-form h2 { font-family: var(--font-display); font-size: 24px; margin: 0 0 6px; color: var(--slate-900); }
.auth-form .lede { color: var(--slate-400); font-size: 13px; margin-bottom: 28px; }
.auth-form .row-between { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.auth-form .alert {
  background: var(--danger-50); border: 1px solid var(--danger-100);
  color: var(--danger-700); padding: 10px 12px; border-radius: 6px;
  font-size: 12.5px; margin-bottom: 16px;
}
.auth-form .alert.success { background: var(--success-50); border-color: var(--success-100); color: var(--success-700); }
.auth-form .alert.warning { background: #FFFBEB; border-color: var(--warning-100); color: var(--warning-700); }

@media (max-width: 880px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-side  { padding: 24px; min-height: 200px; }
  .auth-form-wrap { padding: 24px; }
}

/* =========================================================
   Two-column form layout (Create / Edit)
   ========================================================= */
.form-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: flex-start; }
.form-aside  { position: sticky; top: 76px; }
.form-aside .card { padding: 0; }
.form-aside .card-body { padding: 16px; }
@media (max-width: 1200px) {
  .form-layout { grid-template-columns: 1fr; }
  .form-aside { position: static; }
}
.form-card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; border-bottom: 1px solid var(--slate-100);
}
.form-card-head .icon-box {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--indigo-50); color: var(--indigo-500);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 14px;
}
.form-card-head .h { font-size: 13px; font-weight: 600; color: var(--slate-900); }
.form-card-head .sub { font-size: 11.5px; color: var(--slate-400); margin-top: 2px; }
.form-card-body { padding: 18px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.row-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 960px) { .row-4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px) { .row-2, .row-3, .row-4 { grid-template-columns: 1fr; } }
/* Order Overview tab: Order | Totals & shipping | Sales rep … (Phase 1.5 mock-up). */
.ord-overview-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
@media (max-width: 1100px) { .ord-overview-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 720px)  { .ord-overview-grid { grid-template-columns: 1fr; } }
.ord-check-on  { color: var(--success-700); }
.ord-check-off { color: var(--slate-300); }
/* Order form commission rows: rep | % | worked calculation (third column gets the room). */
.row-3.row-calc { grid-template-columns: 1fr 0.8fr 1.5fr; }
@media (max-width: 720px) { .row-3.row-calc { grid-template-columns: 1fr; } }
.calc-box { background: var(--slate-50); border: 1px solid var(--slate-150); border-radius: 8px;
            padding: 8px 12px; font-size: 12px; color: var(--slate-600); min-height: 38px; }
.calc-box .calc-row { display: flex; justify-content: space-between; gap: 12px; line-height: 1.75; }
.calc-box .calc-row span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.calc-box .calc-row.total { border-top: 1px solid var(--slate-150); margin-top: 3px; padding-top: 3px;
                            font-weight: 600; color: var(--slate-900); }
.calc-box .calc-note { color: var(--slate-400); font-size: 11.5px; line-height: 1.6; }
.ord-cost-missing { color: var(--warning-700); font-size: 11px; font-weight: 500; white-space: nowrap; }
/* Profit margin color bands (OrderMath.MarginBand): < 50% red, 50–54.99% orange, 55%+ green. */
.margin-pill { display: inline-block; padding: 0 7px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
               line-height: 1.7; white-space: nowrap; font-variant-numeric: tabular-nums; }
.margin-pill.margin-low  { background: var(--danger-100);  color: var(--danger-700); }
.margin-pill.margin-mid  { background: #FFEDD5;            color: #C2410C; }   /* orange-100 / orange-700 */
.margin-pill.margin-good { background: var(--success-100); color: var(--success-700); }
.margin-box { border: 1px solid var(--slate-150); border-radius: 8px; padding: 6px 10px; margin-top: 6px;
              font-size: 12px; color: var(--slate-600); line-height: 1.9; }
.margin-box .margin-title { font-weight: 600; color: var(--slate-900); }
/* Order Payments card (sql/687) — Overview, below the details grid. */
.pay-card { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--slate-100); }
.pay-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.pay-head h3 { font-size: 13px; font-weight: 600; margin: 0 0 4px; color: var(--slate-900); }
.pay-add { border: 1px dashed var(--slate-200); border-radius: 8px; margin-bottom: 12px; background: var(--white); }
.pay-add > summary { list-style: none; cursor: pointer; padding: 10px 14px; display: flex; align-items: center; gap: 10px;
                     font-size: 13px; font-weight: 500; color: var(--indigo-600); }
.pay-add > summary::-webkit-details-marker { display: none; }
.pay-add[open] > summary { border-bottom: 1px solid var(--slate-100); background: var(--indigo-50); }
.pay-form { padding: 14px 16px 16px; }
.pay-tbl td { font-size: 12.5px; }
.pay-tbl tr.row-editing { background: var(--indigo-50); }
.pay-tbl tr.row-edit-form td { background: var(--slate-50); border-top: 1px solid var(--slate-100); }
.badge.pay-dep, .dep-tag { background: var(--info-100); color: var(--info-700); }
.dep-tag { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 0 7px; border-radius: 999px; line-height: 1.7; }
.pay-totals { margin: 12px 0 0 auto; max-width: 420px; font-size: 12.5px; color: var(--slate-600); }
.pay-totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.pay-totals strong { color: var(--slate-900); font-variant-numeric: tabular-nums; text-align: right; }
.pay-totals .pay-balance { border-top: 1px solid var(--slate-150); margin-top: 4px; padding-top: 6px; font-weight: 600; }
.pay-held { display: block; font-size: 11px; font-weight: 500; color: var(--slate-500); }
.pay-over { color: var(--danger-700); font-weight: 600; justify-content: flex-end !important; gap: 6px !important; }
/* Order lists (_OrderTable): auto layout, 13 columns. Tighter padding + wrapping headers so the table
   fits a laptop screen; short values stay on one line, text columns wrap. */
table.tbl.ord-list-tbl { min-width: 1000px; }
table.tbl.ord-list-tbl th { padding: 10px 8px; white-space: normal; vertical-align: bottom; }
table.tbl.ord-list-tbl td { padding: 10px 8px; }
table.tbl.ord-list-tbl td.nowrap,
table.tbl.ord-list-tbl td.text-mono,
table.tbl.ord-list-tbl td[style*="text-align:right"] { white-space: nowrap; }
.ord-stage { font-size: 12px; line-height: 1.35; min-width: 90px; color: var(--slate-700); }
.ord-po { max-width: 96px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* =========================================================
   Empty state
   ========================================================= */
.empty {
  text-align: center; padding: 40px 20px;
  color: var(--slate-400);
}
.empty .icon { font-size: 32px; color: var(--slate-300); }
.empty h3 { font-size: 14px; font-weight: 600; color: var(--slate-600); margin: 8px 0 4px; }
.empty p  { font-size: 13px; color: var(--slate-400); margin: 0 0 14px; }

/* Utilities */
.text-mono { font-family: var(--font-mono); }
.text-muted{ color: var(--slate-400); }
.text-right{ text-align: right; }
.flex-row  { display: flex; align-items: center; gap: 8px; }
.flex-grow { flex: 1; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }

/* Validation summary */
.validation-summary { background: var(--danger-50); border: 1px solid var(--danger-100); color: var(--danger-700); padding: 10px 14px; border-radius: 6px; font-size: 12.5px; }
.validation-summary ul { margin: 0; padding-left: 18px; }
.field-error { color: var(--danger-700); font-size: 11.5px; margin-top: 4px; }
input.input-validation-error, select.input-validation-error, textarea.input-validation-error { border-color: var(--danger-400); }

/* Responsive sidebar — auto-collapse on mobile */
@media (max-width: 992px) {
  :root { --sidebar-width: var(--sidebar-collapsed); }
  .sidebar:not(.collapsed) { width: var(--sidebar-collapsed); }
  .sidebar:not(.collapsed) .sidebar-name,
  .sidebar:not(.collapsed) .sidebar-sub,
  .sidebar:not(.collapsed) .sidebar-logo-text,
  .sidebar:not(.collapsed) .nav-section-label,
  .sidebar:not(.collapsed) .nav-item-label,
  .sidebar:not(.collapsed) .nav-badge,
  .sidebar:not(.collapsed) .user-name,
  .sidebar:not(.collapsed) .user-role { display: none; }
  .sidebar:not(.collapsed) .sidebar-logo {
    padding: 18px 0 14px;
    justify-content: center; align-items: center;
  }
  .sidebar:not(.collapsed) .sidebar-logo .mark {
    min-width: 32px; padding: 0 4px; font-size: 12px;
  }
  .main { margin-left: var(--sidebar-collapsed); }
  .content { padding: 20px 18px; }
  .topbar { padding: 0 18px; }
}

/* ====================================================================
   SITE CARDS — used on /Sites/Details and /Companies/Details Sites tab
   ==================================================================== */
.site-card {
  background: white;
  border: 1px solid var(--slate-150);
  border-radius: 10px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(12, 15, 20, 0.04);
  transition: box-shadow 150ms ease;
}
.site-card:hover { box-shadow: 0 3px 10px rgba(12, 15, 20, 0.08); }
.site-card-head {
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid var(--slate-50);
  gap: 16px;
}
.site-name    { font-size: 14px; font-weight: 600; color: var(--slate-900); }
.site-display { font-size: 12px; color: var(--slate-500); margin-top: 2px; }
.site-address { font-size: 11.5px; color: var(--slate-500); margin-top: 4px; line-height: 1.45; }

.site-card-body {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--slate-50);
  background: var(--slate-50);
}
.site-card-body .site-stat:first-child { border-left: none; }
.site-stat {
  padding: 12px 14px;
  text-align: center;
  border-left: 1px solid var(--slate-100);
  background: white;
}
.site-stat-num { font-size: 20px; font-weight: 600; color: var(--slate-900); line-height: 1; }
.site-stat-lbl { font-size: 10.5px; color: var(--slate-500); margin-top: 4px; font-weight: 500;
                 text-transform: uppercase; letter-spacing: 0.04em; }

/* Contacts table — used inside site cards and on Site/Details */
.contacts-table { width: 100%; border-collapse: collapse; }
.contacts-table th {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--slate-500); padding: 8px 12px; border-bottom: 1px solid var(--slate-100);
  text-align: left; background: var(--slate-50);
}
.contacts-table td {
  padding: 10px 12px; font-size: 13px; border-bottom: 1px solid var(--slate-50);
  vertical-align: middle; color: var(--slate-900);
}
.contacts-table tbody tr:last-child td { border-bottom: none; }
.contacts-table tbody tr:hover { background: var(--slate-50); }
.contacts-table a { color: var(--indigo-600); text-decoration: none; }
.contacts-table a:hover { text-decoration: underline; }

.contact-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 50%;
  font-size: 10px; font-weight: 600; flex-shrink: 0;
  background: var(--slate-100); color: var(--slate-600);
}
.contact-avatar.primary { background: var(--indigo-100); color: var(--indigo-700); }

.b-primary {
  background: var(--indigo-50);  color: var(--indigo-700);
  font-size: 9.5px; padding: 2px 7px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}

/* ====================================================================
   AUDIT FEED — used inside any /<Module>/Details "Audit" tab
   ==================================================================== */
.audit-feed { display: flex; flex-direction: column; }
.audit-row {
  display: flex; gap: 14px; padding: 14px 4px;
  border-bottom: 1px solid var(--slate-100);
}
.audit-row:last-child { border-bottom: none; }
.audit-row .action-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.action-dot.tone-create  { background: var(--success-100); color: var(--success-700); }
.action-dot.tone-update  { background: var(--indigo-50);   color: var(--indigo-600); }
.action-dot.tone-delete  { background: var(--danger-100);  color: var(--danger-700); }
.action-dot.tone-restore { background: var(--info-100);    color: var(--info-700); }
.action-dot.tone-neutral { background: var(--slate-100);   color: var(--slate-500); }

.audit-body { flex: 1; min-width: 0; }
.audit-line { font-size: 13px; color: var(--slate-700); display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.audit-action { font-weight: 600; color: var(--slate-900); }
.audit-meta {
  font-size: 11px; padding: 2px 8px; border-radius: 99px;
  background: var(--slate-100); color: var(--slate-500); margin-left: 4px;
}
.audit-notes {
  margin-top: 8px; font-size: 12.5px; color: var(--slate-600);
  background: var(--slate-50); border-radius: 6px; padding: 8px 10px;
}
.audit-notes i { color: var(--slate-400); margin-right: 6px; }

.audit-diff {
  margin-top: 10px; width: 100%; border-collapse: collapse;
  background: var(--slate-50); border-radius: 6px; overflow: hidden;
}
.audit-diff th {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--slate-500); font-weight: 600; padding: 6px 10px;
  text-align: left; border-bottom: 1px solid var(--slate-100); background: white;
}
.audit-diff td {
  font-size: 12.5px; padding: 6px 10px; vertical-align: top;
  border-bottom: 1px solid var(--slate-100); color: var(--slate-700);
  word-break: break-word; max-width: 360px;
}
.audit-diff tr:last-child td { border-bottom: none; }
.audit-field { font-family: var(--font-mono); font-weight: 500; color: var(--slate-900); white-space: nowrap; }
.audit-before span { background: var(--danger-100); color: var(--danger-700);
                     padding: 1px 6px; border-radius: 4px; }
.audit-after  span { background: var(--success-100); color: var(--success-700);
                     padding: 1px 6px; border-radius: 4px; }

/* Audit viewer (Pages/Audit/Index) — date-grouped feed */
.audit-viewer .audit-date-group {
  padding: 8px 4px; margin-top: 8px;
  border-bottom: 1px solid var(--slate-100);
  display: flex; align-items: center; gap: 10px;
}
.audit-viewer .audit-date-group:first-child { margin-top: 0; }
.audit-date-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase;
                  letter-spacing: 0.07em; color: var(--slate-500); }
.audit-date-count { font-size: 10.5px; color: var(--slate-400);
                    background: var(--slate-100); padding: 1px 8px; border-radius: 99px; }
.event-module-chip { font-size: 10.5px; font-weight: 600; padding: 1px 7px;
                     border-radius: 4px; background: var(--slate-100); color: var(--slate-600);
                     text-transform: uppercase; letter-spacing: 0.04em; }
.audit-viewer .entity-link { font-family: var(--font-mono); font-size: 12px;
                             color: var(--indigo-500); text-decoration: none; }
.audit-viewer .entity-link:hover { text-decoration: underline; }
.audit-viewer .audit-time { margin-left: auto; font-size: 10.5px; }
.audit-viewer .audit-line { align-items: center; }

/* ====================================================================
   LICENSES — list expiry bars + create/edit feature accordion
   ==================================================================== */
.b-dongle    { background: var(--indigo-100); color: var(--indigo-700); }
.b-softcode  { background: var(--info-100);   color: var(--info-700); }
.b-expiring  { background: var(--warning-100); color: var(--warning-700); }
.b-expired   { background: var(--danger-100);  color: var(--danger-700); }
.b-perpetual { background: var(--slate-100);   color: var(--slate-500); }

.expiry-bar-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 110px; }
.expiry-wrap     { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.expiry-label    { font-size: 11.5px; font-weight: 500; }
.expiry-lbl      { font-size: 11.5px; font-weight: 500; color: var(--slate-700); }
.expiry-lbl.warning { color: var(--warning-700); }
.expiry-lbl.danger  { color: var(--danger-700); }
.expiry-bar      { height: 4px; background: var(--slate-100); border-radius: 99px; width: 100%; max-width: 140px; overflow: hidden; }
.expiry-fill     { height: 100%; border-radius: 99px; transition: width 200ms ease; }
.ef-success      { background: var(--success-500); }
.ef-warning      { background: var(--warning-500); }
.ef-danger       { background: var(--danger-500); }

/* Warranty coverage badges */
.b-standard { background: var(--slate-100);  color: var(--slate-700); }
.b-extended { background: var(--indigo-50);  color: var(--indigo-700); }
.b-renewal  { background: var(--success-100); color: var(--success-700); }

/* Feature accordion (create/edit) */
.feature-group {
  border: 1px solid var(--slate-150); border-radius: 8px;
  margin-bottom: 14px; overflow: hidden;
}
.feature-group-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--slate-50);
  border-bottom: 1px solid var(--slate-100);
}
.feature-group-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--slate-700);
}
.feature-group-count {
  font-size: 11px; color: var(--slate-500); font-family: var(--font-mono);
}
.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px; padding: 12px;
}
.feature-chk {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border: 1px solid var(--slate-100); border-radius: 6px;
  background: white; cursor: pointer; transition: all 100ms;
  font-size: 12.5px; color: var(--slate-700);
}
.feature-chk:hover { background: var(--slate-50); border-color: var(--slate-200); }
.feature-chk input[type=checkbox] { margin: 0; flex-shrink: 0; }
.feature-chk:has(input:checked) {
  background: var(--indigo-50); border-color: var(--indigo-100); color: var(--slate-900);
}
.feature-code {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  color: var(--indigo-600); padding: 1px 5px; background: white;
  border: 1px solid var(--slate-150); border-radius: 4px; flex-shrink: 0;
}
.feature-label {
  font-size: 12px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; /* long official descriptions (e.g. DSA Pro) clamp to 2 lines; full text in title tooltip */
}

/* Read-only feature pills on the Details page */
.feature-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; background: var(--indigo-50); color: var(--indigo-700);
  border-radius: 6px; font-size: 12px;
}
.feature-pill .feature-code {
  background: white; color: var(--indigo-700); border-color: var(--indigo-100);
}

/* ====================================================================
   DEVICES — status pills + slot grid
   ==================================================================== */
.dev-status {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 99px;
  white-space: nowrap;
}
.dev-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.dev-st-in-stock     { background: var(--info-100);    color: var(--info-700); }
.dev-st-allocated    { background: var(--success-100); color: var(--success-700); }
.dev-st-in-repair    { background: var(--warning-100); color: var(--warning-700); }
.dev-st-loaner       { background: var(--indigo-50);   color: var(--indigo-700); }
.dev-st-rma-pending  { background: var(--warning-100); color: var(--warning-700); }
.dev-st-scrapped     { background: var(--slate-100);   color: var(--slate-500); }
.dev-st-installed    { background: var(--success-100); color: var(--success-700); }
.dev-st-failed       { background: var(--danger-100);  color: var(--danger-700); }
.dev-st-under-repair { background: var(--warning-100); color: var(--warning-700); }
/* unified AssetStatus (2026-06-04) */
.dev-st-stock-new      { background: var(--info-100);    color: var(--info-700); }
.dev-st-stock-repaired { background: var(--indigo-50);   color: var(--indigo-700); }
.dev-st-demo           { background: var(--indigo-50);   color: var(--indigo-700); }
.dev-st-out-for-repair { background: var(--warning-100); color: var(--warning-700); }

.slot-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
@media (max-width: 900px) {
  .slot-grid { grid-template-columns: repeat(2, 1fr); }
}
.slot-card {
  background: white;
  border: 1px solid var(--slate-150);
  border-radius: 10px;
  padding: 14px;
  display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow 150ms ease;
  min-height: 110px;
}
.slot-card:hover { box-shadow: 0 3px 10px rgba(12,15,20,.06); }
.slot-card.empty { background: var(--slate-50); border-style: dashed; }
.slot-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--slate-500); font-weight: 700;
}
.slot-empty  { font-size: 13px; color: var(--slate-400); margin-top: 4px; }
.slot-type   { font-size: 13px; font-weight: 600; color: var(--slate-900); }
.slot-serial { font-size: 12px; color: var(--slate-700); }
.slot-meta   { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 4px; }

/* Per-slot action accordions (Swap / Remove / Install) */
.slot-card .slot-action {
  margin-top: 6px;
  border-top: 1px solid var(--slate-100);
  padding-top: 6px;
}
.slot-card .slot-action:first-of-type { border-top: 0; padding-top: 0; }
.slot-action-summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 5px;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background 100ms;
}
.slot-action-summary::-webkit-details-marker { display: none; }
.slot-action-summary::marker { content: ''; }
.slot-action-summary::after {
  content: '▾';
  margin-left: auto;
  font-size: 10px;
  opacity: 0.5;
}
details[open] > .slot-action-summary::after { content: '▴'; }
.slot-action-summary.primary { color: var(--indigo-600); background: var(--indigo-50); }
.slot-action-summary.primary:hover { background: var(--indigo-100); }
.slot-action-summary.swap    { color: var(--indigo-600); }
.slot-action-summary.swap:hover { background: var(--indigo-50); }
.slot-action-summary.remove  { color: var(--danger-700); }
.slot-action-summary.remove:hover { background: var(--danger-100); }
.slot-form { display: flex; flex-direction: column; gap: 6px; padding: 8px 0 4px; }
.slot-form-row { gap: 6px; }
.slot-input  { height: 30px; font-size: 12px; flex: 1; }
.slot-btn    { width: 100%; }
.slot-sublabel {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--slate-500); font-weight: 600; margin-top: 2px;
}

/* Inline empty-state / informational callout */
.callout {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: 8px;
  font-size: 13px; line-height: 1.45;
}
.callout > i { font-size: 18px; flex-shrink: 0; }
.callout > div { flex: 1; }
.callout-info    { background: var(--info-100);    color: var(--info-700);    border: 1px solid color-mix(in srgb, var(--info-700) 20%, transparent); }
.callout-warning { background: var(--warning-100); color: var(--warning-700); border: 1px solid color-mix(in srgb, var(--warning-700) 20%, transparent); }
.callout-success { background: var(--success-100); color: var(--success-700); border: 1px solid color-mix(in srgb, var(--success-700) 20%, transparent); }

/* ====================================================================
   TOPBAR AVATAR DROPDOWN  (uses native <details> — no JS)
   ==================================================================== */
.user-menu { position: relative; margin: 0; }
.user-menu summary { list-style: none; cursor: pointer; }
.user-menu summary::-webkit-details-marker { display: none; }
.user-menu summary.avatar-trigger {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--indigo-100); color: var(--indigo-600);
  font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.user-menu summary.avatar-trigger:hover { box-shadow: 0 0 0 3px var(--indigo-50); }
.user-menu[open] summary.avatar-trigger { box-shadow: 0 0 0 3px var(--indigo-100); }

.user-menu-pop {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 220px; background: white;
  border: 1px solid var(--slate-150); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(12, 15, 20, 0.12);
  padding: 6px; z-index: 200;
}
.user-menu-head {
  padding: 10px 12px 8px; border-bottom: 1px solid var(--slate-100);
  margin-bottom: 4px;
}
.user-menu-head .user-name { font-size: 13px; font-weight: 600; color: var(--slate-900); }
.user-menu-head .user-role { font-size: 11px; color: var(--slate-500); margin-top: 2px; }
.user-menu-form { margin: 0; }
.user-menu-link {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 8px 10px; border-radius: 6px;
  font-family: var(--font-sans); font-size: 13px;
  background: transparent; border: none; cursor: pointer;
  color: var(--slate-700); text-decoration: none; text-align: left;
}
.user-menu-link:hover { background: var(--slate-50); color: var(--slate-900); }
.user-menu-link i { color: var(--slate-400); font-size: 14px; }

/* ====================================================================
   NOTIFICATIONS bell + dropdown  (Phase 2 Slice C)
   ==================================================================== */
.notif-menu { position: relative; margin: 0; }
.notif-menu summary { list-style: none; cursor: pointer; }
.notif-menu summary::-webkit-details-marker { display: none; }
.notif-menu[open] summary.icon-btn { background: var(--slate-100); color: var(--slate-700); }

.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--danger-500); color: white;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  border: 2px solid var(--slate-50);
}

.notif-pop {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 340px; max-height: 480px; overflow: auto;
  background: white;
  border: 1px solid var(--slate-150); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(12, 15, 20, 0.12);
  z-index: 200;
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--slate-100);
  font-size: 12.5px; font-weight: 600; color: var(--slate-700);
}
.notif-head-link {
  font-size: 11.5px; font-weight: 500; color: var(--indigo-600);
  text-decoration: none;
}
.notif-head-link:hover { text-decoration: underline; }

.notif-list { list-style: none; padding: 0; margin: 0; }
.notif-list li { border-bottom: 1px solid var(--slate-100); }
.notif-list li:last-child { border-bottom: none; }

.notif-item {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; text-decoration: none; color: var(--slate-800);
}
.notif-item:hover { background: var(--slate-50); }
.notif-item-icon { font-size: 16px; padding-top: 1px; flex-shrink: 0; }
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-title {
  font-size: 12.5px; font-weight: 500; color: var(--slate-900);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.notif-item-meta { font-size: 11px; color: var(--slate-500); margin-top: 2px; }

.notif-empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px 14px; gap: 8px;
  font-size: 12px; color: var(--slate-500);
}
.notif-empty i { font-size: 24px; color: var(--slate-300); }

/* ====================================================================
   PROFILE PAGE  (/Account/Profile)
   ==================================================================== */
.profile-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
}
.profile-card {
  padding: 18px 20px; background: white;
  border: 1px solid var(--slate-150); border-radius: 10px;
  box-shadow: 0 1px 2px rgba(12, 15, 20, 0.04);
}
.profile-card .card-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--slate-100);
  padding-bottom: 10px; margin-bottom: 14px;
}
.profile-card .card-head h3 { font-size: 14px; font-weight: 600; color: var(--slate-900); margin: 0; }

.profile-identity {
  display: flex; gap: 16px; align-items: flex-start;
}
.monogram-lg {
  width: 56px; height: 56px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 600; flex-shrink: 0;
}
.profile-identity-body { flex: 1; min-width: 0; }
.profile-name { font-size: 16px; font-weight: 600; color: var(--slate-900); }
.profile-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 8px 0; font-size: 12.5px; color: var(--slate-500); }
.profile-meta i { margin-right: 4px; }
.profile-times { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--slate-700); margin-top: 6px; }

.profile-roles { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.profile-admin-note {
  background: var(--success-100); color: var(--success-700);
  border-radius: 6px; padding: 8px 10px; font-size: 12px;
  margin-bottom: 12px;
}
.profile-admin-note i { margin-right: 6px; }

.profile-perms { display: flex; flex-direction: column; gap: 12px; }
.profile-perm-group-lbl {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--slate-500);
  margin-bottom: 4px;
}
.profile-perm-table { width: 100%; border-collapse: collapse; }
.profile-perm-table td {
  padding: 6px 8px; font-size: 12.5px;
  border-bottom: 1px solid var(--slate-100);
}
.profile-perm-table tr:last-child td { border-bottom: none; }
.profile-perm-mod  { color: var(--slate-700); }
.profile-perm-lvl  { text-align: right; width: 110px; }

.perm-badge {
  font-size: 10.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 99px;
  display: inline-block; min-width: 80px; text-align: center;
}
.perm-full { background: var(--indigo-100); color: var(--indigo-700); }
.perm-edit { background: var(--success-100); color: var(--success-700); }
.perm-view { background: var(--info-100);    color: var(--info-700); }
.perm-none { background: var(--slate-100);   color: var(--slate-400); }

.profile-form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 4px; }
.form-row label { font-size: 12px; font-weight: 500; color: var(--slate-700); }

.profile-activity .audit-row { padding: 8px 0; border-bottom: 1px solid var(--slate-50); }
.empty-inline { color: var(--slate-500); font-size: 12.5px; padding: 8px 0; }
.empty-inline i { margin-right: 6px; }

/* ====================================================================
   DASHBOARD  (/)
   ==================================================================== */
.dash-row {
  display: grid; gap: 14px; margin-bottom: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
.dash-row-phase2 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.dash-section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0 2px 6px; margin: 4px 0 8px;
}
.dash-section-head h3 {
  font-size: 12.5px; font-weight: 600; color: var(--slate-700); margin: 0;
  letter-spacing: 0.01em;
}
/* Dashboard "Order value" year picker + explainer (Phase 1.5 item 13). */
.dash-section-head h3 { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dash-year-form { display: inline; margin: 0; }
.dash-year-form select { font: inherit; font-weight: 600; color: var(--indigo-600); border: 1px solid var(--slate-200);
                         border-radius: 6px; padding: 1px 6px; background: #fff; cursor: pointer; }
.dash-year-reset { font-size: 11.5px; font-weight: 500; color: var(--slate-500); }
.dash-howto { position: relative; }
.dash-howto summary { list-style: none; cursor: pointer; font-size: 11.5px; color: var(--slate-500); }
.dash-howto summary::-webkit-details-marker { display: none; }
.dash-howto summary:hover { color: var(--indigo-600); }
.dash-howto[open] summary { color: var(--indigo-600); }
.dash-howto-body { position: absolute; right: 0; top: 22px; z-index: 20; width: min(560px, 90vw);
                   background: #fff; border: 1px solid var(--slate-150); border-radius: 10px; padding: 14px 16px;
                   box-shadow: 0 10px 30px rgba(12,15,20,.12); font-size: 12.5px; line-height: 1.6; color: var(--slate-700); }
.dash-howto-body p { margin: 0 0 8px; }
.dash-howto-body p:last-child { margin-bottom: 0; }
.dash-row-devices {
  display: grid; gap: 12px; margin-bottom: 18px;
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
@media (max-width: 1100px) { .dash-row-devices { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width:  640px) { .dash-row-devices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---- KPI tile v2: colored top stripe, label-up-top, large number, status chip. ---- */
.dash-tile {
  position: relative; display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--slate-150); border-radius: 10px;
  padding: 12px 14px 12px; box-shadow: 0 1px 2px rgba(12,15,20,0.04);
  text-decoration: none; color: var(--slate-900);
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
  overflow: hidden; min-height: 100px;
}
.dash-tile::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0;
  height: 3px; background: var(--indigo-500);
}
.dash-tile-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.07);
  border-color: var(--slate-200);
}

.dash-tile-lbl {
  font-size: 10px; font-weight: 600; letter-spacing: 0.07em;
  color: var(--slate-500); text-transform: uppercase; margin: 0;
}
.dash-tile-num {
  font-size: 26px; font-weight: 700; line-height: 1; letter-spacing: -0.4px;
  margin: 6px 0 4px; color: var(--slate-900);
}
.dash-tile-sub { font-size: 11.5px; color: var(--slate-500); margin: 0; line-height: 1.3; }
.dash-tile-chip {
  align-self: flex-start; margin-top: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600;
  padding: 2px 8px; border-radius: 99px;
  background: var(--slate-100); color: var(--slate-600);
}
.dash-tile-icon { display: none; } /* legacy slot — hidden in v2 */

/* Order-value cards — 4 across (3 per-type + 1 combined), two stacked $ figures each. */
.dash-row-values { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1100px) { .dash-row-values { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width:  640px) { .dash-row-values { grid-template-columns: 1fr; } }

.dval-grid { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.dval { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dval-lbl { font-size: 11px; color: var(--slate-500); white-space: nowrap; }
.dval-num { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; line-height: 1; }
/* Consistent meaning across every value card: amber = outstanding backlog, green = earned/closed. */
.dval-backlog  .dval-num { color: var(--warning-700); }
.dval-awaiting .dval-num { color: var(--info-700); }
.dval-closed   .dval-num { color: var(--success-700); }

/* Combined card — neutral slate stripe + a backlog-vs-closed split bar. */
.dash-tile-combined::before { background: linear-gradient(90deg, var(--slate-500), var(--slate-400)); }
.dval-bar {
  margin-top: 11px; height: 6px; border-radius: 3px; overflow: hidden;
  background: var(--warning-200);   /* backlog remainder */
}
.dval-bar > i { display: block; height: 100%; background: var(--success-500); border-radius: 3px 0 0 3px; }

/* Compact variant — used by the device-status row (6 tiles wide). */
.dash-tile-compact { padding: 10px 12px; min-height: 74px; }
.dash-tile-compact .dash-tile-num { font-size: 22px; margin: 4px 0 0; }
.dash-tile-compact .dash-tile-lbl { font-size: 9.5px; }

/* Tone palette for stripe + chip + number-accent. */
.dash-tile-violet::before  { background: linear-gradient(90deg, var(--indigo-500), var(--indigo-400)); }
.dash-tile-violet  .dash-tile-num  { color: var(--indigo-700); }
.dash-tile-violet  .dash-tile-chip { background: var(--indigo-100);   color: var(--indigo-700); }

.dash-tile-amber::before   { background: linear-gradient(90deg, var(--warning-500), #FBBF24); }
.dash-tile-amber   .dash-tile-num  { color: var(--warning-700); }
.dash-tile-amber   .dash-tile-chip { background: var(--warning-100);  color: var(--warning-700); }

.dash-tile-rose::before    { background: linear-gradient(90deg, var(--danger-500), #F87171); }
.dash-tile-rose    .dash-tile-num  { color: var(--danger-700); }
.dash-tile-rose    .dash-tile-chip { background: var(--danger-100);   color: var(--danger-700); }

.dash-tile-emerald::before { background: linear-gradient(90deg, var(--success-500), #4ADE80); }
.dash-tile-emerald .dash-tile-num  { color: var(--success-700); }
.dash-tile-emerald .dash-tile-chip { background: var(--success-100);  color: var(--success-700); }

.dash-tile-disabled {
  background: var(--slate-50); border-style: dashed; border-color: var(--slate-200);
  pointer-events: none; box-shadow: none;
}
.dash-tile-disabled::before { background: var(--slate-200); }
.dash-tile-disabled .dash-tile-num,
.dash-tile-disabled .dash-tile-lbl,
.dash-tile-disabled .dash-tile-sub { color: var(--slate-400); }
.dash-tile-disabled .dash-tile-chip { background: var(--slate-100); color: var(--slate-400); }

.phase2-chip {
  position: absolute; top: 10px; right: 12px;
  font-size: 9.5px; font-weight: 700;
  padding: 1px 7px; border-radius: 99px;
  background: var(--warning-100); color: var(--warning-700);
  text-transform: uppercase; letter-spacing: 0.06em;
}

.dash-grid {
  display: grid; gap: 16px; margin-bottom: 16px;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
}
.dash-card { padding: 12px 18px 14px; }

/* =========================================================
   Reports KPI tiles — same visual language as .dash-tile
   (white card + 3px colored top stripe). Shared by
   /Reports/Analytics and /Reports/OrderFlow.
   NOTE: main.content is flex-column gap:20px — do NOT add
   margin-top to report sections, the gap already spaces them.
   ========================================================= */
.rpt-kpi-grid {
  display: grid; gap: 14px; margin: 0;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.rpt-kpi-tile {
  position: relative; overflow: hidden;
  background: #fff; border: 1px solid var(--slate-150); border-radius: 10px;
  padding: 12px 14px; box-shadow: 0 1px 2px rgba(12,15,20,0.04);
}
.rpt-kpi-tile::before {
  content: ''; position: absolute; left: 0; right: 0; top: 0;
  height: 3px; background: linear-gradient(90deg, var(--slate-400), var(--slate-300));
}
.rpt-kpi-label { font-size: 10px; font-weight: 600; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--slate-500); margin: 0; }
.rpt-kpi-value { font-size: 24px; font-weight: 700; line-height: 1; letter-spacing: -0.3px;
  margin: 6px 0 2px; color: var(--slate-900); }
.rpt-kpi-sub   { font-size: 11.5px; color: var(--slate-500); margin: 0; line-height: 1.3; }

/* tones — stripe + number accent, matching the dashboard palette */
.rpt-kpi-tile.tone-indigo::before  { background: linear-gradient(90deg, var(--indigo-500), var(--indigo-400)); }
.rpt-kpi-tile.tone-indigo  .rpt-kpi-value { color: var(--indigo-700); }
.rpt-kpi-tile.tone-emerald::before { background: linear-gradient(90deg, var(--success-500), #4ADE80); }
.rpt-kpi-tile.tone-emerald .rpt-kpi-value { color: var(--success-700); }
.rpt-kpi-tile.tone-amber::before   { background: linear-gradient(90deg, var(--warning-500), #FBBF24); }
.rpt-kpi-tile.tone-amber   .rpt-kpi-value { color: var(--warning-700); }
.rpt-kpi-tile.tone-rose::before    { background: linear-gradient(90deg, var(--danger-500), #F87171); }
.rpt-kpi-tile.tone-rose    .rpt-kpi-value { color: var(--danger-700); }
.rpt-kpi-tile.tone-slate::before   { background: linear-gradient(90deg, var(--slate-500), var(--slate-400)); }

.rpt-h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--slate-900); }
.rpt-h2-sub { font-size: 12px; font-weight: 400; color: var(--slate-500); }

/* ---- Row-level order reports (Phase 1.5: ext-rep commission, backlog, receivables) ---- */
/* main.content is a flex column with a 20px gap — sections carry no margin-top. */
.rpt-toolbar { display: flex; flex-direction: column; gap: 10px; background: #fff; border: 1px solid var(--slate-150);
               border-radius: 10px; padding: 12px 14px; box-shadow: 0 1px 2px rgba(12,15,20,.04); }
.rpt-filters { display: flex; gap: 12px; align-items: end; flex-wrap: wrap; }
.rpt-filters label { display: flex; flex-direction: column; font-size: 11px; color: var(--slate-500); gap: 3px; }
.rpt-filters select, .rpt-filters input[type=date] { padding: 6px 10px; border: 1px solid var(--slate-200); border-radius: 6px;
               font-size: 13px; height: 33px; background: #fff; color: var(--slate-900); }
.rpt-presets { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.rpt-spacer { flex: 1 1 auto; }
.rpt-preset { appearance: none; border: 1px solid var(--slate-200); background: #fff; cursor: pointer; padding: 5px 12px;
              font-size: 12px; font-weight: 600; color: var(--slate-600); border-radius: 999px; }
.rpt-preset:hover { background: var(--slate-50); color: var(--slate-900); }
.rpt-preset.active { background: var(--indigo-500); color: #fff; border-color: var(--indigo-500); }
.rpt-seg { display: inline-flex; border: 1px solid var(--slate-200); border-radius: 8px; overflow: hidden; background: #fff; height: 33px; }
.rpt-seg a { display: inline-flex; align-items: center; padding: 0 14px; font-size: 12.5px; font-weight: 600; color: var(--slate-500); text-decoration: none; }
.rpt-seg a + a { border-left: 1px solid var(--slate-200); }
.rpt-seg a.active { background: var(--indigo-500); color: #fff; }
.rpt-table-wrap { overflow-x: auto; }
.rpt-table { width: 100%; border-collapse: collapse; font-size: 12.5px; background: #fff; }
.rpt-table th, .rpt-table td { padding: 8px 12px; border-bottom: 1px solid var(--slate-100); text-align: left; white-space: nowrap; }
.rpt-table thead th { background: var(--slate-50); color: var(--slate-500); font-size: 10.5px; font-weight: 600;
                      letter-spacing: .04em; text-transform: uppercase; }
.rpt-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.rpt-table td.wrap { white-space: normal; min-width: 180px; }
.rpt-table tbody tr:hover td { background: var(--indigo-50); }
.rpt-table tr.rpt-group td { background: var(--slate-50); font-weight: 600; color: var(--slate-900); padding-top: 10px; }
.rpt-table tr.rpt-subtotal td { font-weight: 600; color: var(--slate-900); border-bottom: 2px solid var(--slate-150); }
.rpt-table tfoot td { border-top: 2px solid var(--slate-200); font-weight: 700; background: var(--slate-50); color: var(--slate-900); }
.rpt-table a.rpt-ref { font-family: var(--font-mono, ui-monospace, monospace); font-weight: 600; color: var(--indigo-500); }
.rpt-type { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.rpt-type.t1 { background: #eef1fe; color: #3b57d6; }
.rpt-type.t2 { background: #e6f6f5; color: #137a74; }
.rpt-type.t3 { background: #fdf0e6; color: #b3621f; }
.rpt-pill-late { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
                 background: var(--danger-100); color: var(--danger-700); }
.rpt-pill-ok   { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px;
                 background: var(--success-100); color: var(--success-700); }
.rpt-muted { color: var(--slate-400); }
@media print { .rpt-toolbar { display: none !important; } .rpt-table tbody tr:hover td { background: none; } }

/* ---- My open tasks: full-width tabular panel with type chips, assignee, action ---- */
/* Selectors stack .dash-card.mt-card to outrank the generic .dash-card .card-head rule below. */
.dash-card.mt-card { padding: 12px 18px 14px; margin-bottom: 14px; }
.dash-card.mt-card .card-head {
  padding: 4px 0 8px;
  margin-bottom: 0;
  border-bottom: none;            /* table thead already provides the separator strip */
}
.dash-card.mt-card .card-head h3 { font-size: 13px; line-height: 1.2; font-weight: 600; }
.card-head-meta { display: inline-flex; gap: 10px; align-items: center; }

.mt-table-wrap { overflow-x: auto; margin: 0 -18px -18px; }
.mt-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.mt-table thead th {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--slate-500);
  text-align: left; padding: 10px 12px;
  background: var(--slate-50);
  border-top: 1px solid var(--slate-100);
  border-bottom: 1px solid var(--slate-150);
  white-space: nowrap;
}
.mt-table thead th:first-child { padding-left: 18px; }
.mt-table thead th:last-child  { padding-right: 18px; }
.mt-table tbody tr.mt-row { transition: background-color 100ms; }
.mt-table tbody tr.mt-row:hover { background: var(--indigo-50); }
.mt-table tbody td {
  padding: 12px; vertical-align: middle;
  border-bottom: 1px solid var(--slate-100);
  color: var(--slate-700);
}
.mt-table tbody td:first-child { padding-left: 18px; }
.mt-table tbody td:last-child  { padding-right: 18px; }
.mt-table tbody tr:last-child td { border-bottom: none; }

/* Overdue treatment — rose left border + bold red days. */
.mt-table tbody tr.mt-row-overdue td:first-child {
  box-shadow: inset 3px 0 0 var(--danger-500);
}

/* mt-table reused inside a standalone .tbl-card (the /Workflow "view all" list pages)
   instead of a .dash-card.mt-card. The wrap's negative-margin bleed is meant to cancel
   the dashboard card's 18px padding; a .tbl-card has none, so the bleed pushes the table
   past the card edge and the clipped header reads as a cut-off border. Neutralise it and
   align the edge inset to the 16px toolbar padding. */
.tbl-card .mt-table-wrap { margin: 0; }
.tbl-card .mt-table thead th:first-child,
.tbl-card .mt-table tbody td:first-child { padding-left: 16px; }
.tbl-card .mt-table thead th:last-child,
.tbl-card .mt-table tbody td:last-child  { padding-right: 16px; }

.mt-order-ref {
  font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-weight: 600; font-size: 12px; color: var(--indigo-600); text-decoration: none;
  letter-spacing: -0.2px;
}
.mt-order-ref:hover { color: var(--indigo-700); text-decoration: underline; }

.mt-task-name {
  font-weight: 500; font-size: 13px; color: var(--slate-900); text-decoration: none;
}
.mt-task-name:hover { color: var(--indigo-600); text-decoration: underline; }

.mt-cell-ms { font-size: 12px; }
.mt-cell-cust { font-size: 12.5px; color: var(--slate-700); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-cell-asg { font-size: 12px; color: var(--slate-600); white-space: nowrap; }

.mt-cell-days { white-space: nowrap; min-width: 88px; }
.mt-days {
  font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
  font-weight: 600; font-size: 14px; color: var(--slate-700);
}
.mt-days small { font-weight: 500; color: var(--slate-400); margin-left: 1px; }
.mt-days-overdue { color: var(--danger-700); }
.mt-days-overdue small { color: var(--danger-500); }
.mt-days-sub { font-size: 10.5px; margin-top: 2px; color: var(--slate-400); }

/* Recent activity column hints (mt-table reuse). */
.mt-col-time    { width: 110px; }
.mt-col-actor   { width: 140px; }
.mt-col-action  { width: 130px; }
.mt-col-module  { width: 120px; }
.mt-col-changes { width: 110px; }
.mt-cell-time   { font-family: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace); font-size: 11.5px; white-space: nowrap; }
.mt-cell-actor  { font-size: 12.5px; color: var(--slate-700); }
.mt-cell-action { font-size: 12.5px; color: var(--slate-700); white-space: nowrap; text-transform: capitalize; }

.mt-cell-act { text-align: right; white-space: nowrap; }
.mt-cell-act .btn { font-size: 11.5px; padding: 4px 10px; }
.mt-cell-act .btn i { font-size: 11px; margin-left: 2px; }

/* Type / status chips for the table cells. */
.mt-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: 99px;
  background: var(--slate-100); color: var(--slate-600);
  text-transform: uppercase; white-space: nowrap;
}
.mt-chip-sm { font-size: 9.5px; padding: 2px 7px; margin-left: 6px; }
.mt-chip-violet  { background: var(--indigo-100);  color: var(--indigo-700); }
.mt-chip-amber   { background: var(--warning-100); color: var(--warning-700); }
.mt-chip-emerald { background: var(--success-100); color: var(--success-700); }
.mt-chip-rose    { background: var(--danger-100);  color: var(--danger-700); }
.dash-card .card-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--slate-100); padding: 4px 0 8px; margin-bottom: 10px;
}
.dash-card .card-head h3 { font-size: 13px; font-weight: 600; color: var(--slate-900); margin: 0; line-height: 1.2; }
.dash-card-link { font-size: 11.5px; text-decoration: none; }
.dash-card-link:hover { color: var(--indigo-500); }

.dash-status-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px;
}
.dash-status-tile {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-radius: 8px;
  background: var(--slate-50); border: 1px solid var(--slate-100);
  text-decoration: none; color: inherit;
  transition: all 100ms;
}
.dash-status-tile:hover { background: white; border-color: var(--indigo-100); }
.dash-status-num { font-size: 18px; font-weight: 600; }

.dash-list { width: 100%; border-collapse: collapse; }
.dash-list td { padding: 8px 6px; border-bottom: 1px solid var(--slate-50); vertical-align: top; }
.dash-list tr:last-child td { border-bottom: none; }
.dash-list-title { font-size: 12.5px; font-weight: 500; color: var(--slate-900); text-decoration: none; font-family: var(--font-mono); }
.dash-list-title:hover { color: var(--indigo-500); }
.dash-list-sub { font-size: 11px; margin-top: 2px; }
.dash-list-when { text-align: right; white-space: nowrap; width: 110px; }
.dash-list-days { font-size: 11px; }
.dash-list-more { padding: 8px 6px 0; font-size: 11px; }

/* =========================================================
   Order Header Strip + Workflow Timeline (above tab bar)
   ========================================================= */
.ord-strip-wrap { position: relative; margin-bottom: 14px; }
.ord-strip-actions {
  position: absolute; top: 14px; right: 16px;
  display: flex; align-items: center; gap: 8px; z-index: 1;
}
.ord-strip {
  background: #fff;
  border: 1px solid var(--slate-100);
  border-radius: 12px;
  padding: 16px 20px 18px;
}
.ord-strip-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 24px;
}
.ord-strip-id {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  /* Leave room for the absolutely-positioned actions in top-right ONLY on the id row.
     The meta row sits below the buttons (forced to its own line via flex-basis:100% on
     .ord-strip-meta) so it gets the full width — no overlap with short device/customer values. */
  flex: 1 1 auto; min-width: 0; padding-right: 180px;
}
/* Force CUSTOMER · DEVICE · RECEIVED · VALUE · AGE onto its own line below the id row
   so it never collides with the action buttons sitting at top:14px right:16px. */
.ord-strip-meta { flex-basis: 100%; }
.ord-strip-ref {
  font-size: 22px; font-weight: 600; color: var(--slate-900); letter-spacing: -0.01em;
}
.ord-strip-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 26px;
  margin: 0; padding: 0;
}
.ord-strip-meta > div { display: flex; align-items: baseline; gap: 8px; }
.ord-strip-meta dt {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em;
  color: var(--slate-400); text-transform: uppercase; margin: 0;
}
.ord-strip-meta dd {
  margin: 0; font-size: 13px; color: var(--slate-900); font-weight: 500;
}
.ord-strip-more {
  font-size: 11px; color: var(--slate-400); margin-left: 4px;
}
.ord-strip-age-overdue { color: #C2410C; font-weight: 600; }

/* timeline progress bar */
.tl-bar {
  margin-top: 14px;
  display: flex; flex-direction: column; gap: 8px;
}
.tl-bar-summary {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--slate-500);
}
.tl-bar-summary strong { color: var(--slate-900); font-weight: 600; }
.tl-bar-sep { color: var(--slate-300); }
.tl-bar-active-label { color: var(--indigo-600); font-weight: 600; }
.tl-bar-done-label { color: var(--success-700); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }

.tl-bar-track {
  position: relative;
  height: 10px;
  background: var(--slate-100);
  border-radius: 999px;
  overflow: visible;
}
/* Done portion: solid green only — no gradient mixing with pending colors */
.tl-bar-fill {
  position: absolute; top: 0; left: 0; bottom: 0;
  background: var(--success-500);
  border-radius: 999px;
  transition: width 200ms ease;
}
.tl-bar-notches {
  position: absolute; inset: 0;
  list-style: none; padding: 0; margin: 0;
}
.tl-notch {
  position: absolute; top: 50%;
  width: 11px; height: 11px; border-radius: 50%;
  background: #fff; border: 2px solid var(--slate-300);
  transform: translate(-50%, -50%);
  cursor: help;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.tl-notch:hover { transform: translate(-50%, -50%) scale(1.5); box-shadow: 0 0 0 4px rgba(79,70,229,0.15); }

/* Done = filled white check on green halo (sits on the green fill so we use a white inner dot) */
.tl-notch-done {
  background: #fff;
  border-color: var(--success-700);
}

/* Pending = light gray hollow ring */
.tl-notch-pending {
  background: #fff;
  border-color: var(--slate-300);
}

/* Active = large indigo with white core + halo, clearly distinct from both done & pending */
.tl-notch-active {
  background: var(--indigo-500);
  border: 3px solid #fff;
  width: 18px; height: 18px;
  box-shadow: 0 0 0 3px var(--indigo-500), 0 0 0 7px rgba(79,70,229,0.18);
  z-index: 2;
}

/* =====================================================================
   Share modal (Order Details -> "Share" button -> <dialog>)
   ===================================================================== */
.ord-strip-actions-share { display: inline-flex; }

.share-modal {
  border: none; border-radius: 12px; padding: 0;
  width: 540px; max-width: calc(100vw - 32px);
  box-shadow: 0 30px 60px -20px rgba(15, 23, 42, 0.40), 0 8px 20px -6px rgba(15, 23, 42, 0.20);
  background: #fff; color: var(--slate-900);
}
.share-modal::backdrop { background: rgba(15, 23, 42, 0.45); }
.share-modal-form { padding: 18px 20px 12px; margin: 0; }
.share-modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.share-modal-head h3 { font-size: 16px; font-weight: 600; margin: 0; }
.share-modal-help { font-size: 13px; color: var(--slate-500); margin: 4px 0 14px; line-height: 1.45; }
.share-modal-url-row { display: flex; gap: 8px; align-items: stretch; }
.share-modal-url-row input {
  flex: 1; font-family: var(--font-mono); font-size: 12.5px;
  padding: 8px 10px; border: 1px solid var(--slate-200); border-radius: 6px;
  background: var(--slate-50); color: var(--slate-700);
}
.share-modal-url-row input:focus { outline: 2px solid var(--indigo-300); outline-offset: -1px; }
.share-modal-actions {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; font-size: 12.5px; color: var(--slate-500);
}
.share-modal-spacer { flex: 1; }
.share-modal-revoke {
  border-top: 1px solid var(--slate-100);
  padding: 10px 20px 16px; margin: 0; text-align: right;
}

/* =====================================================================
   Public order status page (/s/{token}) - used with _PublicLayout
   ===================================================================== */
.public-body { background: #050a1a; margin: 0; min-height: 100vh; position: relative; }
/* Share-page backdrop (2026-10-07): deep-space navy with the Earth + vibration-wave strip from back-mp.png
   (cropped below the website's headline/buttons -> img/share-bg.jpg, ~75 KB) pinned to the bottom, lightly
   dimmed so the white cards stay readable. A fixed pseudo-element (not background-attachment: fixed, which
   iOS ignores) so it stays put while the page scrolls. */
.public-body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(rgba(5, 10, 26, 0.30), rgba(5, 10, 26, 0.30)),
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(59, 130, 246, 0.16), transparent 70%),
    url("../img/share-bg.jpg") center bottom / max(100vw, 1400px) auto no-repeat,
    #050a1a;
}
.public-shell { max-width: 1200px; margin: 0 auto; padding: 24px 28px 48px; }

.public-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 4px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.12); margin-bottom: 20px;
}
.public-brand { display: flex; align-items: center; gap: 12px; }
.public-brand .mark {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 8px; border-radius: 9px;
  background: var(--indigo-500); color: #fff;
  font-weight: 700; font-size: 15px; white-space: nowrap;
}
.public-brand-name { font-weight: 600; font-size: 15px; color: #fff; line-height: 1.1; }
.public-brand-sub  { font-size: 11.5px; color: #a5b4fc; margin-top: 2px; letter-spacing: 0.04em; text-transform: uppercase; }

.public-main { display: flex; flex-direction: column; gap: 16px; }

.public-card {
  background: #fff; border: 1px solid var(--slate-100); border-radius: 12px;
  padding: 18px 20px;
  box-shadow: 0 8px 28px rgba(2, 6, 23, 0.45);
}

.public-summary { display: flex; flex-direction: column; gap: 12px; }
.public-summary-id { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.public-ref { font-size: 18px; font-weight: 600; color: var(--slate-900); }
.public-summary-meta {
  display: flex; flex-wrap: wrap; gap: 18px 28px; margin: 0; padding: 0;
  font-size: 12px;
}
.public-summary-meta div { display: flex; flex-direction: column; gap: 2px; }
.public-summary-meta dt { font-size: 10.5px; color: var(--slate-500); letter-spacing: 0.04em; text-transform: uppercase; margin: 0; }
.public-summary-meta dd { margin: 0; font-size: 13px; color: var(--slate-900); font-weight: 500; }

.public-h2 { font-size: 14px; font-weight: 600; color: var(--slate-900); margin: 0 0 14px; }

.public-progress-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 12px; }
.public-progress-head .public-h2 { margin: 0; }
.public-progress-count { font-size: 12.5px; color: var(--slate-500); }
.public-progress-count strong { color: var(--success-700); font-weight: 600; }

/* Vertical stepper — handles 5 to 30+ milestones cleanly */
.public-vstep {
  list-style: none; padding: 0; margin: 14px 0 0; position: relative;
}
.public-vstep::before {
  content: ""; position: absolute; left: 11px; top: 14px; bottom: 14px;
  width: 2px; background: var(--slate-100);
}
.public-vstep-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center; column-gap: 12px; padding: 6px 0;
  position: relative;
}
.public-vstep-marker {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 2px solid var(--slate-300);
  color: transparent; font-size: 13px;
  position: relative; z-index: 1;
}
.public-vstep-name { font-size: 13.5px; color: var(--slate-900); }
.public-vstep-meta { font-size: 11.5px; color: var(--slate-500); white-space: nowrap; }

.public-vstep-done .public-vstep-marker {
  background: var(--success-500); border-color: var(--success-500); color: #fff;
}
.public-vstep-done .public-vstep-name { color: var(--slate-500); }
.public-vstep-done .public-vstep-meta { color: var(--success-700); font-weight: 500; }

.public-vstep-active .public-vstep-marker {
  background: var(--indigo-500); border-color: var(--indigo-500); color: #fff;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15);
}
.public-vstep-active .public-vstep-name { font-weight: 600; color: var(--indigo-700); }
.public-vstep-active .public-vstep-meta { color: var(--indigo-600); font-weight: 600; }

.public-vstep-pending .public-vstep-name { color: var(--slate-500); }

.public-current { margin: 0 0 14px; padding: 12px 14px; background: var(--indigo-50); border-radius: 8px; }
.public-current-label { font-size: 12px; color: var(--slate-500); margin-bottom: 6px; }
.public-current-task {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 14px; color: var(--slate-900); font-weight: 500;
}
.public-current-task i { color: var(--indigo-500); font-size: 18px; }
.public-current-pill {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px;
  background: var(--indigo-50); color: var(--indigo-700);
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
}
.public-current-done i { color: var(--success-500); }

.public-empty { font-size: 13px; color: var(--slate-500); font-style: italic; }

.public-device-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.public-device-list li {
  border-left: 3px solid var(--indigo-200); padding: 4px 12px;
}
.public-device-line { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.public-device-line strong { font-size: 13.5px; color: var(--slate-900); }
.public-device-type { font-size: 11.5px; color: var(--slate-500); }
.public-modules { font-size: 12.5px; color: var(--slate-700); margin-top: 4px; }
.public-modules-label { color: var(--slate-500); margin-right: 4px; }

.public-contact {
  background: var(--slate-50); border-radius: 8px; padding: 12px 14px;
}
.public-contact-role {
  font-size: 10.5px; color: var(--slate-500);
  letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 6px;
}
.public-contact-name { font-size: 14px; color: var(--slate-900); font-weight: 600; }
.public-contact-email { font-size: 12.5px; color: var(--slate-700); margin-top: 4px; display: inline-flex; align-items: center; gap: 6px; }
.public-contact-email a { color: var(--indigo-600); text-decoration: none; }
.public-contact-email a:hover { text-decoration: underline; }

/* Survey + stay-connected card */
.public-survey { display: flex; align-items: center; gap: 18px; }
.public-survey-text { flex: 1; min-width: 0; }
.public-survey-text p { margin: 0 0 12px; font-size: 13px; color: var(--slate-700); line-height: 1.5; }
.public-survey-text p.public-survey-thanks { margin: 12px 0 0; color: var(--slate-500); font-size: 12.5px; }
.public-survey-btn {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 8px;
  background: var(--indigo-500); color: #fff; font-size: 13px; font-weight: 600; text-decoration: none;
}
.public-survey-btn:hover { background: var(--indigo-600); color: #fff; }
.public-survey-qr { flex-shrink: 0; border: 1px solid var(--slate-100); border-radius: 8px; image-rendering: pixelated; }
.public-connect {
  margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--slate-100);
  font-size: 12.5px; color: var(--slate-700); line-height: 1.6;
}
.public-connect a { color: var(--indigo-600); text-decoration: none; font-weight: 500; white-space: nowrap; }
.public-connect a:hover { text-decoration: underline; }
.public-connect .bi-linkedin { color: #0a66c2; }
/* On a phone the page is already on the device a QR would open, so just the button. */
@media (max-width: 560px) { .public-survey-qr, .public-survey-qr-hint { display: none; } }

.public-timeline { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.public-timeline li { display: flex; align-items: center; gap: 12px; }
.public-timeline-date {
  font-size: 11.5px; color: var(--slate-500); width: 150px; flex-shrink: 0;
}
.public-timeline-dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--success-500); flex-shrink: 0;
}
.public-timeline-name { font-size: 13px; color: var(--slate-900); }
.public-timeline-tag {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--success-50); color: var(--success-700);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase;
}

.public-footer {
  margin-top: 28px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11.5px; color: #cbd5e1; text-align: center;
}
.public-footer a { color: #93c5fd; }
.public-footer span { display: inline-block; padding: 5px 12px; border-radius: 999px; background: rgba(5, 10, 26, 0.65); }
/* Leave the Earth + wave strip visible under the last card / footer. */
.public-body .public-shell { padding-bottom: clamp(140px, 14vw, 240px); }

/* Copy-to-clipboard inline buttons */
.btn-copy {
  background: transparent; border: none; padding: 2px 6px;
  color: var(--slate-500, #64748b); cursor: pointer;
  border-radius: 4px;
}
.btn-copy:hover { color: var(--indigo-500, #6366f1); background: var(--slate-100, #f1f5f9); }
.btn-copy i { font-size: 13px; vertical-align: middle; }


/* Amber informational notice (Test Connect change warnings — Upload, Details, Apply). */
.notice-warn { display: flex; gap: 10px; align-items: flex-start; background: var(--warning-100); border: 1px solid #FCD9A0;
               color: var(--slate-900); border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.6; }
.notice-warn > .bi { color: var(--warning-700); font-size: 16px; line-height: 1.3; }
.notice-warn .notice-body { flex: 1; min-width: 0; }
.notice-warn ul { margin: 4px 0 0; padding-left: 18px; }
.notice-warn .notice-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* QB sync (sql/689): QuickBooks link tag on order Details + marker in order lists */
.qb-tag  { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500; padding: 2px 8px;
           border-radius: 999px; background: #E8F5E9; color: #2E7D32; border: 1px solid #C8E6C9; white-space: nowrap; }
.qb-mark { display: inline-flex; align-items: center; gap: 3px; margin-left: 4px; font-size: 10px; font-weight: 600; padding: 1px 6px;
           border-radius: 999px; background: #E8F5E9; color: #2E7D32; border: 1px solid #C8E6C9; vertical-align: 1px; }
.qb-tag .bi, .qb-mark .bi { font-size: 0.95em; }

/* ---- Deferred revenue pages (sql/693) ---- */
.def-alert { background: var(--danger-100); color: var(--danger-700); border: 1px solid var(--danger-100); border-radius: 8px;
             padding: 10px 14px; font-size: 13px; }
.def-alert.info { background: var(--info-100); color: var(--info-700); border-color: var(--info-100); }
.def-hint { font-size: 11.5px; color: var(--slate-500); margin-top: 4px; }
.def-q-card { border: 1px solid var(--slate-150); border-radius: 10px; background: #fff; padding: 12px 14px; }
.def-q-card + .def-q-card { margin-top: 12px; }
.def-q-head { display: flex; gap: 14px; flex-wrap: wrap; align-items: baseline; }
.def-q-head .ref { font-family: var(--font-mono, ui-monospace, monospace); font-weight: 600; }
.def-q-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 10px; align-items: end; }
.def-q-form .field { margin: 0; }
.def-q-lines { font-size: 12px; margin-top: 8px; }
.def-q-lines td { padding: 2px 10px 2px 0; }
.def-q-lines tr.on td { color: var(--slate-900); font-weight: 600; }
.def-q-lines tr.off td { color: var(--slate-400); }

/* =====================================================================
   Shared confirm dialog (_ConfirmDialog, data-confirm on a submit button)
   ===================================================================== */
.confirm-dlg {
  border: none; border-radius: 12px; padding: 0; width: 440px; max-width: calc(100vw - 32px);
  box-shadow: 0 30px 60px -20px rgba(15, 23, 42, 0.40), 0 8px 20px -6px rgba(15, 23, 42, 0.20);
  background: #fff; color: var(--slate-900);
}
.confirm-dlg::backdrop { background: rgba(15, 23, 42, 0.45); }
.confirm-dlg-body { padding: 20px 22px 16px; margin: 0; }
.confirm-dlg-body h3 { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.confirm-dlg-body p { font-size: 13px; color: var(--slate-500); margin: 0; line-height: 1.5; }
.confirm-dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin: 18px 0 0; padding: 0; }
.confirm-dlg-danger { background: var(--danger-700); color: #fff; border-color: transparent; }
.confirm-dlg-danger:hover { filter: brightness(1.08); }
