/* StudyOs web: Indigo Night design system.
   Order: fonts -> tokens -> reset/base -> layout shells -> components -> utilities -> motion.
   Every colour comes from the tokens below; layout and type scale follow docs/design/v3. */

/* -- Fonts (self-hosted, SIL OFL; see /fonts/OFL.txt) -- */
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 600 800;
  font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("../fonts/instrument-sans-latin.woff2") format("woff2");
}

/* -- Tokens -- */
:root {
  --hero-1: #2A2E4A; --hero-2: #1E2139; --hero-3: #181A2E;
  --hero-ink: #EEF0FA; --hero-muted: #A9AECB; --hero-kicker: #8FD3FF;
  --hero-pill: rgba(255,255,255,.08); --hero-pill-border: rgba(255,255,255,.12);
  --sheet-1: #FAFAFE; --sheet-2: #EEF0FA; --sheet-3: #DFE2F6;
  /* Text greys and accent-strong are deepened from the app's values so they meet WCAG AA (4.5:1) on card and sheets. */
  --ink: #23263D; --muted: #5A5E79; --faint: #666A85;
  --accent: #3F9BD9; --accent-strong: #23699E; --kicker: #5CB8F0;
  /* The web button gradient is deliberately deeper than the app's (#5CB8F0 -> #6F7FEA) so white button text
     meets WCAG AA at every point: 4.75:1 at the start, 5.00:1 midpoint, 5.13:1 at the end. */
  --button-1: #2978B2; --button-2: #5363D3; --button-ink: #FFFFFF; --button-glow: rgba(41,120,178,.45);
  --card: #FFFFFF; --line: rgba(40,46,90,.10); --subtle: rgba(40,46,90,.05);
  --deep: #252941;
  --ok: #8C8F33; --warn: #B07A12; --bad: #D2452F; --info: #3F9BD9;
  --ok-bg: rgba(140,143,51,.12); --warn-bg: rgba(176,122,18,.12); --bad-bg: rgba(210,69,47,.10); --info-bg: rgba(63,155,217,.12);
  --glow-1: rgba(92,184,240,.55); --glow-2: rgba(140,130,240,.45); --glow-3: rgba(127,208,255,.45);
  --font-head: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-pill: 999px;
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px; --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 48px;
  --shadow-card: 0 1px 2px rgba(35,38,61,.04), 0 8px 24px rgba(35,38,61,.06);
  --focus: 0 0 0 3px rgba(63,155,217,.35);

  /* Derived (still only token colours) */
  --font-mono: ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --scrim: rgba(24,26,46,.55);
  --shadow-pop: 0 18px 40px -12px rgba(35,38,61,.28);
  --shadow-dialog: 0 30px 60px -20px rgba(24,26,46,.5);
  --track-off: color-mix(in srgb, var(--faint) 45%, var(--card));
  /* Text versions of the status tones: AA (>= 5:1) on their own tints, on card and on white glyphs. */
  --link-hover: #1A5383;
  --ok-ink: #5C5F16; --warn-ink: #7C5508; --bad-ink: #A8321F; --info-ink: #1F6396;
}

/* -- Reset / base -- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: linear-gradient(180deg, var(--sheet-1), var(--sheet-2)) fixed;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--font-head);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.4px;
}
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }
img, svg { display: block; max-width: 100%; }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { color: var(--link-hover); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
input::placeholder, textarea::placeholder { color: var(--faint); opacity: 1; }
code, kbd, samp { font-family: var(--font-mono); font-size: .9em; }
code { padding: 2px 6px; border-radius: 6px; background: var(--subtle); }
hr { border: 0; height: 1px; background: var(--line); margin: var(--s-4) 0; }
:focus { outline: none; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
a:focus-visible, button:focus-visible, summary:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible { box-shadow: var(--focus); }
[hidden] { display: none !important; }

.so-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--accent-strong);
}
.so-eyebrow::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* -- Brand (logo row) -- */
.so-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
}
.so-brand:hover { color: inherit; }
.so-brand img { width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0; }
.so-brand > span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.so-brand strong {
  font-family: var(--font-head);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.so-brand small {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.3px;
  text-transform: uppercase;
  color: var(--hero-muted);
}
.so-brand--hero img { width: 34px; height: 34px; border-radius: 11px; }
.so-brand--hero strong { font-size: 19px; }

/* -- Admin shell -- */
.so-app {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

/* -- Sidebar -- */
.so-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 14px;
  color: var(--hero-ink);
  background: linear-gradient(185deg, var(--hero-1) 0%, var(--hero-2) 55%, var(--hero-3) 100%);
  overflow: hidden;
}
.so-sidebar > .so-brand { padding: 0 8px; }
.so-nav {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
  margin: 0 -4px;
  padding: 0 4px;
}
.so-nav-section {
  padding: 18px 10px 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--hero-muted);
}
.so-nav-section:first-child { padding-top: 0; }

/* Nav links: shared shape; colours per context (dark sidebar / account nav). */
.so-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
}
.so-nav-link::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: transparent;
  flex-shrink: 0;
}
.so-nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--hero-muted);
}
.so-sidebar .so-nav-link { color: var(--hero-muted); }
.so-sidebar .so-nav-link:hover { color: var(--hero-ink); background: rgba(255,255,255,.06); }
.so-sidebar .so-nav-link.is-active { color: var(--hero-ink); background: var(--hero-pill); box-shadow: inset 0 0 0 1px var(--hero-pill-border); }
.so-sidebar .so-nav-link.is-active::before { background: var(--hero-kicker); }
.so-sidebar .so-nav-link:focus-visible { box-shadow: 0 0 0 2px var(--hero-kicker); }

.so-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px;
  border-radius: var(--r-md);
  background: var(--hero-pill);
  border: 1px solid var(--hero-pill-border);
}
.so-user-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.so-user-meta strong {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.so-user-meta small { font-size: 11px; color: var(--hero-muted); }
.so-user-link { font-size: 12px; font-weight: 600; color: var(--hero-kicker); }
.so-user-link:hover { color: var(--hero-ink); }

.so-scrim { display: none; }

/* -- Content column + top bar -- */
.so-content { min-width: 0; display: flex; flex-direction: column; }
.so-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  height: 60px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--sheet-1) 72%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.so-menu-btn {
  display: none;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.so-menu-btn::before {
  content: "";
  width: 14px; height: 10px;
  background: linear-gradient(currentColor, currentColor) top / 100% 2px no-repeat,
              linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat,
              linear-gradient(currentColor, currentColor) bottom / 100% 2px no-repeat;
}
.so-breadcrumb {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 13px;
  color: var(--muted);
}
.so-breadcrumb a { color: var(--muted); }
.so-breadcrumb a:hover { color: var(--ink); }
.so-breadcrumb > span:not(:last-child) { color: var(--faint); opacity: .7; }
.so-breadcrumb > span:last-child {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.so-env {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--sheet-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.so-env::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ok);
}

.so-main {
  flex: 1;
  width: 100%;
  max-width: 1320px;
  padding: 28px 32px 64px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* -- Page header -- */
.so-page-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 16px;
  row-gap: 6px;
  align-items: end;
}
.so-page-header > * { grid-column: 1; }
.so-page-header > div:not(.so-page-actions) { display: flex; flex-direction: column; gap: 6px; }
.so-page-header .so-eyebrow::before { display: none; }
.so-page-header h1 {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.9px;
  line-height: 1.05;
  text-wrap: pretty;
}
.so-page-header p { margin: 0; font-size: 14px; color: var(--muted); }
.so-page-actions {
  grid-column: 2;
  grid-row: 1 / span 3;
  align-self: end;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.so-back {
  align-self: flex-start;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.so-back:hover { color: var(--ink); }

/* -- Account dropdown (<details class="so-menu">) -- */
.so-menu { position: relative; }
.so-menu > summary {
  position: relative;
  display: block;
  max-width: 240px;
  padding: 7px 30px 7px 12px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  user-select: none;
}
.so-menu > summary::-webkit-details-marker { display: none; }
.so-menu > summary::after {
  content: "";
  position: absolute;
  right: 13px;
  top: 50%;
  width: 7px; height: 7px;
  margin-top: -6px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  opacity: .7;
  flex-shrink: 0;
}
.so-menu > summary:hover { background: var(--subtle); }
.so-menu[open] > summary { background: var(--subtle); }
.so-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  min-width: 200px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  border-radius: var(--r-md);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-pop);
  color: var(--ink);
  animation: so-fade .15s ease;
}
.so-menu-panel form { margin: 0; }
.so-menu-panel a,
.so-menu-panel button {
  display: block;
  width: 100%;
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: none;
  text-align: left;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}
.so-menu-panel a:hover,
.so-menu-panel button:hover { background: var(--sheet-2); color: var(--ink); }

/* -- Card -- */
.so-card {
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  padding: 20px;
  min-width: 0;
}
.so-card--flush { padding: 0; overflow: hidden; }
.so-card--danger { border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
.so-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.so-card--flush > .so-card-header { padding: 18px 20px 12px; margin: 0; }
.so-card-header a { font-size: 13px; font-weight: 600; }
.so-card-title {
  margin: 0;
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.3px;
  line-height: 1.2;
}
.so-card > .so-card-title + p,
.so-card > .so-card-title + .so-muted { margin-top: 6px; color: var(--muted); }
.so-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--faint);
}
.so-card--flush > .so-section-label { display: block; padding: 18px 20px 6px; }
.so-card-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}
.so-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: 16px;
  align-items: start;
}

/* -- Stats -- */
.so-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.so-stat {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card);
  color: var(--ink);
}
a.so-stat:hover { color: var(--ink); border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.so-stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.so-stat-label .so-dot { width: 8px; height: 8px; }
.so-stat-value {
  font-family: var(--font-head);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.8px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.so-stat-hint { font-size: 12px; color: var(--faint); }
.so-stat--ok .so-dot { background: var(--ok); }
.so-stat--warn .so-dot { background: var(--warn); }
.so-stat--bad .so-dot { background: var(--bad); }
.so-stat--bad .so-stat-value { color: var(--bad); }
.so-stat--info .so-dot { background: var(--info); }
.so-stat--neutral .so-dot { background: var(--faint); }

.so-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* -- Alert -- */
.so-alert {
  --tone: var(--warn);
  --tone-bg: var(--warn-bg);
  --tone-ink: var(--warn-ink);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  padding: 14px 18px;
  border-radius: 16px;
  background: var(--tone-bg);
  border: 1px solid color-mix(in srgb, var(--tone) 28%, transparent);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
.so-alert::before {
  content: "!";
  width: 30px; height: 30px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--tone-ink);
  color: var(--button-ink);
  font-size: 15px;
  font-weight: 700;
}
.so-alert > :not(a):first-of-type { flex: 1; min-width: 200px; }
.so-alert a { font-size: 13px; font-weight: 600; color: var(--tone-ink); }
.so-alert a:hover { color: var(--ink); }
.so-alert code { background: color-mix(in srgb, var(--tone) 14%, transparent); font-size: 12px; }
.so-alert ul { flex: 1; margin: 0; padding: 0; list-style: none; }
.so-alert li + li { margin-top: 4px; }
.so-alert--ok { --tone: var(--ok); --tone-bg: var(--ok-bg); --tone-ink: var(--ok-ink); }
.so-alert--ok::before { content: "\2713"; font-size: 14px; }
.so-alert--bad { --tone: var(--bad); --tone-bg: var(--bad-bg); --tone-ink: var(--bad-ink); }
.so-alert--info { --tone: var(--info); --tone-bg: var(--info-bg); --tone-ink: var(--info-ink); }
.so-alert--info::before { content: "i"; font-family: var(--font-head); }
.so-alert--warn { --tone: var(--warn); --tone-bg: var(--warn-bg); --tone-ink: var(--warn-ink); }
/* asp-validation-summary renders an empty, hidden list when the model is valid */
.so-alert.validation-summary-valid { display: none; }

/* -- Table -- */
.so-table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.so-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.so-table th {
  padding: 12px 20px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
  border-bottom: 1px solid var(--line);
}
.so-table td {
  padding: 12px 20px;
  vertical-align: middle;
  border-top: 1px solid var(--line);
}
.so-table tbody tr:first-child td { border-top: 0; }
.so-table tbody tr:hover td { background: var(--subtle); }
.so-table td.so-right, .so-table th.so-right { text-align: right; }
.so-table .so-cell-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.so-table .so-cell-main > :first-child { font-size: 14px; font-weight: 600; }
.so-table .so-cell-main > :not(:first-child) { color: var(--muted); }
.so-table .so-cell-sub { display: block; font-size: 12px; color: var(--faint); }
.so-table .so-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* -- Two-line list (dashboard feeds) -- */
.so-list { margin: 0; padding: 0; list-style: none; }
.so-list-item {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.so-list-time { color: var(--faint); font-variant-numeric: tabular-nums; }
.so-list-main { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.so-list-primary { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-list-secondary { font-size: 12px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.so-list-end { color: var(--muted); font-size: 12px; justify-self: end; }

/* -- Proportional bar (usage, storage): <span class="so-bar" style="--w:42%"></span> -- */
.so-bar { display: block; height: 6px; border-radius: 999px; background: var(--sheet-2); overflow: hidden; }
.so-bar::before { content: ""; display: block; width: var(--w, 0%); height: 100%; border-radius: inherit; background: var(--accent); }

/* -- Bar chart (inline SVG, Areas/Admin/Views/Shared/_BarChart.cshtml) -- */
.so-chart { margin: 0; padding: 4px 20px 8px; overflow-x: auto; }
/* Below ~640px the labels would shrink past legibility: the chart scrolls sideways inside its card instead. */
.so-chart svg { display: block; width: 100%; min-width: 640px; height: auto; overflow: visible; }
.so-chart-bar { fill: var(--accent); }
.so-chart-hit { fill: transparent; }
.so-chart g:hover > .so-chart-bar { fill: var(--accent-strong); }
.so-chart-axis { stroke: var(--line); stroke-width: 1; }
.so-chart-grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.so-chart-label { fill: var(--faint); font-size: 11px; font-family: var(--font-body); font-variant-numeric: tabular-nums; }

/* -- Ranked bars (cost by feature / model): label + value, then a proportional .so-bar -- */
.so-ranked { margin: 0; padding: 0; list-style: none; }
.so-ranked-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 12px;
  align-items: center;
  padding: 11px 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
}
.so-ranked-label { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.so-ranked-value { font-variant-numeric: tabular-nums; color: var(--ink); }
.so-ranked-item .so-bar { grid-column: 1 / -1; }
.so-ranked-hint { grid-column: 1 / -1; font-size: 12px; color: var(--faint); }

/* Setting / row list (label + description left, control right) */
.so-setting {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 14px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
}
.so-setting-text { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 2px; }
.so-setting-text > :first-child { font-size: 14px; font-weight: 600; }
.so-setting-text > :not(:first-child) { font-size: 12px; color: var(--muted); }

/* -- Badge / tag -- */
.so-badge {
  --tone: var(--muted);
  --tone-bg: var(--sheet-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border-radius: var(--r-pill);
  background: var(--tone-bg);
  color: var(--tone);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
}
.so-badge--ok { --tone: var(--ok-ink); --tone-bg: var(--ok-bg); }
.so-badge--warn { --tone: var(--warn-ink); --tone-bg: var(--warn-bg); }
.so-badge--bad { --tone: var(--bad-ink); --tone-bg: var(--bad-bg); }
.so-badge--info { --tone: var(--info-ink); --tone-bg: var(--info-bg); }
.so-badge--neutral { --tone: var(--muted); --tone-bg: var(--sheet-2); }
.so-badge--dot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.so-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 7px;
  background: var(--sheet-2);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.so-tags { display: flex; flex-wrap: wrap; gap: 4px; }

/* -- Filter bar -- */
.so-filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.so-filterbar > input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]),
.so-filterbar > select,
.so-input,
.so-select {
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 14px;
  color: var(--ink);
  min-width: 0;
}
.so-filterbar > input:focus-visible, .so-filterbar > select:focus-visible,
.so-input:focus-visible, .so-select:focus-visible { border-color: var(--accent); box-shadow: var(--focus); }
textarea.so-input { height: auto; padding: 12px; line-height: 1.6; resize: vertical; }
.so-search {
  flex: 1;
  min-width: 240px;
  max-width: 380px;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
}
.so-search::before {
  content: "";
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--faint);
  flex-shrink: 0;
}
.so-search:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.so-search input {
  flex: 1;
  height: auto;
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* -- Field (label inside a rounded box) -- */
.so-field {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px 16px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--line);
  transition: border-color .15s, box-shadow .15s;
}
.so-field > label,
.so-field-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--faint);
}
.so-field input,
.so-field select,
.so-field textarea {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  outline: none;
  box-shadow: none;
}
.so-field select { cursor: pointer; }
.so-field textarea { min-height: 72px; resize: vertical; line-height: 1.5; }
.so-field input:focus-visible,
.so-field select:focus-visible,
.so-field textarea:focus-visible { box-shadow: none; }
.so-field input:disabled, .so-field input[readonly] { color: var(--muted); }
.so-field:focus-within { border-color: var(--accent); box-shadow: var(--focus); }
.so-field:has(.input-validation-error) { border-color: var(--bad); }
.so-field:has(.so-reveal) input { padding-right: 52px; }
.so-field-hint { font-size: 12px; color: var(--faint); }
.so-field-error,
.field-validation-error { font-size: 12px; font-weight: 500; color: var(--bad-ink); }
.so-field-error:empty { display: none; }
.so-fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 12px;
}
.so-reveal {
  position: absolute;
  right: 16px;
  bottom: 14px;
  padding: 2px 0;
  border: 0;
  background: none;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .6px;
  text-transform: uppercase;
  color: var(--muted);
}
.so-reveal:hover { color: var(--ink); }

/* Razor validation output (default class names) */
.input-validation-error:not(.so-field input) { border-color: var(--bad) !important; }
.validation-summary-errors ul { margin: 0; padding: 0; list-style: none; }
.validation-summary-errors:not(.so-alert) { color: var(--bad-ink); font-size: 13px; }

/* -- Checkbox -- */
.so-check {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}
.so-check input[type="checkbox"],
.so-check input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 19px; height: 19px;
  margin: 0;
  flex-shrink: 0;
  border-radius: 7px;
  border: 1.5px solid color-mix(in srgb, var(--faint) 70%, transparent);
  background: var(--card) no-repeat center / 7px 7px;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.so-check input[type="radio"] { border-radius: 50%; }
.so-check input:checked {
  border-color: var(--accent);
  background-color: var(--accent);
  background-image: linear-gradient(var(--button-ink), var(--button-ink));
}
.so-check input[type="radio"]:checked { background-image: radial-gradient(circle, var(--button-ink) 45%, transparent 50%); background-size: 100% 100%; }
.so-check input:disabled { opacity: .5; cursor: not-allowed; }
.so-check:has(input:checked) { color: var(--ink); }
.so-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
  gap: 10px 16px;
}

/* -- Toggle switch (<label class="so-toggle"><input type="checkbox" role="switch"><span>Label</span></label>) -- */
.so-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 14px;
}
.so-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  width: 38px; height: 22px;
  margin: 0;
  flex-shrink: 0;
  border-radius: var(--r-pill);
  background: var(--track-off);
  cursor: pointer;
  transition: background .2s;
}
.so-toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 1px 2px rgba(35,38,61,.25);
  transition: transform .2s;
}
.so-toggle input[type="checkbox"]:checked { background: var(--accent); }
.so-toggle input[type="checkbox"]:checked::before { transform: translateX(16px); }
.so-toggle input:disabled { opacity: .5; cursor: not-allowed; }
.so-toggle input:focus-visible { box-shadow: var(--focus); }
.so-toggle--end { width: 100%; flex-direction: row-reverse; justify-content: space-between; }

/* -- Buttons -- */
.so-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, var(--button-1), var(--button-2));
  color: var(--button-ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 10px 24px -10px var(--button-glow);
  transition: filter .15s, transform .15s, background-color .15s, border-color .15s, color .15s;
}
.so-btn:hover { color: var(--button-ink); filter: brightness(.93); } /* darken, never lighten: keeps AA */
.so-btn:active { transform: translateY(1px); }
.so-btn:focus-visible { box-shadow: var(--focus), 0 10px 24px -10px var(--button-glow); }
.so-btn:disabled, .so-btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: none; transform: none; }
.so-btn--secondary {
  background: var(--card);
  border-color: var(--line);
  color: var(--ink);
  box-shadow: none;
}
.so-btn--secondary:hover { color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 45%, transparent); filter: none; }
.so-btn--secondary:focus-visible, .so-btn--ghost:focus-visible { box-shadow: var(--focus); }
.so-btn--ghost { background: transparent; color: var(--muted); box-shadow: none; }
.so-btn--ghost:hover { background: var(--subtle); color: var(--ink); filter: none; }
.so-btn--danger { background: var(--bad); color: var(--button-ink); box-shadow: 0 10px 24px -12px color-mix(in srgb, var(--bad) 70%, transparent); }
.so-btn--danger:hover { color: var(--button-ink); filter: brightness(.95); }
.so-btn--danger-outline { background: var(--card); border-color: color-mix(in srgb, var(--bad) 35%, transparent); color: var(--bad-ink); box-shadow: none; }
.so-btn--danger-outline:hover { background: var(--bad-bg); color: var(--bad-ink); filter: none; }
.so-btn--sm { height: 34px; padding: 0 12px; border-radius: var(--r-sm); font-size: 12px; }
.so-btn--block { display: flex; width: 100%; }

/* -- "OR" divider -- */
.so-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--faint);
}
.so-divider::before, .so-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }

.so-provider {
  width: 26px; height: 26px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--sheet-2);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

/* -- Tabs (segmented pills) -- */
.so-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 3px;
  border-radius: 12px;
  background: var(--sheet-2);
  border: 1px solid var(--line);
}
.so-tabs > a,
.so-tabs > button {
  padding: 7px 12px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.so-tabs > a:hover, .so-tabs > button:hover { color: var(--ink); }
.so-tabs > .is-active,
.so-tabs > [aria-current="page"],
.so-tabs > [aria-selected="true"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(35,38,61,.12);
}
.so-tabs--line {
  display: flex;
  gap: 4px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: none;
}
.so-tabs--line > a, .so-tabs--line > button {
  margin-bottom: -1px;
  padding: 10px 14px;
  border-radius: 0;
  border-bottom: 2px solid transparent;
  font-size: 14px;
}
.so-tabs--line > .is-active,
.so-tabs--line > [aria-current="page"],
.so-tabs--line > [aria-selected="true"] { background: none; box-shadow: none; color: var(--ink); border-bottom-color: var(--accent); }

/* -- Empty state -- */
.so-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 20px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
}
.so-card--flush .so-empty { border-top: 1px solid var(--line); }

/* -- Pager -- */
.so-pager {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 14px 20px;
  font-size: 13px;
  color: var(--muted);
}
.so-card .so-pager { border-top: 1px solid var(--line); }
.so-pager > span { order: -1; margin-right: auto; font-variant-numeric: tabular-nums; }

/* -- Bulk selection (users list): checkbox column + sticky action bar -- */
.so-col-check { width: 44px; padding-right: 0 !important; }
.so-col-check .so-check { gap: 0; }
.so-bulkbar {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 10px 14px;
  border-radius: var(--r-lg);
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-card), 0 8px 24px rgba(35,38,61,.12);
  font-size: 13px;
  color: var(--muted);
}
.so-bulkbar-count { font-variant-numeric: tabular-nums; }
.so-bulkbar-count strong { color: var(--ink); }
.so-bulkbar-all { margin-left: auto; }
.so-bulkbar-all a { color: var(--accent); font-weight: 600; }

/* -- Dialog (native <dialog>) -- */
.so-dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100vh - 48px);
  padding: 24px;
  border: 0;
  border-radius: 24px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-dialog);
}
.so-dialog[open] { display: flex; flex-direction: column; gap: 16px; animation: so-rise .2s ease; }
.so-dialog::backdrop { background: var(--scrim); }
.so-dialog h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.4px; }
.so-dialog h2 + p { margin-top: -10px; font-size: 13px; color: var(--muted); }
.so-dialog form { margin: 0; }
.so-dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; }

/* -- Key/value list -- */
.so-kv {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
  font-size: 13px;
}
.so-kv > div { display: contents; }
.so-kv dt { color: var(--muted); }
.so-kv dd { margin: 0; text-align: right; font-weight: 500; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

/* -- Avatar -- */
.so-avatar {
  width: 32px; height: 32px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--button-1), var(--button-2));
  color: var(--button-ink);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .2px;
}
.so-avatar--md { width: 34px; height: 34px; }
.so-avatar--lg { width: 64px; height: 64px; font-family: var(--font-head); font-size: 22px; }
.so-avatar--muted { background: var(--sheet-3); color: var(--muted); }

/* -- Auth layout -- */
.so-auth-body { background: var(--sheet-1); }
.so-auth {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr);
  min-height: 100vh;
}
.so-auth-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 32px;
  padding: 40px 48px;
  color: var(--hero-ink);
  background: linear-gradient(185deg, var(--hero-1) 0%, var(--hero-2) 55%, var(--hero-3) 100%);
}
.so-auth-hero > :not(.so-glow) { position: relative; }
.so-glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  animation: so-bloom 11s ease-in-out infinite;
}
.so-glow--1 {
  top: -160px; left: -80px;
  width: 520px; height: 460px;
  background: radial-gradient(circle, var(--glow-1) 0%, transparent 72%);
  filter: blur(30px);
}
.so-glow--2 {
  bottom: -180px; right: -120px;
  width: 460px; height: 420px;
  background: radial-gradient(circle, var(--glow-2) 0%, transparent 70%);
  filter: blur(34px);
  animation-duration: 15s;
  animation-direction: reverse;
}
.so-auth-headline {
  margin-top: auto;
  max-width: 460px;
  font-size: clamp(36px, 3.4vw, 50px);
  font-weight: 800;
  letter-spacing: -1.6px;
  line-height: 1;
  text-wrap: pretty;
}
.so-auth-lede {
  margin: -10px 0 auto;
  max-width: 460px;
  font-size: 16px;
  line-height: 1.55;
  color: var(--hero-muted);
  text-wrap: pretty;
}
.so-auth-glass {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 420px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--hero-pill);
  border: 1px solid var(--hero-pill-border);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  font-size: 13px;
  line-height: 1.45;
  color: var(--hero-ink);
}
.so-auth-glass .so-dot { background: var(--hero-kicker); box-shadow: 0 0 12px var(--glow-3); }

.so-auth-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 32px 48px;
  background: var(--sheet-1);
}
.so-auth-switch {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 20px;
  font-size: 13px;
  color: var(--muted);
}
.so-auth-switch a { font-weight: 600; }
.so-auth-form {
  flex: 1;
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  padding: 32px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: so-rise .4s ease both;
}
.so-auth-form > * { margin: 0; }
.so-auth-form > * + * { margin-top: 22px; }
.so-auth-form > .so-eyebrow { align-self: flex-start; }
.so-auth-form > .so-eyebrow + .so-auth-title,
.so-auth-form > .so-auth-title + .so-auth-sub { margin-top: 10px; }
.so-auth-title {
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -1.2px;
  line-height: 1.02;
  text-wrap: pretty;
}
.so-auth-sub { font-size: 15px; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.so-auth-note { font-size: 13px; color: var(--muted); }
.so-auth-note a { font-weight: 600; }
.so-auth-form .so-btn--block { height: 52px; border-radius: 18px; font-size: 15px; }
.so-auth-form .so-btn--secondary.so-btn--block { height: 50px; font-weight: 500; }
.so-auth-form .so-row--between a { font-size: 13px; font-weight: 600; }
.so-auth-icon {
  --tone: var(--info-ink);
  --tone-bg: var(--info-bg);
  width: 64px; height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 22px;
  background: var(--tone-bg);
}
.so-auth-icon > span {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--tone);
  color: var(--button-ink);
  font-size: 18px;
  font-weight: 700;
}
.so-auth-icon--ok { --tone: var(--ok-ink); --tone-bg: var(--ok-bg); }
.so-auth-icon--warn { --tone: var(--warn-ink); --tone-bg: var(--warn-bg); }
.so-auth-icon--bad { --tone: var(--bad-ink); --tone-bg: var(--bad-bg); }
.so-auth-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12px;
  color: var(--faint);
}
.so-auth-footer a { color: var(--faint); }
.so-auth-footer a:hover { color: var(--muted); }

/* -- Account layout -- */
.so-account-bar {
  position: relative;
  z-index: 10;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 32px;
  color: var(--hero-ink);
  background:
    radial-gradient(420px 220px at 18% -40%, var(--glow-1), transparent 70%),
    linear-gradient(185deg, var(--hero-1), var(--hero-2) 70%, var(--hero-3));
}
.so-account-bar .so-brand img { width: 30px; height: 30px; }
.so-account-bar .so-menu { margin-left: auto; }
.so-account-bar .so-menu > summary:hover,
.so-account-bar .so-menu[open] > summary { background: var(--hero-pill); }
.so-account-bar a:not(.so-brand):not(.so-menu-panel a) { color: var(--hero-muted); font-size: 13px; font-weight: 600; }
.so-account-main {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  animation: so-rise .3s ease both;
}
.so-account {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 32px;
  align-items: start;
}
.so-account-nav {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.so-account-nav .so-nav-link {
  padding: 10px 12px;
  border-radius: 12px;
  font-weight: 600;
  color: var(--muted);
}
.so-account-nav .so-nav-link:hover { color: var(--ink); background: var(--subtle); }
.so-account-nav .so-nav-link.is-active { color: var(--ink); background: var(--card); box-shadow: 0 1px 3px rgba(35,38,61,.08), inset 0 0 0 1px var(--line); }
.so-account-nav .so-nav-link.is-active::before { background: var(--accent); }
.so-account > .so-card { padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.so-account > .so-card > * { margin: 0; }
.so-account > .so-card > .so-card-title { font-size: 26px; font-weight: 800; letter-spacing: -0.6px; }
.so-account > .so-card > .so-card-title + p,
.so-account > .so-card > .so-card-title + .so-muted { margin-top: -12px; font-size: 14px; color: var(--muted); }

/* -- Layout primitives / utilities -- */
.so-stack { display: flex; flex-direction: column; gap: 12px; }
.so-stack > * { margin: 0; }
.so-stack--lg { gap: 22px; }
.so-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.so-row--between { justify-content: space-between; }
.so-row--end { justify-content: flex-end; }
.so-muted { color: var(--muted); }
.so-faint { color: var(--faint); }
.so-mono { font-family: var(--font-mono); font-size: .92em; }
.so-right { text-align: right; margin-left: auto; }
.so-nowrap { white-space: nowrap; }
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* -- Responsive -- */
@media (max-width: 960px) {
  .so-app { grid-template-columns: minmax(0, 1fr); }
  .so-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 50;
    width: min(280px, 86vw);
    transform: translateX(-100%);
    transition: transform .25s cubic-bezier(.2,.8,.2,1);
  }
  .so-sidebar[data-open] { transform: none; box-shadow: var(--shadow-dialog); }
  .so-sidebar[data-open] ~ .so-scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 40;
    background: var(--scrim);
    animation: so-fade .2s ease;
  }
  .so-menu-btn { display: inline-flex; }
  .so-topbar { padding: 0 16px; gap: 12px; }
  .so-main { padding: 20px 16px 48px; }
  .so-page-header h1 { font-size: 28px; }
}
@media (max-width: 900px) {
  .so-auth { grid-template-columns: minmax(0, 1fr); }
  .so-auth-hero { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 18px 20px; }
  .so-auth-headline { margin: 0; flex: 1 1 260px; font-size: 18px; letter-spacing: -0.3px; line-height: 1.25; max-width: none; }
  .so-auth-lede, .so-auth-glass { display: none; }
  .so-glow--1 { width: 320px; height: 240px; top: -140px; }
  .so-glow--2 { display: none; }
  .so-auth-panel { padding: 20px; }
  .so-auth-title { font-size: 32px; }
}
@media (max-width: 760px) {
  .so-account-bar { padding: 0 16px; }
  .so-account-main { padding: 20px 16px 40px; }
  .so-account { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .so-account-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .so-account-nav .so-nav-link { white-space: nowrap; flex-shrink: 0; }
  .so-account > .so-card { padding: 20px; }
}
@media (max-width: 640px) {
  .so-hide-sm { display: none !important; }
  .so-env { display: none; }
  .so-menu > summary { max-width: 150px; }
  .so-page-header { grid-template-columns: minmax(0, 1fr); }
  .so-page-actions { grid-column: 1; grid-row: auto; justify-content: flex-start; margin-top: 8px; }
  .so-list-item { grid-template-columns: 48px minmax(0, 1fr) auto; padding: 11px 16px; }
  .so-search { max-width: none; }
}

/* -- Motion -- */
@keyframes so-rise { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes so-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes so-bloom { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: .9; transform: scale(1.08); } }
.so-main > * { animation: so-rise .3s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .so-glow { animation: none; }
}
