:root {
  --bg: #f4f8fe;
  --surface: #ffffff;
  --surface-soft: #f8faff;
  --surface-strong: #eef4fc;
  --line: #e3ebf6;
  --line-strong: #c9d8ec;
  --text: #0e1b33;
  --text-soft: #33445f;
  --muted: #5b6b85;
  --faint: #8b99ad;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eaf1ff;
  --green: #087a55;
  --green-soft: #e6f7f0;
  --amber: #9a5a05;
  --amber-soft: #fef3e2;
  --red: #b4232f;
  --red-soft: #feecee;
  --violet: #6d4aed;
  --sidebar-width: 232px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(14, 27, 51, 0.04);
  --shadow: 0 8px 26px -18px rgba(37, 99, 235, 0.32);
}

* { box-sizing: border-box; }
html {
  max-width: 100%;
  overflow-x: clip;
  color-scheme: light;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  min-width: 320px;
  max-width: 100%;
  /* Wide data tables scroll inside their own container, never at page level. */
  overflow-x: clip;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--blue); text-underline-offset: 3px; }
a:hover { color: var(--blue-dark); }
[hidden], .hidden { display: none !important; }
svg { display: block; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.24);
  outline-offset: 2px;
}

/* Public account pages */
.public-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}
.auth-layout {
  width: min(980px, 100%);
  min-height: 610px;
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(440px, 1.2fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.auth-layout.compact { min-height: 460px; }
.auth-context {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 42px 38px;
  background: #10213d;
  color: #fff;
}
.auth-context h1 {
  max-width: 320px;
  margin: 44px 0 12px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.16;
  letter-spacing: -0.025em;
}
.auth-context p {
  max-width: 340px;
  margin: 0;
  color: #cbd6e6;
  font-size: 14px;
}
.auth-context-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #cbd6e6;
  font-size: 12px;
}
.auth-context-note::before {
  width: 8px;
  height: 8px;
  margin-top: 5px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #6ee7b7;
  content: "";
}
.auth-main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px clamp(34px, 5vw, 64px);
}
.auth-main h2 {
  margin: 0 0 8px;
  font-size: 25px;
  line-height: 1.25;
  letter-spacing: -0.015em;
}
.auth-main > p { margin: 0 0 24px; color: var(--muted); }
.auth-footer { margin: 24px 0 0; color: var(--muted); font-size: 13px; }
.auth-secondary-panel {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}
.auth-secondary-panel h3 { margin: 0 0 4px; font-size: 15px; }
.auth-secondary-panel p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-lockup strong { display: block; font-size: 17px; letter-spacing: -0.01em; }
.brand-lockup small { display: block; margin-top: 1px; color: inherit; opacity: 0.68; font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  border-radius: 9px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}
.auth-context .brand-mark { background: #fff; color: #10213d; }
.environment-chip {
  width: max-content;
  max-width: 100%;
  margin: 14px 0 0;
  padding: 5px 8px;
  border: 1px solid #e8b857;
  border-radius: var(--radius-sm);
  background: #fff8e8;
  color: #81500b;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.auth-context .environment-chip { border-color: #9a722a; background: rgba(255,255,255,.08); color: #ffe7ad; }
.status-illustration {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 50%;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 22px;
  font-weight: 800;
}

/* Application shell */
.saas-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 22px 14px 16px;
  border-right: 1px solid var(--line);
  background: var(--surface);
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 18px; }
.sidebar-brand strong { display: block; font-size: 16px; }
.sidebar-brand small { display: block; margin-top: 1px; color: var(--muted); font-size: 10px; }
.saas-sidebar > .environment-chip { margin: 0 8px 16px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 3px; min-height: 0; overflow-y: auto; }
.sidebar-nav a {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  color: var(--text-soft);
  font-size: 13px;
  font-weight: 620;
  text-decoration: none;
}
.sidebar-nav a:hover { background: var(--surface-soft); color: var(--text); }
.sidebar-nav a.active { background: var(--blue-soft); color: var(--blue-dark); }
.sidebar-nav svg, .sidebar-logout svg { width: 18px; height: 18px; flex: 0 0 18px; }
.sidebar-footer { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.tenant-identity { display: flex; align-items: center; gap: 9px; padding: 7px 6px 11px; min-width: 0; }
.tenant-identity > span:last-child { min-width: 0; }
.tenant-identity strong, .tenant-identity small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tenant-identity strong { font-size: 12px; font-weight: 700; }
.tenant-identity small { color: var(--muted); font-size: 10px; }
.tenant-avatar { width: 32px; height: 32px; display: grid; place-items: center; flex: 0 0 32px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); font-size: 11px; font-weight: 800; }
.sidebar-logout {
  width: 100%;
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}
.sidebar-logout:hover { background: var(--surface-soft); color: var(--text); }
.saas-workspace { min-height: 100vh; margin-left: var(--sidebar-width); }

/* AuroraCRM Design B for the company and platform workspaces. */
body:has(.saas-sidebar) {
  --sidebar-width: 224px;
  --bg: #f3f6fc;
  --surface-soft: #eef2f8;
  background: #f3f6fc;
}
body:has(.saas-sidebar) .saas-sidebar {
  padding: 20px 16px 14px;
  border-right: 0;
  background: #18243f;
  color: #fff;
}
body:has(.saas-sidebar) .sidebar-brand {
  min-height: 46px;
  margin-bottom: 12px;
  padding: 0 4px 14px;
  border-bottom: 1px solid rgba(255,255,255,.1);
}
body:has(.saas-sidebar) .sidebar-brand .brand-mark {
  width: 36px;
  height: 36px;
  flex-basis: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6871ff, #20b9ce);
  box-shadow: 0 6px 18px rgba(32,185,206,.22);
}
body:has(.saas-sidebar) .sidebar-brand strong { color: #fff; font-size: 16px; font-weight: 650; }
body:has(.saas-sidebar) .sidebar-brand small { color: #8795b2; }
body:has(.saas-sidebar) .environment-chip {
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: #f4ce83;
}
body:has(.saas-sidebar) .sidebar-nav a { color: #aebbd5; font-weight: 520; }
body:has(.saas-sidebar) .sidebar-nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
body:has(.saas-sidebar) .sidebar-nav a.active {
  background: linear-gradient(135deg, #5860d9, #5b5ce9);
  color: #fff;
  box-shadow: 0 8px 22px rgba(67,73,198,.26);
}
body:has(.saas-sidebar) .sidebar-footer { border-top-color: rgba(255,255,255,.1); }
body:has(.saas-sidebar) .tenant-identity strong { color: #fff; }
body:has(.saas-sidebar) .tenant-identity small { color: #8795b2; }
body:has(.saas-sidebar) .tenant-avatar { background: #eef0ff; color: #5357da; }
body:has(.saas-sidebar) .sidebar-logout { color: #aebbd5; }
body:has(.saas-sidebar) .sidebar-logout:hover { background: rgba(255,255,255,.07); color: #fff; }
body:has(.saas-sidebar) .saas-workspace { background: #f3f6fc; }
.mobile-topbar { display: none; }
.sidebar-backdrop { display: none; }
.page-container { width: min(1240px, calc(100% - 48px)); margin: 0 auto; padding: 34px 0 54px; }
.page-container.wide { width: min(1480px, calc(100% - 48px)); }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}
.page-header h1 { margin: 1px 0 6px; font-size: 26px; line-height: 1.2; letter-spacing: -0.02em; }
.page-header p { max-width: 720px; margin: 0; color: var(--muted); }
.eyebrow { color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.page-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.section-stack { display: grid; gap: 16px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.38fr); gap: 16px; align-items: start; }
.content-grid.equal { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Panels and hierarchy */
.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.panel.flush { padding: 0; overflow: hidden; }
.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.panel.flush > .panel-head { margin: 0; padding: 18px 20px 14px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { margin: 0 0 3px; font-size: 16px; line-height: 1.35; }
.panel-head p { margin: 0; color: var(--muted); font-size: 12px; }
.section-title { margin: 0 0 12px; font-size: 14px; }
.muted { color: var(--muted); }
.caption { color: var(--muted); font-size: 11px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric-card {
  min-height: 94px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
.metric-card .metric-label { display: block; margin-bottom: 8px; color: var(--muted); font-size: 11px; font-weight: 650; }
.metric-card .metric-value { display: block; overflow-wrap: anywhere; font-size: 21px; font-weight: 750; line-height: 1.22; letter-spacing: -0.015em; }
.metric-card .metric-meta { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; }
.summary-list { display: grid; margin: 0; }
.summary-row { display: grid; grid-template-columns: minmax(140px, 0.42fr) minmax(0, 1fr); gap: 18px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.summary-row:last-child { border-bottom: 0; }
.summary-row dt { color: var(--muted); font-size: 12px; }
.summary-row dd { margin: 0; min-width: 0; overflow-wrap: anywhere; font-weight: 620; }
.attention-list { display: grid; gap: 9px; }
.attention-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px; border-radius: 8px; background: var(--surface-soft); }
.attention-item.warning { background: var(--amber-soft); color: #6f4308; }
.attention-item.danger { background: var(--red-soft); color: #842029; }
.attention-item.success { background: var(--green-soft); color: #086044; }
.attention-item strong { display: block; margin-bottom: 2px; }
.attention-item span { display: block; font-size: 12px; }

/* Buttons and forms */
.button, button.button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--blue-dark); color: #fff; }
.button.secondary { border-color: var(--line-strong); background: var(--surface); color: var(--text); }
.button.secondary:hover { border-color: #aabed8; background: var(--surface-soft); }
.button.ghost { border-color: transparent; background: transparent; color: var(--blue); }
.button.danger { border-color: #f3c3c8; background: var(--red-soft); color: var(--red); }
.button.danger:hover { background: #fbdde1; }
.button.small { min-height: 32px; padding: 6px 10px; border-radius: 7px; font-size: 12px; }
.button.icon-only { width: 36px; padding: 0; }
.button[disabled], button[disabled] { cursor: not-allowed; opacity: 0.58; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field { min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label, .field-label { display: block; margin-bottom: 5px; color: var(--text-soft); font-size: 12px; font-weight: 700; }
.required::after { margin-left: 3px; color: var(--red); content: "*"; }
.field-hint { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }
input, select, textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 86px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #aebfd6; }
input:focus, select:focus, textarea:focus { border-color: #7fa4ef; box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
input:disabled, select:disabled, textarea:disabled { background: #f2f5f9; color: var(--faint); }
.input-action { display: flex; align-items: stretch; gap: 8px; }
.input-action input { min-width: 0; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.form-actions.start { justify-content: flex-start; }
.inline-message { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--surface-soft); color: var(--text-soft); font-size: 12px; }
.inline-message.success { background: var(--green-soft); color: var(--green); }
.inline-message.error { background: var(--red-soft); color: var(--red); }
.inline-message.warning { background: var(--amber-soft); color: var(--amber); }
.inline-message a { font-weight: 700; }
.field-error { margin-top: 5px; color: var(--red); font-size: 11px; }

/* Tables */
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.table-filters { display: flex; align-items: center; gap: 8px; flex: 1; flex-wrap: wrap; }
.search-input { width: min(320px, 100%); }
.table-filters select { width: auto; min-width: 150px; }
.table-count { color: var(--muted); font-size: 11px; white-space: nowrap; }
.table-scroll { width: 100%; max-width: 100%; overflow-x: auto; contain: inline-size paint; overscroll-behavior-inline: contain; }
.table-scroll > table { min-width: 720px; }
table { width: 100%; border-collapse: separate; border-spacing: 0; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { background: #fbfcfe; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 0.045em; text-transform: uppercase; white-space: nowrap; }
td { max-width: 320px; color: var(--text-soft); font-size: 12px; overflow-wrap: anywhere; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:not(.empty-row):not(.skeleton-row):hover td { background: #fafcff; }
.number-cell { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.primary-cell { color: var(--text); font-weight: 700; }
.secondary-line { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; font-weight: 500; }
.table-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; white-space: nowrap; }
.empty-row td { padding: 32px 18px; }
.empty-state { min-height: 180px; display: grid; place-items: center; align-content: center; gap: 4px; color: var(--muted); text-align: center; }
.empty-state.compact { min-height: 92px; }
.empty-state strong { color: var(--text-soft); }
.empty-state span { max-width: 440px; font-size: 12px; }
.skeleton-row td { padding: 14px; }
.skeleton-line { display: block; width: 100%; height: 16px; border-radius: 5px; background: linear-gradient(90deg, #eef3f9 25%, #f8fafd 50%, #eef3f9 75%); background-size: 200% 100%; animation: skeleton 1.4s infinite; }
@keyframes skeleton { to { background-position: -200% 0; } }

/* Status and navigation controls */
.status-badge { width: max-content; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 999px; background: var(--surface-strong); color: var(--text-soft); font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: currentColor; }
.status-badge.success { background: var(--green-soft); color: var(--green); }
.status-badge.warning { background: var(--amber-soft); color: var(--amber); }
.status-badge.danger { background: var(--red-soft); color: var(--red); }
.status-badge.info { background: var(--blue-soft); color: var(--blue-dark); }
.tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tabs a, .tabs button { min-height: 42px; padding: 10px 14px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs a.active, .tabs button.active { border-bottom-color: var(--blue); color: var(--blue); }
.notice { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 14px 16px; border: 1px solid #efd3a3; border-radius: var(--radius); background: var(--amber-soft); color: #6f4308; }
.notice.danger { border-color: #f2c1c6; background: var(--red-soft); color: #842029; }
.notice.success { border-color: #bde6d5; background: var(--green-soft); color: #086044; }
.notice strong { display: block; margin-bottom: 2px; }
.notice p { margin: 0; font-size: 12px; }

/* Onboarding and details */
.onboarding-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 16px; align-items: start; }
.progress-panel { position: sticky; top: 24px; padding: 14px; }
.step-list { display: grid; gap: 3px; margin: 0; padding: 0; list-style: none; }
.step-item { width: 100%; display: grid; grid-template-columns: 28px minmax(0, 1fr); align-items: center; gap: 9px; padding: 8px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; font-weight: 650; text-align: left; cursor: pointer; }
.step-item:hover { background: var(--surface-soft); color: var(--text); }
.step-number { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); font-size: 11px; }
.step-item.active, .step-item.active:hover { background: var(--blue-soft); color: var(--blue-dark); }
.step-item.active .step-number { border-color: var(--blue); background: var(--blue); color: #fff; }
.step-item.complete { color: var(--green); }
.step-item.complete .step-number { border-color: #a9dcc8; background: var(--green-soft); }
.wizard-step .panel-head { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.form-section { padding-top: 18px; }
.form-section + .form-section { margin-top: 20px; border-top: 1px solid var(--line); }
.form-section h3 { margin: 0 0 4px; font-size: 14px; }
.form-section > p { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.plan-summary { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); }
.plan-summary strong { display: block; font-size: 17px; }
.feature-list { display: grid; gap: 7px; margin: 14px 0 0; padding: 0; list-style: none; }
.feature-list li { display: flex; gap: 8px; color: var(--text-soft); font-size: 12px; }
.feature-list li::before { color: var(--green); font-weight: 900; content: "✓"; }

/* Dialogs, drawers and notifications */
.dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: min(86vh, 820px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 80px rgba(14, 27, 51, .22);
}
.dialog::backdrop { background: rgba(14, 27, 51, .42); backdrop-filter: blur(2px); }
.dialog.wide { width: min(940px, calc(100vw - 32px)); }
.dialog.drawer { width: min(760px, calc(100vw - 32px)); margin: 0 0 0 auto; max-height: 100vh; height: 100vh; border-radius: 14px 0 0 14px; }
.dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 22px 15px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; font-size: 18px; }
.dialog-body { padding: 20px 22px; }
.dialog-copy { margin: 0; padding: 4px 22px 8px; color: var(--muted); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 15px 22px 20px; }
.dialog-close { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--muted); cursor: pointer; }
.toast-stack { position: fixed; z-index: 100; right: 20px; bottom: 20px; width: min(360px, calc(100vw - 40px)); display: grid; gap: 8px; }
.toast { padding: 12px 14px; border: 1px solid var(--line); border-radius: 9px; background: #fff; box-shadow: 0 16px 44px rgba(14,27,51,.14); color: var(--text-soft); font-size: 12px; }
.toast.success { border-color: #bde6d5; color: var(--green); }
.toast.error { border-color: #f2c1c6; color: var(--red); }

/* Platform views */
.platform-view[hidden] { display: none; }
.platform-view { scroll-margin-top: 20px; }
.platform-overview-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 16px; }
.detail-tabs { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 16px; }
.detail-tabs button { min-height: 34px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); color: var(--muted); cursor: pointer; }
.detail-tabs button.active { border-color: #b9cdf4; background: var(--blue-soft); color: var(--blue-dark); }
.detail-section { display: none; }
.detail-section.active { display: block; }
.configuration-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 16px; }
.readiness-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.readiness-line:last-child { border-bottom: 0; }
.readiness-line span:first-child { color: var(--muted); }
.code-text { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }

@media (max-width: 1180px) {
  :root { --sidebar-width: 208px; }
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .page-container, .page-container.wide { width: min(100% - 36px, 1280px); }
  .platform-overview-grid, .configuration-grid { grid-template-columns: 1fr; }
}

/* MacBook viewport: desktop remains desktop, but dense tables and the page
   header keep their own space instead of forcing a horizontal document scroll. */
@media (min-width: 1025px) and (max-width: 1512px) {
  .saas-workspace { padding-inline: clamp(16px, 2vw, 28px); }
  .page-container, .page-container.wide { width: min(100%, 1280px); }
  .page-header, .page-actions, .table-toolbar { gap: 8px; }
  .table-scroll { max-width: 100%; }
}

@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; width: min(560px, 100%); }
  .auth-context { min-height: 210px; padding: 28px; }
  .auth-context h1 { margin: 30px 0 9px; font-size: 26px; }
  .auth-context-note { display: none; }
  .auth-main { padding: 34px 30px; }
  .saas-sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 18px 0 48px rgba(14,27,51,.14); }
  body.sidebar-open .saas-sidebar { transform: translateX(0); }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 35; border: 0; background: rgba(14, 27, 51, .38); }
  body.sidebar-open .sidebar-backdrop { display: block; }
  .saas-workspace { margin-left: 0; padding-top: 56px; }
  .mobile-topbar { position: fixed; inset: 0 0 auto; z-index: 30; height: 56px; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); backdrop-filter: blur(8px); }
  .mobile-topbar .brand-lockup strong { font-size: 14px; }
  .mobile-menu-button { width: 36px; height: 36px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--text); cursor: pointer; }
  .mobile-menu-button svg { width: 18px; }
  .page-container, .page-container.wide { width: min(100% - 28px, 760px); padding: 24px 0 40px; }
  .page-header { flex-direction: column; gap: 14px; }
  .page-actions { justify-content: flex-start; }
  .content-grid, .content-grid.equal, .onboarding-layout { grid-template-columns: 1fr; }
  .progress-panel { position: static; overflow-x: auto; }
  .step-list { display: flex; min-width: 720px; }
  .step-item { grid-template-columns: 28px auto; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .public-page { padding: 0; place-items: stretch; }
  .auth-layout { min-height: 100vh; border: 0; border-radius: 0; }
  .auth-context { min-height: 180px; padding: 24px 20px; }
  .auth-context h1 { margin: 24px 0 8px; font-size: 23px; }
  .auth-main { justify-content: flex-start; padding: 30px 20px 40px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .page-header h1 { font-size: 23px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: auto; }
  .panel { padding: 16px; }
  .panel.flush > .panel-head, .table-toolbar { padding-left: 16px; padding-right: 16px; }
  .table-toolbar { align-items: stretch; flex-direction: column; }
  .table-filters { align-items: stretch; flex-direction: column; }
  .search-input, .table-filters select { width: 100%; }
  .form-actions { align-items: stretch; flex-direction: column-reverse; }
  .form-actions .button { width: 100%; }
  .summary-row { grid-template-columns: 1fr; gap: 3px; }
  .notice { align-items: stretch; flex-direction: column; }
  .dialog.drawer { width: 100vw; border-radius: 0; }
  .dialog-actions { align-items: stretch; flex-direction: column-reverse; }
  .dialog-actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
