/*
 * Environment Manager — styling.
 *
 * Recreates the Advantive ONE portal look without the private @advantiveone/ui
 * package: shadcn "default" style on the "slate" base color, plus the brand
 * accents pulled from the a1 logo (#f58220 orange, #3b2845 plum).
 */

:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --popover: 0 0% 100%;
  --primary: 222.2 47.4% 11.2%;
  --primary-foreground: 210 40% 98%;
  --secondary: 210 40% 96.1%;
  --secondary-foreground: 222.2 47.4% 11.2%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --accent: 210 40% 96.1%;
  --accent-foreground: 222.2 47.4% 11.2%;
  --destructive: 0 72% 51%;
  --destructive-foreground: 210 40% 98%;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
  --ring: 222.2 84% 4.9%;
  --radius: 0.5rem;

  /* Advantive brand */
  --brand: 28 91% 55%;        /* #f58220 */
  --brand-plum: 279 27% 22%;  /* #3b2845 */
  --success: 142 71% 45%;
  --warning: 38 92% 50%;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 47% 9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --primary: 210 40% 98%;
    --primary-foreground: 222.2 47.4% 11.2%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --border: 217.2 32.6% 20%;
    --input: 217.2 32.6% 20%;
    --ring: 212.7 26.8% 83.9%;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    Helvetica, Arial, sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Header (mirrors the portal's sticky top bar) ─────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 64px;
  padding: 0 1rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.85);
  backdrop-filter: blur(8px);
}
.header .logo { height: 36px; width: auto; object-fit: contain; }
.header .divider {
  width: 1px; height: 28px; background: hsl(var(--border));
}
.header .title {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.header .title .sub { color: hsl(var(--muted-foreground)); font-weight: 400; }
.header .spacer { flex: 1; }
.header .badge {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: 999px;
  padding: 2px 10px;
}

/* ── Layout ───────────────────────────────────────────────────────────────── */
.body { display: flex; flex: 1; overflow: hidden; }

.sidebar {
  width: 300px;
  flex-shrink: 0;
  border-right: 1px solid hsl(var(--border));
  overflow-y: auto;
  padding: 1rem;
  background: hsl(var(--card));
}
.sidebar h2 {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
  margin: 0.25rem 0.25rem 0.75rem;
}

.tool-btn {
  display: block;
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  border-radius: var(--radius);
  padding: 0.6rem 0.7rem;
  margin-bottom: 0.35rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.tool-btn:hover { background: hsl(var(--accent)); }
.tool-btn.active {
  background: hsl(var(--accent));
  border-color: hsl(var(--border));
}
.tool-btn .name { font-weight: 600; display: flex; align-items: center; gap: 0.4rem; }
.tool-btn .desc {
  font-size: 12px;
  color: hsl(var(--muted-foreground));
  margin-top: 2px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tool-btn .missing { color: hsl(var(--destructive)); font-size: 11px; }

.main { flex: 1; overflow-y: auto; padding: 1.5rem; }
.main-inner { max-width: 900px; margin: 0 auto; }

.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; color: hsl(var(--muted-foreground)); text-align: center; gap: 0.5rem;
}
.empty-state img { width: 56px; opacity: 0.8; margin-bottom: 0.5rem; }

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}
.card h1 { font-size: 20px; margin: 0 0 0.25rem; letter-spacing: -0.01em; }
.card .card-desc { color: hsl(var(--muted-foreground)); margin: 0 0 0.25rem; }

.alert {
  display: flex; gap: 0.6rem;
  border: 1px solid hsl(var(--warning) / 0.4);
  background: hsl(var(--warning) / 0.10);
  color: hsl(var(--foreground));
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  font-size: 13px;
  margin: 0.75rem 0 0;
}
.alert .icon { color: hsl(var(--warning)); flex-shrink: 0; }
.alert-info {
  border-color: hsl(var(--brand) / 0.4);
  background: hsl(var(--brand) / 0.08);
  align-items: center;
}
.alert-info .icon { color: hsl(var(--brand)); }

.status-line { font-size: 12px; margin-top: 0.6rem; color: hsl(var(--muted-foreground)); }
.status-line.ok { color: hsl(var(--success)); }

.btn-sm { height: 30px; padding: 0 0.85rem; font-size: 13px; }

/* Installer download buttons (connector page banner + Installers page table):
   version strings vary in length ("2026.3.7" vs "2026.10.123"), and without a
   floor every button sizes to its own text — ragged widths in a table column,
   and a banner button that jumps around as different connectors load. Sized
   for the longest version this feed format supports, "9999.99.999" (max
   4.2.3 digits per the vendor's versioning), plus the "⬇ v" prefix. */
.btn-installer { min-width: 9.5rem; }

/* ── Form ─────────────────────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.3rem; }
.field.full { grid-column: 1 / -1; }
.field label { font-weight: 500; font-size: 13px; }
.field .help { color: hsl(var(--muted-foreground)); font-size: 12px; }

input[type="text"], input[type="email"], input[type="date"], select {
  height: 38px;
  border: 1px solid hsl(var(--input));
  border-radius: var(--radius);
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  padding: 0 0.7rem;
  font-size: 14px;
  font-family: inherit;
}
input:focus, select:focus {
  outline: 2px solid hsl(var(--ring) / 0.4);
  outline-offset: 1px;
  border-color: hsl(var(--ring));
}

.checkbox-row { display: flex; align-items: center; gap: 0.5rem; }
.checkbox-row input { width: 16px; height: 16px; accent-color: hsl(var(--brand)); }

.actions { display: flex; gap: 0.6rem; align-items: center; margin-top: 1rem; }

.btn {
  height: 38px;
  padding: 0 1.1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  white-space: nowrap;
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s, opacity 0.12s, transform 0.04s, filter 0.12s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
/* Pressed feedback: a click visibly registers (dips + darkens) even when the
   action then disables the button or waits on a load. Applies to every variant. */
.btn:active:not(:disabled) { transform: translateY(1px) scale(0.985); filter: brightness(0.92); }
a.btn { text-decoration: none; }   /* anchors styled as buttons (e.g. open-in-new-tab actions) */
.btn-primary { background: hsl(var(--brand)); color: white; }
.btn-primary:hover:not(:disabled) { background: hsl(var(--brand) / 0.9); }
.btn-secondary {
  background: hsl(var(--secondary));
  color: hsl(var(--secondary-foreground));
  border-color: hsl(var(--border));
}
.btn-secondary:hover:not(:disabled) { background: hsl(var(--accent)); }
.btn-destructive { background: hsl(var(--destructive)); color: white; }
.btn-destructive:hover:not(:disabled) { background: hsl(var(--destructive) / 0.9); }

/* ── Terminal ─────────────────────────────────────────────────────────────── */
.terminal-card { padding: 0; overflow: hidden; }
.terminal-head {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--muted));
}
.terminal-head .dot { width: 10px; height: 10px; border-radius: 50%; background: hsl(var(--muted-foreground) / 0.4); }
.terminal-head .dot.running { background: hsl(var(--warning)); animation: pulse 1.2s infinite; }
.terminal-head .dot.ok { background: hsl(var(--success)); }
.terminal-head .dot.err { background: hsl(var(--destructive)); }
.terminal-head .state { font-size: 12px; color: hsl(var(--muted-foreground)); }
.terminal-head .elapsed { font-size: 12px; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; }
.terminal-head .cmd { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 12px; color: hsl(var(--muted-foreground)); margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }

.terminal-body {
  background: #0b0f19;
  color: #d7dce5;
  font-family: ui-monospace, "Cascadia Code", Consolas, "Courier New", monospace;
  font-size: 13px;
  line-height: 1.45;
  padding: 0.9rem;
  height: 380px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.terminal-body .sys { color: #7f8ea3; font-style: italic; }
.terminal-body .exit-ok { color: #4ade80; }
.terminal-body .exit-err { color: #f87171; }

.terminal-input-row {
  display: flex; gap: 0.5rem;
  padding: 0.6rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--card));
}
.terminal-input-row input {
  flex: 1;
  font-family: ui-monospace, Consolas, monospace;
}
.terminal-input-row input:disabled { opacity: 0.5; }

.hidden { display: none !important; }

/* ── Boot / version ─────────────────────────────────────────────────────── */
.boot { display: flex; height: 100vh; align-items: center; justify-content: center; color: hsl(var(--muted-foreground)); }
.app-version { position: fixed; bottom: 8px; right: 10px; font-size: 11px; color: hsl(var(--muted-foreground)); opacity: 0.7; }

/* ── Header env selector ─────────────────────────────────────────────────── */
.env-slot { display: flex; align-items: center; gap: 0.5rem; }
.env-label { font-size: 12px; color: hsl(var(--muted-foreground)); }
.env-select { height: 34px; }

/* ── Sidebar nav ─────────────────────────────────────────────────────────── */
.nav-section { margin-bottom: 1.1rem; }
.nav-section-title {
  display: flex; align-items: center; gap: 0.45rem;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: hsl(var(--muted-foreground)); margin: 0 0.25rem 0.4rem; font-weight: 600;
}
.dot-sm { width: 8px; height: 8px; border-radius: 50%; background: hsl(var(--muted-foreground) / 0.5); }
.dot-sm.ok { background: hsl(var(--success)); }
.dot-sm.warn { background: hsl(var(--warning)); }
.dot-sm.muted { background: hsl(var(--muted-foreground) / 0.4); }
.nav-item {
  display: block; width: 100%; text-align: left; border: 1px solid transparent;
  border-radius: var(--radius); padding: 0.5rem 0.7rem; margin-bottom: 0.2rem;
  background: transparent; color: inherit; cursor: pointer; font-size: 14px;
  transition: background 0.12s, border-color 0.12s;
}
.nav-item:hover { background: hsl(var(--accent)); }
.nav-item.active { background: hsl(var(--accent)); border-color: hsl(var(--border)); font-weight: 600; }
.nav-item.disabled { opacity: 0.5; pointer-events: none; }

/* ── Cards / sections ────────────────────────────────────────────────────── */
.card-title { font-size: 18px; margin: 0 0 0.25rem; letter-spacing: -0.01em; }
.subsection { margin-top: 1.1rem; padding-top: 1rem; border-top: 1px solid hsl(var(--border)); }
.subsection h3, .sub-h { font-size: 14px; margin: 0 0 0.5rem; }
.sub-h { margin-top: 1rem; }
.inline-form { display: flex; gap: 0.5rem; align-items: center; margin-bottom: 0.4rem; }
.inline-form input { flex: 1; }

/* ── Repeater (dynamic rows) ─────────────────────────────────────────────── */
.repeater { margin-bottom: 0.5rem; }
.repeater-row { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.6rem; }
.repeater-row > :first-child { flex: 1; }
.subrow-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 0.6rem; flex: 1; }
.subrow-grid-3 { display: grid; grid-template-columns: 1.4fr 1.2fr 1.4fr; gap: 0.6rem; flex: 1; }
/* Subtle icon action (row remove, modal close). Borderless by default so it
   reads as an affordance, not a form control; destructive intent on hover. */
.icon-btn {
  width: 32px; height: 32px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: var(--radius);
  background: transparent; color: hsl(var(--muted-foreground));
  cursor: pointer; font-size: 15px; line-height: 1;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.icon-btn:hover { background: hsl(var(--destructive) / 0.1); color: hsl(var(--destructive)); border-color: hsl(var(--destructive) / 0.3); }
.btn-ghost { background: transparent; border: 1px dashed hsl(var(--border)); color: hsl(var(--muted-foreground)); }
.btn-ghost:hover:not(:disabled) { background: hsl(var(--accent)); color: hsl(var(--foreground)); border-color: hsl(var(--brand) / 0.4); }
.btn-ghost-danger { color: hsl(var(--destructive)); }
.btn-ghost-danger:hover:not(:disabled) { background: hsl(var(--destructive) / 0.08); color: hsl(var(--destructive)); border-color: hsl(var(--destructive) / 0.4); }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; border: 1px solid hsl(var(--border)); border-radius: var(--radius); margin: 0.4rem 0 0.6rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th, .data-table td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid hsl(var(--border)); }
.data-table th { background: hsl(var(--muted)); font-weight: 600; color: hsl(var(--muted-foreground)); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.clickable { cursor: pointer; }
.data-table tr.clickable:hover td { background: hsl(var(--accent)); }
.table-empty { padding: 0.8rem; color: hsl(var(--muted-foreground)); font-size: 13px; }

/* Table controls: filter + pager */
.table-controls { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin: 0.3rem 0 0.5rem; flex-wrap: wrap; }
.table-filter { height: 34px; flex: 1; min-width: 180px; max-width: 320px; }
.table-pager { display: flex; align-items: center; gap: 0.5rem; }
.table-info { font-size: 12px; color: hsl(var(--muted-foreground)); font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table td .table-empty { padding: 0.6rem; }

/* ── Pills / badges ──────────────────────────────────────────────────────── */
.badge-row { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.pill { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 999px; border: 1px solid hsl(var(--border)); color: hsl(var(--muted-foreground)); }
.pill-ok { background: hsl(var(--success) / 0.12); color: hsl(var(--success)); border-color: hsl(var(--success) / 0.4); }
.pill-warn { background: hsl(var(--warning) / 0.12); color: hsl(38 92% 40%); border-color: hsl(var(--warning) / 0.4); }
.pill-muted { background: hsl(var(--muted)); }
.pill-danger { background: hsl(var(--destructive) / 0.12); color: hsl(var(--destructive)); border-color: hsl(var(--destructive) / 0.4); }

/* ── Result banner / log ─────────────────────────────────────────────────── */
.result-host { margin-top: 0.9rem; }
.result-banner { display: flex; align-items: center; gap: 0.55rem; padding: 0.65rem 0.85rem; border-radius: var(--radius); font-size: 14px; }
.result-banner.success { background: hsl(var(--success) / 0.1); border: 1px solid hsl(var(--success) / 0.4); }
.result-banner.error { background: hsl(var(--destructive) / 0.08); border: 1px solid hsl(var(--destructive) / 0.4); }
.result-banner.info { background: hsl(var(--brand) / 0.08); border: 1px solid hsl(var(--brand) / 0.4); }
.result-banner.warn { background: hsl(38 92% 50% / 0.1); border: 1px solid hsl(38 92% 50% / 0.45); }
.result-icon { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 12px; flex-shrink: 0; }
.result-banner.success .result-icon { background: hsl(var(--success)); }
.result-banner.error .result-icon { background: hsl(var(--destructive)); }
.result-banner.info .result-icon { background: hsl(var(--brand)); }
.result-banner.warn .result-icon { background: hsl(38 92% 50%); }
.logpanel { margin-top: 0.6rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.logpanel summary { cursor: pointer; padding: 0.5rem 0.75rem; font-size: 13px; color: hsl(var(--muted-foreground)); user-select: none; }
.logpre { margin: 0; padding: 0.75rem; background: #0b0f19; color: #d7dce5; border-radius: 0 0 var(--radius) var(--radius); font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; }

/* ── Key/value output ────────────────────────────────────────────────────── */
.kv { display: flex; align-items: center; gap: 0.75rem; padding: 0.6rem 0; }
.kv-key { font-size: 13px; color: hsl(var(--muted-foreground)); }
.kv-val { font-family: ui-monospace, Consolas, monospace; font-size: 15px; background: hsl(var(--muted)); padding: 3px 10px; border-radius: 6px; }

/* ── Spinner ─────────────────────────────────────────────────────────────── */
.spinner-row { display: flex; align-items: center; gap: 0.6rem; color: hsl(var(--muted-foreground)); font-size: 14px; padding: 0.4rem 0; }
.spinner { width: 16px; height: 16px; border: 2px solid hsl(var(--border)); border-top-color: hsl(var(--brand)); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.row-status { display: flex; align-items: center; gap: 6px; }

/* ── Toasts ──────────────────────────────────────────────────────────────── */
.toast-host { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 0.5rem; z-index: 100; }
.toast { padding: 0.7rem 1rem; border-radius: var(--radius); background: hsl(var(--card)); border: 1px solid hsl(var(--border)); box-shadow: 0 4px 16px rgba(0,0,0,0.15); font-size: 14px; opacity: 0; transform: translateY(8px); transition: opacity 0.2s, transform 0.2s; max-width: 340px; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { border-left: 4px solid hsl(var(--success)); }
.toast-error { border-left: 4px solid hsl(var(--destructive)); }
.toast-info { border-left: 4px solid hsl(var(--brand)); }

/* ── Stats row (data-loader plan) ────────────────────────────────────────── */
.stat-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 0.4rem 0 0.6rem; }
.stat { flex: 1; min-width: 120px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 0.7rem 0.9rem; background: hsl(var(--muted) / 0.4); }
.stat-value { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.stat-label { font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 2px; }

/* ── SQL box ─────────────────────────────────────────────────────────────── */
.sql-box { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 13px; padding: 0.6rem 0.7rem; border: 1px solid hsl(var(--input)); border-radius: var(--radius); background: hsl(var(--background)); color: hsl(var(--foreground)); resize: vertical; min-height: 90px; }
.sql-box:focus { outline: 2px solid hsl(var(--ring) / 0.4); outline-offset: 1px; border-color: hsl(var(--ring)); }

.muted-note { font-size: 12px; color: hsl(var(--muted-foreground)); margin: 0.4rem 0; }

/* ── Fabric provisioning ─────────────────────────────────────────────────── */
.step-item { display: flex; gap: 0.8rem; padding: 0.7rem 0; border-top: 1px solid hsl(var(--border)); }
.step-item:first-child { border-top: none; }
.step-num {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
  background: hsl(var(--muted)); color: hsl(var(--foreground));
}
.step-num.manual { background: hsl(var(--warning) / 0.18); color: hsl(var(--warning)); }
.step-body { flex: 1; }
.step-title { font-weight: 600; display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.step-what { font-size: 13px; margin: 2px 0; }
.step-detail { font-size: 12px; color: hsl(var(--muted-foreground)); }
.cfg-item { padding: 0.55rem 0; border-top: 1px solid hsl(var(--border)); }
.cfg-item:first-child { border-top: none; }
.cfg-name { font-family: ui-monospace, Consolas, monospace; font-size: 13px; font-weight: 600; }
.cfg-help { font-size: 13px; margin: 2px 0; }
.schema-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.35rem 1rem; }
.schema-opt { display: flex; align-items: center; gap: 0.4rem; font-size: 13px; font-family: ui-monospace, Consolas, monospace; }
/* Collapsible reference / prereq disclosures */
details.fab-ref { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 0 0.9rem; margin: 0.55rem 0; background: hsl(var(--card)); }
details.fab-ref > summary { cursor: pointer; padding: 0.75rem 0; font-weight: 600; font-size: 14px; list-style: none; display: flex; align-items: center; gap: 0.5rem; }
details.fab-ref > summary::-webkit-details-marker { display: none; }
details.fab-ref > summary::before { content: "▸"; color: hsl(var(--muted-foreground)); font-size: 12px; }
details.fab-ref[open] > summary::before { content: "▾"; }
details.fab-ref > summary .fab-sum-note { font-weight: 400; color: hsl(var(--muted-foreground)); font-size: 12px; margin-left: auto; }
details.fab-ref > .fab-ref-body { padding-bottom: 0.8rem; }
.prereq-status { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.inline-form select { flex: 0 0 auto; }
a { color: hsl(var(--brand)); }

/* ══ Redesign: shell, home, hub ═══════════════════════════════════════════ */
.nav-item { display: flex; align-items: center; gap: 0.6rem; }
.nav-icon { width: 18px; text-align: center; opacity: 0.8; }
.nav-spacer { flex: 1; min-height: 1.5rem; }
.nav-hint { font-size: 11px; color: hsl(var(--muted-foreground)); padding: 0.5rem; line-height: 1.4; }

.page-title { font-size: 24px; letter-spacing: -0.02em; margin: 0.5rem 0 0.25rem; }
.page-sub { color: hsl(var(--muted-foreground)); margin: 0 0 1rem; }

/* Breadcrumb */
.breadcrumb { display: flex; align-items: center; gap: 0.4rem; font-size: 13px; margin-bottom: 0.25rem; }
.bc-sep { color: hsl(var(--muted-foreground)); }
.bc-link { color: hsl(var(--muted-foreground)); cursor: pointer; }
.bc-link:hover { color: hsl(var(--brand)); text-decoration: underline; }
.bc-current { color: hsl(var(--foreground)); font-weight: 500; }

/* Hero (home) */
.hero { padding: 1.5rem 0 1rem; }
.hero-title { font-size: 28px; letter-spacing: -0.02em; margin: 0 0 0.4rem; }
.hero-sub { color: hsl(var(--muted-foreground)); margin: 0 0 1rem; display: flex; align-items: center; gap: 0.3rem; flex-wrap: wrap; }
.hero-search-row { display: flex; gap: 0.5rem; max-width: 640px; }
.hero-search { flex: 1; height: 44px; font-size: 15px; }
.hero-search-row .btn { height: 44px; }

/* Section head */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 1.4rem 0 0.6rem; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: hsl(var(--muted-foreground)); margin: 0; }

/* Tiles */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.action-tile { display: flex; align-items: center; gap: 0.85rem; text-align: left; padding: 1rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); cursor: pointer; transition: border-color 0.12s, box-shadow 0.12s, transform 0.06s; }
.action-tile:hover { border-color: hsl(var(--brand) / 0.5); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }
.action-tile:active { transform: translateY(1px); }
.action-icon { font-size: 22px; flex-shrink: 0; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; background: hsl(var(--brand) / 0.1); border-radius: 10px; }
.action-body { flex: 1; }
.action-title { font-weight: 600; }
.action-desc { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-top: 2px; }
.action-arrow { color: hsl(var(--muted-foreground)); font-size: 18px; }

/* Recent chips */
.chip-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip { display: flex; flex-direction: column; align-items: flex-start; padding: 0.5rem 0.8rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); cursor: pointer; }
.chip:hover { border-color: hsl(var(--brand) / 0.5); background: hsl(var(--accent)); }
.chip-name { font-weight: 600; font-size: 13px; }
.chip-id { font-size: 11px; color: hsl(var(--muted-foreground)); font-family: ui-monospace, Consolas, monospace; }

/* Empty state */
.empty { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; padding: 2rem; color: hsl(var(--muted-foreground)); text-align: center; border: 1px dashed hsl(var(--border)); border-radius: var(--radius); }
.empty-icon { font-size: 26px; opacity: 0.5; }
.empty-msg { font-size: 14px; }

/* Skeleton */
.skeleton { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.5rem 0; }
.skeleton-bar { height: 14px; border-radius: 6px; background: linear-gradient(90deg, hsl(var(--muted)) 25%, hsl(var(--accent)) 37%, hsl(var(--muted)) 63%); background-size: 400% 100%; animation: shimmer 1.4s ease-in-out infinite; }
.skeleton-bar:nth-child(2) { width: 85%; } .skeleton-bar:nth-child(3) { width: 70%; } .skeleton-bar:nth-child(4) { width: 90%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }

/* ── Press feedback for non-.btn interactive elements ───────────────────────── */
/* Every clickable thing should visibly react to a press, not just .btn. Instant
   (no transition) so the click reads immediately. */
.nav-item:active,
.tab:active { transform: translateY(1px); }
.chip:active { transform: translateY(1px) scale(0.99); filter: brightness(0.97); }
.ae-sitebtn:active { transform: translateY(1px) scale(0.98); }
.data-table tr.clickable:active td { background: hsl(var(--accent) / 0.7); }

/* ── Content-shaped loading skeletons (share the .skeleton-bar shimmer) ──────── */
/* A stat number / insight value that's still fetching shows a shimmer block the
   size of the eventual content, so data fades in instead of popping over a "…". */
.stat-skel, .insight-skel, .insight-skel-sub {
  display: inline-block; border-radius: 6px;
  background: linear-gradient(90deg, hsl(var(--muted)) 25%, hsl(var(--accent)) 37%, hsl(var(--muted)) 63%);
  background-size: 400% 100%; animation: shimmer 1.4s ease-in-out infinite;
}
.stat-skel { width: 2.4ch; height: 1.4rem; vertical-align: -0.2rem; }
.insight-skel { width: 5.5rem; height: 1rem; }
.insight-skel-sub { display: block; width: 70%; height: 0.65rem; margin-top: 0.45rem; opacity: 0.7; }

/* Tabs */
/* overflow-x:auto alone makes overflow-y compute to auto (CSS spec), so the tab's
   2px underline triggered a spurious vertical scrollbar — pin overflow-y:hidden. */
.tabs { display: flex; gap: 0.15rem; border-bottom: 1px solid hsl(var(--border)); margin: 0.5rem 0 1.1rem; overflow-x: auto; overflow-y: hidden; }
.tab { padding: 0.55rem 0.9rem; border: none; background: transparent; color: hsl(var(--muted-foreground)); cursor: pointer; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: hsl(var(--foreground)); }
.tab.active { color: hsl(var(--brand)); border-bottom-color: hsl(var(--brand)); font-weight: 600; }

/* Hub header */
.hub-title-row { display: flex; align-items: center; gap: 0.9rem; flex-wrap: wrap; }
.hub-sub { color: hsl(var(--muted-foreground)); font-size: 13px; margin-top: 0.15rem; font-family: ui-monospace, Consolas, monospace; }

/* Enterprises table row hint */
.row-open { color: hsl(var(--brand)); font-size: 12px; }

/* Modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 1rem; z-index: 200; overflow-y: auto; }
.modal { background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 12px; width: 100%; max-width: 720px; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal-wide { max-width: 980px; }
/* Confirmation dialog (U.confirm) — a compact modal centered in the viewport,
   sized to its message, replacing the browser's native confirm(). */
.modal-confirm { max-width: 480px; margin: auto; }
.confirm-msg { margin: 0 0 0.25rem; white-space: pre-wrap; line-height: 1.5; }
.actions-end { justify-content: flex-end; }
.actions-split { justify-content: space-between; }

/* Insight boxes (extract monitoring) */
.insight-row { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 0.6rem 0; }
.insight-box { flex: 1; min-width: 180px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 0.7rem 0.9rem; background: hsl(var(--brand) / 0.05); }
.insight-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; color: hsl(var(--muted-foreground)); }
.insight-value { font-size: 16px; font-weight: 600; margin-top: 3px; font-variant-numeric: tabular-nums; }

/* At-a-glance dashboard (Overview) + agreement signing-URL cell */
.dashboard { margin-bottom: 0.6rem; }
/* Dashboard health cards lay out label ↔ value on one line (value right-aligned),
   with any sub-note full-width below. Equal-width (flex: 1 1 0) + equal-height
   (row stretch) so the cards read as a uniform strip. */
.dashboard .insight-row { align-items: stretch; }
/* Each card is wrapped in a host div; the wrapper is the flex item, so give it
   the equal-width/stretch and let the inner .insight-box fill it (height too). */
.dashboard .insight-row > * { flex: 1 1 0; min-width: 0; display: flex; }
.dashboard .insight-box { display: flex; flex-direction: column; flex: 1; }
.dashboard .insight-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem; flex-wrap: wrap; }
.dashboard .insight-head .insight-label { margin: 0; }
.dashboard .insight-head .insight-value { margin: 0; text-align: right; }
.dashboard .insight-box .muted-note { margin: 0.35rem 0 0; }
.dashboard .insight-box a.muted-note { display: inline-block; }
.url-cell { display: flex; align-items: center; gap: 0.6rem; }

/* Topic checkbox list (create connector) */
.scope-details { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 0.5rem 0.7rem; margin: 0.4rem 0 0.6rem; background: hsl(var(--muted) / 0.25); }
.scope-details > summary { cursor: pointer; font-size: 13px; font-weight: 600; }
.scope-details[open] > summary { margin-bottom: 0.4rem; }

.topic-list { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; margin: 0.4rem 0; }
.topic-item { display: flex; align-items: center; gap: 0.4rem; font-size: 13px; font-family: ui-monospace, Consolas, monospace; }
.topic-item input { width: 15px; height: 15px; }

/* Edit modals: read-only (immutable) field + connector site-association rows */
.ro-field { padding: 0.45rem 0.6rem; background: hsl(var(--muted) / 0.4); border: 1px dashed hsl(var(--border)); border-radius: var(--radius); }
.ro-field code { font-size: 13px; color: hsl(var(--muted-foreground)); }
.edit-site-list { display: flex; flex-direction: column; gap: 0.5rem; max-height: 260px; overflow-y: auto; padding: 0.25rem 0; }
.edit-site-row { display: grid; grid-template-columns: 1fr; gap: 0.35rem; padding: 0.5rem 0.6rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.edit-site-ids { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }

/* Height-capped scroll area (e.g. long request tables inside a modal) */
.scroll-cap { max-height: 340px; overflow-y: auto; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.scroll-cap .table-wrap { border: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid hsl(var(--border)); }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-body { padding: 1.25rem; }

.sticky-actions { position: sticky; bottom: 0; background: hsl(var(--background) / 0.9); backdrop-filter: blur(6px); padding: 0.75rem 0; border-top: 1px solid hsl(var(--border)); margin-top: 1rem; }

/* ══ Auth: login screen + user menu ═══════════════════════════════════════ */
.login-wrap { min-height: 100vh; display: flex; padding: 2rem; }
.login-side { display: none; position: relative; width: 50%; overflow: hidden; margin: -2rem 0 -2rem -2rem; }
.login-side img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.login-side-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); }
.login-side-copy { position: absolute; left: 0; bottom: 0; padding: 2.5rem; color: #fff; max-width: 460px; }
.login-side-copy h1 { font-size: 2rem; font-weight: 700; margin: 0 0 0.75rem; }
.login-side-copy p { font-size: 1rem; line-height: 1.5; margin: 0; opacity: 0.92; }
.login-card { width: 100%; min-width: 0; max-width: 420px; margin: auto; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 14px; padding: 2rem; box-shadow: 0 12px 48px rgba(0,0,0,0.12); text-align: center; }
.login-logo { height: 34px; width: auto; object-fit: contain; margin-bottom: 1rem; }
@media (min-width: 900px) { .login-side { display: block; } }
.login-title { font-size: 20px; margin: 0 0 0.25rem; letter-spacing: -0.01em; }
.login-sub { color: hsl(var(--muted-foreground)); margin: 0 0 1.25rem; font-size: 14px; }
.login-card .field { text-align: left; margin-bottom: 1rem; }
.login-env { width: 100%; height: 40px; }
/* Read-only environment shown when the deployment fixes it (no chooser). */
.env-fixed { display: flex; align-items: center; padding: 0 0.75rem;
  border: 1px solid hsl(var(--border)); border-radius: 6px;
  background: hsl(var(--muted)); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.03em; font-size: 13px; }
.login-btn { width: 100%; height: 44px; font-size: 15px; }
.login-step { margin-top: 1rem; text-align: left; }
.login-note { font-size: 11.5px; color: hsl(var(--muted-foreground)); margin-top: 1.25rem; line-height: 1.5; }
.device-box { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 1rem; text-align: center; }
.device-box p { margin: 0 0 0.6rem; font-size: 13px; }
.device-link { display: inline-block; font-weight: 600; margin-bottom: 0.75rem; }
.device-code { font-family: ui-monospace, Consolas, monospace; font-size: 26px; font-weight: 700; letter-spacing: 4px; background: hsl(var(--muted)); border-radius: 8px; padding: 0.6rem; margin: 0.5rem 0; }

.env-chip { font-size: 12px; color: hsl(var(--muted-foreground)); border: 1px solid hsl(var(--border)); border-radius: 999px; padding: 3px 10px; font-family: ui-monospace, Consolas, monospace; }

.user-menu { position: relative; }
.user-btn { border: none; background: transparent; cursor: pointer; padding: 0; }
.user-avatar { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 50%; background: hsl(var(--brand)); color: #fff; font-weight: 700; font-size: 14px; }
.user-pop { display: none; position: absolute; right: 0; top: 42px; width: 240px; background: hsl(var(--card)); border: 1px solid hsl(var(--border)); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.18); padding: 0.9rem; z-index: 100; }
.user-menu.open .user-pop { display: block; }
.user-name { font-weight: 600; }
.user-email { font-size: 12px; color: hsl(var(--muted-foreground)); margin-bottom: 0.4rem; word-break: break-all; }
.user-roles { font-size: 11px; color: hsl(var(--muted-foreground)); font-family: ui-monospace, Consolas, monospace; margin-bottom: 0.75rem; word-break: break-word; }

/* Grant chips (Users & Access) */
.grant-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.grant-chip { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: hsl(var(--muted)); border: 1px solid hsl(var(--border)); border-radius: 6px; padding: 3px 8px; }

/* Grouped grant view (Users & Access → Current grants) */
.grant-groups { display: flex; flex-direction: column; gap: 0.6rem; }
.grant-group { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 0.6rem 0.8rem 0.7rem; background: hsl(var(--muted) / 0.25); }
.grant-group-global { background: hsl(var(--brand) / 0.05); }
.grant-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.5rem; padding-bottom: 0.4rem; border-bottom: 1px solid hsl(var(--border)); }
.grant-group-name { font-weight: 600; font-size: 13px; letter-spacing: -0.01em; }
.grant-group-count { font-size: 11px; color: hsl(var(--muted-foreground)); white-space: nowrap; }
.grant-roles { display: flex; flex-direction: column; gap: 0.4rem; }
.grant-role-row { display: grid; grid-template-columns: minmax(140px, 210px) 1fr; gap: 0.5rem 0.8rem; align-items: start; }
.grant-role-name { font-family: ui-monospace, Consolas, monospace; font-size: 12px; font-weight: 600; color: hsl(var(--foreground)); padding-top: 3px; word-break: break-word; }
@media (max-width: 560px) { .grant-role-row { grid-template-columns: 1fr; gap: 0.25rem; } }

/* Provisioning sheet review (Tasks → Review provisioning sheet) */
.muted { color: hsl(var(--muted-foreground)); }
.small { font-size: 12px; }
.file-row { margin: 0.5rem 0 0.2rem; }
/* Style the browser's file picker to match the design system rather than the
   raw OS control. */
.file-input {
  display: block; font-size: 13px; max-width: 100%;
  color: hsl(var(--muted-foreground));
}
.file-input::file-selector-button {
  margin-right: 0.85rem;
  height: 34px; padding: 0 0.95rem;
  border-radius: var(--radius);
  border: 1px solid hsl(var(--border));
  background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
  font-weight: 500; font-size: 13px; font-family: inherit; cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.file-input::file-selector-button:hover { background: hsl(var(--accent)); border-color: hsl(var(--brand) / 0.4); }
.upload-status { margin-top: 0.75rem; font-size: 13px; }
.upload-status strong { font-weight: 600; color: hsl(var(--foreground)); }
.results-host { margin-top: 1.1rem; }
.results-host .section-head { margin-top: 1.4rem; }
/* A hint line that sits directly under a section heading (rule text). */
.results-host .section-head + .muted.small,
.results-host .section-head + .small { margin: -0.35rem 0 0.6rem; }

/* ── DataSpaces schema list (readable replacement for JSON-blob cells) ────── */
.schema-list { display: flex; flex-direction: column; gap: 0.6rem; }
.schema-card {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--card, var(--background)));
  overflow: hidden;
}
.schema-card > summary {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.7rem 0.9rem; cursor: pointer; list-style: none;
}
.schema-card > summary::-webkit-details-marker { display: none; }
.schema-card > summary::before {
  content: "▸"; color: hsl(var(--muted-foreground));
  transition: transform 0.15s ease; display: inline-block;
}
.schema-card[open] > summary::before { transform: rotate(90deg); }
.schema-card > summary:hover { background: hsl(var(--muted) / 0.5); }
.schema-card > summary .badge-row { margin-bottom: 0; }
.schema-actions { margin-left: auto; display: flex; gap: 0.4rem; }
.schema-name { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
/* When a human-readable schemaTitle is available it leads (schema-name); the
   raw, often very long table/schema identifier drops to a wrapped monospace
   subtitle underneath instead of competing for the same line. */
.schema-title-block { display: flex; flex-direction: column; gap: 0.1rem; min-width: 0; flex: 1 1 260px; }
.schema-identifier {
  font-family: ui-monospace, Consolas, monospace; font-size: 11.5px;
  color: hsl(var(--muted-foreground)); overflow-wrap: anywhere; line-height: 1.3;
}
/* At-a-glance schema facts (version, field count, registered/refreshed
   timestamps) — one consistent label/value style, as its own line under the
   title+badges so long UTC timestamps have room instead of forcing a badge
   or a wrapped paragraph row in the body. */
.schema-meta { display: flex; flex-wrap: wrap; gap: 0.9rem 1.4rem; flex-basis: 100%; margin-top: 0.15rem; }
.schema-meta-item { display: flex; flex-direction: column; gap: 0.05rem; min-width: 0; }
.schema-meta-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: hsl(var(--muted-foreground)); }
.schema-meta-value { font-size: 12.5px; font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.schema-body { padding: 0.4rem 0.9rem 0.9rem; border-top: 1px solid hsl(var(--border)); }
.schema-fields-h { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  color: hsl(var(--muted-foreground)); margin: 0.7rem 0 0.4rem; }

/* Compact key/value grid for a schema's remaining scalar properties. */
.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.3rem 1rem; margin: 0.3rem 0 0.2rem; }
.kv-pair { display: flex; align-items: baseline; gap: 0.5rem; min-width: 0; }
.kv-pair .kv-key { flex: 0 0 auto; }
.kv-pair .kv-val { font-size: 13px; background: none; padding: 0; overflow-wrap: anywhere; }
/* Long free-text props (e.g. schemaDescription) stack full-width so a paragraph
   doesn't distort the grid. */
.kv-pair-wide { display: flex; flex-direction: column; align-items: stretch; gap: 0.15rem; margin: 0.3rem 0 0.1rem; }
.kv-pair-wide .kv-val { line-height: 1.45; white-space: pre-wrap; }
/* Long identifiers (e.g. tableName) are one unbroken token — break on word
   boundaries first (underscores count as breakable via overflow-wrap) so they
   wrap in place rather than stretching the card or spilling past it. */
.kv-pair-wide .kv-val-mono { font-size: 12.5px; word-break: break-word; }

/* Monospace inline cell (field names, examples) inside data tables. */
.mono-cell { font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; overflow-wrap: anywhere; }

/* ── Live extract monitor (polls until a terminal status) ────────────────── */
.small { font-size: 12px; }
.monitor-box {
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 0.7rem 0.9rem;
  margin-top: 0.5rem;
  background: hsl(var(--muted) / 0.35);
}
.monitor-head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.monitor-head .btn-sm { margin-left: auto; }
.monitor-meta { margin-top: 0.5rem; }
.monitor-msg { margin-top: 0.25rem; overflow-wrap: anywhere; }

/* Assume Role — view-only simulation banner (feature plan 19). */
.assume-banner {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 1rem;
  background: hsl(var(--warning) / 0.16);
  border-bottom: 1px solid hsl(var(--warning) / 0.55);
  color: hsl(var(--foreground));
  font-size: 0.9rem;
}
.assume-banner .assume-dot { color: hsl(var(--warning)); animation: assume-pulse 2s ease-in-out infinite; }
.assume-banner .spacer { flex: 1; }
@keyframes assume-pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
/* Tint the whole app while simulating so it's unmistakable. */
.app-assuming .main { box-shadow: inset 0 0 0 2px hsl(var(--warning) / 0.30); }

/* ── Roles & Permissions reference — the permission matrix (feature plan 19) ── */
.pm-list { margin: 0.2rem 0 0; padding-left: 1.1rem; }
.pm-list li { margin: 0.35rem 0; line-height: 1.5; }
.pm-wrap { margin-top: 0.4rem; }
.perm-matrix { border-collapse: collapse; font-size: 13px; min-width: 640px; }
.perm-matrix th, .perm-matrix td { border-bottom: 1px solid hsl(var(--border)); padding: 0.45rem 0.6rem; vertical-align: middle; }
.perm-matrix thead th { position: sticky; top: 0; background: hsl(var(--muted)); z-index: 2; }
/* Sticky permission (first) column so role columns scroll under it. */
.pm-permcol { position: sticky; left: 0; background: hsl(var(--card)); text-align: left; min-width: 230px; z-index: 1; }
.perm-matrix thead .pm-permcol { z-index: 3; background: hsl(var(--muted)); }
.pm-permkey { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; display: block; color: hsl(var(--foreground)); }
.pm-permdesc { display: block; font-size: 11px; color: hsl(var(--muted-foreground)); margin-top: 0.1rem; line-height: 1.35; font-weight: 400; }
.pm-rolecol { text-align: center; min-width: 92px; }
.pm-rolelabel { font-weight: 600; font-size: 12px; }
.pm-rolekey { font-size: 10.5px; color: hsl(var(--muted-foreground)); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.pm-super { background: hsl(var(--brand) / 0.10); }
.pm-group th { background: hsl(var(--secondary)); text-transform: uppercase; letter-spacing: 0.05em; font-size: 11px; color: hsl(var(--muted-foreground)); text-align: left; padding: 0.4rem 0.6rem; }
.pm-cell { text-align: center; font-size: 15px; }
.pm-yes { color: hsl(var(--success)); font-weight: 700; }
.pm-no { color: hsl(var(--muted-foreground)); opacity: 0.5; }
.pm-flag { color: hsl(var(--warning)); font-weight: 700; }
.pm-footer { margin-top: 1.2rem; padding-top: 0.8rem; border-top: 1px solid hsl(var(--border)); }

/* Assume Role — the live "what this role gets" breakdown. */
.ar-breakdown { margin-top: 0.8rem; padding: 0.7rem 0.8rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--muted) / 0.4); }
.ar-bd-head { display: flex; align-items: baseline; gap: 0.5rem; }
.ar-bd-perms { display: flex; flex-direction: column; gap: 0.2rem; margin: 0.5rem 0; }
.ar-bd-perm { font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.ar-bd-facts { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 0.4rem; }

/* Operator access — current-access rows (feature plan 19 rework). */
.oa-current { display: flex; flex-direction: column; gap: 0.4rem; }
.oa-grant { display: flex; align-items: flex-start; gap: 0.6rem; padding: 0.5rem 0.6rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius); }
.oa-grant .oa-details { flex: 1; min-width: 0; }
.oa-details > summary { cursor: pointer; list-style: revert; }
.oa-details .ar-breakdown { margin-top: 0.5rem; }
.oa-remove { flex: 0 0 auto; color: hsl(var(--destructive)); }

/* ── Access Editor (feature plan 20) — guided role×sites assignment ── */
.ae-current { margin-top: 4px; }
.ae-grant { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 11px 13px; margin-bottom: 9px; }
.ae-grant-top { display: flex; align-items: center; gap: 10px; }
.ae-role { font-weight: 650; display: inline-flex; align-items: baseline; gap: 8px; }
.ae-rolekey { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; font-weight: 500; color: hsl(var(--muted-foreground)); }
.ae-spacer { flex: 1; }
.ae-remove { color: hsl(var(--destructive)); }
.ae-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ae-chip { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid hsl(var(--border)); background: hsl(var(--muted)); }
.ae-chip.site::before { content: "📍 "; font-size: 10px; }
.ae-chip.ent { background: hsl(var(--brand) / 0.14); border-color: transparent; color: hsl(var(--brand)); }
.ae-does { margin-top: 7px; font-size: 12.5px; color: hsl(var(--muted-foreground)); }
.ae-sitegrid { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 12px; }
.ae-sitebtn { border: 1px solid hsl(var(--border)); background: hsl(var(--card)); color: hsl(var(--foreground)); border-radius: 999px; padding: 6px 13px; cursor: pointer; font: inherit; }
.ae-sitebtn.on { background: hsl(var(--brand)); border-color: hsl(var(--brand)); color: #fff; }
.ae-preview { background: hsl(var(--success) / 0.12); border-radius: var(--radius); padding: 11px 13px; margin: 10px 0 4px; }
.ae-eyebrow { text-transform: uppercase; letter-spacing: 0.06em; font-size: 11px; font-weight: 600; color: hsl(var(--success)); }
.ae-pending { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.ae-pline { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.ae-pline .ae-mark { font-weight: 700; width: 14px; text-align: center; }
.ae-pline.add .ae-mark { color: hsl(var(--success)); }
.ae-pline.remove .ae-mark { color: hsl(var(--destructive)); }
.ae-advanced { margin-top: 16px; border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 10px 14px; }
.ae-advanced > summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.ae-advanced[open] > summary { margin-bottom: 8px; }

/* Access Editor — add/find tabs, staged removals, danger action (feature plan 20) */
.ae-tabs { display: inline-flex; background: hsl(var(--muted)); border: 1px solid hsl(var(--border)); border-radius: 9px; padding: 3px; gap: 3px; margin-bottom: 12px; }
.ae-tab { border: 0; background: transparent; color: hsl(var(--muted-foreground)); font: inherit; font-weight: 600; padding: 6px 13px; border-radius: 7px; cursor: pointer; }
.ae-tab.on { background: hsl(var(--card)); color: hsl(var(--foreground)); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.ae-grant.ae-staged { opacity: .55; border-style: dashed; }
.ae-danger { color: hsl(var(--destructive)); margin-left: auto; }

/* Assume Role — larger, resizable grants box (feature plan 19). */
.ae-grantbox { width: 100%; min-height: 150px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; line-height: 1.5; }

/* Filterable combobox (searchSelect) — enterprise/role pickers (Users & Access redesign). */
.searchselect { position: relative; }
.searchselect-input { width: 100%; }
.searchselect-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 60;
  max-height: 220px; overflow-y: auto; background: hsl(var(--card)); border: 1px solid hsl(var(--border));
  border-radius: var(--radius); box-shadow: 0 6px 18px rgba(0,0,0,.14); }
.searchselect-menu.open { display: block; }
.searchselect-option { padding: 7px 11px; font-size: 13.5px; cursor: pointer; }
.searchselect-option.hi, .searchselect-option:hover { background: hsl(var(--muted)); }
.searchselect-option.muted { color: hsl(var(--muted-foreground)); cursor: default; }

/* Grant card list — Customer grants / Operator access (Users & Access redesign).
   One enterprise/grant per row (full width), not a multi-column grid. */
.grant-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.grant-card { border: 1px solid hsl(var(--border)); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.grant-card-head { display: flex; align-items: center; gap: 8px; }
.grant-card-title { font-weight: 650; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.grant-card-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.grant-card-add { display: flex; align-items: center; justify-content: center; min-height: 96px; border: 1px dashed hsl(var(--border));
  border-radius: var(--radius); background: transparent; color: hsl(var(--muted-foreground)); cursor: pointer; font: inherit; }
.grant-card-add:hover { border-color: hsl(var(--brand)); color: hsl(var(--brand)); }
.grant-card-add-icon { font-size: 28px; line-height: 1; }

/* ── Collapsible sidebar + embed mode (feature plan 21) ── */
/* Sidebar is a flex column so the spacer pushes the collapse control to the very
   bottom of the rail (not inline after the nav items). */
.sidebar { display: flex; flex-direction: column; }
.nav-collapse { display: flex; align-items: center; gap: 0.6rem; width: 100%; border: 0;
  background: transparent; color: hsl(var(--muted-foreground)); cursor: pointer; padding: 0.6rem 0.7rem;
  border-radius: 8px; font: inherit; margin-top: auto; border-top: 1px solid hsl(var(--border));
  border-radius: 0; }
.nav-collapse:hover { background: hsl(var(--accent)); color: hsl(var(--foreground)); }
/* Collapsed: icons only. Hide the text labels and shrink the rail. */
.app-collapsed .sidebar { width: 60px; padding: 1rem 0.5rem; }
.app-collapsed .nav-label,
.app-collapsed .nav-hint { display: none; }
.app-collapsed .nav-item,
.app-collapsed .nav-collapse { justify-content: center; gap: 0; padding-left: 0; padding-right: 0; }
.app-collapsed .nav-item .nav-icon { margin: 0; }
/* Embed mode (iframed in the portal): no top bar, seamless. */
.app-embed .header { display: none; }
.app-embed .body { height: 100vh; }
.app-no-sidebar .main { width: 100%; }
