/* MySamriddhi Partners: design system.
   Plain CSS (no build step), server-rendered templates. Tokens first, then layout, then
   components. Every colour comes from a token so the palette can change in one place. */

:root {
  /* Surfaces (matched to mysamriddhi.com) */
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #e0e6eb;

  /* Text */
  --ink: #333333;
  --ink-2: #4a4a4a;
  --muted: #666666;
  --faint: #94a3b8;

  /* Lines */
  --line: #dae0e7;
  --line-strong: #c7cfd9;

  /* Brand: mysamriddhi green for actions, mysamriddhi navy for the sidebar, mysamriddhi gold accent */
  --primary: #1fb77d;
  --primary-hover: #189566;
  --primary-soft: #e4f7ef;
  --primary-ring: rgba(31, 183, 125, 0.22);
  --accent: #f5b800;
  --side-bg: #0d2f4f;
  --side-ink: #9fb3c8;
  --side-ink-strong: #ffffff;
  --side-line: rgba(255, 255, 255, 0.08);
  --side-hover: rgba(255, 255, 255, 0.06);
  --side-active: rgba(255, 255, 255, 0.12);

  /* Status tones */
  --success: #067647; --success-bg: #ecfdf3; --success-line: #abefc6;
  --warning: #b54708; --warning-bg: #fffaeb; --warning-line: #fedf89;
  --danger: #b42318;  --danger-bg: #fef3f2;  --danger-line: #fecdca;
  --info: #175cd3;    --info-bg: #eff8ff;    --info-line: #b2ddff;
  --neutral: #344054; --neutral-bg: #f2f4f7; --neutral-line: #e4e7ec;

  /* Shape and depth (mysamriddhi uses a .625rem/10px radius) */
  --radius-sm: 7px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-lg: 0 16px 40px -12px rgba(16, 24, 40, 0.22);

  /* Type (mysamriddhi's serif stack, no web font to load) */
  --font: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --sidebar-w: 264px;
  --topbar-h: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 14px/1.55 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { color: var(--ink); margin: 0 0 8px; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
h2 { font-size: 16px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0 0 12px; }
ul, ol { margin: 0 0 12px; padding-left: 20px; }
li + li { margin-top: 4px; }
a { color: var(--primary); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }
strong { font-weight: 600; }
code, pre, .mono { font-family: var(--mono); font-size: 12px; }
code { background: var(--surface-3); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; white-space: pre-wrap; word-break: break-word; color: var(--ink-2); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
img, svg { max-width: 100%; }
::selection { background: var(--primary-soft); }
.num, td, .stat-value { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }

.icon {
  width: 18px; height: 18px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -4px;
}
.icon-sm { width: 15px; height: 15px; vertical-align: -3px; }
.icon-lg { width: 22px; height: 22px; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ---------- Brand mark ---------- */
.logo { display: inline-flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.logo:hover { text-decoration: none; }
.logo-mark { width: 32px; height: 32px; flex: none; display: block; }
.logo-text { display: flex; flex-direction: column; line-height: 1.15; }
.logo-text b { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; }
.logo-text span { font-size: 11.5px; opacity: 0.7; }

/* ---------- App shell: sidebar + topbar ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(to right, var(--side-bg) var(--sidebar-w), var(--bg) var(--sidebar-w)); }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--side-bg); color: var(--side-ink);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--side-line);
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar-head { padding: 18px 18px 14px; display: flex; align-items: center; justify-content: space-between; }
.sidebar .logo { color: var(--side-ink-strong); }
.sidebar-close { display: none; }
.sidebar-env { margin: 0 18px 8px; font-size: 11px; color: var(--side-ink); border: 1px solid var(--side-line); border-radius: 999px; padding: 3px 10px; display: inline-flex; align-items: center; gap: 6px; width: max-content; }
.sidebar-env::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #3fb68b; }
.nav { padding: 6px 12px 16px; flex: 1; }
.nav-label { font-size: 12px; font-weight: 500; color: #7d8a9a; padding: 24px 10px 8px; }
.nav-label:first-child { padding-top: 12px; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; margin: 1px 0; border-radius: var(--radius);
  color: var(--side-ink); font-weight: 500; font-size: 13.5px; text-decoration: none;
  position: relative;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.nav a .icon { opacity: 0.85; }
.nav a:hover { background: var(--side-hover); color: var(--side-ink-strong); text-decoration: none; }
.nav a.active { background: var(--side-active); color: #fff; }
.nav a.active::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav a.active .icon { opacity: 1; }
.nav-tag { margin-left: auto; font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: rgba(255,255,255,.08); color: var(--side-ink); }
.sidebar-foot { border-top: 1px solid var(--side-line); padding: 16px 20px 20px; font-size: 12px; color: #7d8a9a; }
.sidebar-foot a { color: var(--side-ink); }
.side-meta span { color: #c4cdd8; }
.side-meta .mono { font-size: 12px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 32px;
  background: rgba(255, 255, 255, 0.86); backdrop-filter: saturate(160%) blur(10px); -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); min-width: 0; }
.crumbs b { color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.user-menu { position: relative; }
.user-menu > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 4px 8px 4px 4px; border-radius: 999px; border: 1px solid transparent; transition: background-color .15s, border-color .15s; }
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover, .user-menu[open] > summary { background: var(--surface-3); border-color: var(--line); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 600; font-size: 12.5px; flex: none; border: 1px solid #cfe5e1; }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; text-align: left; }
.user-meta b { font-size: 13px; font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { font-size: 11.5px; color: var(--muted); }
.menu-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 240px; z-index: 30;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  padding: 6px; animation: pop .14s var(--ease);
}
.menu-panel .menu-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.menu-panel .menu-head b { display: block; font-size: 13px; word-break: break-all; }
.menu-panel a { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-sm); color: var(--ink-2); font-size: 13.5px; }
.menu-panel a:hover { background: var(--surface-3); text-decoration: none; color: var(--ink); }

.content { width: 100%; max-width: 1240px; margin: 0 auto; padding: 32px 32px 64px; }
.content-narrow { max-width: 880px; }
.backdrop { display: none; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin-bottom: 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head p { margin: 0; color: var(--muted); max-width: 760px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { font-size: 13px; font-weight: 500; color: var(--primary); margin-bottom: 4px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.back-link:hover { color: var(--ink); text-decoration: none; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs); padding: 20px 22px; margin-bottom: 20px;
}
.card > :last-child { margin-bottom: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: -20px -22px 18px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { margin: 0; }
.card-head p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.card-flush { padding: 0; }
.card-flush > .card-head { margin: 0; }
.card-flush .table-wrap { border: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); box-shadow: none; margin: 0; }
.card-muted { background: var(--surface-2); box-shadow: none; }
.card-title-row { display: flex; align-items: center; gap: 10px; }
.icon-tile { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.icon-tile.warn { background: var(--warning-bg); color: var(--warning); }
.icon-tile.bad { background: var(--danger-bg); color: var(--danger); }
.icon-tile.ok { background: var(--success-bg); color: var(--success); }
.icon-tile.neutral { background: var(--surface-3); color: var(--ink-2); }

.grid { display: grid; gap: 20px; margin-bottom: 20px; }
.stack > .grid:last-child, .card .grid:last-child { margin-bottom: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 20px; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 28px 0 12px; }
.section-title h2 { margin: 0; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-xs); display: flex; flex-direction: column; gap: 8px; color: inherit; position: relative; transition: border-color .15s; }
a.stat:hover { text-decoration: none; border-color: var(--line-strong); }
.stat-top { display: flex; align-items: center; justify-content: space-between; }
.stat-label { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.stat-value { font-size: 28px; font-weight: 500; letter-spacing: -0.02em; line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat-value.text { font-size: 18px; }
.stat-meta { font-size: 12px; color: var(--muted); }
.stat .icon-tile, .stat .icon-tile.ok, .stat .icon-tile.warn, .stat .icon-tile.bad { width: 32px; height: 32px; border-radius: 8px; background: transparent; color: var(--muted); }

/* ---------- Bars (simple, data-driven) ---------- */
.bars { display: flex; flex-direction: column; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 150px minmax(0, 1fr) 110px; align-items: center; gap: 14px; font-size: 13px; }
.bar-row .bar-label { color: var(--ink-2); }
.bar-row .bar-value { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-track { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--primary); transform-origin: left; animation: grow .7s var(--ease) both; }
.bar-fill.soft { background: #7fb3ac; }
.bar-fill.warn { background: #f79009; }
.bar-fill.bad { background: #f04438; }
.bar-fill.neutral { background: #98a2b3; }

.split-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--surface-3); gap: 2px; }
.split-bar span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: 1px; }

/* ---------- Tables ---------- */
.table-wrap { width: 100%; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; background: transparent; font-size: 13.5px; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); white-space: nowrap; letter-spacing: 0.01em; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color .12s; }
tbody tr:hover { background: #fafbfc; }
td.muted, td .muted { font-size: 12.5px; }
td.actions { text-align: right; white-space: nowrap; }
td.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.card table th { background: var(--surface-2); }
.card > table, .card > .table-wrap { margin: 0; }
.cell-title { font-weight: 600; color: var(--ink); }
.cell-sub { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
table.kv th { width: 34%; background: transparent; font-size: 13px; color: var(--muted); font-weight: 500; white-space: normal; }
table.kv td, table.kv th { padding: 10px 0; }

/* ---------- Description list ---------- */
.dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; margin: 0; }
.dl div { min-width: 0; }
.dl dt { font-size: 12px; font-weight: 500; color: var(--muted); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.dl dd { margin: 0; font-weight: 500; color: var(--ink); word-break: break-word; }
.dl .full { grid-column: 1 / -1; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; line-height: 18px;
  background: var(--neutral-bg); color: var(--neutral); border: 1px solid var(--neutral-line);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.8; }
.badge.plain::before { display: none; }
.badge.success { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.badge.warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning-line); }
.badge.danger { background: var(--danger-bg); color: var(--danger); border-color: var(--danger-line); }
.badge.info { background: var(--info-bg); color: var(--info); border-color: var(--info-line); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--line); font-size: 12px; font-weight: 500; color: var(--ink-2); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Alerts and flash messages ---------- */
.messages { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 10px; }
.messages li, .alert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--info-line); background: var(--info-bg); color: #1849a9; font-size: 13.5px;
  animation: rise .3s var(--ease) both;
}
.messages li + li { margin-top: 0; }
.messages li.error, .alert.danger { background: var(--danger-bg); border-color: var(--danger-line); color: #912018; }
.messages li.success, .alert.success { background: var(--success-bg); border-color: var(--success-line); color: #05603a; }
.messages li.warning, .alert.warning { background: var(--warning-bg); border-color: var(--warning-line); color: #93370d; }
.alert.neutral { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.alert .icon { margin-top: 1px; }
.alert p:last-child, .alert ul:last-child { margin-bottom: 0; }
.alert-body { flex: 1; min-width: 0; }
.alert-body strong { display: block; margin-bottom: 2px; }
.msg-close { margin-left: auto; background: none; border: 0; padding: 0; color: inherit; opacity: .6; cursor: pointer; height: auto; min-height: 0; box-shadow: none; }
.msg-close:hover { opacity: 1; background: none; }
.errorlist { color: var(--danger); margin: 6px 0 0; padding-left: 0; list-style: none; font-size: 12.5px; }
.errorlist li::before { content: "• "; }
.card > .errorlist, .alert-list { background: var(--danger-bg); border: 1px solid var(--danger-line); border-radius: var(--radius); padding: 10px 14px; margin-bottom: 16px; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 500; font-size: 13px; color: var(--ink-2); margin: 16px 0 6px; }
form > label:first-child, .field:first-child > label, .form-grid > .field > label { margin-top: 0; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=tel], input[type=number], input[type=url], input:not([type]), select, textarea {
  width: 100%; max-width: 520px;
  padding: 8px 12px; min-height: 40px;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  font: inherit; font-size: 14px;
  box-shadow: var(--shadow-xs);
  transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
select { appearance: none; -webkit-appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #b8bfca; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
input[disabled], select[disabled], textarea[disabled] { background: var(--surface-3); color: var(--muted); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; flex: none; cursor: pointer; }
.wide input, .wide select, .wide textarea, input.wide, textarea.wide, select.wide { max-width: none; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid input, .form-grid select, .form-grid textarea { max-width: none; }
.form-grid .full { grid-column: 1 / -1; }
.field { min-width: 0; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 20px; }
.form-actions .muted { font-size: 12.5px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 400; color: var(--ink); margin: 10px 0; cursor: pointer; font-size: 14px; }
.check input { margin-top: 3px; }
.checks-inline { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.checks-inline .check { margin: 6px 0; font-size: 13px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0; }
.inline-form input[type=text] { width: auto; min-width: 160px; max-width: 220px; min-height: 34px; padding: 6px 10px; font-size: 13px; }
.form-card-narrow { max-width: 640px; }

/* Choice cards: big tappable checkboxes */
.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 8px 0 4px; }
.choice {
  display: flex; align-items: flex-start; gap: 12px; margin: 0;
  padding: 14px 16px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); cursor: pointer; font-weight: 400; color: var(--ink);
  transition: border-color .15s, background-color .15s, box-shadow .15s;
}
.choice:hover { border-color: #9fb9b5; }
.choice:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 1px var(--primary) inset; }
.choice:has(input:disabled) { opacity: .6; cursor: not-allowed; }
.choice input { margin-top: 2px; }
.choice-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.choice-title { font-weight: 500; font-size: 14px; }
.choice-sub { font-size: 12.5px; color: var(--muted); }
.choice .badge { align-self: flex-start; white-space: normal; }

/* File upload drop zone: the real <input type=file> covers the zone, so drag-and-drop,
   keyboard focus and the browser's own "required" check all still work. */
.dropzone {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2); color: var(--muted); font-size: 13px; margin: 0;
  transition: border-color .15s, background-color .15s;
  min-width: 240px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); color: var(--ink-2); }
.dropzone:focus-within { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-ring); }
.dropzone.has-file { border-style: solid; border-color: var(--success-line); background: var(--success-bg); color: var(--success); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone .icon-tile { width: 34px; height: 34px; background: var(--surface); border: 1px solid var(--line); }
.dropzone b { color: var(--ink); font-weight: 600; }
.dropzone .dz-text { display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.dropzone .dz-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Buttons ---------- */
button, .button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 8px 16px;
  border: 1px solid var(--primary); border-radius: var(--radius);
  background: var(--primary); color: #fff;
  font: inherit; font-size: 13.5px; font-weight: 500; line-height: 1.2; white-space: nowrap;
  cursor: pointer; text-decoration: none;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.08);
  transition: background-color .15s var(--ease), border-color .15s var(--ease), box-shadow .15s var(--ease), transform .08s;
}
button:hover, .button:hover, .btn:hover { background: var(--primary-hover); border-color: var(--primary-hover); text-decoration: none; color: #fff; }
button:active, .button:active, .btn:active { transform: translateY(1px); }
button:focus-visible, .button:focus-visible, .btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--primary-ring); }
button[disabled] { opacity: .55; cursor: not-allowed; }
button.secondary, .button.secondary, .btn.secondary {
  background: var(--surface); color: var(--ink-2); border-color: var(--line-strong);
}
button.secondary:hover, .button.secondary:hover, .btn.secondary:hover { background: var(--surface-2); color: var(--ink); border-color: #b8bfca; }
button.danger, .btn.danger, .button.danger { background: var(--surface); color: var(--danger); border-color: var(--danger-line); }
button.danger:hover, .btn.danger:hover, .button.danger:hover { background: var(--danger-bg); color: #912018; border-color: #fda29b; }
button.danger-solid { background: #d92d20; border-color: #d92d20; }
button.danger-solid:hover { background: #b42318; border-color: #b42318; }
button.ghost, .btn.ghost, .button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); box-shadow: none; }
button.ghost:hover, .btn.ghost:hover, .button.ghost:hover { background: var(--surface-3); color: var(--ink); }
button.sm, .btn.sm, .button.sm { min-height: 32px; padding: 5px 12px; font-size: 12.5px; }
button.block, .btn.block { width: 100%; }
.icon-btn { width: 38px; height: 38px; padding: 0; min-height: 0; background: transparent; border-color: var(--line); color: var(--ink-2); box-shadow: none; }
.icon-btn:hover { background: var(--surface-3); color: var(--ink); border-color: var(--line-strong); }

/* Reason-required actions: a small panel opens under the button */
.action-pop { position: relative; display: inline-block; text-align: left; }
.action-pop > summary { list-style: none; }
.action-pop > summary::-webkit-details-marker { display: none; }
.action-pop > .pop-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 15; width: 300px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 14px; white-space: normal; animation: pop .14s var(--ease);
}
.pop-panel label { margin-top: 0; }
.pop-panel input[type=text], .pop-panel textarea { max-width: none; }
.pop-panel .form-actions { margin-top: 12px; justify-content: flex-end; }
.pop-title { font-weight: 600; margin-bottom: 4px; font-size: 13.5px; }
.pop-text { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }

/* ---------- Stepper (application wizard) ---------- */
.stepper { list-style: none; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; padding: 0; margin: 0 0 24px; counter-reset: step; }
.stepper li { margin: 0; }
.stepper a {
  display: flex; flex-direction: column; gap: 10px; height: 100%;
  padding: 12px 14px 14px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; position: relative;
  transition: border-color .15s, box-shadow .15s;
}
.stepper a:hover { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.stepper .step-top { display: flex; align-items: center; justify-content: space-between; }
.stepper .step-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--muted); border: 1px solid var(--line); }
.stepper .step-label { line-height: 1.3; }
.stepper .done .step-num { background: var(--success-bg); color: var(--success); border-color: var(--success-line); }
.stepper .current a { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary) inset; color: var(--ink); }
.stepper .current .step-num { background: var(--primary); color: #fff; border-color: var(--primary); }
.stepper .step-state { font-size: 11px; font-weight: 600; color: var(--success); }
.progress { height: 6px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin: 14px 0 0; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 999px; animation: grow .7s var(--ease) both; transform-origin: left; }

/* ---------- Timeline / activity ---------- */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; padding: 0 0 16px 26px; margin: 0; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--surface); border: 2px solid var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 10px; top: 19px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline .t-title { font-size: 13.5px; color: var(--ink); }
.timeline .t-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

.list-plain { list-style: none; padding: 0; margin: 0; }
.list-plain > li { padding: 12px 0; border-bottom: 1px solid var(--line); margin: 0; }
.list-plain > li:first-child { padding-top: 0; }
.list-plain > li:last-child { border-bottom: 0; padding-bottom: 0; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; margin: 0; }
.checklist .icon { color: var(--primary); margin-top: 1px; }

.next-actions { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.next-actions li { margin: 0; }
.next-actions a, .next-actions span.na {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2);
  color: var(--ink); font-weight: 500; text-decoration: none; transition: border-color .15s, background-color .15s;
}
.next-actions a:hover { border-color: var(--primary); background: var(--primary-soft); }
.next-actions a .chev { margin-left: auto; color: var(--muted); }

.link-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.link-tile { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); transition: border-color .15s; }
.link-tile:hover { text-decoration: none; border-color: var(--line-strong); }
.link-tile b { display: block; font-weight: 600; margin-bottom: 2px; }
.link-tile span { font-size: 12.5px; color: var(--muted); }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .icon-tile { margin: 0 auto 12px; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }

.qr-box { width: 200px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.qr-box svg { width: 100%; height: auto; display: block; }
.secret { font-family: var(--mono); font-size: 12px; background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 10px; word-break: break-all; }
.otp-input { letter-spacing: 0.4em; font-size: 20px !important; font-weight: 600; text-align: center; font-family: var(--mono) !important; }

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 2px; }

.prose { max-width: 72ch; color: var(--ink-2); }
.prose h2 { margin-top: 24px; }

/* ---------- Auth layout (login, sign-up, MFA) ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.auth-aside {
  position: relative; overflow: hidden;
  background: var(--side-bg); color: var(--side-ink);
  padding: 40px 48px; display: flex; flex-direction: column;
}
.auth-aside::before {
  content: ""; position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(160deg, #000 10%, transparent 75%);
  -webkit-mask-image: linear-gradient(160deg, #000 10%, transparent 75%);
}
.auth-aside > * { position: relative; }
.auth-aside .logo { color: #fff; }
.auth-pitch { margin-top: auto; margin-bottom: auto; max-width: 440px; padding: 48px 0; }
.auth-pitch h2 { color: #fff; font-size: 30px; font-weight: 600; letter-spacing: -0.025em; line-height: 1.2; margin-bottom: 14px; }
.auth-pitch p { font-size: 15px; color: #b7c2cf; }
.auth-points { list-style: none; padding: 0; margin: 28px 0 0; display: flex; flex-direction: column; gap: 14px; }
.auth-points li { display: flex; gap: 12px; align-items: flex-start; margin: 0; color: #d3dae3; }
.auth-points .icon-tile { width: 32px; height: 32px; border-radius: 9px; background: rgba(255,255,255,.06); color: #e7c98a; border: 1px solid rgba(255,255,255,.08); }
.auth-points b { display: block; color: #fff; font-weight: 600; font-size: 14px; }
.auth-points span { font-size: 13px; color: #9aa7b6; }
.auth-foot { font-size: 12px; color: #738195; }
.auth-main { display: flex; flex-direction: column; background: var(--surface); }
.auth-top { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 20px 32px; font-size: 13px; color: var(--muted); }
.auth-top .logo { display: none; margin-right: auto; }
.auth-form { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 32px 64px; }
.auth-card { width: 100%; max-width: 420px; animation: rise .4s var(--ease) both; }
.auth-card.wide { max-width: 520px; }
.auth-card h1 { font-size: 26px; margin-bottom: 6px; }
.auth-card .lede { color: var(--muted); margin-bottom: 24px; }
.auth-card input[type=text], .auth-card input[type=email], .auth-card input[type=password], .auth-card input[type=tel], .auth-card input:not([type]) { max-width: none; min-height: 44px; }
.auth-card button[type=submit]:not(.secondary) { width: 100%; min-height: 44px; font-size: 14px; }
.auth-card .form-actions { margin-top: 24px; }
.auth-alt { margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.auth-alt p { margin-bottom: 6px; }
.auth-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--primary); background: var(--primary-soft); border-radius: 999px; padding: 4px 10px; margin-bottom: 16px; }

/* ---------- Public layout (prospect pages, privacy) ---------- */
.public-top { background: var(--surface); border-bottom: 1px solid var(--line); }
.public-top-inner { max-width: 1040px; margin: 0 auto; height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 16px; }
.public-top nav { display: flex; gap: 18px; font-size: 13.5px; }
.public-top nav a { color: var(--ink-2); }
.public-main { max-width: 760px; margin: 0 auto; padding: 40px 24px 64px; }
.public-main.wide { max-width: 1040px; }
.public-foot { max-width: 1040px; margin: 0 auto; padding: 24px; font-size: 12px; color: var(--faint); border-top: 1px solid var(--line); }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.content > * { animation: rise .35s var(--ease) both; }
.content > *:nth-child(2) { animation-delay: .03s; }
.content > *:nth-child(3) { animation-delay: .06s; }
.content > *:nth-child(4) { animation-delay: .09s; }
.content > *:nth-child(n+5) { animation-delay: .12s; }
/* The compliance watermark must never animate: the fade-in's last frame would reset its
   faint opacity and its rotation, turning it into solid, straight text. */
.content > .watermark { animation: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
  .stepper { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); background: var(--bg); }
  .sidebar {
    position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: min(var(--sidebar-w), 86vw);
    transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg);
  }
  .nav-open .sidebar { transform: none; }
  .backdrop { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(13, 23, 38, .45); opacity: 0; pointer-events: none; transition: opacity .2s; }
  .nav-open .backdrop { opacity: 1; pointer-events: auto; }
  .menu-btn, .sidebar-close { display: inline-flex; }
  .sidebar-close { color: var(--side-ink); border-color: var(--side-line); }
  .sidebar-close:hover { background: var(--side-hover); color: #fff; border-color: var(--side-line); }
  .topbar { padding: 0 20px; }
  .content { padding: 24px 20px 56px; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .link-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .auth-top .logo { display: inline-flex; }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  h1, .page-head h1 { font-size: 21px; }
  .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 21px; }
  .grid-2, .grid-3, .form-grid, .choices, .dl, .link-tiles { grid-template-columns: minmax(0, 1fr); }
  .stepper { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-meta { display: none; }
  .card { padding: 16px; border-radius: var(--radius); }
  .card-head { margin: -16px -16px 16px; padding: 14px 16px; }
  .card-flush { padding: 0; }
  .card-flush > .card-head { margin: 0; }
  th, td { padding: 10px 12px; }
  .bar-row { grid-template-columns: minmax(0, 1fr) 96px; }
  .bar-row .bar-track { grid-column: 1 / -1; grid-row: 2; }
  .action-pop > .pop-panel { position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto; }
  .auth-form { padding: 8px 20px 48px; align-items: flex-start; }
  .auth-top { padding: 16px 20px; }
  .public-main { padding: 28px 16px 48px; }
  .public-top-inner { padding: 0 16px; }
  .crumbs span.crumb-root, .crumbs .crumb-sep { display: none; }
}

@media print {
  .sidebar, .topbar, .backdrop { display: none !important; }
  .app { display: block; }
  .content { padding: 0; }
  .card, .table-wrap { box-shadow: none; break-inside: avoid; }
}

/* ---------- Status colours for the partner-status chart ---------- */
.seg-DRAFT { background: #98a2b3; }
.seg-SUBMITTED { background: #f79009; }
.seg-APPROVED { background: var(--primary); }
.seg-REJECTED { background: #f04438; }
.seg-SUSPENDED { background: #fb6514; }
.seg-TERMINATED { background: #475467; }
i.dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: 1px; }

/* One-time code inputs */
#id_token, #id_code { letter-spacing: 0.35em; font-size: 18px; font-weight: 600; font-family: var(--mono); max-width: 240px; }

/* Native file pickers outside a drop zone */
input[type=file] { font: inherit; font-size: 13px; color: var(--muted); max-width: 100%; }
input[type=file]::file-selector-button {
  font: inherit; font-size: 13px; font-weight: 500; margin-right: 12px; padding: 8px 12px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--surface); color: var(--ink-2);
  transition: background-color .15s, border-color .15s;
}
input[type=file]::file-selector-button:hover { background: var(--surface-2); border-color: #b8bfca; }
.list-row > :first-child { flex: 1; min-width: 0; }
summary.button { list-style: none; }
summary.button::-webkit-details-marker { display: none; }

/* ========== v2 components: tabs, switches, dialogs, readable audit rows ========== */

/* Tabs. Server tabs are links (.tab.active); in-page tabs are buttons with role="tab". */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 0 0 20px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs .tab, .tabs .tab:hover {
  appearance: none; -webkit-appearance: none; background: none; border: 0; box-shadow: none; transform: none;
  border-bottom: 2px solid transparent; border-radius: 0; margin-bottom: -1px; min-height: 0;
  padding: 12px 16px; color: var(--muted); font: inherit; font-size: 13.5px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; cursor: pointer; text-decoration: none;
}
.tabs .tab:hover { color: var(--ink); }
.tabs .tab:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; border-radius: 6px; }
.tabs .tab.active, .tabs .tab[aria-selected="true"] { color: var(--primary); border-bottom-color: var(--primary); }
.tab-count { font-size: 11.5px; font-weight: 600; line-height: 18px; padding: 0 8px; border-radius: 999px; background: var(--surface-3); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tabs .tab.active .tab-count, .tabs .tab[aria-selected="true"] .tab-count { background: var(--primary-soft); color: var(--primary); }
.js [role="tabpanel"][hidden] { display: none; }
.tabs.pills { border: 1px solid var(--line); background: var(--surface-3); border-radius: 10px; padding: 3px; display: inline-flex; margin-bottom: 16px; }
.tabs.pills .tab, .tabs.pills .tab:hover { border-bottom: 0; margin: 0; border-radius: 8px; padding: 8px 16px; }
.tabs.pills .tab.active, .tabs.pills .tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-xs); }

/* Toggle switch: opens a confirm dialog; the change itself happens in the dialog form */
button.switch, button.switch:hover {
  position: relative; flex: none; width: 44px; height: 24px; min-height: 0; padding: 0; border-radius: 999px;
  border: 0; background: #d0d5dd; box-shadow: inset 0 1px 2px rgba(16, 24, 40, .12); transform: none; cursor: pointer;
  transition: background-color .2s var(--ease);
}
button.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .25); transition: transform .2s var(--ease); }
button.switch[aria-checked="true"] { background: var(--primary); }
button.switch[aria-checked="true"]::after { transform: translateX(20px); }
button.switch:focus-visible { box-shadow: 0 0 0 4px var(--primary-ring); }

/* Modal dialog */
dialog.modal { border: 0; padding: 0; border-radius: 16px; width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 48px); background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px -16px rgba(16, 24, 40, .35); overflow: auto; }
dialog.modal[open] { animation: pop .18s var(--ease); }
dialog.modal::backdrop { background: rgba(11, 23, 36, .5); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.modal-head { display: flex; gap: 14px; align-items: flex-start; padding: 22px 24px 4px; }
.modal-head h2 { margin: 2px 0 4px; font-size: 17px; }
.modal-head p { margin: 0; color: var(--muted); font-size: 13.5px; }
.modal-body { padding: 14px 24px 20px; }
.modal-body textarea { max-width: none; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 24px; background: var(--surface-2); border-top: 1px solid var(--line); }

/* Settings rows (feature flags) */
.setting-list { list-style: none; margin: 0; padding: 0; }
.setting-row { display: grid; grid-template-columns: minmax(0, 1fr) 240px auto; gap: 20px; align-items: center; padding: 16px 22px; border-top: 1px solid var(--line); margin: 0; }
.setting-row:first-child { border-top: 0; }
.setting-row:hover { background: #fafbfc; }
.setting-title { font-weight: 600; color: var(--ink); }
.setting-key { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }
.setting-meta { font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.setting-meta .badge { margin-bottom: 4px; }
.value-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.value-chips .chip { font-size: 12px; }
.not-set { color: var(--faint); font-style: italic; }

/* Summary pill in page headers */
.summary-pill { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px; font-size: 13px; color: var(--ink-2); box-shadow: var(--shadow-xs); white-space: nowrap; }
.summary-pill b { color: var(--ink); font-variant-numeric: tabular-nums; }
.dot-ok, .dot-off { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: #12b76a; box-shadow: 0 0 0 3px #d1fadf; }
.dot-off { background: #98a2b3; box-shadow: 0 0 0 3px var(--surface-3); }

/* Callout */
.callout { display: flex; gap: 14px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: var(--surface); margin-bottom: 20px; box-shadow: var(--shadow-xs); }
.callout .icon-tile { width: 34px; height: 34px; }
.callout b { display: block; margin-bottom: 2px; color: var(--ink); }
.callout p { margin: 0; color: var(--muted); font-size: 13px; }

/* Audit log */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1; min-width: 220px; max-width: 420px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search input { padding-left: 38px; max-width: none; }
details.filters-panel { margin-bottom: 16px; }
details.filters-panel > summary { list-style: none; display: inline-flex; }
details.filters-panel > summary::-webkit-details-marker { display: none; }
.filters-body { margin-top: 12px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.active-filters { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.table-audit { min-width: 980px; }
.table-audit td { vertical-align: middle; }
.event { display: flex; gap: 12px; align-items: center; min-width: 0; }
.event .icon-tile { width: 32px; height: 32px; border-radius: 9px; }
.event-label { font-weight: 600; color: var(--ink); line-height: 1.3; }
.event-code { font-family: var(--mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.actor { display: flex; gap: 10px; align-items: center; min-width: 0; }
.actor .avatar { width: 28px; height: 28px; font-size: 11px; }
.actor .avatar.system { background: var(--surface-3); color: var(--ink-2); border-color: var(--line); }
.actor-name { font-weight: 500; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; display: block; }
.actor-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.change-inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; }
.change-inline .from { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(102, 112, 133, .5); }
.change-inline .to { color: var(--ink); font-weight: 600; }
.change-inline .key { color: var(--muted); }
details.diff > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; color: var(--primary); }
details.diff > summary::-webkit-details-marker { display: none; }
details.diff > summary .icon { transition: transform .15s; }
details.diff[open] > summary .icon { transform: rotate(90deg); }
.diff-list { margin: 8px 0 0; padding: 10px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 14px; font-size: 12.5px; }
.diff-list dt { color: var(--muted); }
.diff-list dd { margin: 0; color: var(--ink); word-break: break-word; }
.diff-list .same { color: var(--muted); }
.reason { font-size: 13px; color: var(--ink-2); max-width: 280px; min-width: 170px; }
.table-audit td:nth-child(4) { max-width: 250px; overflow-wrap: anywhere; }
.when { white-space: nowrap; }
.when b { display: block; font-weight: 500; color: var(--ink); }
.when span { font-size: 12px; color: var(--muted); }
.seq { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.pager-info { font-size: 13px; color: var(--muted); }

/* Activity feed (dashboard) */
.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--line); margin: 0; }
.feed li:first-child { border-top: 0; padding-top: 0; }
.feed .icon-tile { width: 32px; height: 32px; border-radius: 9px; }
.feed-title { font-weight: 500; color: var(--ink); font-size: 13.5px; line-height: 1.35; }
.feed-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Account card */
.kv { list-style: none; margin: 0; padding: 0; }
.kv li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); margin: 0; font-size: 13px; }
.kv li:first-child { border-top: 0; padding-top: 0; }
.kv span { color: var(--muted); }
.kv b { font-weight: 500; color: var(--ink); text-align: right; word-break: break-word; }

/* Numbered steps and QR (MFA setup) */
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; margin: 0; color: var(--ink-2); }
.steps li::before { content: counter(s); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; background: var(--primary-soft); color: var(--primary); }
.mfa-box { margin: 6px 0 22px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); }
.mfa-box .qr-box { width: 220px; margin: 0 auto; box-shadow: var(--shadow-sm); }
.secret-row { display: flex; gap: 8px; align-items: stretch; }
.secret-row .secret { flex: 1; display: flex; align-items: center; background: var(--surface); }
button.copy, button.copy:hover { min-height: 0; padding: 6px 12px; font-size: 12.5px; background: var(--surface); color: var(--ink-2); border: 1px solid var(--line-strong); box-shadow: var(--shadow-xs); }
button.copy:hover { background: var(--surface-2); }
button.copy.copied { color: var(--success); border-color: var(--success-line); background: var(--success-bg); }

/* Auth card polish: one-time code inputs */
.auth-card #id_token, .auth-card #id_code { max-width: none; text-align: center; font-size: 22px; letter-spacing: .5em; padding-left: calc(12px + .5em); min-height: 52px; }

@media (max-width: 1024px) {
  .setting-row { grid-template-columns: minmax(0, 1fr) auto; }
  .setting-row .setting-meta { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 720px) {
  .setting-row { padding: 14px 16px; gap: 10px 14px; }
  .summary-pill { white-space: normal; }
  .modal-head, .modal-body { padding-left: 18px; padding-right: 18px; }
  .modal-foot { padding: 12px 18px; }
}

/* "More filters" opens the panel that follows it */
.toolbar details.filters-panel:not([open]) ~ .filters-body { display: none; }
.toolbar details.filters-panel[open] > summary { background: var(--primary-soft); border-color: #9fcfc8; color: var(--primary); }
.search { margin: 0; font-weight: 400; }
details.diff > summary { white-space: nowrap; }
.table-audit th:nth-child(5), .table-audit td:nth-child(5) { min-width: 170px; }

/* Menu items that are forms (POST log out) */
.menu-panel form { margin: 0; }
.menu-panel form button, .menu-panel form button:hover { width: 100%; justify-content: flex-start; gap: 10px; padding: 8px 12px; min-height: 0; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--ink-2); font-weight: 400; font-size: 13.5px; box-shadow: none; transform: none; }
.menu-panel form button:hover { background: var(--surface-3); color: var(--ink); }

/* A form button that looks like a text link (logout is POST-only) */
button.link-button, button.link-button:hover {
  display: inline-flex; align-items: center; gap: 6px; min-height: 0; padding: 0; border: 0;
  background: none; box-shadow: none; transform: none; color: var(--primary);
  font: inherit; font-weight: 500; cursor: pointer;
}
button.link-button:hover { text-decoration: underline; }

/* One-time link with a copy button (staff invitations) */
.new-link { margin-bottom: 16px; border-color: var(--primary); }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; max-width: none; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.copy-row button { flex: none; }

/* Wizard document rows: after an upload the page lands on the next row to fill */
tr[id^="doc-"] { scroll-margin-top: 88px; }
tr[id^="doc-"]:target > td { background: var(--primary-soft); }

/* Wizard: summary before submit */
.summary { display: grid; gap: 16px; margin-top: 16px; }
.summary-block { border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
.summary-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.summary-head h3 { margin: 0; font-size: 14px; }
.summary-block p { margin: 0; }
.summary-table { width: 100%; }
.summary-table td { padding: 6px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.summary-table tr:last-child td { border-bottom: 0; }
.summary-table td:last-child { text-align: right; white-space: nowrap; }
.summary-dl { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.summary-dl dt { color: var(--muted); }
.summary-dl dd { margin: 0; word-break: break-word; }
