/* Web UI design system – hand-made, no build step.
 *
 * Theming: every color is a CSS variable. White-label branding overrides the
 * --brand-* / --brand-contrast / --accent tokens per reseller via a nonce'd <style>
 * block emitted by the layout (see internal/web/branding.go); everything else
 * derives from those tokens. Dark mode follows prefers-color-scheme unless
 * <html data-theme="light|dark"> forces a scheme (theme toggle in the top bar).
 *
 * Typography: Inter (variable, self-hosted – @font-face in layouts/base.html).
 * Naming: plain, short classes (.btn, .btn-primary, .card, .card-header ...).
 * No style="" attributes anywhere: the CSP forbids inline styles.
 */

:root {
  --brand-50: #eef2ff; --brand-100: #e0e7ff; --brand-200: #c7d2fe; --brand-300: #a5b4fc;
  --brand-400: #818cf8; --brand-500: #6366f1; --brand-600: #4f46e5; --brand-700: #4338ca;
  --brand-800: #3730a3; --brand-900: #312e81;
  --brand: var(--brand-600);
  --brand-contrast: #ffffff;
  --accent: #10b981;
  --link: var(--brand-600);
  --brand-soft: var(--brand-50);
  --brand-soft-text: var(--brand-700);
  --ring: color-mix(in srgb, var(--brand-500) 35%, transparent);

  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f8f9fb; --surface-3: #eff1f4;
  --border: #e4e7ec; --border-strong: #d0d5dd; --divider: #eef0f3;
  --text: #101828; --text-2: #344054; --muted: #5d6678; --faint: #98a2b3;

  --sidebar-bg: #fbfbfc; --sidebar-border: var(--border); --sidebar-text: #344054; --sidebar-muted: #7a8394;
  --sidebar-hover: #f0f2f5; --sidebar-active: #ffffff; --sidebar-active-text: var(--text);
  --sidebar-icon: #8a93a3; --sidebar-active-icon: var(--brand-600);
  --topbar-bg: rgba(255, 255, 255, .82);

  --ok-bg: #ecfdf3; --ok-border: #abefc6; --ok-text: #067647; --ok: #12b76a;
  --warn-bg: #fffaeb; --warn-border: #fedf89; --warn-text: #93370d; --warn: #f79009;
  --err-bg: #fef3f2; --err-border: #fecdca; --err-text: #b42318; --err: #f04438; --err-strong: #d92d20;
  --info-bg: #eff8ff; --info-border: #b2ddff; --info-text: #175cd3; --info: #2e90fa;

  --radius-sm: .375rem; --radius: .5rem; --radius-lg: .75rem; --radius-xl: 1rem;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 12px 24px -6px rgba(16, 24, 40, .14), 0 4px 8px -4px rgba(16, 24, 40, .06);
  --font: "Inter Variable", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
  --sidebar-w: 16rem; --topbar-h: 3.75rem;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --link: var(--brand-300); --brand-soft: color-mix(in srgb, var(--brand-500) 18%, transparent); --brand-soft-text: var(--brand-200);
    --bg: #0b0d12; --surface: #12151c; --surface-2: #161a22; --surface-3: #1d222c;
    --border: #242a35; --border-strong: #333b48; --divider: #1d222b;
    --text: #eef0f4; --text-2: #cdd2dc; --muted: #959daf; --faint: #6b7385;
    --sidebar-bg: #0e1016; --sidebar-border: #1d222b; --sidebar-text: #c3c9d4; --sidebar-muted: #7d8597;
    --sidebar-hover: #171b23; --sidebar-active: #1c212b; --sidebar-active-text: #ffffff;
    --sidebar-icon: #7d8597; --sidebar-active-icon: var(--brand-300);
    --topbar-bg: rgba(11, 13, 18, .78);
    --ok-bg: #0b2a1c; --ok-border: #11583a; --ok-text: #75e0a7; --ok: #17b26a;
    --warn-bg: #2b1d07; --warn-border: #6b3f0b; --warn-text: #fec84b; --warn: #f79009;
    --err-bg: #2c0f0e; --err-border: #7a271a; --err-text: #fda29b; --err: #f04438;
    --info-bg: #0b1d36; --info-border: #194185; --info-text: #84caff; --info: #2e90fa;
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .3);
    --shadow-md: 0 4px 10px -2px rgba(0, 0, 0, .5);
    --shadow-lg: 0 16px 32px -8px rgba(0, 0, 0, .6), 0 4px 8px -4px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --link: var(--brand-300); --brand-soft: color-mix(in srgb, var(--brand-500) 18%, transparent); --brand-soft-text: var(--brand-200);
  --bg: #0b0d12; --surface: #12151c; --surface-2: #161a22; --surface-3: #1d222c;
  --border: #242a35; --border-strong: #333b48; --divider: #1d222b;
  --text: #eef0f4; --text-2: #cdd2dc; --muted: #959daf; --faint: #6b7385;
  --sidebar-bg: #0e1016; --sidebar-border: #1d222b; --sidebar-text: #c3c9d4; --sidebar-muted: #7d8597;
  --sidebar-hover: #171b23; --sidebar-active: #1c212b; --sidebar-active-text: #ffffff;
  --sidebar-icon: #7d8597; --sidebar-active-icon: var(--brand-300);
  --topbar-bg: rgba(11, 13, 18, .78);
  --ok-bg: #0b2a1c; --ok-border: #11583a; --ok-text: #75e0a7; --ok: #17b26a;
  --warn-bg: #2b1d07; --warn-border: #6b3f0b; --warn-text: #fec84b; --warn: #f79009;
  --err-bg: #2c0f0e; --err-border: #7a271a; --err-text: #fda29b; --err: #f04438;
  --info-bg: #0b1d36; --info-border: #194185; --info-text: #84caff; --info: #2e90fa;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 1px 3px rgba(0, 0, 0, .3);
  --shadow-md: 0 4px 10px -2px rgba(0, 0, 0, .5);
  --shadow-lg: 0 16px 32px -8px rgba(0, 0, 0, .6), 0 4px 8px -4px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.55; color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "cv11", "ss03"; text-rendering: optimizeLegibility; }
a { color: var(--link); text-decoration: none; text-underline-offset: 2px; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.25; color: var(--text); letter-spacing: -.011em; }
h1 { font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; }
h2 { font-size: 1.0625rem; font-weight: 600; }
h3 { font-size: .9375rem; font-weight: 600; }
h4 { font-size: .875rem; font-weight: 600; }
p { margin: 0 0 .75rem; }
strong, b { font-weight: 600; }
small { font-size: .8125rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1.25rem 0; }
code, pre, kbd, .mono { font-family: var(--mono); font-size: .8125rem; }
code { background: var(--surface-3); padding: .0625rem .3125rem; border-radius: var(--radius-sm); }
pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: .75rem 1rem; overflow-x: auto; }
pre code { background: none; padding: 0; }
kbd { display: inline-flex; align-items: center; padding: 0 .375rem; min-width: 1.25rem; height: 1.25rem; font-size: .6875rem; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: .3125rem; }
img, svg { vertical-align: middle; }
::selection { background: color-mix(in srgb, var(--brand-500) 25%, transparent); }
[x-cloak] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; border-radius: var(--radius-sm); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: -999px; top: .5rem; z-index: 200; background: var(--surface); color: var(--text); padding: .5rem 1rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.skip-link:focus { left: 1rem; }
.icon { width: 1.25rem; height: 1.25rem; flex-shrink: 0; }
.icon-sm { width: 1rem; height: 1rem; flex-shrink: 0; }
.icon-lg { width: 1.5rem; height: 1.5rem; flex-shrink: 0; }
.num, .tnum, time { font-variant-numeric: tabular-nums; }

/* ---------- app shell ---------- */
.shell { min-height: 100%; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--sidebar-bg); color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border); overflow-y: auto; overscroll-behavior: contain; z-index: 40; display: flex; flex-direction: column;
  transition: transform .25s var(--ease); scrollbar-width: thin; }
.sidebar-brand { display: flex; align-items: center; gap: .625rem; height: var(--topbar-h); padding: 0 1.125rem; color: var(--text); font-weight: 650; font-size: 1rem; letter-spacing: -.015em; flex-shrink: 0; }
.sidebar-brand img { height: 1.75rem; max-width: 8.5rem; object-fit: contain; }
.sidebar-brand a { color: inherit; min-width: 0; }
.sidebar-brand a:hover { text-decoration: none; }
.brand-mark { width: 1.875rem; height: 1.875rem; border-radius: .5rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center;
  color: var(--brand-contrast); background: linear-gradient(135deg, var(--brand-500), var(--brand-700)); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), var(--shadow-xs); }
.brand-mark .icon { width: 1.125rem; height: 1.125rem; }
.nav { padding: .25rem .625rem 1.5rem; flex: 1; }
.nav-section { padding: 1.125rem .625rem .375rem; font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--sidebar-muted); }
.nav-item { position: relative; display: flex; align-items: center; gap: .625rem; padding: .4375rem .625rem; margin: 1px 0; border-radius: var(--radius); color: var(--sidebar-text); font-weight: 500; font-size: .875rem; line-height: 1.25rem; transition: background .12s, color .12s; }
.nav-item .icon { width: 1.125rem; height: 1.125rem; color: var(--sidebar-icon); transition: color .12s; }
.nav-item:hover { background: var(--sidebar-hover); color: var(--text); text-decoration: none; }
.nav-item:hover .icon { color: var(--text-2); }
.nav-item.active { background: var(--sidebar-active); color: var(--sidebar-active-text); font-weight: 600; box-shadow: var(--shadow-xs), 0 0 0 1px var(--border); }
.nav-item.active .icon { color: var(--sidebar-active-icon); }
.nav-group > summary { list-style: none; cursor: pointer; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary .chev { margin-left: auto; width: .875rem; height: .875rem; transition: transform .15s var(--ease); }
.nav-group[open] > summary .chev { transform: rotate(90deg); }
.nav-sub { margin: .125rem 0 .375rem 1.1875rem; padding-left: .625rem; border-left: 1px solid var(--border); }
.nav-sub .nav-item { padding: .3125rem .625rem; font-size: .8125rem; font-weight: 450; }
.nav-sub .nav-item .icon { width: 1rem; height: 1rem; }
.nav-sub .nav-item.active { font-weight: 600; }
.sidebar-foot { display: flex; align-items: center; gap: .5rem; padding: .875rem 1.125rem; font-size: .75rem; color: var(--sidebar-muted); border-top: 1px solid var(--sidebar-border); }
.sidebar-foot .dot-ok { width: .5rem; height: .5rem; border-radius: 999px; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); flex-shrink: 0; }

.main { padding-left: var(--sidebar-w); min-height: 100%; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: .75rem; padding: 0 2rem;
  background: var(--topbar-bg); -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--border); }
.topbar .spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: .25rem; }
.content { padding: 2rem; max-width: 92rem; width: 100%; margin: 0 auto; flex: 1; }
.menu-toggle { display: none; }
.backdrop { position: fixed; inset: 0; background: rgba(9, 12, 18, .5); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); z-index: 35; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: var(--radius); color: var(--muted); background: none; border: 0; cursor: pointer; transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.theme-toggle .t-dark, .theme-toggle .t-auto { display: none; }
.theme-toggle[data-mode="dark"] .t-light, .theme-toggle[data-mode="auto"] .t-light { display: none; }
.theme-toggle[data-mode="dark"] .t-dark { display: inline; }
.theme-toggle[data-mode="auto"] .t-auto { display: inline; }

/* area switcher (staff/resellers may switch between admin / reseller / customer) */
.area-switch { display: inline-flex; padding: .1875rem; gap: .125rem; background: var(--surface-3); border-radius: var(--radius); border: 1px solid var(--border); }
.area-switch a { padding: .1875rem .625rem; border-radius: .3125rem; font-size: .8125rem; font-weight: 500; color: var(--muted); white-space: nowrap; }
.area-switch a:hover { color: var(--text); text-decoration: none; }
.area-switch a.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); box-shadow: none; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .main { padding-left: 0; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 1.25rem 1rem 2rem; }
  .topbar { padding: 0 .75rem; gap: .5rem; }
  .area-switch { display: none; }
}

/* impersonation / maintenance banners */
.impersonation { display: flex; align-items: center; gap: .75rem; justify-content: center; flex-wrap: wrap; padding: .5rem 1rem; background: var(--warn); color: #1d1300; font-weight: 500; font-size: .8125rem; }
.impersonation form { margin: 0; }
.maintenance-banner { display: flex; align-items: center; gap: .625rem; justify-content: center; flex-wrap: wrap; padding: .5rem 1rem; background: var(--err-strong, #d92d20); color: #fff; font-weight: 500; font-size: .8125rem; text-align: center; }

/* global search */
.search { position: relative; width: 100%; max-width: 30rem; }
.search .input { padding-left: 2.25rem; padding-right: 3rem; background: var(--surface-2); border-color: var(--border); height: 2.25rem; }
.search .input:hover { border-color: var(--border-strong); }
.search .input:focus { background: var(--surface); }
.search > .icon-sm { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search > kbd { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search .input:focus ~ kbd { display: none; }
.search-results { position: absolute; top: calc(100% + .375rem); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); max-height: 26rem; overflow-y: auto; z-index: 50; padding: .25rem; }
.search-results:empty { display: none; }
.search-group { padding: .5rem .625rem .25rem; font-size: .6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.search-hit { display: block; padding: .5rem .625rem; color: var(--text); border-radius: var(--radius); }
.search-hit:hover, .search-hit:focus { background: var(--surface-3); text-decoration: none; outline: 0; }
.search-hit small { display: block; color: var(--muted); font-size: .75rem; }
.search-none { padding: .75rem; color: var(--muted); }
@media (max-width: 640px) { .search > kbd { display: none; } .search .input { padding-right: .75rem; } }

/* notification bell */
.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem; border-radius: var(--radius); color: var(--muted); transition: background .12s, color .12s; }
.bell:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.bell .count { position: absolute; top: .1875rem; right: .1875rem; min-width: 1.0625rem; height: 1.0625rem; padding: 0 .25rem; border-radius: 999px; background: var(--err); color: #fff; font-size: .625rem; font-weight: 700; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--surface); font-variant-numeric: tabular-nums; }

/* user menu / dropdown */
.dropdown { position: relative; }
.dropdown-toggle { display: inline-flex; align-items: center; gap: .5rem; background: none; border: 0; font: inherit; font-weight: 500; color: var(--text-2); cursor: pointer; padding: .25rem .5rem .25rem .25rem; border-radius: var(--radius); transition: background .12s; }
.dropdown-toggle:hover { background: var(--surface-3); }
.avatar { width: 2rem; height: 2rem; border-radius: 999px; background: linear-gradient(135deg, var(--brand-400), var(--brand-700)); color: var(--brand-contrast); display: inline-flex; align-items: center; justify-content: center; font-weight: 600; font-size: .75rem; letter-spacing: .02em; flex-shrink: 0; }
.avatar-lg { width: 2.5rem; height: 2.5rem; font-size: .875rem; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + .375rem); min-width: 15rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: .3125rem; z-index: 50; animation: pop-in .14s var(--ease); transform-origin: top right; }
.dropdown-menu a, .dropdown-menu button { display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left; padding: .4375rem .625rem; color: var(--text-2); background: none; border: 0; border-radius: var(--radius-sm); font: inherit; font-size: .8125rem; cursor: pointer; }
.dropdown-menu a .icon-sm, .dropdown-menu button .icon-sm { color: var(--faint); }
.dropdown-menu a:hover, .dropdown-menu button:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.dropdown-menu hr { border: 0; border-top: 1px solid var(--border); margin: .3125rem -.3125rem; }
.dropdown-menu form { margin: 0; }
.dropdown-menu .lang-switch .btn-link { color: var(--text-2); }
.dropdown-head { padding: .5rem .625rem; font-size: .75rem; color: var(--muted); line-height: 1.4; }
.dropdown-head strong { display: block; color: var(--text); font-size: .8125rem; }
.dropdown-user { display: flex; align-items: center; gap: .625rem; padding: .5rem .625rem .625rem; }
.dropdown-user .who { min-width: 0; line-height: 1.35; }
.dropdown-user .who strong { display: block; font-size: .875rem; color: var(--text); }
.dropdown-user .who span { display: block; font-size: .75rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes pop-in { from { opacity: 0; transform: scale(.97) translateY(-2px); } to { opacity: 1; transform: none; } }

/* ---------- page header ---------- */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; flex-wrap: wrap; margin-bottom: 1.75rem; }
.page-header > div:first-child { min-width: 0; }
.page-header h1 { margin-bottom: .25rem; }
.page-header p { color: var(--muted); margin: 0; max-width: 48rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.breadcrumbs { display: flex; align-items: center; gap: .375rem; font-size: .8125rem; color: var(--faint); margin-bottom: .5rem; flex-wrap: wrap; }
.breadcrumbs a { color: var(--muted); font-weight: 500; }
.breadcrumbs a:hover { color: var(--text); text-decoration: none; }
@media (max-width: 640px) { .page-header { align-items: flex-start; margin-bottom: 1.25rem; } h1 { font-size: 1.3125rem; } }

/* ---------- cards & grid ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card + .card { margin-top: 1.25rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: .75rem 1rem; flex-wrap: wrap; padding: .875rem 1.25rem; border-bottom: 1px solid var(--border); min-height: 3.25rem; }
.card-header h2, .card-header h3 { margin: 0; font-size: .9375rem; }
.card-header .text-sm { font-weight: 500; }
.card-body { padding: 1.25rem; }
.card-body > :last-child { margin-bottom: 0; }
.card-footer { padding: .75rem 1.25rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card > .table-wrap:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.grid { display: grid; gap: 1.25rem; }
.grid > .card + .card { margin-top: 0; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1280px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 768px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 480px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }

/* KPI stat tiles */
.stat { position: relative; padding: 1.125rem 1.25rem; display: flex; gap: .875rem; align-items: flex-start; color: inherit; height: 100%; border-radius: var(--radius-lg); transition: background .12s; }
.stat > span:last-child { min-width: 0; }
a.stat:hover { text-decoration: none; background: var(--surface-2); }
a.stat[href]::after { content: ""; position: absolute; top: 1.25rem; right: 1.25rem; width: .4375rem; height: .4375rem; border-top: 1.5px solid var(--faint); border-right: 1.5px solid var(--faint); transform: rotate(45deg); opacity: 0; transition: opacity .12s, transform .12s; }
a.stat[href]:hover::after { opacity: 1; transform: translateX(2px) rotate(45deg); }
.stat-icon { width: 2.5rem; height: 2.5rem; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand-soft-text); flex-shrink: 0; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-500) 14%, transparent); }
.stat-label { color: var(--muted); font-size: .8125rem; font-weight: 500; }
.stat-value { font-size: 1.625rem; font-weight: 650; line-height: 1.3; color: var(--text); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .75rem; color: var(--muted); }
.stat-delta { display: inline-flex; align-items: center; gap: .125rem; font-size: .75rem; font-weight: 600; padding: 0 .375rem; border-radius: 999px; }
.stat-delta.up { color: var(--ok-text); background: var(--ok-bg); } .stat-delta.down { color: var(--err-text); background: var(--err-bg); }
.stat.tone-ok .stat-icon { background: var(--ok-bg); color: var(--ok-text); box-shadow: inset 0 0 0 1px var(--ok-border); }
.stat.tone-warn .stat-icon { background: var(--warn-bg); color: var(--warn-text); box-shadow: inset 0 0 0 1px var(--warn-border); }
.stat.tone-err .stat-icon { background: var(--err-bg); color: var(--err-text); box-shadow: inset 0 0 0 1px var(--err-border); }
.stat.tone-err .stat-value { color: var(--err-text); }
.placeholder { padding: 3rem 2rem; text-align: center; color: var(--muted); border: 1.5px dashed var(--border-strong); border-radius: var(--radius-lg); background: var(--surface-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { padding: .75rem 1.25rem; border-bottom: 1px solid var(--divider); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.list li:last-child { border-bottom: 0; }
.card > .list li:hover { background: var(--surface-2); }
dl { margin: 0; }
dt { color: var(--muted); font-size: .8125rem; }
dd { margin: 0 0 .75rem; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .875rem; }
.table th { position: sticky; top: 0; z-index: 1; text-align: left; font-size: .75rem; font-weight: 600; letter-spacing: .01em; color: var(--muted); background: var(--surface-2); padding: .625rem 1rem; white-space: nowrap; border-bottom: 1px solid var(--border); }
.table th:first-child, .table td:first-child { padding-left: 1.25rem; }
.table th:last-child, .table td:last-child { padding-right: 1.25rem; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--divider); vertical-align: middle; color: var(--text-2); }
.table td a.font-semibold, .table td strong { color: var(--text); }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table tfoot td { background: var(--surface-2); font-weight: 600; border-top: 1px solid var(--border); border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table input[type="checkbox"] { width: 1rem; height: 1rem; accent-color: var(--brand); vertical-align: middle; }
.table th:has(> input[type="checkbox"]), .table td:has(> input[type="checkbox"]:only-child) { width: 2.75rem; }
.table-striped tbody tr:nth-child(even) { background: var(--surface-2); }
.sort { color: inherit; display: inline-flex; align-items: center; gap: .3125rem; }
.sort:hover { color: var(--text); text-decoration: none; }
.sort::after { content: ""; width: .5rem; height: .625rem; opacity: .35; background: currentColor; clip-path: polygon(50% 0, 100% 38%, 0 38%, 50% 0, 0 62%, 100% 62%, 50% 100%, 0 62%); }
.sort.asc::after { opacity: 1; clip-path: polygon(50% 15%, 100% 65%, 0 65%); }
.sort.desc::after { opacity: 1; clip-path: polygon(0 35%, 100% 35%, 50% 85%); }
.sort.asc, .sort.desc { color: var(--text); }
.empty { padding: 3.5rem 1.5rem; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; }
.empty > .icon { width: 3rem; height: 3rem; padding: .75rem; border-radius: 999px; color: var(--brand-soft-text); background: var(--brand-soft); box-shadow: 0 0 0 8px color-mix(in srgb, var(--brand-500) 6%, transparent); margin-bottom: .75rem; }
.empty p { margin: .5rem 0 0; max-width: 28rem; }
.empty .btn { margin-top: 1rem; }
.filters { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-end; padding: .875rem 1.25rem; border-bottom: 1px solid var(--border); }
#table > .filters { background: var(--surface-2); padding-top: .625rem; padding-bottom: .625rem; }
.filters .field { margin: 0; min-width: 10rem; }
.filters .field .label { font-size: .75rem; color: var(--muted); }
.filters .input, .filters .select { height: 2.125rem; padding-top: .3125rem; padding-bottom: .3125rem; }
@media (max-width: 640px) { .filters .field { min-width: 0; flex: 1 1 9rem; } }

/* ---------- forms ---------- */
.field { margin-bottom: 1.125rem; }
.label { display: block; font-weight: 500; font-size: .8125rem; margin-bottom: .375rem; color: var(--text-2); }
.label .req { color: var(--err); }
.input, .select, .textarea { display: block; width: 100%; padding: .5rem .75rem; font: inherit; font-size: .875rem; line-height: 1.25rem; color: var(--text); background-color: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-xs); transition: border-color .12s, box-shadow .12s, background-color .12s; }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--border-strong) 80%, var(--text) 20%); }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--brand-500); box-shadow: 0 0 0 3px var(--ring); }
.input[aria-invalid="true"], .select[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--err); }
.input[aria-invalid="true"]:focus, .select[aria-invalid="true"]:focus, .textarea[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--err) 25%, transparent); }
.input:disabled, .select:disabled, .textarea:disabled, .input[readonly] { background-color: var(--surface-3); color: var(--muted); box-shadow: none; }
.select { appearance: none; -webkit-appearance: none; padding-right: 2.25rem; background-repeat: no-repeat; background-position: right .625rem center; background-size: 1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%2398a2b3'%3E%3Cpath fill-rule='evenodd' d='M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z'/%3E%3C/svg%3E"); }
.select[multiple], .select[size] { background-image: none; padding-right: .75rem; }
.input[type="color"] { padding: .25rem; height: 2.375rem; }
.input[type="file"] { padding: .375rem; }
.input[type="file"]::file-selector-button { font: inherit; font-size: .8125rem; font-weight: 500; margin-right: .75rem; padding: .3125rem .75rem; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); cursor: pointer; }
.textarea { min-height: 6rem; resize: vertical; }
.hint { font-size: .75rem; color: var(--muted); margin: .375rem 0 0; }
.field-error { display: flex; gap: .25rem; align-items: center; font-size: .75rem; font-weight: 500; color: var(--err-text); margin: .375rem 0 0; }
.check { display: flex; gap: .5rem; align-items: center; cursor: pointer; }
.check input { width: 1rem; height: 1rem; margin: 0; accent-color: var(--brand); flex-shrink: 0; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); }
.form-row { display: grid; gap: 0 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .form-row { grid-template-columns: minmax(0, 1fr); } }
.form-actions { display: flex; gap: .5rem; justify-content: flex-end; flex-wrap: wrap; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--divider); }
fieldset { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1rem 1.25rem .25rem; margin: 0 0 1.25rem; min-width: 0; }
legend { padding: 0 .375rem; font-weight: 600; font-size: .8125rem; color: var(--text); }
.otp { letter-spacing: .5em; text-align: center; font-family: var(--mono); font-size: 1.375rem; padding-top: .625rem; padding-bottom: .625rem; }
.hp { position: absolute; left: -10000px; top: auto; width: 1px; height: 1px; overflow: hidden; }

/* ---------- buttons ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .4375rem; padding: .5rem .875rem; font: inherit; font-size: .875rem; font-weight: 550; line-height: 1.25rem;
  border-radius: var(--radius); border: 1px solid transparent; cursor: pointer; white-space: nowrap; user-select: none; text-decoration: none;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s, transform .06s; }
.btn:hover { text-decoration: none; }
.btn:active:not(:disabled) { transform: translateY(.5px); }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px var(--ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); color: var(--brand-contrast); box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, .14); border-color: color-mix(in srgb, var(--brand) 85%, #000); }
.btn-primary:hover { background: var(--brand-700); color: var(--brand-contrast); }
.btn-secondary { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--surface-2); color: var(--text); border-color: color-mix(in srgb, var(--border-strong) 80%, var(--text) 20%); }
.btn-danger { background: var(--err-strong, #d92d20); color: #fff; box-shadow: var(--shadow-xs); border-color: color-mix(in srgb, #d92d20 85%, #000); }
.btn-danger:hover { background: #b42318; color: #fff; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-link { background: none; border: 0; padding: 0; color: var(--link); cursor: pointer; font: inherit; }
.btn-link:hover { text-decoration: underline; }
.btn-sm { padding: .3125rem .625rem; font-size: .8125rem; gap: .3125rem; border-radius: var(--radius-sm); }
.btn-lg { padding: .6875rem 1.25rem; font-size: .9375rem; }
.btn-block { width: 100%; }
.btn-icon { padding: .5rem; }
.btn-icon.btn-sm { padding: .3125rem; }
/* destructive row actions are quiet until hovered */
.table .btn-danger.btn-sm { background: var(--surface); color: var(--err-text); border-color: var(--border-strong); }
.table .btn-danger.btn-sm:hover { background: var(--err-bg); border-color: var(--err-border); }
.spinner { display: inline-block; width: 1rem; height: 1rem; border: 2px solid currentColor; border-right-color: transparent; border-radius: 999px; animation: spin .7s linear infinite; vertical-align: -.125em; }
@keyframes spin { to { transform: rotate(360deg); } }
/* loading state: htmx adds .htmx-request to the requesting element (button or form) */
.btn.htmx-request, form.htmx-request .btn[type="submit"] { color: transparent !important; pointer-events: none; }
.btn.htmx-request::after, form.htmx-request .btn[type="submit"]::after {
  content: ""; position: absolute; inset: 0; margin: auto; width: 1rem; height: 1rem; border: 2px solid var(--brand-contrast); border-right-color: transparent; border-radius: 999px; animation: spin .7s linear infinite; }
.btn-secondary.htmx-request::after, .btn-ghost.htmx-request::after, form.htmx-request .btn-secondary[type="submit"]::after, form.htmx-request .btn-ghost[type="submit"]::after { border-color: var(--text-2); border-right-color: transparent; }

/* htmx indicator (includeIndicatorStyles=false, so it is styled here – CSP safe) */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.progress-bar { position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 100; overflow: hidden; background: color-mix(in srgb, var(--brand) 25%, transparent); }
.progress-bar::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--brand); animation: indeterminate 1.1s var(--ease) infinite; }
@keyframes indeterminate { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
/* swapped table region fades while loading */
#table.htmx-request { opacity: .55; transition: opacity .15s; }
.skeleton { display: block; height: .75rem; border-radius: var(--radius-sm); background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite linear; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3125rem; padding: .0625rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 550; line-height: 1.25rem; background: var(--surface-3); color: var(--text-2); white-space: nowrap; box-shadow: inset 0 0 0 1px var(--border); vertical-align: middle; }
.badge-ok::before, .badge-warn::before, .badge-err::before, .badge-info::before { content: ""; width: .375rem; height: .375rem; border-radius: 999px; background: currentColor; flex-shrink: 0; }
.badge-ok, .badge-warn, .badge-err, .badge-info { padding-left: .4375rem; }
.badge-ok { background: var(--ok-bg); color: var(--ok-text); box-shadow: inset 0 0 0 1px var(--ok-border); }
.badge-warn { background: var(--warn-bg); color: var(--warn-text); box-shadow: inset 0 0 0 1px var(--warn-border); }
.badge-err { background: var(--err-bg); color: var(--err-text); box-shadow: inset 0 0 0 1px var(--err-border); }
.badge-info { background: var(--info-bg); color: var(--info-text); box-shadow: inset 0 0 0 1px var(--info-border); }
.badge-brand { background: var(--brand-soft); color: var(--brand-soft-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-500) 22%, transparent); }

/* ---------- alerts ---------- */
.alert { display: flex; gap: .75rem; align-items: flex-start; padding: .8125rem 1rem; border-radius: var(--radius-lg); border: 1px solid; margin-bottom: 1rem; font-size: .875rem; }
.alert > .icon { margin-top: .0625rem; width: 1.125rem; height: 1.125rem; }
.alert > div { min-width: 0; flex: 1; }
.alert a { color: inherit; font-weight: 600; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 40%, transparent); }
.alert ul { margin: .25rem 0 0; padding-left: 1.25rem; }
.alert p:last-child { margin-bottom: 0; }
.alert-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok-text); }
.alert-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-text); }
.alert-err { background: var(--err-bg); border-color: var(--err-border); color: var(--err-text); }
.alert-info { background: var(--info-bg); border-color: var(--info-border); color: var(--info-text); }
article.alert { color: var(--text); }
article.alert > .icon { color: var(--warn-text); }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--border); margin-bottom: 1.5rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; padding: .625rem .75rem; color: var(--muted); border: 0; background: none; font: inherit; font-size: .875rem; font-weight: 500; cursor: pointer; white-space: nowrap; margin-bottom: -1px; border-bottom: 2px solid transparent; transition: color .12s, border-color .12s; }
.tab:hover { color: var(--text); text-decoration: none; border-bottom-color: var(--border-strong); }
.tab.active, .tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--brand); font-weight: 600; }
.card > .tabs { padding: 0 1rem; margin-bottom: 0; }

/* ---------- pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: .75rem 1.25rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.pages { display: flex; gap: .25rem; flex-wrap: wrap; }
.page-link { min-width: 2rem; height: 2rem; padding: 0 .5rem; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); border: 1px solid var(--border); color: var(--text-2); background: var(--surface); font-weight: 500; box-shadow: var(--shadow-xs); }
.page-link:hover { background: var(--surface-2); text-decoration: none; border-color: var(--border-strong); }
.page-link.active { background: var(--brand); border-color: var(--brand); color: var(--brand-contrast); }
.page-link.disabled { opacity: .45; pointer-events: none; box-shadow: none; }

/* ---------- modal / confirm ---------- */
dialog.modal { padding: 0; border: 1px solid var(--border); color: var(--text); background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); width: min(30rem, calc(100vw - 2rem)); }
dialog.modal[open] { animation: pop-in .16s var(--ease); }
dialog.modal::backdrop { background: rgba(9, 12, 18, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.modal-header { padding: 1.25rem 1.5rem 0; display: flex; justify-content: space-between; align-items: center; }
.modal-header h2 { margin: 0; font-size: 1.0625rem; }
.modal-body { padding: .75rem 1.5rem 1.25rem; color: var(--text-2); }
.modal-body p { margin: 0; }
.modal-footer { padding: .875rem 1.5rem; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-xl) var(--radius-xl); display: flex; justify-content: flex-end; gap: .5rem; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 1.25rem; bottom: 1.25rem; z-index: 80; display: flex; flex-direction: column; gap: .5rem; width: min(24rem, calc(100vw - 2rem)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; gap: .75rem; align-items: flex-start; padding: .875rem 1rem; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: toast-in .22s var(--ease); font-size: .875rem; }
.toast::before { content: ""; width: .5rem; height: .5rem; margin-top: .4375rem; border-radius: 999px; flex-shrink: 0; background: var(--info); box-shadow: 0 0 0 4px color-mix(in srgb, var(--info) 18%, transparent); }
.toast-success::before { background: var(--ok); box-shadow: 0 0 0 4px color-mix(in srgb, var(--ok) 18%, transparent); }
.toast-warning::before { background: var(--warn); box-shadow: 0 0 0 4px color-mix(in srgb, var(--warn) 18%, transparent); }
.toast-error::before { background: var(--err); box-shadow: 0 0 0 4px color-mix(in srgb, var(--err) 18%, transparent); }
.toast .msg { flex: 1; color: var(--text); }
.toast button { background: none; border: 0; color: var(--faint); cursor: pointer; font-size: 1.125rem; line-height: 1; padding: 0 .125rem; border-radius: var(--radius-sm); }
.toast button:hover { color: var(--text); }
@keyframes toast-in { from { transform: translateY(.5rem) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- progress / steps / timeline ---------- */
.meter { height: .5rem; border-radius: 999px; background: var(--surface-3); overflow: hidden; }
.meter > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
progress { width: 100%; height: .5rem; border: 0; border-radius: 999px; overflow: hidden; background: var(--surface-3); appearance: none; -webkit-appearance: none; accent-color: var(--brand); }
progress::-webkit-progress-bar { background: var(--surface-3); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--brand); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--brand); border-radius: 999px; }
.steps { display: flex; gap: .5rem; list-style: none; margin: 0 0 1.5rem; padding: 0; counter-reset: step; flex-wrap: wrap; }
.steps li { flex: 1; min-width: 7rem; display: flex; align-items: center; gap: .5rem; padding-top: .625rem; border-top: 3px solid var(--border); font-size: .8125rem; color: var(--muted); font-weight: 500; counter-increment: step; }
.steps li::before { content: counter(step); width: 1.375rem; height: 1.375rem; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; font-size: .6875rem; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.steps li.done, .steps li.active { border-top-color: var(--brand); color: var(--text); }
.steps li.done::before, .steps li.active::before { background: var(--brand); color: var(--brand-contrast); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline > li { position: relative; padding: 0 0 1.125rem 1.75rem; }
.timeline > li::before { content: ""; position: absolute; left: .3125rem; top: .375rem; width: .625rem; height: .625rem; border-radius: 999px; background: var(--surface); border: 2px solid var(--brand); }
.timeline > li::after { content: ""; position: absolute; left: .5625rem; top: 1.125rem; bottom: 0; width: 2px; background: var(--border); }
.timeline > li:last-child::after { display: none; }
.timeline > li:last-child { padding-bottom: 0; }

/* ---------- public layout ---------- */
.pub { min-height: 100%; display: flex; flex-direction: column; background: var(--bg); overflow-x: clip; }
.pub-header { position: sticky; top: 0; z-index: 30; background: var(--topbar-bg); -webkit-backdrop-filter: saturate(180%) blur(12px); backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--border); color: var(--text); }
.pub-header .inner, .pub-main, .pub-footer .inner { max-width: 76rem; width: 100%; margin: 0 auto; padding-left: 1.5rem; padding-right: 1.5rem; }
.pub-header .inner { height: 4rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.pub-header a { color: var(--text-2); font-weight: 500; }
.pub-header a:hover { color: var(--text); text-decoration: none; }
.pub-header .btn-primary, .pub-header .btn-primary:hover { color: var(--brand-contrast); }
.pub-brand { display: flex; align-items: center; gap: .625rem; font-size: 1.0625rem; font-weight: 650; letter-spacing: -.015em; min-width: 0; }
.pub-brand img { height: 2rem; max-width: 10rem; object-fit: contain; }
.pub-brand a, .pub-header .pub-brand a { color: var(--text); font-weight: 650; }
.pub-nav { display: flex; gap: 1.5rem; align-items: center; font-size: .875rem; }
.pub-main { padding-top: 2.5rem; padding-bottom: 4rem; flex: 1; }
.pub-footer { border-top: 1px solid var(--border); background: var(--surface); padding: 2.5rem 0 2rem; color: var(--muted); font-size: .8125rem; }
.pub-footer .inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem 2rem; }
.pub-footer a { color: var(--muted); margin-right: 1.25rem; }
.pub-footer a:hover { color: var(--text); }
.pub-footer .lang-switch .btn-link { color: var(--muted); }
@media (max-width: 640px) { .pub-header .inner, .pub-main, .pub-footer .inner { padding-left: 1rem; padding-right: 1rem; } .pub-nav { gap: .75rem; } .pub-main { padding-top: 1.5rem; } }

/* landing */
.hero { position: relative; text-align: center; padding: 4.5rem 1rem 3.5rem; isolation: isolate; }
.hero::before { content: ""; position: absolute; inset: -2.5rem -50vw 0; z-index: -1;
  background: radial-gradient(60rem 26rem at 50% -4rem, color-mix(in srgb, var(--brand-400) 22%, transparent), transparent 70%),
              radial-gradient(30rem 18rem at 85% 10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%); }
.hero::after { content: ""; position: absolute; inset: -2.5rem -50vw 0; z-index: -1; opacity: .5;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px); background-size: 48px 48px;
  -webkit-mask-image: radial-gradient(40rem 20rem at 50% 0, #000, transparent 75%); mask-image: radial-gradient(40rem 20rem at 50% 0, #000, transparent 75%); }
.hero h1 { font-size: clamp(2.125rem, 5vw, 3.5rem); font-weight: 700; letter-spacing: -.035em; line-height: 1.08; margin: 0 auto 1rem; max-width: 46rem; }
.hero p { color: var(--muted); font-size: 1.125rem; max-width: 38rem; margin: 0 auto; }
.eyebrow { display: inline-flex; align-items: center; gap: .5rem; padding: .25rem .75rem .25rem .375rem; margin-bottom: 1.25rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); font-size: .8125rem; font-weight: 500; color: var(--text-2); }
.eyebrow .badge { box-shadow: none; }
.searchbar { display: flex; gap: .5rem; max-width: 40rem; margin: 2rem auto 0; padding: .375rem; background: var(--surface); border: 1px solid var(--border); border-radius: calc(var(--radius-lg) + .125rem); box-shadow: var(--shadow-lg); }
.searchbar .input { font-size: 1rem; padding: .625rem .875rem; border: 0; box-shadow: none; background: transparent; }
.searchbar .input:focus { box-shadow: none; }
.searchbar:focus-within { border-color: var(--brand-400); box-shadow: var(--shadow-lg), 0 0 0 3px var(--ring); }
.tld-chips { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; margin-top: 1.25rem; }
.tld-chips a { padding: .25rem .75rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-weight: 600; font-size: .8125rem; box-shadow: var(--shadow-xs); }
.tld-chips a:hover { border-color: var(--brand-400); color: var(--link); text-decoration: none; }
.section { padding: 3.5rem 0 0; }
.section-head { text-align: center; max-width: 40rem; margin: 0 auto 2rem; }
.section-head h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.025em; margin-bottom: .5rem; }
.section-head p { color: var(--muted); font-size: 1rem; margin: 0; }
.feature { padding: 1.5rem; }
.feature h3 { margin: 1rem 0 .375rem; font-size: 1rem; }
.feature p { color: var(--muted); margin: 0; }
.feature-icon { width: 2.5rem; height: 2.5rem; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; background: var(--brand-soft); color: var(--brand-soft-text); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand-500) 18%, transparent); }
.trust { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
.trust > div { display: flex; gap: .75rem; align-items: flex-start; padding: 1.125rem; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); }
.trust .icon { color: var(--ok); }
.trust strong { display: block; color: var(--text); font-size: .875rem; }
.trust span { color: var(--muted); font-size: .8125rem; }
@media (max-width: 1024px) { .trust { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .trust { grid-template-columns: minmax(0, 1fr); } .hero { padding: 2.5rem 0 2rem; } .searchbar { flex-direction: column; } }
.cta { margin-top: 3.5rem; padding: 2.5rem 2rem; border-radius: var(--radius-xl); text-align: center; color: #fff;
  background: radial-gradient(40rem 14rem at 20% 0, color-mix(in srgb, var(--brand-400) 70%, transparent), transparent 70%), linear-gradient(135deg, var(--brand-600), var(--brand-800)); box-shadow: var(--shadow-lg); }
.cta h2 { color: inherit; font-size: 1.5rem; letter-spacing: -.02em; }
.cta p { opacity: .85; margin: 0 auto 1.25rem; max-width: 34rem; }
.cta .btn-secondary { border-color: transparent; }
.prose { max-width: 48rem; }
.prose h2 { margin-top: 1.75rem; }
.prose p, .prose li { color: var(--text-2); }

/* auth (split layout with brand panel) */
.auth-split { min-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); }
.auth-panel { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: 2.5rem 3rem; color: #fff;
  background: radial-gradient(36rem 24rem at 0% 0%, color-mix(in srgb, var(--brand-400) 55%, transparent), transparent 70%),
              radial-gradient(30rem 22rem at 100% 100%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 70%),
              linear-gradient(160deg, var(--brand-700), var(--brand-900)); }
.auth-panel::after { content: ""; position: absolute; inset: 0; opacity: .14; pointer-events: none;
  background-image: linear-gradient(rgba(255, 255, 255, .5) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .5) 1px, transparent 1px); background-size: 44px 44px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 85%); mask-image: linear-gradient(180deg, #000, transparent 85%); }
.auth-panel > * { position: relative; z-index: 1; }
.auth-panel .auth-brand { color: #fff; margin: 0; flex-direction: row; font-size: 1.125rem; }
.auth-panel .brand-mark { background: rgba(255, 255, 255, .16); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); color: #fff; }
.auth-panel h2 { color: #fff; font-size: 2rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.15; max-width: 26rem; margin-bottom: 1rem; }
.auth-panel p { color: rgba(255, 255, 255, .8); max-width: 26rem; font-size: 1rem; }
.auth-points { list-style: none; margin: 1.75rem 0 0; padding: 0; display: grid; gap: .875rem; }
.auth-points li { display: flex; gap: .75rem; align-items: center; color: rgba(255, 255, 255, .92); font-weight: 500; }
.auth-points .icon { width: 2rem; height: 2rem; padding: .4375rem; border-radius: var(--radius); background: rgba(255, 255, 255, .12); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18); }
.auth-panel .auth-copy { font-size: .75rem; color: rgba(255, 255, 255, .65); margin: 0; }
.auth-wrap { min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2.5rem 1.5rem; background: var(--surface); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: .625rem; margin-bottom: 1.75rem; font-size: 1.25rem; font-weight: 650; letter-spacing: -.015em; color: var(--text); }
.auth-brand:hover { text-decoration: none; }
.auth-brand img { max-height: 3rem; max-width: 12rem; }
.auth-mobile-brand { display: none; }
.auth-card { width: 100%; max-width: 24rem; }
.auth-card.wide { max-width: 32rem; }
.auth-wrap .card.auth-card { border: 0; box-shadow: none; background: transparent; }
.auth-wrap .card.auth-card > .card-body { padding: 0; }
.auth-card h1 { font-size: 1.625rem; letter-spacing: -.025em; text-align: left; }
.auth-card h1 + p { text-align: left; margin-bottom: 1.75rem; }
.auth-card .btn-block { margin-top: .5rem; padding-top: .625rem; padding-bottom: .625rem; }
.auth-links { margin-top: 1.5rem; text-align: center; font-size: .8125rem; color: var(--muted); }
.auth-links a { font-weight: 500; }
.auth-foot { margin-top: 2.5rem; font-size: .75rem; color: var(--muted); gap: .25rem 1rem; justify-content: center; }
.auth-foot a { color: var(--muted); }
.auth-foot .btn-link { color: var(--muted); }
@media (max-width: 960px) {
  .auth-split { grid-template-columns: minmax(0, 1fr); }
  .auth-panel { display: none; }
  .auth-mobile-brand { display: flex; }
  .auth-wrap { background: var(--bg); justify-content: flex-start; padding-top: 3rem; }
  .auth-wrap .card.auth-card { background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow); }
  .auth-wrap .card.auth-card > .card-body { padding: 1.5rem; }
}

/* error pages */
.error-page { text-align: center; padding: 4rem 1rem; max-width: 32rem; margin: 0 auto; }
.error-code { font-size: 4.5rem; font-weight: 750; letter-spacing: -.04em; line-height: 1; margin-bottom: 1rem;
  background: linear-gradient(135deg, var(--brand-400), var(--brand-700)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page p { color: var(--muted); }

/* ---------- module specifics ---------- */
/* invoice document (server-rendered invoice HTML) */
.invoice-doc { font-variant-numeric: tabular-nums; color: var(--text); }
.invoice-doc table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
.invoice-doc th, .invoice-doc td { padding: .5rem .75rem; border-bottom: 1px solid var(--divider); text-align: left; }
.invoice-doc th { font-size: .75rem; color: var(--muted); font-weight: 600; background: var(--surface-2); }
.invoice-doc td:last-child, .invoice-doc th:last-child { text-align: right; }
/* support thread */
.thread { display: flex; flex-direction: column; }
.thread > article.card + article.card { margin-top: 0; }
.thread > article.card .card-header { min-height: 0; padding: .625rem 1.125rem; background: var(--surface-2); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
/* uptime sparkline */
.sparkline { display: block; width: 100%; color: var(--brand); overflow: visible; }
/* 2FA QR code */
.qr { display: inline-block; margin: 0 0 1rem; padding: .75rem; background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); }
.qr svg, .qr img { display: block; width: 12rem; height: 12rem; }
.dropdown-menu-list { display: flex; flex-direction: column; }
.lang-switch { margin: 0; display: inline-flex; }
.dropdown-menu .lang-switch { display: block; }

/* ---------- helpers ---------- */
.flex { display: flex; } .items-center { align-items: center; } .justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; } .gap-4 { gap: 1rem; } .wrap { flex-wrap: wrap; } .grow { flex: 1; }
.mt-0 { margin-top: 0; } .mt-2 { margin-top: .5rem; } .mt-4 { margin-top: 1rem; } .mt-6 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: .5rem; } .mb-4 { margin-bottom: 1rem; } .mb-6 { margin-bottom: 1.5rem; }
.p-0 { padding: 0; }
.text-muted { color: var(--muted); } .text-sm { font-size: .8125rem; } .text-xs { font-size: .75rem; } .text-right { text-align: right; } .text-center { text-align: center; }
.font-semibold { font-weight: 600; } .truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden { display: none !important; }
@media (max-width: 640px) { .hide-sm { display: none !important; } }

/* bell dropdown (layout, /notifications/recent) */
.bell-menu .bell { cursor: pointer; }
.bell-dropdown { width: 23rem; max-width: calc(100vw - 1.5rem); }
.bell-list { max-height: 24rem; overflow-y: auto; }
.bell-list > p { padding: .5rem .625rem; margin: 0; }
.dropdown-menu .bell-list a.search-hit { display: block; }

/* scrollable checkbox picker (zones, domains) */
.picker-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: .25rem .75rem; max-height: 18rem; overflow-y: auto; padding: .625rem .875rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.picker-list .check { padding: .1875rem 0; min-width: 0; }
.picker-list .check span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-actions { display: flex; gap: .5rem; align-items: center; margin-bottom: .5rem; font-size: .875rem; }

/* forms inside table cells / action rows */
form.inline, .table td form, .actions form { display: inline-flex; align-items: center; gap: .375rem; margin: 0; vertical-align: middle; }
.table td .input, .table td .select { padding-top: .25rem; padding-bottom: .25rem; min-width: 0; }
.table td .select { padding-right: 2rem; }
.cell-form { display: flex; flex-wrap: wrap; align-items: center; gap: .375rem; margin: 0; }
.cell-form .input, .cell-form .select { width: auto; flex: 1 1 6rem; }

/* tree indentation (account tree, nested lists) */
.tree, .tree ul, ul.list ul.list { list-style: none; margin: 0; }
.tree ul, ul.list ul.list { padding-left: 1.25rem; margin-left: .625rem; border-left: 1px solid var(--border); }
.tree-node { display: flex; align-items: center; gap: .5rem; padding: .3125rem 0; }
.depth-1 { padding-left: 1.5rem; } .depth-2 { padding-left: 3rem; } .depth-3 { padding-left: 4.5rem; }
.depth-4 { padding-left: 6rem; } .depth-5 { padding-left: 7.5rem; } .depth-6 { padding-left: 9rem; }
.table td.depth-1:first-child { padding-left: 2.5rem; } .table td.depth-2:first-child { padding-left: 3.75rem; } .table td.depth-3:first-child { padding-left: 5rem; }
.table td.depth-4:first-child { padding-left: 6.25rem; } .table td.depth-5:first-child { padding-left: 7.5rem; } .table td.depth-6:first-child { padding-left: 8.75rem; }

/* select-all checkbox (Alpine "selectAll") */
.select-all-count { font-size: .75rem; color: var(--muted); }

/* branding live preview (Alpine "brandPreview" sets --pv-* on the container) */
.brand-preview[data-live] .pv-primary { fill: var(--pv-primary); }
.brand-preview[data-live] .pv-secondary { fill: var(--pv-secondary); }
.brand-preview[data-live] .pv-accent { fill: var(--pv-accent); }

/* ---------- motion & print ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .progress-bar::before { animation: none; width: 100%; }
}
@media print {
  .sidebar, .topbar, .toasts, .backdrop, .page-actions, .progress-bar, .pub-header, .pub-footer { display: none !important; }
  .main { padding-left: 0; }
  .content { padding: 0; max-width: none; }
  .card { box-shadow: none; border-color: #ccc; }
  body { background: #fff; color: #000; }
}
.user-chev { transform: rotate(90deg); color: var(--faint); width: .875rem; height: .875rem; }
.cta-actions { display: flex; gap: .5rem; flex-wrap: wrap; justify-content: center; }
.cta-ghost { color: #fff; border-color: rgba(255, 255, 255, .35); background: rgba(255, 255, 255, .08); }
.cta-ghost:hover { color: #fff; background: rgba(255, 255, 255, .16); }
.eyebrow:hover { text-decoration: none; border-color: var(--border-strong); }
.eyebrow .icon-sm { color: var(--faint); }
.dropdown-toggle > .hide-sm { white-space: nowrap; max-width: 12rem; overflow: hidden; text-overflow: ellipsis; }
/* the hamburger is a .btn – keep it hidden on desktop (specificity over .btn) */
.topbar .menu-toggle { display: none; }
@media (max-width: 1024px) { .topbar .menu-toggle { display: inline-flex; } }
.table td a.font-semibold { white-space: nowrap; }
/* key/value lists: <li><span>Label</span><span>value</span></li> */
.list li > span:first-child:not(:has(*)):not(:only-child) { color: var(--muted); flex-shrink: 0; max-width: 45%; }
.list li > span:first-child + span:last-child { text-align: right; min-width: 0; overflow-wrap: anywhere; }
/* collapsible cards: <details class="card"><summary class="card-header"> */
details.card > summary.card-header { list-style: none; cursor: pointer; border-bottom-color: transparent; border-radius: var(--radius-lg); transition: background .12s; }
details.card > summary.card-header::-webkit-details-marker { display: none; }
details.card > summary.card-header::after { content: ""; width: .5rem; height: .5rem; margin-right: .25rem; border-right: 1.5px solid var(--faint); border-bottom: 1.5px solid var(--faint); transform: rotate(45deg) translateY(-2px); transition: transform .15s var(--ease); }
details.card > summary.card-header:hover { background: var(--surface-2); }
details.card[open] > summary.card-header { border-bottom-color: var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
details.card[open] > summary.card-header::after { transform: rotate(-135deg) translateY(-2px); }
details > summary { cursor: pointer; }
details > summary.text-sm { color: var(--link); font-weight: 500; }
/* marketplace listing cards */
.listing-card { transition: border-color .15s, box-shadow .15s, transform .15s; }
.listing-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.listing-name { font-size: 1rem; color: var(--text); letter-spacing: -.01em; }
.price { font-size: 1.25rem; font-weight: 650; letter-spacing: -.02em; color: var(--text); font-variant-numeric: tabular-nums; }
.table td:first-child > a, .table td > time { white-space: nowrap; }
/* KPI tiles stay two-up on phones */
@media (max-width: 480px) {
  .grid-4:has(> .card > .stat) { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
  .grid-4 .stat { flex-direction: column; gap: .625rem; padding: .875rem 1rem; }
  .grid-4 .stat-icon { width: 2.25rem; height: 2.25rem; }
  .grid-4 .stat-value { font-size: 1.25rem; }
  .pub-brand { font-size: .9375rem; }
}
