/*
 * Butyle admin theme, on top of Tabler 1.7.3 (RTL build).
 * CSP: this file is the only first-party style sheet. No inline style, no
 * data: URI, no external URL. Every image Tabler embedded as a data: URI is
 * replaced below with a local file under /static/img/ui.
 *
 * Theming: every colour token is a light-dark() pair, so the theme follows
 * `color-scheme` alone:
 *   html (no data-bs-theme)      -> "light dark": the operating system decides
 *   html[data-bs-theme=light]    -> light (Tabler)
 *   html[data-bs-theme=dark]     -> dark  (Tabler)
 * The manual toggle (admin.js) only sets data-bs-theme; without JavaScript
 * the page follows prefers-color-scheme.
 */

/*
 * Tabler is imported here, not linked from the page (Task L16): a style sheet
 * applies only once its imports have loaded, so Tabler's own rules, whose
 * data: images the CSP blocks, never apply before the replacements below. A
 * separate <link> raced: from the cache Tabler applied first and, without
 * JavaScript to hold the parser, the browser requested those images. The
 * cascade order is unchanged: Tabler first, this theme after it.
 */
@import url("/static/vendor/tabler/1.7.3/tabler.rtl.min.css");

/* ---------- Font (Vazirmatn 33.0.3, OFL 1.1, variable, local) ---------- */
@font-face {
  font-family: "Vazirmatn";
  src: url("/static/vendor/vazirmatn/33.0.3/Vazirmatn-wght.woff2") format("woff2-variations"),
       url("/static/vendor/vazirmatn/33.0.3/Vazirmatn-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---------- Butyle tokens ---------- */
:root {
  /* Surfaces */
  --b-page: light-dark(#f6f3f1, #141117);
  --b-surface: light-dark(#ffffff, #1d1921);
  --b-surface-2: light-dark(#faf7f6, #241f29);
  --b-border: light-dark(#e6dfe2, #3a3340);
  --b-control-border: light-dark(#8a7f8d, #80768a);

  /* Ink */
  --b-ink: light-dark(#261f2b, #f2edf3);
  --b-ink-2: light-dark(#4f4656, #d2c9d6);
  --b-muted: light-dark(#665d6c, #aba2b1);

  /* Brand: plum, with a bronze accent used for decoration only */
  --b-primary: light-dark(#7b3f6e, #dca6cf);
  --b-primary-hover: light-dark(#67335c, #e9bfde);
  --b-on-primary: light-dark(#ffffff, #2a1424);
  --b-primary-soft: light-dark(#f4e9f1, #3a2535);
  --b-primary-soft-ink: light-dark(#62305a, #efc9e5);
  --b-accent: light-dark(#a8743f, #d9a874);

  /* Status (always shown with an icon and a word, never colour alone) */
  --b-success: light-dark(#1d7350, #62cf9b);
  --b-success-soft: light-dark(#e5f3ec, #17332a);
  --b-warning: light-dark(#8a5200, #eab45a);
  --b-warning-soft: light-dark(#fbf0dc, #372a14);
  --b-danger: light-dark(#b3261e, #ff8f85);
  --b-danger-soft: light-dark(#fbe9e7, #3d1b1a);
  --b-info: light-dark(#285f8f, #91c0f2);
  --b-info-soft: light-dark(#e6eff7, #172c40);

  /* Sidebar: deep plum in both themes */
  --b-sidebar: light-dark(#2a1f2b, #100d12);
  --b-sidebar-ink: #eadfe8;
  --b-sidebar-muted: light-dark(#bcaebb, #a99aa8);
  --b-sidebar-active: light-dark(#3d2c3d, #2a2030);
  --b-sidebar-mark: #d9a874;

  /* Login brand panel (Issue #57, U1): sand to soft plum, or deep plum */
  --b-auth-art-from: light-dark(#f6efe6, #241b26);
  --b-auth-art-to: light-dark(#efe1ec, #17121a);

  /* Chart (validated: dataviz six checks, both surfaces) */
  --b-chart: light-dark(#7b3f6e, #c46fb0);
  --b-chart-grid: light-dark(#ece6e9, #2f2935);

  /* Shape and rhythm */
  --b-radius: 10px;
  --b-radius-sm: 6px;
  --b-radius-lg: 14px;
  --b-shadow: 0 1px 2px light-dark(rgb(42 31 43 / 6%), rgb(0 0 0 / 40%)), 0 4px 16px light-dark(rgb(42 31 43 / 5%), rgb(0 0 0 / 30%));
  --b-focus: light-dark(#7b3f6e, #f0c4e4);
  --b-sidebar-width: 264px;
  --b-sidebar-rail: 76px;
  --b-topbar-height: 60px;

  /* ---------- Tabler mapping ---------- */
  --tblr-font-sans-serif: "Vazirmatn", Tahoma, "Segoe UI", system-ui, sans-serif;
  --tblr-body-font-family: var(--tblr-font-sans-serif);
  --tblr-body-font-size: 0.9375rem;
  --tblr-body-line-height: 1.75;
  --tblr-body-bg: var(--b-page);
  --tblr-body-color: var(--b-ink);
  --tblr-emphasis-color: var(--b-ink);
  --tblr-heading-color: var(--b-ink);
  --tblr-secondary: var(--b-muted);
  --tblr-secondary-color: var(--b-muted);
  --tblr-bg-surface: var(--b-surface);
  --tblr-bg-surface-secondary: var(--b-surface-2);
  --tblr-bg-forms: var(--b-surface);
  --tblr-border-color: var(--b-border);
  --tblr-border-color-translucent: var(--b-border);
  --tblr-primary: var(--b-primary);
  --tblr-primary-rgb: 123, 63, 110;
  --tblr-primary-fg: var(--b-on-primary);
  --tblr-primary-darken: var(--b-primary-hover);
  --tblr-primary-lt: var(--b-primary-soft);
  --tblr-link-color: var(--b-primary);
  --tblr-link-hover-color: var(--b-primary-hover);
  --tblr-success: var(--b-success);
  --tblr-warning: var(--b-warning);
  --tblr-danger: var(--b-danger);
  --tblr-info: var(--b-info);
  --tblr-border-radius: var(--b-radius-sm);
  --tblr-card-border-radius: var(--b-radius);

  /* Replacements of Tabler's data: URI images (blocked by the CSP) */
  --tblr-control-select-bg: url("/static/img/ui/select-chevron.svg");
  --tblr-control-select-bg-dark: url("/static/img/ui/select-chevron.svg");
  --tblr-btn-close-bg: url("/static/img/ui/close.svg");
}

/* Auto: follow the operating system until the user picks a theme. */
html:not([data-bs-theme=light]):not([data-bs-theme=dark]) {
  color-scheme: light dark;
}

/* Tabler 1.7.3's RTL build places the arrow on the right but pads the left. */
[dir=rtl] .form-select:not([multiple]):not([size]) { background-position: left var(--tblr-control-padding-x, 0.75rem) center, left 2.25rem center; }
.form-select {
  --tblr-control-select-bg: url("/static/img/ui/select-chevron.svg");
  --tblr-control-select-bg-dark: url("/static/img/ui/select-chevron.svg");
}
[data-bs-theme=dark] .form-select { --tblr-control-select-bg: url("/static/img/ui/select-chevron.svg"); }
.form-check-input[type=checkbox] { --tblr-form-check-icon: url("/static/img/ui/check-mask.svg"); }
.form-check-input[type=radio] { --tblr-form-check-icon: url("/static/img/ui/radio-mask.svg"); }
.form-check-input[type=checkbox]:indeterminate { --tblr-form-check-icon: url("/static/img/ui/minus-mask.svg"); }
.was-validated .form-control:valid, .form-control.is-valid { background-image: url("/static/img/ui/valid.svg"); }
.was-validated .form-control:invalid, .form-control.is-invalid { background-image: url("/static/img/ui/invalid.svg"); }
.was-validated .form-select:valid:not([multiple]):not([size]), .form-select.is-valid:not([multiple]):not([size]) { --tblr-form-select-bg-icon: url("/static/img/ui/valid.svg"); }
.was-validated .form-select:invalid:not([multiple]):not([size]), .form-select.is-invalid:not([multiple]):not([size]) { --tblr-form-select-bg-icon: url("/static/img/ui/invalid.svg"); }
.btn-close { --tblr-btn-close-bg: url("/static/img/ui/close.svg"); }
.table-sort::after { mask-image: url("/static/img/ui/sort-mask.svg"); }
.table-sort.asc::after { mask-image: url("/static/img/ui/sort-asc-mask.svg"); }
.table-sort.desc::after { mask-image: url("/static/img/ui/sort-desc-mask.svg"); }

/* ---------- Base ---------- */
html, body { min-height: 100%; }
body {
  background: var(--b-page);
  color: var(--b-ink);
  font-feature-settings: "ss01" 0;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-weight: 700; letter-spacing: 0; }
a { text-underline-offset: 0.2em; }
code, kbd, .ltr-value, .font-monospace {
  font-family: "Cascadia Mono", Consolas, "Courier New", monospace;
}
.ltr-value { direction: ltr; unicode-bidi: isolate; }
bdi, .bidi { unicode-bidi: isolate; }

:focus-visible {
  outline: 2px solid var(--b-focus);
  outline-offset: 2px;
}
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible, .form-check-input:focus-visible {
  outline: 2px solid var(--b-focus);
  outline-offset: 2px;
  box-shadow: none;
}
.form-control, .form-select { border-color: var(--b-control-border); }
.form-control::placeholder { color: var(--b-muted); opacity: 1; }
.form-check-input { border-color: var(--b-control-border); }
.form-label { font-weight: 600; }
.form-hint { color: var(--b-muted); }

.visually-hidden-focusable:not(:focus):not(:focus-within), .sr-only {
  position: absolute !important; width: 1px !important; height: 1px !important;
  padding: 0 !important; margin: -1px !important; overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important;
}

/* Icons: <svg class="icon"><use href="…tabler-sprite.svg#ti-name"></use></svg> */
.icon {
  width: 1.25rem; height: 1.25rem;
  flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -0.25em;
}
.icon-sm { width: 1rem; height: 1rem; }
.icon-lg { width: 1.75rem; height: 1.75rem; }
.icon-xl { width: 3rem; height: 3rem; stroke-width: 1.25; }
/* Directional icons mirror in RTL. */
[dir=rtl] .icon-flip { transform: scaleX(-1); }

/* Progressive enhancement switches. theme.js adds class "js" to <html>. */
html:not(.js) .js-only { display: none !important; }
html.js .no-js-only { display: none !important; }

/* Skip link */
.skip-link {
  position: absolute; inset-inline-start: 1rem; top: -100px; z-index: 1100;
  background: var(--b-primary); color: var(--b-on-primary);
  padding: 0.5rem 1rem; border-radius: var(--b-radius-sm);
}
.skip-link:focus { top: 0.75rem; }

/* ---------- App shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--b-sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--b-topbar-height) 1fr;
  grid-template-areas: "sidebar topbar" "sidebar main";
  min-height: 100vh;
}
html.sidebar-collapsed .shell { grid-template-columns: var(--b-sidebar-rail) minmax(0, 1fr); }

.sidebar {
  grid-area: sidebar;
  background: var(--b-sidebar);
  color: var(--b-sidebar-ink);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
  z-index: 30;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 0.75rem;
  height: var(--b-topbar-height);
  padding-inline: 1.25rem;
  color: var(--b-sidebar-ink);
  text-decoration: none;
  border-bottom: 1px solid rgb(255 255 255 / 8%);
}
.sidebar-brand:hover { color: #fff; text-decoration: none; }
/* The owner's logo (2026-11-08): a square JPEG tile with its own background,
   so it reads the same in the light and the dark theme. The height caps it;
   width: auto keeps the aspect ratio. */
.brand-logo { width: auto; height: auto; max-width: 100%; max-height: 40px; flex: none; border-radius: 25%; }
.brand-logo-sm { max-height: 32px; }
.brand-logo-lg { max-height: 56px; }
.brand-name { font-weight: 800; font-size: 1.05rem; line-height: 1.2; }
.brand-sub { display: block; font-size: 0.75rem; font-weight: 400; color: var(--b-sidebar-muted); }

.sidebar-nav { padding: 1rem 0.75rem; flex: 1; }
.nav-group + .nav-group { margin-top: 1.25rem; }
.nav-group-title {
  font-size: 0.75rem; font-weight: 600; color: var(--b-sidebar-muted);
  padding-inline: 0.75rem; margin: 0 0 0.375rem;
}
.nav-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav-link-b {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--b-radius-sm);
  color: var(--b-sidebar-ink);
  text-decoration: none;
  position: relative;
}
.nav-link-b:hover { background: rgb(255 255 255 / 6%); color: #fff; text-decoration: none; }
.nav-link-b[aria-current=page] { background: var(--b-sidebar-active); color: #fff; font-weight: 600; }
.nav-link-b[aria-current=page]::before {
  content: ""; position: absolute; inset-inline-start: -0.75rem; top: 0.5rem; bottom: 0.5rem;
  width: 3px; border-radius: 3px; background: var(--b-sidebar-mark);
}
.nav-link-b:focus-visible { outline-color: #f0c4e4; }
.nav-link-b .badge { margin-inline-start: auto; }
.sidebar-foot {
  padding: 0.75rem 1.25rem 1rem;
  font-size: 0.75rem; color: var(--b-sidebar-muted);
  border-top: 1px solid rgb(255 255 255 / 8%);
}

/* Collapsed rail (desktop, JS) */
html.sidebar-collapsed .sidebar .brand-text,
html.sidebar-collapsed .sidebar .nav-text,
html.sidebar-collapsed .sidebar .nav-group-title,
html.sidebar-collapsed .sidebar .sidebar-foot,
html.sidebar-collapsed .sidebar .nav-link-b .badge { display: none; }
html.sidebar-collapsed .sidebar-brand { justify-content: center; padding-inline: 0; }
html.sidebar-collapsed .nav-link-b { justify-content: center; padding-inline: 0; }

.topbar {
  grid-area: topbar;
  display: flex; align-items: center; gap: 0.75rem;
  padding-inline: 1.5rem;
  background: var(--b-surface);
  border-bottom: 1px solid var(--b-border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .spacer { flex: 1; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  border: 1px solid transparent; border-radius: var(--b-radius-sm);
  background: transparent; color: var(--b-ink-2);
  cursor: pointer;
}
.icon-btn:hover { background: var(--b-surface-2); color: var(--b-ink); border-color: var(--b-border); }

.env-badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.8125rem; font-weight: 600;
  padding: 0.2rem 0.65rem; border-radius: 100rem;
  border: 1px solid currentColor;
}
.env-badge.env-production { color: var(--b-danger); background: var(--b-danger-soft); }
.env-badge.env-staging { color: var(--b-warning); background: var(--b-warning-soft); }
.env-badge.env-development { color: var(--b-info); background: var(--b-info-soft); }

/* Disclosure menu (details/summary: works without JS) */
.menu { position: relative; display: inline-block; }
.menu > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.3rem 0.5rem; border-radius: var(--b-radius-sm);
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary:hover { background: var(--b-surface-2); }
.menu-panel {
  position: absolute; inset-inline-end: 0; top: calc(100% + 6px);
  min-width: 240px;
  background: var(--b-surface);
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius);
  box-shadow: var(--b-shadow);
  padding: 0.5rem;
  z-index: 50;
}
.menu-panel a, .menu-panel button.menu-item {
  display: flex; align-items: center; gap: 0.6rem; width: 100%;
  padding: 0.5rem 0.65rem; border-radius: var(--b-radius-sm);
  color: var(--b-ink); text-decoration: none;
  background: none; border: 0; font: inherit; text-align: start; cursor: pointer;
}
.menu-panel a:hover, .menu-panel button.menu-item:hover { background: var(--b-surface-2); }
.menu-panel hr { margin: 0.4rem 0; border-color: var(--b-border); opacity: 1; }
.menu-head { padding: 0.4rem 0.65rem 0.6rem; }
.menu-head .who { font-weight: 700; }
.menu-head .role { font-size: 0.8125rem; color: var(--b-muted); }

.avatar-b {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--b-primary-soft); color: var(--b-primary-soft-ink);
  font-weight: 700; font-size: 0.9rem;
}

.main {
  grid-area: main;
  padding: 1.5rem 1.75rem 3rem;
  min-width: 0;
}
.content { max-width: 1280px; margin-inline: auto; }
.content-narrow { max-width: 760px; margin-inline: auto; }

/* Breadcrumbs */
.crumbs { margin-bottom: 0.5rem; }
.crumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; font-size: 0.8125rem; }
.crumbs li { display: inline-flex; align-items: center; gap: 0.5rem; color: var(--b-muted); }
.crumbs li + li::before { content: "/"; color: var(--b-border); }
.crumbs a { color: var(--b-muted); text-decoration: none; }
.crumbs a:hover { color: var(--b-primary); text-decoration: underline; }
.crumbs [aria-current=page] { color: var(--b-ink-2); }

/* Page header */
.page-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
  gap: 1rem; margin-bottom: 1.5rem;
}
.page-head h1 { font-size: 1.5rem; margin: 0; }
.page-head .lead-b { color: var(--b-muted); margin: 0.25rem 0 0; max-width: 70ch; }
.page-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* ---------- Cards and panels ---------- */
.card { border-color: var(--b-border); box-shadow: var(--b-shadow); border-radius: var(--b-radius); }
.card-header { border-bottom-color: var(--b-border); }
.card-title { font-weight: 700; }
.card-sub { color: var(--b-muted); font-size: 0.8125rem; margin: 0; }
.section-gap { margin-top: 1.5rem; }
.grid-b { display: grid; gap: 1rem; }
.grid-kpi { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
@media (min-width: 1200px) { .grid-kpi { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.grid-2 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
.grid-halves { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* KPI tile */
.kpi { padding: 1.1rem 1.25rem; }
.kpi-label { display: flex; align-items: center; gap: 0.5rem; color: var(--b-muted); font-size: 0.875rem; margin: 0; }
.kpi-label .icon { color: var(--b-primary); }
.kpi-value { font-size: 1.75rem; font-weight: 800; line-height: 1.3; margin: 0.35rem 0 0.15rem; color: var(--b-ink); }
.kpi-value small { font-size: 0.875rem; font-weight: 500; color: var(--b-muted); }
.kpi-foot { font-size: 0.8125rem; color: var(--b-muted); margin: 0; }
.kpi-hero .kpi-value { font-size: 2.75rem; }

/* Status pill: icon + word, never colour alone */
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.15rem 0.6rem; border-radius: 100rem;
  font-size: 0.8125rem; font-weight: 600; line-height: 1.6;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pill .icon { width: 0.95rem; height: 0.95rem; stroke-width: 2.25; }
.pill-success { color: var(--b-success); background: var(--b-success-soft); }
.pill-warning { color: var(--b-warning); background: var(--b-warning-soft); }
.pill-danger { color: var(--b-danger); background: var(--b-danger-soft); }
.pill-info { color: var(--b-info); background: var(--b-info-soft); }
.pill-neutral { color: var(--b-ink-2); background: var(--b-surface-2); border-color: var(--b-border); }
.pill-brand { color: var(--b-primary-soft-ink); background: var(--b-primary-soft); }
.pill-outline { background: transparent; border-color: currentColor; }

/* Health row */
.health-list { list-style: none; margin: 0; padding: 0; }
.health-list li {
  display: flex; align-items: flex-start; gap: 0.75rem;
  padding: 0.85rem 0; border-bottom: 1px solid var(--b-border);
}
.health-list li:last-child { border-bottom: 0; }
.health-list .h-name { font-weight: 600; }
.health-list .h-desc { font-size: 0.8125rem; color: var(--b-muted); margin: 0; }
.health-list .pill { margin-inline-start: auto; }

/* Token-state breakdown (stacked bar as SVG; the list carries the numbers) */
.breakdown { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.4rem; }
.breakdown li { display: flex; align-items: center; gap: 0.5rem; font-size: 0.875rem; }
.breakdown .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.breakdown .count { margin-inline-start: auto; font-weight: 700; }
.sw-1 { background: var(--b-success); fill: var(--b-success); }
.sw-2 { background: var(--b-warning); fill: var(--b-warning); }
.sw-3 { background: var(--b-info); fill: var(--b-info); }
.sw-4 { background: var(--b-muted); fill: var(--b-muted); }
.stackbar { width: 100%; height: 12px; display: block; }

/* ---------- Chart (SVG, server-rendered geometry; no inline style) ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid line { stroke: var(--b-chart-grid); stroke-width: 1; }
.chart .axis text, .chart .label { fill: var(--b-muted); font-size: 11px; font-family: var(--tblr-font-sans-serif); }
.chart .value { fill: var(--b-ink); font-size: 11px; font-weight: 700; font-family: var(--tblr-font-sans-serif); }
.chart .bar { fill: var(--b-chart); }
.chart .bar-hit { fill: transparent; }
.chart g.col:hover .bar, .chart g.col:focus .bar { fill: var(--b-primary-hover); }
.chart g.col:focus { outline: none; }
.chart g.col:focus .bar-hit { stroke: var(--b-focus); stroke-width: 2; }
.chart-wrap { position: relative; }
.chart-table summary { cursor: pointer; color: var(--b-primary); font-size: 0.875rem; margin-top: 0.5rem; }

/* ---------- Tables ---------- */
.table { --tblr-table-bg: transparent; margin-bottom: 0; }
.table > :not(caption) > * > * { border-bottom-color: var(--b-border); padding: 0.75rem 1rem; }
.table thead th {
  background: var(--b-surface-2);
  color: var(--b-muted);
  font-size: 0.8125rem; font-weight: 600;
  text-transform: none; letter-spacing: 0;
  white-space: nowrap;
}
.table tbody tr:hover > * { background: var(--b-surface-2); }
.table .cell-main { font-weight: 600; color: var(--b-ink); }
.table .cell-sub { display: block; font-size: 0.8125rem; color: var(--b-muted); font-weight: 400; }
.table .num { text-align: start; font-variant-numeric: tabular-nums; }
.table-responsive { border-radius: 0 0 var(--b-radius) var(--b-radius); }
th[aria-sort] a, th .sort-link {
  color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 0.25rem;
}
th .sort-link:hover { color: var(--b-ink); }
th .sort-link .icon { width: 0.9rem; height: 0.9rem; }
.row-link { color: var(--b-ink); text-decoration: none; }
.row-link:hover { color: var(--b-primary); text-decoration: underline; }

/* Toolbar of filters (GET form) */
.filterbar {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--b-border);
}
.filterbar .field { display: grid; gap: 0.25rem; min-width: 150px; }
.filterbar .field-grow { flex: 1 1 240px; }
.filterbar .form-label { font-size: 0.8125rem; margin: 0; color: var(--b-muted); }
/* Search fields (Issue #57, U2). The field is dir="auto", so Latin text
   keeps its own order, but its sides are physical here: an empty field and
   any text start at the right (the caret too), the icon sits on the left
   (the inline end of the RTL page) and only the left is padded for it,
   whichever way the typed text runs. These rules are the search fields'
   own: the password reveal field (.input-reveal, Issue #54) shares none of
   them. */
.search-input { position: relative; }
.search-input .icon { position: absolute; left: 0.7rem; top: 50%; translate: 0 -50%; color: var(--b-muted); pointer-events: none; }
.search-input .form-control { text-align: right; padding-left: 2.3rem; padding-right: var(--tblr-control-padding-x, 0.75rem); }
/* A Persian filter field without an icon (the catalog test page). */
.form-control.search-text { text-align: right; }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.25rem 0.75rem; border-radius: 100rem;
  border: 1px solid var(--b-border); background: var(--b-surface);
  color: var(--b-ink-2); font-size: 0.8125rem; text-decoration: none;
}
.chip:hover { border-color: var(--b-primary); color: var(--b-primary); text-decoration: none; }
.chip[aria-current=true] { background: var(--b-primary-soft); color: var(--b-primary-soft-ink); border-color: transparent; font-weight: 600; }
.result-meta { color: var(--b-muted); font-size: 0.8125rem; }

/* Pagination */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; padding: 0.85rem 1.25rem; border-top: 1px solid var(--b-border); }
.pager-links { display: flex; gap: 0.35rem; list-style: none; margin: 0; padding: 0; }
.pager-links a, .pager-links span {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.25rem;
  min-width: 36px; height: 36px; padding: 0 0.6rem;
  border-radius: var(--b-radius-sm); border: 1px solid var(--b-border);
  color: var(--b-ink-2); text-decoration: none; font-size: 0.875rem;
}
.pager-links a:hover { border-color: var(--b-primary); color: var(--b-primary); }
.pager-links [aria-current=page] { background: var(--b-primary); color: var(--b-on-primary); border-color: var(--b-primary); font-weight: 700; }
.pager-links .disabled { color: var(--b-muted); opacity: 0.6; }

/* Profile completeness: five segments, each an element (no width style) */
.segments { display: inline-flex; gap: 3px; vertical-align: middle; }
.segments .seg { width: 14px; height: 8px; border-radius: 2px; background: var(--b-border); }
.segments .seg.on { background: var(--b-success); }
.segments.partial .seg.on { background: var(--b-warning); }
.completeness { display: flex; align-items: center; gap: 0.5rem; }
.completeness .ratio { font-size: 0.8125rem; color: var(--b-muted); }
.facts { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.3rem; }
.fact {
  display: inline-flex; align-items: center; gap: 0.25rem;
  font-size: 0.75rem; padding: 0.05rem 0.45rem; border-radius: 4px;
  border: 1px solid var(--b-border); color: var(--b-muted);
}
.fact .icon { width: 0.8rem; height: 0.8rem; stroke-width: 2.5; }
.fact.ok { color: var(--b-success); border-color: transparent; background: var(--b-success-soft); }

/* Segmented control (radio group styled as buttons) */
.segmented { display: inline-flex; border: 1px solid var(--b-control-border); border-radius: var(--b-radius-sm); overflow: hidden; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  padding: 0.3rem 0.8rem; font-size: 0.8125rem; cursor: pointer; color: var(--b-ink-2); margin: 0; font-weight: 500;
  border-inline-start: 1px solid var(--b-border);
}
.segmented label:first-of-type { border-inline-start: 0; }
.segmented input:checked + label { background: var(--b-primary); color: var(--b-on-primary); font-weight: 600; }
.segmented input:focus-visible + label { outline: 2px solid var(--b-focus); outline-offset: -2px; }

/* Definition list for details */
.dl-b { display: grid; grid-template-columns: max-content 1fr; gap: 0.6rem 1.5rem; margin: 0; }
.dl-b dt { color: var(--b-muted); font-weight: 500; }
.dl-b dd { margin: 0; color: var(--b-ink); font-weight: 600; }

/* ---------- Alerts, toasts ---------- */
.alert-b {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.85rem 1rem; border-radius: var(--b-radius-sm);
  border: 1px solid transparent; margin-bottom: 1rem;
}
.alert-b .icon { margin-top: 0.2rem; }
.alert-b p { margin: 0; }
.alert-b .alert-title { font-weight: 700; }
.alert-b .alert-close { margin-inline-start: auto; }
.alert-b.success { background: var(--b-success-soft); color: var(--b-success); border-color: color-mix(in oklab, var(--b-success) 30%, transparent); }
.alert-b.danger { background: var(--b-danger-soft); color: var(--b-danger); border-color: color-mix(in oklab, var(--b-danger) 30%, transparent); }
.alert-b.warning { background: var(--b-warning-soft); color: var(--b-warning); border-color: color-mix(in oklab, var(--b-warning) 30%, transparent); }
.alert-b.info { background: var(--b-info-soft); color: var(--b-info); border-color: color-mix(in oklab, var(--b-info) 30%, transparent); }
.alert-b .alert-body { color: var(--b-ink); }
.alert-b .alert-body .alert-title { color: inherit; }

/* With JS, the page's notices move into a fixed toast region. */
.toast-region { display: grid; gap: 0.5rem; }
html.js .toast-region.floating {
  position: fixed; inset-inline-start: 1.25rem; bottom: 1.25rem; z-index: 1080;
  width: min(420px, calc(100vw - 2.5rem));
}
html.js .toast-region.floating .alert-b { box-shadow: var(--b-shadow); margin: 0; background-clip: padding-box; }
html.js .toast-region.floating .alert-b.success { background: color-mix(in oklab, var(--b-success-soft) 92%, var(--b-surface)); }

/* ---------- One-time secret ---------- */
.secret-panel {
  border: 2px dashed var(--b-primary);
  border-radius: var(--b-radius);
  background: var(--b-primary-soft);
  padding: 1.25rem;
}
.secret-panel h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 0.5rem; color: var(--b-primary-soft-ink); }
.secret-value {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem;
  background: var(--b-surface); border: 1px solid var(--b-border); border-radius: var(--b-radius-sm);
  padding: 0.75rem 1rem; margin: 0.5rem 0 1rem;
}
.secret-value code {
  font-size: 1.25rem; letter-spacing: 0.08em; color: var(--b-ink);
  direction: ltr; unicode-bidi: isolate; word-break: break-all; flex: 1;
}
.secret-value code.uri { font-size: 0.8125rem; letter-spacing: 0; }
/* The QR code of a new TOTP secret (Task L16), drawn on a canvas by admin.js;
   black on white in both themes, so every authenticator can read it. */
.qr-box { margin: 0.75rem 0 0.25rem; }
.qr-box canvas { display: block; width: 200px; height: 200px; image-rendering: pixelated; border-radius: 6px; border: 1px solid var(--b-border); }
.copy-warning { margin: 0.35rem 0 0; color: var(--b-muted); font-size: 0.8125rem; }
.secret-facts { list-style: none; padding: 0; margin: 0 0 0.75rem; display: grid; gap: 0.3rem; }
.secret-facts li { display: flex; gap: 0.5rem; align-items: flex-start; }

/* ---------- Wizard ---------- */
.wizard-steps { list-style: none; margin: 0 0 1.5rem; padding: 0; display: flex; gap: 0.5rem; counter-reset: step; }
.wizard-steps li {
  flex: 1; display: flex; align-items: center; gap: 0.6rem;
  padding: 0.75rem 1rem; border-radius: var(--b-radius);
  background: var(--b-surface); border: 1px solid var(--b-border);
  color: var(--b-muted); font-size: 0.875rem;
}
.wizard-steps .num {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 2px solid var(--b-border); font-weight: 700; color: var(--b-muted);
}
.wizard-steps .done { color: var(--b-ink-2); }
.wizard-steps .done .num { background: var(--b-success); border-color: var(--b-success); color: var(--b-surface); }
.wizard-steps [aria-current=step] { border-color: var(--b-primary); color: var(--b-ink); font-weight: 600; box-shadow: 0 0 0 3px var(--b-primary-soft); }
.wizard-steps [aria-current=step] .num { border-color: var(--b-primary); color: var(--b-primary); }
.wizard-steps .step-title { display: block; }
.wizard-steps .step-sub { display: block; font-size: 0.75rem; font-weight: 400; color: var(--b-muted); }

/* Choice cards (radio) */
.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.75rem; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; pointer-events: none; }
.choice label {
  display: flex; gap: 0.75rem; align-items: flex-start;
  border: 1px solid var(--b-control-border); border-radius: var(--b-radius);
  padding: 1rem; cursor: pointer; height: 100%; margin: 0; font-weight: 400;
  background: var(--b-surface);
}
.choice label .icon { color: var(--b-primary); }
.choice label strong { display: block; }
.choice label span { color: var(--b-muted); font-size: 0.8125rem; }
.choice input:checked + label { border-color: var(--b-primary); box-shadow: 0 0 0 2px var(--b-primary); background: var(--b-primary-soft); }
.choice input:focus-visible + label { outline: 2px solid var(--b-focus); outline-offset: 3px; }

/* ---------- Step-up ---------- */
/* Without JS the code field is part of the form; with JS it moves into a dialog. */
.stepup-field {
  border: 1px solid var(--b-border); border-radius: var(--b-radius-sm);
  background: var(--b-surface-2);
  padding: 0.85rem 1rem; margin: 1rem 0;
}
.stepup-field .form-label { display: flex; align-items: center; gap: 0.4rem; }
.code-input {
  direction: ltr; text-align: center;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 1.35rem; letter-spacing: 0.4em;
  max-width: 12rem;
}

dialog.dlg {
  border: 1px solid var(--b-border);
  border-radius: var(--b-radius-lg);
  padding: 0;
  width: min(460px, calc(100vw - 2rem));
  background: var(--b-surface); color: var(--b-ink);
  box-shadow: 0 24px 64px rgb(0 0 0 / 30%);
}
dialog.dlg::backdrop { background: rgb(20 12 20 / 55%); backdrop-filter: blur(2px); }
.dlg-head { display: flex; align-items: center; gap: 0.75rem; padding: 1.1rem 1.25rem 0.25rem; }
.dlg-head h2 { font-size: 1.1rem; margin: 0; }
.dlg-icon {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--b-primary-soft); color: var(--b-primary-soft-ink);
}
.dlg-icon.danger { background: var(--b-danger-soft); color: var(--b-danger); }
.dlg-body { padding: 0.5rem 1.25rem 1rem; }
.dlg-body p { color: var(--b-ink-2); }
.dlg-foot {
  display: flex; gap: 0.5rem; justify-content: flex-end;
  padding: 0.85rem 1.25rem; border-top: 1px solid var(--b-border);
  background: var(--b-surface-2); border-radius: 0 0 var(--b-radius-lg) var(--b-radius-lg);
}

/* Busy button (admin.js, prevents a double submit) */
.btn.is-busy { pointer-events: none; opacity: 0.8; }
.btn.is-busy .spinner-b { display: inline-block; }
.spinner-b {
  display: none; width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid currentColor; border-inline-end-color: transparent;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Empty, skeleton, error states ---------- */
.empty-b { text-align: center; padding: 3rem 1.5rem; }
.empty-icon {
  width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 1rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--b-primary-soft); color: var(--b-primary-soft-ink);
}
.empty-b h2, .empty-b h3 { font-size: 1.1rem; }
.empty-b p { color: var(--b-muted); max-width: 46ch; margin-inline: auto; }

.skel {
  display: block; border-radius: 6px; height: 0.9rem;
  background: linear-gradient(90deg, var(--b-surface-2) 25%, var(--b-border) 37%, var(--b-surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}
.skel-lg { height: 2rem; width: 50%; }
.skel-w60 { width: 60%; } .skel-w40 { width: 40%; } .skel-w80 { width: 80%; }
.skel + .skel { margin-top: 0.6rem; }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.status-page {
  min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5rem;
  padding: 2rem 1rem;
}
.status-card { max-width: 520px; width: 100%; text-align: center; padding: 2.5rem 2rem; }
.status-code { font-size: 4rem; font-weight: 900; line-height: 1; color: var(--b-primary); margin: 0 0 0.5rem; }

/* ---------- Auth pages ---------- */
.auth {
  min-height: 100vh;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
}
/* The brand panel (Issue #57, U1): the owner's logo on a plain Plum & Sand
   background, sand to soft plum in the light theme and deep plum in the
   dark one; no illustration and no image file besides the logo. */
.auth-art {
  background: linear-gradient(160deg, var(--b-auth-art-from), var(--b-auth-art-to));
  color: var(--b-ink);
  padding: 3rem;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 2.5rem;
  text-align: center;
  border-inline-start: 1px solid var(--b-border);
}
.auth-art .auth-art-logo { max-height: 168px; border-radius: 22%; box-shadow: var(--b-shadow); }
.auth-art .auth-art-name { font-size: 2rem; font-weight: 800; line-height: 1.3; margin: 1rem 0 0; color: var(--b-primary-soft-ink); }
.auth-art .auth-art-sub { color: var(--b-muted); margin: 0.25rem 0 0; }
.auth-art h2 { color: var(--b-ink); font-size: 1.5rem; max-width: 22ch; line-height: 1.6; margin-inline: auto; }
.auth-art p { color: var(--b-ink-2); max-width: 40ch; margin-inline: auto; }
.auth-art .feat { list-style: none; padding: 0; margin: 1.5rem auto 0; display: grid; gap: 0.75rem; width: fit-content; text-align: start; }
.auth-art .feat li { display: flex; gap: 0.6rem; align-items: center; color: var(--b-ink-2); }
.auth-art .feat .icon { color: var(--b-accent); }
.auth-form {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.5rem;
  padding: 2rem 1.25rem;
  background: var(--b-page);
}
.auth-box { width: 100%; max-width: 420px; }
.auth-box h1 { font-size: 1.5rem; margin-bottom: 0.25rem; }
.auth-box .sub { color: var(--b-muted); margin-bottom: 1.5rem; }
.auth-tools { position: absolute; top: 1rem; inset-inline-end: 1rem; z-index: 5; display: flex; align-items: center; gap: 0.5rem; }
.input-reveal { position: relative; }
/* The wrapper carries dir="ltr" like its password field, so the button's
   inline end and the field's inline end are the same side and the value
   never runs under the button (4px inset + 34px button + 0.5rem gap). The
   space stays reserved without JavaScript, when the button is hidden. */
.input-reveal .icon-btn { position: absolute; inset-inline-end: 4px; top: 50%; translate: 0 -50%; width: 34px; height: 34px; }
.input-reveal .form-control { padding-inline-end: calc(38px + 0.5rem); }

/* Timeline (audit) */
.timeline-b { list-style: none; margin: 0; padding: 0 1.25rem; }
.timeline-b li { display: grid; grid-template-columns: 36px 1fr auto; gap: 0.75rem; padding: 0.85rem 0; border-bottom: 1px solid var(--b-border); }
.timeline-b li:last-child { border-bottom: 0; }
.tl-dot {
  width: 32px; height: 32px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--b-surface-2); color: var(--b-ink-2); border: 1px solid var(--b-border);
}
.tl-dot.ok { color: var(--b-success); background: var(--b-success-soft); border-color: transparent; }
.tl-dot.fail { color: var(--b-danger); background: var(--b-danger-soft); border-color: transparent; }
.tl-title { font-weight: 600; margin: 0; }
.tl-meta { font-size: 0.8125rem; color: var(--b-muted); margin: 0; }
.tl-time { font-size: 0.8125rem; color: var(--b-muted); white-space: nowrap; }

/* Hub (prototype index) */
.hub-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.75rem; }
.hub-list a {
  display: flex; gap: 0.75rem; align-items: flex-start; height: 100%;
  padding: 1rem; border-radius: var(--b-radius); border: 1px solid var(--b-border);
  background: var(--b-surface); color: var(--b-ink); text-decoration: none;
}
.hub-list a:hover { border-color: var(--b-primary); }
.hub-list a span { display: block; font-size: 0.8125rem; color: var(--b-muted); }
.hub-list .icon { color: var(--b-primary); margin-top: 0.2rem; }

/* Prototype-only annotation (not ported) */
.proto-note {
  border: 1px dashed var(--b-info); color: var(--b-info); background: var(--b-info-soft);
  border-radius: var(--b-radius-sm); padding: 0.4rem 0.75rem; font-size: 0.8125rem; margin-bottom: 1rem;
}

/* Drawer backdrop (mobile, JS) */
.drawer-backdrop { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 991.98px) {
  .shell, html.sidebar-collapsed .shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas: "topbar" "sidebar" "main";
  }
  /* Without JS the navigation stays visible, stacked under the top bar. */
  .sidebar { position: static; height: auto; }
  .sidebar .sidebar-brand { display: none; }
  .sidebar-nav { display: flex; flex-wrap: wrap; gap: 0.75rem 1.5rem; }
  .nav-group + .nav-group { margin-top: 0; }
  html.sidebar-collapsed .sidebar .nav-text, html.sidebar-collapsed .sidebar .nav-group-title { display: revert; }

  /* With JS it becomes an off-canvas drawer. */
  html.js .sidebar {
    position: fixed; top: 0; bottom: 0; inset-inline-start: 0;
    width: min(300px, 86vw); height: 100vh;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    z-index: 1060;
    visibility: hidden;
  }
  html.js .sidebar .sidebar-brand { display: flex; }
  html.js .sidebar-nav { display: block; }
  html.js .nav-group + .nav-group { margin-top: 1.25rem; }
  html.js.nav-open .sidebar { transform: none; visibility: visible; }
  html.js.nav-open .drawer-backdrop {
    display: block; position: fixed; inset: 0; z-index: 1050;
    background: rgb(20 12 20 / 50%); border: 0;
  }
  .topbar { padding-inline: 1rem; }
  .main { padding: 1.25rem 1rem 2.5rem; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { display: none; }
  .grid-halves { grid-template-columns: minmax(0, 1fr); }
  .wizard-steps { flex-direction: column; }
}
@media (max-width: 575.98px) {
  .topbar .who-text, .topbar .env-text { display: none; }
  .page-head h1 { font-size: 1.3rem; }
  .kpi-hero .kpi-value { font-size: 2.25rem; }
  .dl-b { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; }
  .dl-b dd { margin-bottom: 0.6rem; }
  .timeline-b li { grid-template-columns: 32px 1fr; }
  .timeline-b .tl-time { grid-column: 2; }
  .filterbar .field { min-width: 0; flex: 1 1 100%; }
  /* Stacked table rows on narrow screens */
  .table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table-stack tr { display: block; border-bottom: 1px solid var(--b-border); padding: 0.5rem 0; }
  .table-stack td { display: flex; justify-content: space-between; gap: 1rem; border: 0 !important; padding: 0.35rem 1rem !important; }
  .table-stack td::before { content: attr(data-label); color: var(--b-muted); font-size: 0.8125rem; font-weight: 500; }
  .table-stack td.cell-first { display: block; }
  .table-stack td.cell-first::before { content: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
@media (forced-colors: active) {
  .pill, .chip, .env-badge, .segments .seg { border: 1px solid CanvasText; }
  .segments .seg.on { background: Highlight; }
  .chart .bar { fill: Highlight; }
}
@media print {
  .sidebar, .topbar, .page-actions, .filterbar, .pager { display: none !important; }
  .shell { display: block; }
}

/* Chart text stays legible when the SVG scales down on phones. */
@media (max-width: 575.98px) {
  .chart .axis text, .chart .label, .chart .value { font-size: 20px; }
  .chart .label:nth-of-type(n) { display: none; }
  .chart g.col:nth-last-child(4n+1) .label { display: inline; }
}

/* ---------- The services form (Issue #57, U4) ---------- */
/* Two rows that wrap on narrow screens: the name (wide) and the category
   (as wide as its words); the price kind, the amounts, the duration and the
   button. No control is wider than it needs to be. */
.svc-row { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0.75rem 1rem; margin-bottom: 0.75rem; }
.svc-row-price { align-items: flex-end; }
.svc-field { margin: 0; min-width: 0; }
.svc-field > .form-label, .svc-field > legend.form-label { font-size: 0.8125rem; margin-bottom: 0.25rem; }
.svc-name { flex: 1 1 18rem; }
.svc-name .form-hint { margin: 0.25rem 0 0; font-size: 0.75rem; }
.svc-category { flex: 0 0 auto; }
.svc-category .form-select { width: auto; min-width: 10rem; }
.svc-kind { flex: 0 0 auto; border: 0; padding: 0; }
.svc-kind legend { float: none; width: auto; padding: 0; }
.svc-kind .segmented label { padding: 0.375rem 0.75rem; }
.svc-amount { flex: 0 0 auto; }
.svc-amount .form-control { width: 10rem; }
.svc-duration { flex: 0 0 auto; border: 0; padding: 0; }
.svc-duration legend { float: none; width: auto; padding: 0; }
.svc-pair { display: flex; align-items: center; gap: 0.4rem; }
.svc-pair .form-control { width: 4.5rem; }
.svc-pair-label { margin: 0; font-size: 0.8125rem; color: var(--b-muted); }
.svc-submit { flex: 0 0 auto; margin-inline-start: auto; }
.svc-kept { font-size: 0.8125rem; margin: 0 0 0.5rem; color: var(--b-ink-2); }
.svc-form .form-hint { font-size: 0.75rem; margin: 0 0 0.25rem; }
.svc-description { margin-top: 0.5rem; }
.svc-description > summary { cursor: pointer; color: var(--b-primary); font-size: 0.875rem; }
.svc-description[open] > summary { margin-bottom: 0.5rem; }
/* With JavaScript, the amount fields and labels of other price kinds are hidden (U3). */
[data-kinds][hidden], [data-kind-label][hidden] { display: none !important; }
@media (max-width: 575.98px) {
  .svc-submit { margin-inline-start: 0; flex: 1 1 100%; }
  .svc-submit .btn { width: 100%; }
}

/* The quick entry (Issue #57, U6), a <details> card on the services page. */
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary .card-title::after { content: "\25BE"; margin-inline-start: 0.5rem; color: var(--b-muted); }
details.card[open] > summary .card-title::after { content: "\25B4"; }
.quick-examples { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.25rem; }
.quick-examples code { font-family: var(--tblr-font-sans-serif); background: var(--b-surface-2); border: 1px solid var(--b-border); border-radius: var(--b-radius-sm); padding: 0.1rem 0.5rem; color: var(--b-ink); }

/* LTR values (codes, keys, numbers) in an RTL page: validation icon on the right. */
.form-control[dir=ltr].is-invalid, .form-control[dir=ltr].is-valid {
  background-position: right 0.75rem center;
  padding-right: 2.5rem; padding-left: var(--tblr-control-padding-x, 0.75rem);
}
/* A button beside a labelled field lines up with the field. */
.btn-align { margin-top: 34px; }
/* A stored text shown as it was sent, its lines kept (Issue #79, the data snapshot). */
.pre-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.pre-text > div { min-height: 1.5em; }

/* Stage 2b: the preview of a legal text keeps its line breaks. */
.legal-preview-paragraph { white-space: pre-line; }
