/* ---------- Base / Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: #0f172a;
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Tokens ---------- */
:root {
  --bg-grad: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-muted: #475569;
  --text-faint: #64748b;

  --primary-grad: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
  --primary: #2563eb;
  --primary-deep: #1e40af;

  --good: #16a34a;
  --good-bg: #dcfce7;
  --good-tint: #f0fdf4;
  --urgent: #dc2626;
  --urgent-bg: #fee2e2;
  --urgent-tint: #fef2f2;
  --caution: #f59e0b;
  --caution-bg: #fef3c7;
  --caution-tint: #fffbeb;
  --routine: #2563eb;
  --routine-bg: #dbeafe;
  --routine-tint: #eff6ff;

  --radius: 16px;
  --radius-sm: 10px;
  --radius-xs: 6px;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04), 0 1px 1px rgba(15, 23, 42, 0.03);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 4px 8px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(15, 23, 42, 0.08);
}

/* ---------- App shell ---------- */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Top bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: saturate(140%) blur(12px);
  -webkit-backdrop-filter: saturate(140%) blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 14px 28px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px; letter-spacing: -0.01em;
  color: var(--text);
}
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--primary-grad);
  display: grid; place-items: center;
  color: white; font-size: 14px; font-weight: 700;
  letter-spacing: 0;
  box-shadow: 0 2px 6px rgba(30, 64, 175, 0.35);
}
.topbar-spacer { flex: 1; }
.topbar-nav {
  display: flex; align-items: center; gap: 4px;
}
.topbar-nav a {
  padding: 8px 12px; border-radius: 8px;
  color: var(--text-muted); font-size: 14px; font-weight: 500;
}
.topbar-nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.topbar-nav a.active { color: var(--text); background: var(--surface-2); font-weight: 600; border-bottom: 2px solid var(--primary); }

/* ---------- Impersonation banner ---------- */
.impersonation-banner {
  background: var(--caution-bg);
  border-bottom: 1px solid #fbbf24;
  color: #92400e;
  text-align: center;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.impersonation-banner a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}
.impersonation-banner a:hover {
  color: var(--primary-deep);
}

.account-switch {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: var(--text);
  background: white;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.account-switch:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.account-switch .swatch {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, #0f172a 0%, #334155 100%);
  display: grid; place-items: center;
  color: white; font-size: 10px; font-weight: 700;
}
.account-switch .chev { color: var(--text-faint); margin-left: 2px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #475569, #1e293b);
  color: white;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  border: 2px solid white;
  box-shadow: var(--shadow-sm);
}

/* ---------- Page layout ---------- */
.page {
  flex: 1;
  max-width: 1240px;
  width: 100%;
  min-width: 0;
  margin: 0 auto;
  padding: 36px 28px 80px;
}
.page-header {
  margin-bottom: 28px;
}
.page-eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 8px;
}
.page-title {
  font-size: 28px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 700;
  margin: 0;
}
.page-sub {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 15px;
  max-width: 640px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
  overflow: hidden;
}
.card-pad { padding: 24px; }
.card-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.card-head h3 {
  margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.01em;
}
.card-head .spacer { flex: 1; }

.card-link {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card-link + .card-link { margin-left: 0; }
.card-link:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: #94a3b8;
  text-decoration: none;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 14px; font-weight: 600; letter-spacing: -0.005em;
  border: 1px solid transparent;
  transition: transform .08s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary-grad);
  color: white;
  box-shadow: 0 1px 2px rgba(30,64,175,0.3), 0 4px 12px rgba(59, 130, 246, 0.25);
}
.btn-primary:hover { box-shadow: 0 1px 2px rgba(30,64,175,0.35), 0 8px 20px rgba(59, 130, 246, 0.35); }
.btn-secondary {
  background: white;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--surface-2); border-color: #94a3b8; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

/* View-as role picker dropdown */
.view-as-menu {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  min-width: 160px;
  margin-top: 4px;
  padding: 4px 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
}
.view-as-menu a {
  display: block;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
}
.view-as-menu a:hover {
  background: var(--surface-2);
}

.btn-danger {
  background: linear-gradient(135deg, #b91c1c, #dc2626);
  color: white;
  box-shadow: 0 1px 2px rgba(185,28,28,0.3), 0 4px 12px rgba(220, 38, 38, 0.25);
}
.btn-lg { padding: 14px 22px; font-size: 15px; border-radius: 12px; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Pills / badges ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; }
.pill-good { color: #15803d; background: var(--good-bg); }
.pill-good .dot { background: var(--good); }
.pill-urgent { color: #b91c1c; background: var(--urgent-bg); }
.pill-urgent .dot { background: var(--urgent); }
.pill-caution { color: #b45309; background: var(--caution-bg); }
.pill-caution .dot { background: var(--caution); }
.pill-routine { color: #1d4ed8; background: var(--routine-bg); }
.pill-routine .dot { background: var(--routine); }
.pill-neutral { color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); }
.pill-partial { color: #0369a1; background: #e0f2fe; }
.pill-partial .dot { background: #0284c7; }
.pill-info { color: #7c3aed; background: #f5f3ff; }
.pill-active { color: #fff; background: var(--text); }

/* ---------- Detail display ---------- */
.detail-value { margin: 0; font-size: 14px; color: var(--text); }
.detail-message { white-space: pre-wrap; line-height: 1.6; background: var(--surface-2); padding: 12px; border-radius: 8px; }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text); }
.field .help { font-size: 12px; color: var(--text-faint); }
.input, .textarea, .select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: white;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}
.textarea { min-height: 96px; resize: vertical; }

/* Toggle / radio cards */
.choice-row { display: flex; gap: 12px; flex-wrap: wrap; }
.choice {
  flex: 1 1 160px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 14px 16px;
  background: white;
  display: flex; align-items: center; gap: 12px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.choice:hover { border-color: #94a3b8; background: var(--surface-2); }
.choice.active {
  border-color: var(--primary);
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
.choice .radio {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--border-strong);
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.choice.active .radio { border-color: var(--primary); }
.choice.active .radio::after {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
}
.choice .label { font-weight: 600; font-size: 14px; }
.choice .sub { font-size: 12px; color: var(--text-faint); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.table th {
  font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-faint);
  background: var(--surface-2);
}
.table tr:last-child td { border-bottom: 0; }
.table tr.row-link { cursor: pointer; transition: background .12s ease; }
.table tr.row-link:hover { background: #f8fafc; }
.table .right { text-align: right; }
.table .num { font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Responsive "stacked card" tables.
   On phones, a table with the `table-cards` modifier turns each row into a
   self-contained card: the header row is hidden, and every cell shows its own
   label (from the cell's data-label attribute) on the left with the value on
   the right. This removes the need to scroll sideways to reach the Status
   column. Larger screens are unaffected and keep the normal table. */
@media (max-width: 640px) {
  .table.table-cards { min-width: 0; }
  .table.table-cards thead { display: none; }
  .table.table-cards,
  .table.table-cards tbody,
  .table.table-cards tr,
  .table.table-cards td { display: block; width: 100%; }
  .table.table-cards tr {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    background: var(--surface);
    overflow: hidden;
  }
  .table.table-cards tr:last-child { margin-bottom: 0; }
  .table.table-cards tr:hover { background: var(--surface); }
  .table.table-cards td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    text-align: right;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
  }
  .table.table-cards td:last-child { border-bottom: 0; }
  /* Left-hand label taken from each cell's data-label attribute */
  .table.table-cards td::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-faint);
    text-align: left;
    flex: 0 0 auto;
    white-space: nowrap;
  }
  /* Cells with no label (e.g. an actions column) get no divider gap */
  .table.table-cards td:not([data-label])::before { content: none; }
  /* The "no results" row spans the whole card and stays centred */
  .table.table-cards td.table-empty {
    display: block;
    text-align: center;
  }
  .table.table-cards td.table-empty::before { content: none; }
  /* An actions cell (e.g. "Pay invoice"): collapse to nothing when empty,
     otherwise show its button as a full-width action at the foot of the card.
     font-size:0 hides the stray whitespace an empty cell would otherwise show. */
  .table.table-cards td.card-actions {
    padding: 0;
    border-bottom: 0;
    font-size: 0;
  }
  .table.table-cards td.card-actions::before { content: none; }
  .table.table-cards td.card-actions .btn {
    display: block;
    margin: 12px 14px;
    font-size: 14px;
  }
}

/* ---------- Misc utilities ---------- */
.hstack { display: flex; align-items: center; gap: 12px; }
.vstack { display: flex; flex-direction: column; gap: 12px; }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.tnum { font-variant-numeric: tabular-nums; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.section-title {
  font-size: 13px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-faint);
  margin: 0 0 10px;
}

/* ---------- Pending requests ---------- */
.pending-request {
  padding: 12px 14px;
  background: var(--surface-2, #f8fafc);
  border: 1px solid var(--border);
  border-radius: 8px;
}

/* ---------- Side panel (drawer) ---------- */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.4);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(480px, 100vw);
  background: white;
  z-index: 101;
  transform: translateX(100%);
  transition: transform .25s cubic-bezier(.32,.72,.3,1);
  display: flex; flex-direction: column;
  box-shadow: -8px 0 32px rgba(15,23,42,0.12);
}
.drawer.open { transform: translateX(0); }
.drawer-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.drawer-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.drawer-body { padding: 22px; overflow-y: auto; flex: 1; }
.drawer-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--surface-2);
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.5);
  z-index: 200;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: white;
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(15,23,42,0.18);
  width: min(90vw, 520px);
  max-height: 80vh;
  display: flex; flex-direction: column;
}
.modal-head {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.modal-body { padding: 22px; overflow-y: auto; flex: 1; }
.modal-foot {
  padding: 16px 22px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 10px;
  background: var(--surface-2);
  border-radius: 0 0 12px 12px;
}

/* ---------- Icon picker ---------- */
.icon-picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
  background: var(--surface-2);
}
.icon-picker-cell {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.icon-picker-cell:hover {
  border-color: var(--border);
  color: var(--text);
}
.icon-picker-cell.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* ---------- Toast ---------- */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: white;
  padding: 12px 18px; border-radius: 12px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  z-index: 200;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
  display: flex; align-items: center; gap: 10px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Phase 1: Email preview ---------- */
.email-frame {
  max-width: 720px;
  margin: 0 auto;
}
.email-window {
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.email-chrome {
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.email-chrome .dots { display: flex; gap: 6px; }
.email-chrome .dots span {
  width: 11px; height: 11px; border-radius: 50%; background: #cbd5e1;
}
.email-chrome .url {
  margin-left: 12px;
  font-size: 12px; color: var(--text-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.email-meta {
  padding: 20px 28px;
  border-bottom: 1px solid var(--border);
  display: grid; grid-template-columns: 100px 1fr; gap: 6px 16px;
  font-size: 13px;
}
.email-meta .k { color: var(--text-faint); }
.email-meta .v { color: var(--text); }
.email-body {
  padding: 32px 28px 28px;
}
.email-body h2 {
  font-size: 22px; letter-spacing: -0.02em; margin: 0 0 16px;
}
.email-body p { margin: 0 0 14px; color: #334155; }
.email-cta-wrap {
  margin: 28px 0 12px;
  text-align: center;
  padding: 24px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}
.email-fineprint {
  font-size: 12px; color: var(--text-faint); margin-top: 18px;
}

/* ---------- Phase 1: Quote ---------- */
.quote-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
}
.quote-meta {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 24px;
  margin-top: 8px;
}
.quote-meta .k { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); margin-bottom: 4px; }
.quote-meta .v { font-size: 14px; color: var(--text); font-weight: 500; }

.line-items {
  border-radius: 12px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.line-row {
  display: grid;
  grid-template-columns: 1fr 90px 130px;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.line-row:last-child { border-bottom: 0; }
.line-row .desc strong { display: block; font-size: 14px; }
.line-row .desc small { display: block; color: var(--text-faint); font-size: 12px; margin-top: 2px; }
.line-row .qty, .line-row .amt { font-variant-numeric: tabular-nums; align-self: center; }
.line-row .qty { color: var(--text-muted); font-size: 14px; }
.line-row .amt { text-align: right; font-weight: 600; font-size: 14px; }

.totals {
  margin-top: 18px;
  border-top: 2px solid var(--text);
  padding-top: 14px;
}
.totals .row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 14px; }
.totals .row.grand { font-size: 18px; font-weight: 700; padding-top: 10px; }

.signature-card .docusign-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--surface-2);
  border-radius: 10px;
  margin-bottom: 16px;
}
.docusign-logo {
  width: 36px; height: 36px;
  background: #ffd200;
  color: #000; font-weight: 700; font-size: 11px;
  display: grid; place-items: center; border-radius: 8px;
}

/* ---------- Phase 1: Sign confirmation ---------- */
.confirm-wrap {
  max-width: 560px; margin: 80px auto 0;
  text-align: center;
}
.success-mark {
  width: 80px; height: 80px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--good-bg);
  color: var(--good);
  display: grid; place-items: center;
  position: relative;
}
.success-mark svg { width: 40px; height: 40px; }
.success-mark::after {
  content: ""; position: absolute; inset: -10px;
  border-radius: 50%;
  border: 2px solid var(--good);
  opacity: 0.25;
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.95); opacity: 0.4; }
  100% { transform: scale(1.2); opacity: 0; }
}
.countdown {
  margin-top: 24px;
  font-size: 13px; color: var(--text-muted);
}
.countdown .progress {
  margin: 12px auto 0;
  height: 4px; max-width: 220px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.countdown .bar {
  height: 100%;
  background: var(--primary-grad);
  width: 0;
  transition: width 1s linear;
}

/* ---------- Phase 2: Hub tiles ---------- */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 32px;
}
.hub-tile {
  padding: 24px;
  display: flex; flex-direction: column; gap: 16px;
  min-height: 280px;
}
.hub-tile-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--routine-tint);
  color: var(--primary);
  display: grid; place-items: center;
}
.hub-tile-icon svg { width: 22px; height: 22px; }
.hub-tile h3 {
  margin: 0; font-size: 18px; letter-spacing: -0.015em; font-weight: 700;
}
.hub-tile .desc { color: var(--text-muted); font-size: 14px; }
.hub-tile .preview {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.hub-tile-cta {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--primary);
  margin-top: 12px;
}

/* Hub secondary row */
.hub-secondary {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}

/* CTA banner */
.cta-banner { margin-top: 20px; }

/* Placeholder widgets (coming soon) */
.placeholder-widget .placeholder-content {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 24px 16px; gap: 12px;
}
.placeholder-widget .placeholder-content p {
  margin: 0; font-size: 13px; color: var(--text-faint); max-width: 320px;
}

/* Upsell nudge */
.upsell-nudge { margin-top: 20px; border-left: 4px solid var(--primary); }

/* ---------- Hours balance widget ---------- */
.hours-widget {
  display: flex; align-items: flex-end; gap: 24px;
  padding: 20px 0 8px;
}
.hours-num { font-size: 52px; line-height: 1; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.hours-of { font-size: 16px; color: var(--text-faint); margin-left: 4px; font-weight: 500; }
.hours-meta {
  flex: 1;
  display: flex; flex-direction: column; gap: 4px;
}
.hours-meta .label { font-size: 12px; color: var(--text-faint); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.hours-meta .val { font-size: 14px; }
.bar-track {
  height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden;
  border: 1px solid var(--border);
}
.bar-fill {
  height: 100%; background: var(--primary-grad);
  border-radius: 999px;
  transition: width .4s ease;
}
.bar-meta {
  display: flex; justify-content: space-between;
  margin-top: 8px;
  font-size: 12px; color: var(--text-faint);
}

/* ---------- Calendar (Phase 2 / screen 6) ---------- */
.cal-toolbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
}
.cal-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 360px;
}
.cal-col-head {
  text-align: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.cal-col-head .dow { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); }
.cal-col-head .dom { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.cal-col-head .dom.today { color: var(--primary); }
.slot {
  padding: 8px 10px;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  text-align: center;
  font-size: 13px; font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: border-color .12s ease, background .12s ease, transform .08s ease;
  font-variant-numeric: tabular-nums;
}
.slot:hover { border-color: var(--primary); background: #eff6ff; color: var(--primary-deep); }
.slot.unavailable { color: var(--text-faint); background: transparent; border-style: dashed; cursor: not-allowed; }
.slot.unavailable:hover { background: transparent; color: var(--text-faint); border-color: var(--border-strong); }
.slot.selected { background: var(--primary-grad); color: white; border-color: var(--primary-deep); }
.slot.selected:hover { background: var(--primary-grad); color: white; }

/* ---------- Service catalog cards ---------- */
.catalog-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.svc-card {
  display: flex; flex-direction: column;
  transition: transform .15s ease, box-shadow .15s ease;
  cursor: pointer; overflow: hidden;
}
.svc-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.svc-card .card-top { padding: 24px 24px 20px; display: flex; align-items: flex-start; gap: 14px; }
.svc-card .icon { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: 0 0 auto; }
.svc-card .icon svg { width: 24px; height: 24px; }
.icon.monitor { background: #dbeafe; color: #1e40af; }
.icon.shield { background: #fee2e2; color: #991b1b; }
.icon.mail { background: #dcfce7; color: #166534; }
.icon.phone { background: #fef9c3; color: #854d0e; }
.icon.cloud { background: #ede9fe; color: #5b21b6; }
.icon.network { background: #ffedd5; color: #c2410c; }
.icon.wrench { background: #e2e8f0; color: #334155; }
.icon.generic { background: #f1f5f9; color: #64748b; }
.svc-card h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.svc-card .timeline { font-size: 12px; color: var(--text-faint); display: flex; align-items: center; gap: 4px; }
.svc-card .desc { padding: 0 24px; color: var(--text-muted); font-size: 13px; line-height: 1.55; flex: 1; }
.svc-card .card-footer {
  margin-top: auto; padding: 16px 24px;
  background: var(--surface-2); border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.svc-card .price { font-weight: 700; font-size: 15px; color: var(--text); }
.svc-card .price small { font-weight: 500; color: var(--text-faint); font-size: 12px; }
.svc-card .btn-see {
  padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600;
  background: white; color: var(--primary); border: 1px solid var(--border);
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .15s;
}
.svc-card:hover .btn-see { background: var(--primary); color: white; border-color: var(--primary); }
.svc-card .btn-see svg { transition: transform .15s; }
.svc-card:hover .btn-see svg { transform: translateX(2px); }

.svc-card-clickable { position: relative; transition: transform .15s ease, box-shadow .15s ease; }
.svc-card-clickable:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.svc-card-link { color: inherit; text-decoration: none; }
.svc-card-link::after {
  content: ""; position: absolute; inset: 0;
  border-radius: var(--radius);
  z-index: 0;
}

/* Project showcase strip */
.showcase {
  margin-top: 28px;
}
.showcase-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.showcase-item {
  padding: 18px;
  display: flex; flex-direction: column; gap: 10px;
}
.showcase-item .ph {
  height: 110px;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e293b 0%, #475569 100%);
  position: relative; overflow: hidden;
}
.showcase-item .ph::after {
  content: ""; position: absolute; inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,0.08), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(59,130,246,0.25), transparent 50%);
}
.showcase-item h5 { margin: 0; font-size: 14px; font-weight: 600; }
.showcase-item .stat { font-size: 12px; color: var(--text-faint); }

/* ---------- Phase 3: Routing matrix ---------- */
.matrix {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.quadrant {
  border-radius: 14px;
  padding: 22px;
  border: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 10px;
  position: relative;
  background: white;
}
.quadrant.q-good { border-color: #86efac; background: var(--good-tint); }
.quadrant.q-urgent { border-color: #fca5a5; background: var(--urgent-tint); }
.quadrant.q-routine { border-color: #93c5fd; background: var(--routine-tint); }
.quadrant.q-caution { border-color: #fcd34d; background: var(--caution-tint); }
.quadrant h4 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
.quadrant .desc { color: var(--text-muted); font-size: 13px; }
.quadrant .axes { display: flex; gap: 6px; margin-bottom: 4px; }

.outcome-card {
  padding: 32px;
  text-align: left;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: white;
  display: flex; gap: 24px; align-items: flex-start;
}
.outcome-card.good { border-left: 4px solid var(--good); }
.outcome-card.urgent { border-left: 4px solid var(--urgent); }
.outcome-card.routine { border-left: 4px solid var(--routine); }
.outcome-card.caution { border-left: 4px solid var(--caution); }
.outcome-card .badge {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: grid; place-items: center;
  flex: 0 0 auto;
}
.outcome-card.good .badge { background: var(--good-bg); color: var(--good); }
.outcome-card.urgent .badge { background: var(--urgent-bg); color: var(--urgent); }
.outcome-card.routine .badge { background: var(--routine-bg); color: var(--routine); }
.outcome-card.caution .badge { background: var(--caution-bg); color: var(--caution); }
.outcome-card h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.02em; }
.outcome-card p { margin: 0 0 12px; color: var(--text-muted); }

.upsell {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: white;
  border: 1px dashed #fca5a5;
}
.upsell .row { display: flex; justify-content: space-between; padding: 4px 0; font-size: 13px; }
.upsell .row.savings { font-weight: 700; color: var(--good); border-top: 1px solid var(--border); margin-top: 4px; padding-top: 8px; }

/* ---------- Stepper for Phase 3 intake ---------- */
.stepper {
  display: flex; align-items: center; gap: 0;
  margin-bottom: 24px;
  font-size: 13px;
}
.stepper .step {
  display: flex; align-items: center; gap: 8px;
  color: var(--text-faint);
}
.stepper .num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface-2); border: 1px solid var(--border-strong);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
  color: var(--text-faint);
}
.stepper .step.active { color: var(--text); font-weight: 600; }
.stepper .step.active .num { background: var(--primary-grad); color: white; border-color: transparent; }
.stepper .step.done { color: var(--text-muted); }
.stepper .step.done .num { background: var(--good); color: white; border-color: transparent; }
.stepper .sep {
  width: 36px; height: 1px; background: var(--border-strong);
  margin: 0 12px;
}

/* ---------- Footer / screen jumper ---------- */
.dev-jumper {
  position: fixed;
  bottom: 16px; left: 16px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: flex; align-items: center; gap: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  font-size: 12px;
  max-width: calc(100vw - 32px);
  flex-wrap: wrap;
}
.dev-jumper .lbl {
  padding: 0 8px;
  color: var(--text-faint); font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
}
.dev-jumper a {
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text-muted);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.dev-jumper a:hover { background: var(--surface-2); text-decoration: none; }
.dev-jumper a.active { background: var(--primary-grad); color: white; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .hub-grid { grid-template-columns: 1fr 1fr; }
  .catalog-grid { grid-template-columns: 1fr 1fr; }
  .showcase-grid { grid-template-columns: 1fr 1fr; }
  .quote-grid { grid-template-columns: 1fr; }
  .cal-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .matrix { grid-template-columns: 1fr; }
  .topbar-inner { padding: 12px 16px; gap: 10px; }
  .topbar-nav { display: none; }
  .brand > span:last-child { display: none; }
  .invite-link { display: none; }
  .account-switch .name { display: none; }
}
@media (max-width: 800px) {
  .page { padding: 24px 16px 100px; }
  .page-title { font-size: 22px; }
  .hub-grid { grid-template-columns: 1fr; }
  .catalog-grid { grid-template-columns: 1fr; }
  .showcase-grid { grid-template-columns: 1fr; }
  .hub-secondary { grid-template-columns: 1fr; }
  .cal-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .cal-col { min-height: auto; padding: 10px 8px; }
  .quote-meta { grid-template-columns: 1fr; }
  .line-row { grid-template-columns: 1fr 60px 90px; padding: 12px 14px; }
  .email-body, .email-meta { padding-left: 18px; padding-right: 18px; }
  .outcome-card { padding: 22px; flex-direction: column; gap: 14px; }
  .detail-hero { flex-direction: column; }
  .table { width: auto; min-width: 100%; }
  .table th, .table td { padding: 8px 10px; font-size: 13px; }
  .table th { white-space: nowrap; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .between { flex-wrap: wrap; }
  .admin-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .card-head { flex-wrap: wrap; gap: 8px; }
  .hide-mobile { display: none; }
}

/* ---------- Contact form layout ---------- */
.contact-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}
.contact-main {
  /* Grows to fill the space beside the side panel in the desktop row layout. */
  flex: 1 1 0;
}
.contact-side {
  flex: 0 0 280px;
  position: sticky;
  top: 90px;
}
.prefill-row {
  padding: 14px 16px;
  background: var(--surface-2);
  border-radius: 12px;
  border: 1px solid var(--border);
}

@media (max-width: 900px) {
  /* Stack the form and side panel; reset align-items so children fill the
     full width instead of shrinking to their content (the default flex-start
     applies to the horizontal cross-axis once the layout becomes a column). */
  .contact-layout { flex-direction: column; align-items: stretch; }
  /* In the column layout the card's flex shorthand controls height, not width.
     A basis of 0 combined with the card's `overflow: hidden` (which zeroes the
     flex minimum size) collapses the card vertically and clips the form. Reset
     it so the card takes its natural content height. */
  .contact-main { flex: none; }
  .contact-side { position: static; flex: none; width: 100%; }
}

/* ---------- Admin tabs ---------- */
.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.admin-tab {
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.admin-tab:hover {
  color: var(--text);
}
.admin-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

/* ---------- Sign-in page ---------- */
.signin-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 140px);
  padding: 24px;
}
.signin-card {
  width: 100%;
  max-width: 420px;
}
.signin-sent .success-mark {
  background: var(--routine-bg);
  color: var(--primary);
}

/* ---------- Admin catalog tab ---------- */
.row-inactive { opacity: 0.5; }
.reorder-controls {
  display: flex;
  align-items: center;
  gap: 4px;
}
.btn-xs { padding: 0 4px; font-size: 11px; line-height: 1.2; }
.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

/* ---------- Order status pipeline ---------- */
.status-pipeline {
  display: flex;
  align-items: center;
  gap: 0;
}
.pipeline-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}
.pipeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--primary-grad);
}
.pipeline-dot.dot-neutral { background: var(--text-muted); }
.pipeline-dot.dot-routine { background: var(--routine); }
.pipeline-dot.dot-partial { background: #0284c7; }
.pipeline-dot.dot-good { background: var(--good); }
.pipeline-line {
  flex: 1;
  height: 2px;
  background: var(--border-strong);
  margin: 0 12px;
  min-width: 32px;
}

/* ---------- Service detail page ---------- */
.detail-back {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 14px; font-weight: 500; color: var(--text-muted);
  margin-bottom: 28px; cursor: pointer;
}
.detail-back:hover { color: var(--text); text-decoration: none; }

/* Hero banner */
.detail-hero {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 36px 32px; margin-bottom: 28px;
  display: flex; align-items: flex-start; gap: 20px;
  box-shadow: var(--shadow-sm);
}
.detail-hero .icon {
  width: 60px; height: 60px; border-radius: 16px;
  display: grid; place-items: center; flex: 0 0 auto;
}
.detail-hero .icon svg { width: 30px; height: 30px; }
.detail-hero h1 { margin: 0 0 8px; font-size: 26px; font-weight: 800; letter-spacing: -0.025em; }
.hero-desc { margin: 0 0 14px; font-size: 15px; line-height: 1.65; color: var(--text-muted); max-width: 640px; }
.hero-meta { display: flex; gap: 20px; flex-wrap: wrap; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; font-weight: 500; color: var(--text-muted);
}
.meta-chip svg { width: 15px; height: 15px; color: var(--text-faint); }
.hero-phases {
  display: flex; align-items: center; gap: 6px; margin-top: 14px; flex-wrap: wrap;
}
.phase-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 12px 5px 6px; border-radius: 8px;
  background: var(--routine-tint); border: 1px solid #bfdbfe;
  font-size: 13px; font-weight: 600; color: var(--primary-deep);
}
.phase-chip-num {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--primary-grad); color: white;
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700;
}
.phase-arrow { color: var(--border-strong); flex: 0 0 auto; }

.detail-body {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: flex-start;
}
.detail-main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

/* Phase groups */
.phase-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.phase-number {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--primary-grad); color: white;
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700;
}
.phase-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.phase-toggle {
  margin-left: auto; display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--text-faint);
  cursor: pointer; padding: 4px 10px; border-radius: 6px;
  transition: all .15s;
}
.phase-toggle:hover { background: var(--surface-2); color: var(--text-muted); }
.phase-toggle .toggle-box {
  width: 18px; height: 18px; border-radius: 5px;
  background: #dcfce7; border: 1.5px solid #86efac;
  display: grid; place-items: center; transition: all .15s;
}
.phase-toggle .toggle-box svg { width: 11px; height: 11px; color: #16a34a; }
.phase-toggle.off .toggle-box { background: white; border-color: var(--border-strong); }
.phase-toggle.off .toggle-box svg { display: none; }
.phase-toggle.required { cursor: default; color: var(--text-faint); opacity: 0.5; }
.phase-toggle.required:hover { background: transparent; color: var(--text-faint); }
.phase-items { display: flex; flex-direction: column; gap: 8px; }

/* Deliverable cards */
.deliverable {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: border-color .15s, box-shadow .15s;
  cursor: pointer;
  user-select: none;
}
.deliverable:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.deliverable.unchecked { opacity: 0.5; }
.deliverable.unchecked .del-check { background: white; border-color: var(--border-strong); }
.deliverable.unchecked .del-check svg { display: none; }
.deliverable.required { cursor: default; }
.deliverable.required .del-check { background: #dbeafe; border-color: #93c5fd; }
.deliverable.required .del-check svg { color: var(--primary); }
.deliverable.required .del-lock {
  font-size: 11px; font-weight: 600; color: var(--text-faint);
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 4px; margin-left: auto; flex: 0 0 auto; align-self: center;
}
.del-check {
  width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto;
  background: #dcfce7; border: 1.5px solid #86efac;
  display: grid; place-items: center; margin-top: 1px;
  transition: all .15s;
}
.del-check svg { width: 13px; height: 13px; color: #16a34a; }
.del-text { font-size: 14px; line-height: 1.5; color: var(--text); }
.del-text .del-detail { display: block; font-size: 12px; color: var(--text-faint); margin-top: 2px; }

/* Not-included section */
.not-included { margin-top: 8px; }
.not-included-title {
  font-size: 14px; font-weight: 600; color: var(--text-faint);
  margin: 0 0 10px; display: flex; align-items: center; gap: 8px;
}
.not-included-list {
  display: flex; flex-wrap: wrap; gap: 8px;
  list-style: none; margin: 0; padding: 0;
}
.not-included-list li {
  padding: 6px 14px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-faint);
  display: inline-flex; align-items: center; gap: 6px;
}
.not-included-list li svg { width: 12px; height: 12px; color: #cbd5e1; }

/* Callout */
.detail-callout {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: var(--routine-tint);
  border: 1px solid #bfdbfe;
}
.detail-callout svg { flex: 0 0 auto; color: var(--primary); margin-top: 2px; }
.detail-callout p { margin: 0; font-size: 14px; color: var(--text); line-height: 1.6; }

/* Sidebar */
.detail-sidebar { position: sticky; top: 90px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }

.sidebar-pricing {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 28px; text-align: center; box-shadow: var(--shadow-sm);
}
.sidebar-pricing .price-label {
  font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--text-faint); margin-bottom: 4px;
}
.sidebar-pricing .price-big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); }
.sidebar-pricing .selected-count {
  margin-top: 12px; font-size: 13px; color: var(--text-muted);
  padding: 8px 12px; background: var(--surface-2); border-radius: 8px;
  border: 1px solid var(--border);
}
.sidebar-pricing .selected-count strong { color: var(--text); }
.btn-quote {
  display: block; width: 100%; padding: 14px; margin-top: 16px;
  background: var(--primary); color: white; border: none; border-radius: var(--radius-sm);
  font-size: 15px; font-weight: 600; cursor: pointer; transition: background .15s;
  text-align: center;
}
.btn-quote:hover { background: var(--primary-deep); color: white; }
.btn-quote[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-quote[disabled]:hover { background: var(--primary); }
.sidebar-pricing .reassurance { margin-top: 16px; font-size: 12px; color: var(--text-faint); line-height: 1.6; }
.sidebar-pricing .reassurance span {
  display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 8px;
}
.sidebar-pricing .reassurance span svg { width: 14px; height: 14px; flex: 0 0 auto; }

/* Cross-sell / related services */
.sidebar-related {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
}
.sidebar-related h4 { margin: 0 0 12px; font-size: 14px; font-weight: 700; }
.related-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.related-item:last-child { border-bottom: none; }
.related-item .r-icon {
  width: 36px; height: 36px; border-radius: 10px;
  display: grid; place-items: center; flex: 0 0 auto;
}
.related-item .r-icon svg { width: 18px; height: 18px; }
.r-icon.monitor { background: #dbeafe; color: #1e40af; }
.r-icon.shield { background: #fee2e2; color: #991b1b; }
.r-icon.mail { background: #dcfce7; color: #166534; }
.r-icon.phone { background: #fef9c3; color: #854d0e; }
.r-icon.cloud { background: #ede9fe; color: #5b21b6; }
.r-icon.network { background: #ffedd5; color: #c2410c; }
.r-icon.wrench { background: #e2e8f0; color: #334155; }
.related-item .r-name { font-size: 13px; font-weight: 600; }
.related-item .r-price { font-size: 12px; color: var(--text-faint); }
.related-item .r-arrow { margin-left: auto; color: var(--text-faint); }
.related-item:hover .r-arrow { color: var(--primary); }

@media (max-width: 900px) {
  .detail-body { grid-template-columns: 1fr; }
  .detail-sidebar { position: static; }
}

/* ---------- Toggle switch ---------- */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.toggle-slider {
  width: 40px;
  height: 22px;
  background: #cbd5e1;
  border-radius: 11px;
  position: relative;
  transition: background .2s ease;
}
.toggle-slider::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-slider {
  background: var(--primary);
}
.toggle input:checked + .toggle-slider::after {
  transform: translateX(18px);
}
.toggle.toggle-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.toggle.toggle-disabled input {
  pointer-events: none;
}

/* ---------- Settings page ---------- */
.settings-category { margin-bottom: 16px; }
.settings-cat-desc {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--text-faint);
  font-weight: 400;
}
.settings-types { padding: 0 24px 16px; }
.settings-col-headers {
  display: grid;
  grid-template-columns: 1fr 70px 70px;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.settings-col-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  text-align: center;
}
.settings-type-row {
  display: grid;
  grid-template-columns: 1fr 70px 70px;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.settings-type-row:last-child { border-bottom: none; }
.settings-type-name {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-type-label { font-size: 14px; font-weight: 500; }
.settings-type-desc { font-size: 12px; color: var(--text-faint); }
.settings-toggle-cell { display: flex; justify-content: center; }
.settings-toggle-hint {
  grid-column: 1 / -1;
  font-size: 13px;
  color: var(--text-muted);
  margin: -4px 0 4px;
  padding: 0;
}
.settings-info {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 16px;
  font-size: 13px;
  color: var(--text-faint);
  margin-top: 8px;
}

/* Team default recipients picker */
.team-picker { padding: 0 24px 16px; }
.team-picker-empty {
  font-size: 13px;
  color: var(--text-faint);
  padding: 12px 0;
}
.team-member-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.team-member-row:last-child { border-bottom: none; }
.team-member-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  flex-shrink: 0;
}
.team-member-name {
  font-size: 14px;
  font-weight: 500;
}
.team-member-email {
  font-size: 12px;
  color: var(--text-faint);
  margin-left: auto;
}

.settings-notif-header { margin-top: 40px; }
.settings-notif-header:first-child { margin-top: 0; }

/* Your team table */
.team-card { overflow: hidden; }
.team-card-header {
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.team-count {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-faint);
}
.team-table-wrap { padding: 0; overflow-x: auto; }
.team-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.team-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  padding: 10px 16px 10px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--hover-bg, rgba(0,0,0,0.02));
}
.team-table th:last-child { padding-right: 24px; }
.team-table td {
  padding: 14px 16px 14px 24px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.team-table td:last-child { padding-right: 24px; }
.team-table tbody tr:last-child td { border-bottom: none; }
.team-table tbody tr:hover { background: var(--hover-bg, rgba(0,0,0,0.02)); }
.team-member-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}
.team-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.02em;
}
.team-member-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.team-table-name { font-weight: 500; font-size: 14px; }
.team-table-email { color: var(--text-faint); font-size: 12px; }
.team-table-activity { color: var(--text-faint); font-size: 13px; }
.role-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 12px;
  line-height: 1.3;
}
.role-admin {
  background: rgba(59,130,246,0.10);
  color: var(--primary);
}
.role-member {
  background: var(--hover-bg, rgba(0,0,0,0.04));
  color: var(--text-faint);
}
.role-select {
  appearance: none;
  -webkit-appearance: none;
  font-size: 12px;
  font-weight: 500;
  padding: 3px 24px 3px 10px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--hover-bg, rgba(0,0,0,0.04)) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center;
  color: var(--text-faint);
  cursor: pointer;
  line-height: 1.3;
}
.role-select:hover { border-color: var(--primary); }
.role-select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(37,99,235,0.15); }
.role-select-admin {
  background-color: rgba(59,130,246,0.10);
  color: var(--primary);
  border-color: transparent;
}
.role-select-admin:hover { border-color: var(--primary); }
.team-table-action { white-space: nowrap; text-align: right; }
.team-confirm-prompt { font-size: 13px; color: var(--text-faint); margin-right: 8px; }
.btn-danger-sm {
  font-size: 12px;
  padding: 4px 10px;
  border: none;
  border-radius: 4px;
  background: var(--danger, #d44);
  color: #fff;
  cursor: pointer;
  margin-right: 4px;
}
.btn-danger-sm:hover { opacity: 0.9; }
.btn-ghost-sm {
  font-size: 12px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.btn-ghost-sm:hover { background: var(--hover-bg, rgba(0,0,0,0.04)); }
.btn-remove { color: var(--danger, #d44); border-color: var(--danger, #d44); }
.btn-remove:hover { background: rgba(221,68,68,0.06); }

.role-permissions-card { margin-top: 12px; }
.role-permissions-toggle {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--text-secondary); list-style: none;
}
.role-permissions-toggle::-webkit-details-marker { display: none; }
.role-permissions-toggle::marker { display: none; content: ""; }
.role-chevron { transition: transform 0.2s ease; flex-shrink: 0; }
details[open] > .role-permissions-toggle .role-chevron { transform: rotate(180deg); }
.role-permissions-body { padding: 0 24px 20px; }
.role-permissions-grid { width: 100%; }
.rp-header, .rp-row {
  display: grid; grid-template-columns: 1fr 80px 80px;
  align-items: center; gap: 8px;
}
.rp-header {
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.rp-cap-label {
  font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-faint);
}
.rp-role-label {
  font-weight: 600; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--text-faint); text-align: center;
}
.rp-row {
  padding: 10px 12px; border-bottom: 1px solid var(--border-light, rgba(0,0,0,0.06));
}
.rp-row-last { border-bottom: none; }
.rp-cap { font-size: 14px; color: var(--text-secondary); }
.rp-check {
  display: flex; align-items: center; justify-content: center;
  color: var(--success, #16a34a);
}
.rp-cross {
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint, #aaa);
}
.rp-qual {
  font-size: 12px; font-weight: 500; text-align: center;
  color: var(--text-secondary); line-height: 1.3;
}

@media (max-width: 600px) {
  .settings-types { padding: 0 16px 12px; }
  .settings-col-headers,
  .settings-type-row { grid-template-columns: 1fr 56px 56px; gap: 8px; }
  .team-picker { padding: 0 16px 12px; }
  .team-member-email { display: none; }
  .team-card-header { padding: 12px 16px; }
  .team-table th { padding-left: 16px; }
  .team-table th:last-child { padding-right: 16px; }
  .team-table td { padding-left: 16px; }
  .team-table td:last-child { padding-right: 16px; }
  .team-table-email { display: none; }
  .team-avatar { width: 28px; height: 28px; font-size: 11px; }
  .role-permissions-toggle { padding: 12px 16px; }
  .role-permissions-body { padding: 0 16px 16px; }
  .rp-header, .rp-row { grid-template-columns: 1fr 64px 64px; gap: 4px; }
}

/* ---------- Mobile (375px target) ---------- */
@media (max-width: 480px) {
  .page { padding: 16px 12px 80px; }
  .page-title { font-size: 20px; }
  .page-sub { font-size: 13px; }
  .card-pad { padding: 16px; }
  .card-head { padding: 14px 16px; }
  .hub-tile { padding: 16px; min-height: auto; }
  .hub-tile h3 { font-size: 16px; }
  .hub-tile-icon { width: 36px; height: 36px; border-radius: 10px; }
  .hub-tile-icon svg { width: 18px; height: 18px; }
  /* Stack the status-stages legend vertically on phones instead of scrolling
     it sideways. Each stage sits on its own line, joined by a short vertical
     connector — a compact timeline that always fits the screen width. */
  .status-pipeline { flex-direction: column; align-items: flex-start; gap: 0; overflow: visible; }
  .pipeline-step { font-size: 13px; white-space: nowrap; gap: 10px; }
  .pipeline-line { width: 2px; height: 16px; min-width: 0; flex: none; margin: 4px 0 4px 4px; }
  .hstack { flex-wrap: wrap; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .detail-hero { padding: 20px 16px; }
  .detail-hero h1 { font-size: 20px; }
  .topbar-inner { padding: 10px 12px; }
  .between { flex-direction: column; align-items: stretch; }
  .admin-tabs { gap: 2px; }
  .admin-tab { padding: 8px 10px; font-size: 13px; }
  .choice-row { gap: 8px; }
  .choice { flex: 1 1 100%; }
  .team-table th, .team-table td { padding-left: 12px; padding-right: 8px; }
  .team-table-action { white-space: normal; }
  .table th, .table td { padding: 8px 6px; }
}

.diff-changed { background: var(--caution-bg); border-radius: 4px; padding: 2px 6px; }
