/* Fonts are served by the portal itself (the CSP allows nothing else). Roboto: Apache 2.0; JetBrains Mono: OFL. */
@font-face { font-family: "Roboto"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/roboto-400.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/roboto-500.woff2") format("woff2"); }
@font-face { font-family: "Roboto"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/roboto-700.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/jetbrains-mono-400.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("fonts/jetbrains-mono-500.woff2") format("woff2"); }

/* Light: clean, Google Admin style. Dark: the "command center" look. Same layout either way. */
:root, :root[data-theme="light"] {
  color-scheme: light;
  --navy: #1b3a6b;
  --accent: #1a73e8;
  --accent-soft: #e8f0fe;
  --accent-text: #174ea6;
  --on-accent: #ffffff;
  --bg: #f8f9fa;
  --panel: #ffffff;
  --panel-2: #f1f3f4;
  --border: #dadce0;
  --border-soft: #eceff1;
  --text: #202124;
  --muted: #5f6368;
  --side-bg: #ffffff;
  --side-text: #202124;
  --side-active: #174ea6;
  --hover: #f1f3f4;
  --shadow: 0 1px 2px rgba(60, 64, 67, 0.15), 0 1px 3px 1px rgba(60, 64, 67, 0.08);
  --ok-bg: #e6f4ea; --ok: #188038;
  --bad-bg: #fce8e6; --bad: #c5221f;
  --warn-bg: #fef7e0; --warn: #b06000;
  --info-bg: #e8f0fe; --info: #174ea6;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #7aa7ff;
  --accent-soft: rgba(122, 167, 255, 0.14);
  --accent-text: #a9c7ff;
  --on-accent: #0b0f17;
  --bg: #0b0f17;
  --panel: #111723;
  --panel-2: #161d2b;
  --border: #222b3b;
  --border-soft: #1a2232;
  --text: #e6eaf2;
  --muted: #8b95a8;
  --side-bg: #0e131d;
  --side-text: #c9d2e3;
  --side-active: #a9c7ff;
  --hover: #182032;
  --shadow: 0 0 0 1px var(--border);
  --ok-bg: rgba(74, 222, 128, 0.12); --ok: #4ade80;
  --bad-bg: rgba(248, 113, 113, 0.13); --bad: #f87171;
  --warn-bg: rgba(251, 191, 36, 0.12); --warn: #fbbf24;
  --info-bg: rgba(122, 167, 255, 0.14); --info: #a9c7ff;
}

/* Before the theme script runs (or with scripts off), follow the computer's setting. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --accent: #7aa7ff; --accent-soft: rgba(122, 167, 255, 0.14); --accent-text: #a9c7ff; --on-accent: #0b0f17;
    --bg: #0b0f17; --panel: #111723; --panel-2: #161d2b; --border: #222b3b; --border-soft: #1a2232;
    --text: #e6eaf2; --muted: #8b95a8; --side-bg: #0e131d; --side-text: #c9d2e3; --side-active: #a9c7ff; --hover: #182032;
    --shadow: 0 0 0 1px #222b3b;
    --ok-bg: rgba(74, 222, 128, 0.12); --ok: #4ade80; --bad-bg: rgba(248, 113, 113, 0.13); --bad: #f87171;
    --warn-bg: rgba(251, 191, 36, 0.12); --warn: #fbbf24; --info-bg: rgba(122, 167, 255, 0.14); --info: #a9c7ff;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14.5px;
  -webkit-font-smoothing: antialiased;
}
.mono, code { font-family: var(--mono); font-size: 0.86em; }
.kbd { display: inline-block; font: 500 0.72rem var(--mono); border: 1px solid var(--border); border-bottom-width: 2px;
  border-radius: 6px; padding: 0 6px; color: var(--muted); background: var(--panel); line-height: 1.6; }

a { color: var(--accent); }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  background: var(--side-bg);
  color: var(--side-text);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 12px;
  font-weight: 500;
  font-size: 0.98rem;
  color: var(--text);
  text-decoration: none;
}
.sidebar .brand small { display: block; font-weight: 400; font-size: 0.74rem; color: var(--muted); }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--navy); color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 0.8rem; flex: none; }
:root[data-theme="dark"] .brand-mark { box-shadow: 0 0 18px rgba(122, 167, 255, 0.35); }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 12px 14px 4px; }
.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--side-text);
  text-decoration: none;
}
.sidebar nav a svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sidebar nav a:hover { background: var(--hover); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--side-active); font-weight: 500; }
.sidebar nav a.active svg { stroke: var(--side-active); }
.nav-count { margin-left: auto; font-size: 0.7rem; padding: 0 8px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-weight: 500; }
.side-foot { margin-top: auto; padding: 14px 14px 4px; font-size: 0.76rem; color: var(--muted); }

.workspace { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  min-height: 60px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 24px;
  background: var(--bg);
  flex-wrap: wrap;
}
.topbar .spacer { flex: 1; }
.topbar form { margin: 0; display: flex; align-items: center; gap: 8px; }
.topbar label { color: var(--muted); font-size: 0.85rem; }
.topbar .who { color: var(--muted); font-size: 0.9rem; display: inline-flex; align-items: center; gap: 6px; }
.crumb { color: var(--muted); font-size: 0.86rem; white-space: nowrap; }
.crumb b { color: var(--text); font-weight: 500; }
.search-pill { flex: 1 1 280px; max-width: 560px; display: flex; align-items: center; gap: 10px; background: var(--panel-2);
  border: 1px solid transparent; border-radius: 999px; padding: 8px 16px; color: var(--muted); cursor: text; font: inherit; text-align: left; }
.search-pill:hover { border-color: var(--border); }
.search-pill svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; flex: none; }
.search-pill .kbd { margin-left: auto; }
.topbar select#tenant-select { border-radius: 8px; background: var(--panel); }
.avatar-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-weight: 500; }
details.menu > summary.avatar-btn { list-style: none; }

.content { padding: 6px 28px 60px; min-width: 0; }

.plain-main { max-width: 440px; margin: 12vh auto 0; padding: 0 20px; }

/* ---------- type ---------- */
h1 { margin: 0 0 4px; font-size: 1.6rem; font-weight: 400; }
h2 { margin: 0 0 12px; font-size: 1rem; font-weight: 500; color: var(--text); }
h2.spaced { margin-top: 20px; }
.muted { color: var(--muted); }
.crumbs { color: var(--muted); font-size: 0.88rem; margin: 0 0 14px; }
.errtext { color: var(--bad); }

/* ---------- controls ---------- */
.btn {
  background: var(--accent);
  color: var(--on-accent);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  font-family: inherit;
}
.btn:hover { filter: brightness(1.08); }
.btn.small { padding: 6px 14px; font-size: 0.85rem; }
.btn.ghost { background: transparent; color: var(--accent-text); border-color: var(--border); }
.btn.ghost:hover { background: var(--hover); filter: none; }

input[type="search"], input[type="text"], select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
  background: var(--panel);
  color: var(--text);
  font-family: inherit;
}
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
input[type="search"] { width: 280px; max-width: 100%; }
select { cursor: pointer; }

/* ---------- cards / grids ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 18px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  min-width: 0;
  box-shadow: var(--shadow);
}
.card.error { background: var(--bad-bg); border-color: var(--bad); }
.card.flag { background: var(--warn-bg); border-color: var(--warn); color: var(--warn); }
.card.flag p { margin: 0 0 4px; }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
th { color: var(--muted); font-weight: 500; width: 38%; }
table.list th { width: auto; }

.users-card { padding: 0; overflow: hidden; }
.users-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; padding: 18px 20px 6px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; align-items: center; padding: 10px 20px 14px; flex-wrap: wrap; }
.toolbar form { margin: 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.syncline { padding: 0 20px 12px; color: var(--muted); font-size: 0.82rem; display: flex; gap: 16px; flex-wrap: wrap; }

.table-wrap { overflow: auto; max-height: calc(100vh - 330px); min-height: 160px; border-top: 1px solid var(--border); }
table.data { font-size: 0.9rem; }
table.data th { width: auto; position: sticky; top: 0; background: var(--panel); z-index: 1; white-space: nowrap; border-bottom: 1px solid var(--border);
  font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.04em; }
table.data td { padding: 11px 14px; }
table.data tbody tr.kb-row td { background: var(--accent-soft); }
table.data th a { color: var(--muted); text-decoration: none; }
table.data th a:hover, table.data th a.sorted { color: var(--text); }
table.data td { vertical-align: middle; }
table.data tbody tr:hover { background: var(--hover); }
td.num { color: var(--muted); }

.pager { display: flex; align-items: center; justify-content: flex-end; gap: 14px; padding: 10px 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.88rem; flex-wrap: wrap; }
.pager a.btn { padding: 4px 10px; }
.pager .off { opacity: 0.4; pointer-events: none; }

/* ---------- dropdown menus (no JavaScript) ---------- */
details.menu { position: relative; display: inline-block; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute;
  right: 0;
  z-index: 20;
  min-width: 210px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}
.menu-panel a, .menu-panel label { display: block; padding: 7px 10px; border-radius: 6px; color: var(--text); text-decoration: none; font-size: 0.9rem; cursor: pointer; }
.menu-panel a:hover, .menu-panel label:hover { background: var(--hover); }
.menu-panel .sep { height: 1px; background: var(--border); margin: 4px 0; }
.row-menu summary { padding: 2px 10px; border-radius: 6px; color: var(--muted); }
.row-menu summary:hover { background: var(--hover); color: var(--text); }

/* ---------- badges ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 0.76rem; font-weight: 500; vertical-align: middle; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.bad { background: var(--bad-bg); color: var(--bad); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.info { background: var(--info-bg); color: var(--info); }
.tick { color: var(--ok); font-weight: 700; }

.notice { background: var(--info-bg); color: var(--info); border-radius: 12px; padding: 10px 14px; margin-bottom: 14px; font-size: 0.9rem; }

ul.plain { margin: 0; padding-left: 18px; }
ul.plain li { margin: 2px 0; }

/* ---------- login ---------- */
.login-card { text-align: center; padding: 32px; }
.login-card .btn { width: 100%; margin-top: 10px; padding: 12px; }
.login-card form { margin: 0; }

.head-actions { display: flex; gap: 10px; align-items: flex-start; }

/* ---------- user page: header chips, tabs, edit form ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; align-items: center; }
.chip {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  color: var(--accent);
  font-size: 0.85rem;
  text-decoration: none;
}
.chip.muted-chip { color: var(--muted); border-color: var(--border); font-family: Consolas, monospace; font-size: 0.8rem; }
.chip.plain-chip { border-color: transparent; color: var(--muted); padding-left: 2px; }
a.chip.plain-chip:hover { color: var(--accent); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 6px 0 20px; flex-wrap: wrap; }
.tabs a {
  padding: 10px 16px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  font-weight: 500;
}
.tabs a:hover { color: var(--text); background: var(--hover); border-radius: 8px 8px 0 0; }
.tabs a.active { color: var(--accent-text); border-bottom-color: var(--accent); }

.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.card-head h2 { margin: 0; }
.link-btn {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.82rem;
  margin-left: 6px;
}
.link-btn:hover { background: var(--hover); }
td.right { text-align: right; white-space: nowrap; }
.spaced-block { margin-top: 18px; }

.wide-form { max-width: 860px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.field.span-2 { grid-column: span 2; }
@media (max-width: 700px) { .field-grid { grid-template-columns: 1fr; } .field.span-2 { grid-column: auto; } }

/* ---------- action forms ---------- */
.form-card { max-width: 640px; }
.field { display: block; margin-bottom: 14px; }
.field span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 0.88rem; }
.field input[type="text"], .field select { width: 100%; }
.form-actions { display: flex; gap: 10px; margin: 18px 0 8px; flex-wrap: wrap; }
.warn-notice { background: var(--warn-bg); color: var(--warn); margin-top: 12px; }
.menu-note { display: block; padding: 8px 10px; color: var(--muted); font-size: 0.85rem; }

/* ---------- dashboard ---------- */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 20px; }
.tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 18px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow);
}
.tile:hover { border-color: var(--accent); }
.tile-label { color: var(--muted); font-size: 0.85rem; }
.tile-num { font-size: 1.9rem; font-weight: 400; line-height: 1.1; }
.tile-warn .tile-num { color: var(--warn); }

/* ---------- Ask AI dock ---------- */
.ai-btn { background: linear-gradient(90deg, #4b5fd6, #8a5cf0); }
.ai-dock {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.18s ease;
  z-index: 50;
}
html.ai-open .ai-dock { transform: none; }
html.ai-open .shell { padding-right: 380px; }
.ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  color: #fff;
  font-weight: 600;
  background: linear-gradient(90deg, #4b5fd6, #8a5cf0);
}
.ai-x { background: transparent; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; line-height: 1; }
.ai-body { flex: 1; overflow: auto; padding: 16px; }
.ai-msg { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; font-size: 0.9rem; }
.ai-msg p { margin: 8px 0 0; color: var(--muted); }
.ai-input { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.ai-input input { flex: 1; }

@media (max-width: 1100px) {
  html.ai-open .shell { padding-right: 0; }
}

/* ---------- column chooser ---------- */
.hide-org .c-org, .hide-aliases .c-aliases, .hide-login .c-login,
.hide-twosv .c-twosv, .hide-admin .c-admin, .hide-related .c-related { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { padding: 0 10px 0 0; }
  .sidebar .brand small, .sidebar .brand .brand-text, .nav-group, .side-foot { display: none; }
  .sidebar nav { flex-direction: row; }
  .sidebar nav a { padding: 8px 12px; white-space: nowrap; }
  .topbar { padding: 8px 16px; }
  .content { padding: 6px 16px 48px; }
  .crumb { display: none; }
}

/* One-time secret (new password or backup codes) */
.secret-box { border: 1px solid var(--warn); background: var(--warn-bg); border-radius: 8px; padding: 12px 14px; margin: 12px 0; }
.secret-box h2 { margin-top: 0; }
.secret { display: inline-block; font-family: Consolas, monospace; font-size: 1.05rem; padding: 4px 10px; margin: 0 8px 8px 0; background: var(--bg, #fff); color: var(--text); border-radius: 6px; user-select: all; }

/* Email page */
.inline-form { display: flex; gap: 10px; margin: 6px 0 12px; flex-wrap: wrap; }
.inline-form input[type="search"] { flex: 1; width: auto; min-width: 200px; }
.card:not(.users-card) .syncline { padding: 2px 0 12px; }

/* Multi-step plans and results (offboarding) */
ol.steps { padding-left: 22px; margin: 8px 0 14px; }
ol.steps > li { margin-bottom: 10px; }
ol.steps ul.plain { margin: 4px 0 0; }

/* Inline edit: fields read as plain text until the card's Edit button is clicked */
.inline-edit fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.inline-edit fieldset[disabled] input { border-color: transparent; background: transparent; padding-left: 0; color: var(--text); cursor: default; }
.inline-edit fieldset[disabled] input::placeholder { color: var(--muted); }
.inline-edit .edit-actions { display: none; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.inline-edit.editing .edit-actions { display: flex; }
.small-text { font-size: 0.78rem; word-break: break-all; }
.tile.tile-active { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
table.spaced { margin-top: 14px; }
button.link-btn { background: transparent; font-family: inherit; cursor: pointer; }
button.link-btn:hover { background: var(--hover); }

/* Text areas, date fields, read-only signature view */
textarea, input[type="date"] {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; font: inherit; font-size: 0.92rem;
}
.field textarea { width: 100%; resize: vertical; }
.sig-preview { width: 100%; min-height: 120px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.sig-preview.empty { display: flex; align-items: center; justify-content: center; background: transparent; }
.inline-edit fieldset[disabled] textarea { border-color: transparent; background: transparent; padding-left: 0; color: var(--text); resize: none; }
.inline-edit fieldset[disabled] select { border-color: transparent; background: transparent; padding-left: 0; color: var(--text); appearance: none; }
.sendas { padding: 10px 0; border-bottom: 1px solid var(--border); }
.sendas:last-child { border-bottom: 0; }
.sendas-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.sendas-head .grow { flex: 1; }
.btn.danger { background: var(--bad-bg); color: var(--bad); border: 1px solid var(--bad); }

/* Clients and the add-a-client wizard */
.wizard { display: flex; flex-direction: column; gap: 18px; max-width: 900px; }
.step-no { display: inline-flex; align-items: center; justify-content: center; width: 1.6em; height: 1.6em; border-radius: 50%;
  background: var(--info-bg); color: var(--info); font-size: 0.85em; margin-right: 6px; }
.plain-ol { padding-left: 20px; display: flex; flex-direction: column; gap: 10px; }
.scope-line { white-space: pre-wrap; word-break: break-all; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 10px; font-size: 0.78rem; margin: 6px 0 0; }
code.copyable { user-select: all; }
.checks-table td:first-child { width: 70px; }
.btn.ok-btn { background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok); }
form.inline { display: inline; }
.big-input { font-size: 1.05rem !important; padding: 11px 13px !important; width: 100%; max-width: 480px; }
.summary-line { margin: 4px 0 6px; }
.big-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin: 6px 0 14px; }
details.more { margin-top: 10px; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 0.9rem; }
details.more[open] summary { margin-bottom: 8px; }
pre.message { white-space: pre-wrap; background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px;
  font-family: inherit; font-size: 0.85rem; margin: 0 0 8px; max-height: 320px; overflow: auto; word-break: break-word; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }
.setup-box { border-top: 1px solid var(--border); margin-top: 14px; padding-top: 12px; }
.setup-box h3 { margin: 0 0 4px; font-size: 1rem; }
.setup-form .field input { max-width: 420px; }
.setup-plan { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 8px 0; }
.priv-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.priv-list code { font-size: 0.75rem; background: var(--panel); border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; }
.intro-card p + p { margin-top: 6px; }
.menu-panel.wide-panel { width: 300px; padding: 10px; }
.menu-panel.wide-panel form { margin-top: 6px; }
.welcome-box { margin: 12px 0; }
.welcome-box h2 { margin: 0 0 6px; }
.nowrap { white-space: nowrap; }
.plain-toolbar { padding: 0 0 12px; }
.report-body { padding: 12px 20px 16px; }
.report-body .table-wrap { border-top: 0; }

/* Licenses page */
.row-line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.row-line:last-child { border-bottom: 0; }
details.card > summary { cursor: pointer; padding: 2px 0; }
details.card[open] > summary { margin-bottom: 10px; }
.right { text-align: right; }
.digest-text { white-space: pre-wrap; font-family: inherit; font-size: 0.92rem; line-height: 1.55; margin: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; vertical-align: middle; margin-right: 10px; }
/* Org unit tree: indentation by depth (no inline styles: the CSP forbids them). */
.ou-depth-1 { padding-left: 34px !important; }
.ou-depth-2 { padding-left: 56px !important; }
.ou-depth-3 { padding-left: 78px !important; }
.ou-depth-4 { padding-left: 100px !important; }
.ou-depth-5, .ou-depth-6 { padding-left: 122px !important; }
.report-body h2 + .table-wrap { margin-bottom: 22px; }

/* Something slow is running: an indeterminate bar with what's happening and how long it has taken. */
.progress { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.progress[hidden] { display: none; }
.progress-bar { position: relative; height: 6px; border-radius: 3px; overflow: hidden; background: var(--border); }
.progress-bar::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 35%; border-radius: 3px; background: var(--accent);
  animation: progress-slide 1.3s ease-in-out infinite;
}
@keyframes progress-slide { from { left: -35%; } to { left: 100%; } }
@media (prefers-reduced-motion: reduce) { .progress-bar::after { animation: none; left: 0; width: 100%; opacity: 0.5; } }
.btn.busy { opacity: 0.75; cursor: progress; }

/* Diagnostic findings (Email page): one line each, problems first by the badge. */
.findings { list-style: none; padding: 0; margin: 8px 0; display: grid; gap: 6px; }
.findings .badge { margin-right: 6px; }
textarea.mono { width: 100%; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 0.82rem; }
tr.row-warn td { background: rgba(214, 140, 0, 0.12); }

/* Drive investigation search: fields side by side on wide screens, stacked on phones. */
.drive-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; align-items: end; }
.drive-form .form-actions { margin: 0; }

/* Add a client: where the tech is, and what they do next. */
.stepper { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 0 0 12px; counter-reset: step; }
.stepper li { counter-increment: step; color: var(--muted); font-size: 0.9rem; }
.stepper li::before { content: counter(step); display: inline-grid; place-items: center; width: 1.5em; height: 1.5em;
  margin-right: 6px; border-radius: 50%; border: 1px solid var(--border); font-size: 0.8rem; }
.stepper li.done { color: var(--text); }
.stepper li.done::before { content: "\2713"; background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.stepper li.current { color: var(--accent); font-weight: 600; }
.stepper li.current::before { border-color: var(--accent); }
.next-step[hidden] { display: none; }

/* The tech's portal role, and the "View as" preview. */
.role-badge { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 10px; font-size: 0.78rem;
  border: 1px solid var(--border); color: var(--muted); }
.role-badge.role-operator { border-color: var(--accent); color: var(--accent); }
.view-as { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; }
.view-as select { font-size: 0.85rem; padding: 3px 6px; }
.view-as-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }

/* Audit log filters and row details. */
.audit-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px 14px; align-items: end; }
.audit-filters .form-actions { margin: 0; }
.audit-detail summary { cursor: pointer; font-size: 0.82rem; }
.audit-detail code { display: block; white-space: pre-wrap; word-break: break-word; font-size: 0.78rem; margin-top: 4px; }
.via-tech { font-size: 0.8rem; color: var(--accent); }
.check-line { display: flex; align-items: center; gap: 8px; margin: 8px 0; font-size: 0.9rem; }

/* ---------- redesign: stat strip, segmented filters, theme switch, command palette ---------- */
.stat-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.stat-strip a, .stat-strip > div { display: block; padding: 14px 18px; border-left: 1px solid var(--border-soft); color: var(--text); text-decoration: none; }
.stat-strip > :first-child { border-left: 0; }
.stat-strip a:hover { background: var(--hover); }
.stat-strip a.on { background: var(--accent-soft); }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 0.84rem; }
.stat-num { font-size: 1.8rem; line-height: 1.2; margin-top: 2px; }
.stat-hint { font-size: 0.76rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--muted); }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.bad { background: var(--bad); } .dot.info { background: var(--accent); }
@media (max-width: 860px) {
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-strip > :nth-child(3) { border-left: 0; }
  .stat-strip > :nth-child(n+3) { border-top: 1px solid var(--border-soft); }
}

.seg { display: inline-flex; background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 3px; overflow-x: auto; max-width: 100%; }
.seg a { padding: 5px 14px; border-radius: 999px; white-space: nowrap; font-size: 0.85rem; color: var(--muted); text-decoration: none; }
.seg a b { font-weight: 500; margin-left: 6px; color: var(--text); }
.seg a:hover { background: var(--hover); }
.seg a.on { background: var(--accent-soft); color: var(--accent-text); }
.kb-hint { display: flex; justify-content: flex-end; gap: 14px; flex-wrap: wrap; padding: 8px 16px; color: var(--muted); font-size: 0.76rem; border-top: 1px solid var(--border-soft); }

.theme-switch { display: inline-flex; border: 1px solid var(--border); border-radius: 999px; padding: 2px; background: var(--panel); }
.theme-switch button { border: 0; background: transparent; color: var(--muted); padding: 4px 10px; border-radius: 999px; font: inherit; font-size: 0.8rem; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent-text); }

.palette-backdrop { position: fixed; inset: 0; background: rgba(15, 20, 30, 0.45); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 16px; }
.palette-backdrop[hidden] { display: none; }
.palette { width: 100%; max-width: 640px; background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28); overflow: hidden; }
.palette-q { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.palette-q svg { width: 18px; height: 18px; stroke: var(--muted); fill: none; stroke-width: 2; flex: none; }
.palette-q input { flex: 1; border: 0; background: transparent; font-size: 1rem; padding: 4px 0; width: auto; }
.palette-q input:focus-visible { outline: none; }
.palette-list { max-height: 55vh; overflow-y: auto; padding: 4px 0 8px; }
.palette-sec { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); padding: 10px 16px 4px; }
.palette-item { display: flex; align-items: center; gap: 12px; padding: 9px 16px; color: var(--text); text-decoration: none; }
.palette-item .sub { color: var(--muted); font-size: 0.82rem; }
.palette-item .tag { margin-left: auto; font-size: 0.72rem; color: var(--muted); }
.palette-item.on, .palette-item:hover { background: var(--accent-soft); }
.palette-empty { padding: 14px 16px; color: var(--muted); }
.palette-foot { display: flex; gap: 14px; padding: 8px 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.74rem; }

.login-card { border-radius: 20px; }
.login-card .brand-mark { margin: 0 auto 12px; width: 44px; height: 44px; border-radius: 12px; font-size: 1rem; }
.chip { border-radius: 8px; border-color: var(--border); color: var(--accent-text); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.ai-btn { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
@media (max-width: 1100px) { .theme-switch button { padding: 4px 8px; } .search-pill span:not(.kbd) { display: none; } .search-pill { flex: 0 0 auto; } }
.stat-strip .stat-label, .stat-strip .stat-num, .stat-strip .stat-hint { display: flex; }
.stat-strip .stat-num, .stat-strip .stat-hint { display: block; }
.search-pill .kbd, .kbd { white-space: nowrap; }
a.mono { text-decoration: none; }
a.mono:hover { text-decoration: underline; }
.account-menu .menu-panel { display: flex; flex-direction: column; gap: 10px; }
.account-who { display: flex; flex-direction: column; gap: 2px; padding: 2px 4px; }
.account-menu .view-as { display: flex; justify-content: space-between; }
.topbar { flex-wrap: nowrap; }
.topbar .crumb { flex: none; }
.topbar #tenant-select { max-width: 240px; }
@media (max-width: 1250px) { .topbar .crumb { display: none; } }
@media (max-width: 1000px) { .topbar { flex-wrap: wrap; } .ai-btn { display: none; } }
table.list td { overflow-wrap: break-word; word-break: normal; }
.grid.wide { grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr)); }
.page-head { flex-wrap: wrap; }
.page-head > div { min-width: 0; }
@media (max-width: 860px) { .page-head .form-actions { margin: 4px 0 0; } .toolbar form { width: 100%; } .toolbar input[type="search"] { flex: 1; width: auto; } }
@media (max-width: 860px) { .shell { grid-template-columns: minmax(0, 1fr); } .sidebar { min-width: 0; } }

/* Describe a task side panel (reuses the right-hand dock). */
.ai-dock { width: 380px; box-shadow: -8px 0 30px rgba(0, 0, 0, 0.18); }
.ai-head { background: var(--panel); color: var(--text); border-bottom: 1px solid var(--border); }
.ai-x { color: var(--muted); }
.ai-body { display: flex; flex-direction: column; gap: 10px; }
#assist-input { width: 100%; resize: vertical; font-size: 0.95rem; border-radius: 12px; }
.assist-examples { display: flex; flex-wrap: wrap; gap: 6px; }
.assist-examples .chip { background: var(--panel); cursor: pointer; font: inherit; font-size: 0.8rem; }
.assist-results { display: flex; flex-direction: column; gap: 8px; }
.assist-understood { margin: 0; font-weight: 500; }
.assist-card { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 12px;
  color: var(--text); text-decoration: none; background: var(--panel); }
.assist-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.assist-card .tag { font-size: 0.72rem; color: var(--accent-text); }
.assist-card.small { padding: 8px 12px; }
.assist-note { font-size: 0.76rem; margin: 4px 0 0; }
details.ai-msg summary { cursor: pointer; }
@media (max-width: 860px) { .ai-dock { width: 100%; } .ai-btn { display: inline-block; } }
@media (max-width: 1000px) { .topbar .ai-btn { display: inline-block; } }

/* Top left: company logo (or the letter mark) and an always-visible sign out. */
.brand-logo { height: 30px; width: auto; max-width: 150px; object-fit: contain; flex: none; }
.side-account { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 4px 10px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--panel-2); }
.side-who { display: flex; flex-direction: column; gap: 3px; min-width: 0; font-size: 0.82rem; }
.side-who strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.side-who .role-badge { margin-left: 0; align-self: flex-start; }
.side-account form { margin: 0; }
.side-signout { padding: 4px 12px; }
@media (max-width: 860px) { .side-account { margin: 0 8px 0 0; padding: 4px 8px; flex: none; } .side-who { display: none; } }
.brand-logo { height: 34px; }
.logo-dark { display: none; }
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .logo-light { display: none; } :root:not([data-theme]) .logo-dark { display: block; } }
.login-logo { height: 64px; width: auto; margin: 0 auto 14px; }
:root[data-theme="dark"] .login-card .logo-dark { display: block; }
.feedback-text { white-space: pre-wrap; overflow-wrap: anywhere; min-width: 240px; }
.findings .btn, .findings .muted { margin-left: 8px; }
.assist-person { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); }
.assist-person-head { display: flex; flex-direction: column; gap: 2px; color: var(--text); text-decoration: none; }
.assist-person-head:hover strong { color: var(--accent-text); }
.assist-badges { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 0.8rem; }
.assist-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.assist-quick .chip { text-decoration: none; color: var(--text); background: var(--panel-2); border: 1px solid var(--border); font-size: 0.8rem; }
.assist-quick .chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.assist-quick .chip.risky { color: var(--bad); }
.assist-quick .chip.ghost { color: var(--accent-text); }
.role-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.role-form input[type="text"] { min-width: 180px; }
.plain-ol { padding-left: 20px; margin: 8px 0; display: grid; gap: 6px; }
.inline-menu { display: inline-block; }
tr.row-active td { background: var(--accent-soft); }
.baseline-check p { margin: 6px 0; }
