/* ==========================================================================
   Ugarit Tech Radius — design system
   Brand (identical to ugarit-tech.com): rust #A8481F (action colour), navy #14212B (structure and text),
   cream #FBFAF7 (canvas), line #E7E2D9, muted text #5B6670, light rust #F0A27A (accent on dark).
   Type: IBM Plex Sans Arabic for Arabic, Sora for Latin letters and digits.
   Rules: logical properties only (works in RTL and LTR), 8pt spacing grid, three font weights,
   one accent colour, borders before shadows, motion limited to opacity/transform.
   ========================================================================== */

@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('/fonts/ibm-plex-sans-arabic-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('/fonts/ibm-plex-sans-arabic-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  src: url('/fonts/ibm-plex-sans-arabic-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'Sora';
  src: url('/fonts/sora-latin-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sora';
  src: url('/fonts/sora-latin-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Sora';
  src: url('/fonts/sora-latin-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* brand ramps (each step is derived from the website's base value) */
  --rust-700: #803718;
  --rust-600: #943f1b;
  --rust-500: #a8481f;
  --rust-300: #f0a27a;
  --rust-100: #f2e4dd;
  --rust-50: #f9f2ef;
  --navy-900: #0e171e;
  --navy-800: #14212b;
  --navy-700: #1e2d3a;
  --navy-600: #2a3b4b;

  /* surfaces: canvas (60%), raised/structural (30%), accent (10%) */
  --canvas: #fbfaf7;
  --surface: #ffffff;
  --surface-muted: #f6f3ed;
  --surface-sunken: #f0ece4;
  --border: #e7e2d9;
  --border-strong: #cfc8bb;
  --hairline: #efebe4;

  /* ink */
  --text: #14212b;
  --text-2: #5b6670;
  --text-3: #66707d;
  --on-dark: #f4f1ea;
  --on-dark-2: #aab3be;

  /* the one accent */
  --accent: var(--rust-500);
  --accent-hover: var(--rust-600);
  --accent-press: var(--rust-700);
  --accent-soft: var(--rust-50);
  --accent-on-dark: var(--rust-300);
  --on-accent: #ffffff;
  --focus: #1b62d6;

  /* status (always shown with a word, never colour alone) */
  --ok: #1c7447;
  --ok-soft: #e6f2eb;
  --warn: #8f5500;
  --warn-soft: #fbefd9;
  --bad: #b3261e;
  --bad-soft: #fbe9e7;
  --info: #22608b;
  --info-soft: #e5eff6;
  --neutral-soft: #eeebe5;

  /* charts (validated: colour-blind safe on white) */
  --series-1: #b85c2e;
  --series-2: #2a78a8;
  --series-3: #3e9b6e;
  --chart-grid: #e9e5dd;
  --chart-axis: #c9c4ba;

  /* type */
  --font: 'IBM Plex Sans Arabic', 'Sora', 'Segoe UI', Tahoma, system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, 'Cascadia Mono', 'SF Mono', Consolas, 'Liberation Mono', monospace;
  --text-meta: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-h3: 1.2rem;
  --text-h2: 1.44rem;
  --text-h1: 1.728rem;
  --w-regular: 400;
  --w-medium: 500;
  --w-semibold: 600;

  /* spacing (4 / 8 grid) */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s6: 24px;
  --s8: 32px;
  --s12: 48px;
  --s16: 64px;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow-1: 0 1px 2px rgba(20, 33, 43, 0.05);
  --shadow-2: 0 6px 20px rgba(20, 33, 43, 0.07);
  --shadow-3: 0 16px 40px rgba(20, 33, 43, 0.07);

  --motion-100: 100ms;
  --motion-150: 150ms;
  --motion-200: 200ms;
  --motion-300: 300ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.7, 0, 0.84, 0);

  /* viewports: narrow / medium / wide */
  --vp-narrow: 375px;
  --vp-medium: 768px;
  --vp-wide: 1280px;

  --control-h: 44px;
  --sidebar-w: 256px;
  --topbar-h: 64px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--text-base);
  font-weight: var(--w-regular);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure {
  margin: 0;
}
ul,
ol {
  padding: 0;
  list-style: none;
}
h1,
h2,
h3,
h4 {
  font-weight: var(--w-semibold);
  line-height: 1.25;
}
h1 {
  font-size: var(--text-h1);
}
h2 {
  font-size: var(--text-h2);
}
h3 {
  font-size: var(--text-h3);
}
h4 {
  font-size: var(--text-base);
}
a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
img,
svg {
  display: block;
  max-width: 100%;
}
table {
  border-collapse: collapse;
  width: 100%;
}
hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: var(--s6) 0;
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
[hidden] {
  display: none !important;
}

/* ---- helpers ----------------------------------------------------------- */
.ltr {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}
.mono {
  font-family: var(--mono);
  font-size: 0.92em;
}
.num {
  font-variant-numeric: tabular-nums;
}
.muted {
  color: var(--text-3);
}
.secondary {
  color: var(--text-2);
}
.small {
  font-size: var(--text-sm);
}
.meta {
  font-size: var(--text-meta);
  line-height: 1.4;
  color: var(--text-3);
}
.strong {
  font-weight: var(--w-semibold);
}
.medium {
  font-weight: var(--w-medium);
}
.nowrap {
  white-space: nowrap;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.end {
  text-align: end;
}
.center {
  text-align: center;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.row {
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.row.wrap {
  flex-wrap: wrap;
}
.row.between {
  justify-content: space-between;
}
.row.top {
  align-items: flex-start;
}
.row.gap3 {
  gap: var(--s3);
}
.row.gap4 {
  gap: var(--s4);
}
.stack {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}
.stack.s2 {
  gap: var(--s2);
}
.stack.s3 {
  gap: var(--s3);
}
.stack.s6 {
  gap: var(--s6);
}
.stack.s8 {
  gap: var(--s8);
}
.grow {
  flex: 1 1 auto;
  min-width: 0;
}
.grid {
  display: grid;
  gap: var(--s4);
}
.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid.cols-auto {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.prose {
  max-width: 68ch;
}
.icon {
  flex: none;
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon.sm {
  width: 16px;
  height: 16px;
}
.icon.lg {
  width: 24px;
  height: 24px;
}
[dir='rtl'] .icon.flip {
  transform: scaleX(-1);
}

/* ---- app shell (sidebar first in the DOM: it sits on the right in Arabic) */
.app {
  display: flex;
  min-height: 100vh;
  width: 100%;
}
.sidebar {
  flex: none;
  width: var(--sidebar-w);
  background: var(--navy-800);
  color: var(--on-dark);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s4) var(--s4) var(--s3);
  color: var(--on-dark);
  min-height: var(--topbar-h);
}
.sidebar-brand:hover {
  text-decoration: none;
}
.sidebar-brand img {
  width: 36px;
  height: 36px;
  flex: none;
  object-fit: contain;
}
.sidebar-brand .name {
  font-weight: var(--w-semibold);
  line-height: 1.25;
}
.sidebar-brand .sub {
  font-size: var(--text-meta);
  color: var(--on-dark-2);
  line-height: 1.4;
}
.nav {
  flex: 1 1 auto;
  padding: var(--s2) var(--s3) var(--s4);
}
.nav-group {
  margin-top: var(--s4);
}
.nav-title {
  font-size: var(--text-meta);
  color: var(--on-dark-2);
  padding: 0 var(--s3) var(--s1);
  line-height: 1.4;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 44px;
  padding: var(--s2) var(--s3);
  border-radius: var(--radius);
  color: var(--on-dark);
  font-size: var(--text-sm);
  position: relative;
}
.nav-item:hover {
  background: var(--navy-700);
  text-decoration: none;
}
.nav-item[aria-current='page'] {
  background: var(--navy-600);
  font-weight: var(--w-medium);
}
.nav-item[aria-current='page']::before {
  content: '';
  position: absolute;
  inset-inline-start: -12px;
  inset-block: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--accent-on-dark);
}
[dir='rtl'] .nav-item[aria-current='page']::before {
  border-radius: 4px 0 0 4px;
}
.nav-item .icon {
  color: var(--on-dark-2);
}
.nav-item[aria-current='page'] .icon {
  color: var(--on-dark);
}
.nav-count {
  margin-inline-start: auto;
  min-width: 24px;
  padding: 0 var(--s2);
  border-radius: 12px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: var(--text-meta);
  line-height: 20px;
  text-align: center;
}
.sidebar :focus-visible {
  outline-color: #9cc2ff;
}
.sidebar-foot {
  padding: var(--s3) var(--s4) var(--s4);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: var(--text-meta);
  color: var(--on-dark-2);
  line-height: 1.5;
}
.sidebar-foot a {
  color: inherit;
}
.sidebar-foot strong {
  color: var(--on-dark);
  font-weight: var(--w-medium);
}

.main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: var(--topbar-h);
  padding: var(--s2) var(--s6);
  background: var(--canvas);
  border-bottom: 1px solid var(--border);
}
.topbar .menu-btn {
  display: none;
}
.page {
  width: 100%;
  max-width: var(--vp-wide);
  margin-inline: auto;
  padding: var(--s6) var(--s6) var(--s16);
}
.page.narrow {
  max-width: 720px;
}
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--s4);
  flex-wrap: wrap;
  margin-bottom: var(--s6);
}
.page-head .titles {
  min-width: 0;
  flex: 1 1 320px;
}
.page-head h1 {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}
.page-head .desc {
  color: var(--text-2);
  margin-top: var(--s1);
  max-width: 72ch;
}
.page-head .actions {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: var(--s1);
  font-size: var(--text-sm);
  color: var(--text-3);
  margin-bottom: var(--s2);
}
.crumbs a {
  color: var(--text-2);
}
.skip-link {
  position: absolute;
  inset-inline-start: var(--s2);
  top: -80px;
  z-index: 100;
  background: var(--surface);
  padding: var(--s2) var(--s4);
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
}
.skip-link:focus {
  top: var(--s2);
}
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 32, 0.45);
  z-index: 60;
  animation: fade-in var(--motion-150) var(--ease-out);
}

/* ---- buttons ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: var(--control-h);
  padding: 0 var(--s4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-weight: var(--w-medium);
  font-size: var(--text-sm);
  line-height: 1.2;
  white-space: nowrap;
  text-decoration: none;
  transition: background-color var(--motion-100) var(--ease-out), border-color var(--motion-100) var(--ease-out);
}
.btn:hover {
  background: var(--surface-muted);
  text-decoration: none;
}
.btn:active {
  background: var(--surface-sunken);
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn.primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn.primary:active {
  background: var(--accent-press);
}
.btn.danger {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
}
.btn.danger:hover {
  background: #991f18;
}
/* outlined secondary button (first-contact screens, next to a primary one) */
.btn.outline {
  background: transparent;
  border-color: var(--accent);
  color: var(--accent);
}
.btn.outline:hover {
  background: var(--accent-soft);
}
.btn.ghost {
  border-color: transparent;
  background: transparent;
}
.btn.ghost:hover {
  background: var(--surface-sunken);
}
.btn.block {
  width: 100%;
}
.btn.lg {
  min-height: 52px;
  font-size: var(--text-base);
  padding: 0 var(--s6);
}
.btn[aria-busy='true'] {
  cursor: progress;
  opacity: 0.85;
}
.btn[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  flex: none;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-2);
}
.icon-btn:hover {
  background: var(--surface-sunken);
  color: var(--text);
}
.icon-btn.bordered {
  border-color: var(--border-strong);
  background: var(--surface);
}
.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font-weight: var(--w-medium);
  text-align: start;
}
.link-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
.spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid currentColor;
  border-inline-end-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
kbd {
  display: inline-block;
  min-width: 20px;
  padding: 0 var(--s1);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-2);
  font-family: var(--mono);
  font-size: var(--text-meta);
  line-height: 18px;
  text-align: center;
}

/* ---- forms ------------------------------------------------------------- */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  min-width: 0;
}
.field-label {
  display: flex;
  align-items: center;
  gap: var(--s1);
  min-height: 24px;
  font-size: var(--text-sm);
  font-weight: var(--w-medium);
}
.field-label .req {
  color: var(--bad);
  margin-inline-start: 2px;
}
.field-label .opt {
  color: var(--text-3);
  font-weight: var(--w-regular);
}
.field-hint {
  font-size: var(--text-sm);
  color: var(--text-3);
  line-height: 1.5;
}
.field-error {
  font-size: var(--text-sm);
  color: var(--bad);
  line-height: 1.5;
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: var(--control-h);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  line-height: 1.4;
  transition: border-color var(--motion-100) var(--ease-out);
}
.textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.55;
}
.input::placeholder,
.textarea::placeholder {
  color: #7d8691;
}
.input:hover,
.select:hover,
.textarea:hover {
  border-color: rgba(20, 33, 43, 0.38);
}
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  border-color: var(--focus);
}
.input[aria-invalid='true'],
.select[aria-invalid='true'],
.textarea[aria-invalid='true'] {
  border-color: var(--bad);
}
.input[readonly] {
  background: var(--surface-muted);
}
.input.ltr-input {
  direction: ltr;
  text-align: start;
}
[dir='rtl'] .input.ltr-input {
  text-align: right;
}
/* lists of technical names (one per line) read left to right in both languages */
.textarea.ltr-input {
  direction: ltr;
  text-align: left;
  font-family: var(--mono);
  font-size: var(--text-sm);
}
.select {
  appearance: none;
  padding-inline-end: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23465160' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
[dir='rtl'] .select {
  background-position: left 12px center;
}
.input-group {
  display: flex;
  align-items: stretch;
  position: relative;
}
.input-group .input {
  flex: 1 1 auto;
  min-width: 0;
}
.input-group .addon {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--s3);
  border: 1px solid var(--border-strong);
  background: var(--surface-muted);
  color: var(--text-2);
  font-size: var(--text-sm);
  white-space: nowrap;
}
.input-group .input:not(:last-child) {
  border-start-end-radius: 0;
  border-end-end-radius: 0;
}
.input-group .addon:last-child {
  border-inline-start: 0;
  border-start-end-radius: var(--radius);
  border-end-end-radius: var(--radius);
}
.input-group .select.addon-select {
  flex: none;
  width: auto;
  border-inline-start: 0;
  border-start-start-radius: 0;
  border-end-start-radius: 0;
  background-color: var(--surface-muted);
}
.input-group .inside-btn {
  position: absolute;
  inset-inline-end: 0;
  top: 0;
  height: var(--control-h);
}
.input-group .input.has-inside-btn {
  padding-inline-end: 48px;
}
/* A left-to-right box (a password) on a right-to-left page: the box's own "end" is its right side, but the
   eye button sits at the page's end, on the left. Keep the room for the button where the button is, so the
   text starts at the same edge as the username above it. */
[dir='rtl'] .input-group .input.ltr-input.has-inside-btn {
  padding-right: var(--s3);
  padding-left: 48px;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: var(--s3);
  min-height: 44px;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.switch .track {
  position: relative;
  flex: none;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  background: #b7bdc4;
  transition: background-color var(--motion-150) var(--ease-out);
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 33, 43, 0.25);
  transition: transform var(--motion-150) var(--ease-out);
}
.switch input:checked + .track {
  background: var(--accent);
}
.switch input:checked + .track::after {
  transform: translateX(20px);
}
[dir='rtl'] .switch input:checked + .track::after {
  transform: translateX(-20px);
}
.switch input:focus-visible + .track {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.switch .state {
  font-size: var(--text-sm);
  color: var(--text-2);
}
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 44px;
  cursor: pointer;
}
.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  flex: none;
}
.radio-cards {
  display: grid;
  gap: var(--s2);
}
.radio-card {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.radio-card input {
  margin-top: 4px;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  flex: none;
}
.radio-card:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.radio-card .t {
  font-weight: var(--w-medium);
}
.radio-card .d {
  font-size: var(--text-sm);
  color: var(--text-2);
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s4) var(--s4);
}
.form-grid .full {
  grid-column: 1 / -1;
}
.form-section {
  padding-block: var(--s6);
  border-top: 1px solid var(--border);
}
.form-section:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.form-section > h2 {
  font-size: var(--text-h3);
  margin-bottom: var(--s1);
}
.form-section > .desc {
  color: var(--text-2);
  font-size: var(--text-sm);
  margin-bottom: var(--s4);
}
.form-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) 0;
  margin-top: var(--s4);
  background: var(--canvas);
  border-top: 1px solid var(--border);
  z-index: 5;
}
details.advanced {
  border-top: 1px solid var(--border);
  padding-top: var(--s4);
}
details.advanced > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 44px;
  cursor: pointer;
  color: var(--accent);
  font-weight: var(--w-medium);
  list-style: none;
}
details.advanced > summary::-webkit-details-marker {
  display: none;
}
details.advanced[open] > summary .icon {
  transform: rotate(180deg);
}
details.advanced > .body {
  padding-top: var(--s3);
}

/* help "?" */
.help-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  flex: none;
  padding: 0;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-2);
  font-size: 13px;
  font-weight: var(--w-semibold);
  line-height: 1;
  font-family: 'Segoe UI', system-ui, sans-serif;
}
.help-btn::after {
  content: '';
  position: absolute;
  inset: -11px;
}
.help-btn:hover,
.help-btn[aria-expanded='true'] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.popover {
  position: fixed;
  z-index: 90;
  max-width: min(360px, calc(100vw - 16px));
  padding: var(--s4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  font-size: var(--text-sm);
  line-height: 1.6;
  color: var(--text-2);
  animation: pop-in var(--motion-150) var(--ease-out);
}
.popover h4 {
  color: var(--text);
  font-size: var(--text-sm);
  margin-bottom: var(--s1);
}
.popover .example {
  margin-top: var(--s2);
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text);
}
.popover .more {
  display: inline-block;
  margin-top: var(--s2);
}
.tooltip {
  position: fixed;
  z-index: 95;
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) var(--s2);
  border-radius: var(--radius-sm);
  background: var(--navy-800);
  color: var(--on-dark);
  font-size: var(--text-meta);
  line-height: 1.5;
  white-space: nowrap;
  pointer-events: none;
  animation: fade-in var(--motion-100) var(--ease-out);
}
.tooltip kbd {
  background: var(--navy-600);
  border-color: rgba(255, 255, 255, 0.2);
  color: var(--on-dark);
}

/* ---- surfaces ---------------------------------------------------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s4) var(--s4) 0;
}
.card-head h2,
.card-head h3 {
  font-size: var(--text-base);
  display: flex;
  align-items: center;
  gap: var(--s2);
}
.card-body {
  padding: var(--s4);
}
.card-body.flush {
  padding: 0;
}
.card-foot {
  padding: var(--s3) var(--s4);
  border-top: 1px solid var(--hairline);
  font-size: var(--text-sm);
}
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s3);
}
.section-title h2 {
  font-size: var(--text-h3);
  display: flex;
  align-items: center;
  gap: var(--s2);
}

/* KPI tiles (max five in a strip) */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s4);
}
.stat {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  padding: var(--s4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  color: var(--text);
  min-width: 0;
}
a.stat:hover {
  text-decoration: none;
  border-color: var(--border-strong);
}
.stat .label {
  display: flex;
  align-items: center;
  gap: var(--s1);
  font-size: var(--text-sm);
  color: var(--text-2);
}
.stat .value {
  font-size: var(--text-h1);
  font-weight: var(--w-semibold);
  line-height: 1.2;
  overflow-wrap: anywhere;
}
.stat .hint {
  font-size: var(--text-sm);
  color: var(--text-3);
}
.stat.bad .value {
  color: var(--bad);
}

/* status = coloured dot + words */
.status {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--text-sm);
  white-space: nowrap;
}
.status::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
}
.status.ok::before {
  background: var(--ok);
}
.status.warn::before {
  background: #d98a00;
}
.status.bad::before {
  background: var(--bad);
}
.status.info::before {
  background: var(--info);
}
.status.off::before {
  background: transparent;
  border: 2px solid var(--text-3);
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 0 var(--s2);
  min-height: 24px;
  border-radius: var(--radius-sm);
  background: var(--neutral-soft);
  color: var(--text-2);
  font-size: var(--text-meta);
  line-height: 1.4;
  white-space: nowrap;
}
.tag.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.tag.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.tag.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.tag.info {
  background: var(--info-soft);
  color: var(--info);
}

/* banners */
.banner {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.banner .icon {
  margin-top: 2px;
}
.banner .body {
  flex: 1 1 auto;
  min-width: 0;
}
.banner .title {
  font-weight: var(--w-medium);
  color: var(--text);
}
.banner.info {
  background: var(--info-soft);
  border-color: #c5dceb;
  color: #1c4a6b;
}
.banner.warn {
  background: var(--warn-soft);
  border-color: #efd8a8;
  color: #6b4100;
}
.banner.bad {
  background: var(--bad-soft);
  border-color: #f1c6c2;
  color: #8a1c16;
}
.banner.ok {
  background: var(--ok-soft);
  border-color: #c3e0cf;
  color: #155a37;
}
.banner .actions {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-top: var(--s2);
}
.app-banners {
  display: flex;
  flex-direction: column;
}
.app-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s3);
  flex-wrap: wrap;
  padding: var(--s2) var(--s4);
  font-size: var(--text-sm);
  text-align: center;
  background: var(--warn-soft);
  color: #6b4100;
  border-bottom: 1px solid #efd8a8;
}
.app-banner.bad {
  background: var(--bad-soft);
  color: #8a1c16;
  border-color: #f1c6c2;
}
.app-banner.trial {
  background: var(--accent-soft);
  color: var(--rust-700);
  border-color: var(--rust-100);
}
.app-banner a {
  font-weight: var(--w-medium);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.app-banner-meta {
  opacity: 0.85;
}
.app-banner.info {
  background: var(--info-soft);
  color: #1c4a6b;
  border-color: #c5dceb;
}

/* ---- tables (always inside a visible frame) ----------------------------- */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-bottom: var(--s3);
}
.search {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex: 1 1 280px;
  max-width: 480px;
  min-height: var(--control-h);
  padding: 0 var(--s3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
}
.search:focus-within {
  outline: 2px solid var(--focus);
  border-color: var(--focus);
}
.search label {
  font-size: var(--text-sm);
  font-weight: var(--w-medium);
  white-space: nowrap;
}
.search input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  border: 0;
  background: transparent;
  outline: none;
  color: var(--text);
}
.search input::placeholder {
  color: #7d8691;
}
.chips {
  display: flex;
  align-items: center;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-bottom: var(--s3);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 32px;
  padding: 0 var(--s1) 0 var(--s3);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--surface);
  font-size: var(--text-sm);
}
[dir='rtl'] .chip {
  padding: 0 var(--s3) 0 var(--s1);
}
.chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-2);
}
.chip button:hover {
  background: var(--surface-sunken);
}
.table-frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
}
/* a table placed inside a frame or a card is framed once, by its parent */
.table-frame > .table-frame,
.card-body.flush > .table-frame {
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.table-scroll {
  overflow-x: auto;
}
.table {
  font-size: var(--text-sm);
}
.table th {
  position: sticky;
  top: 0;
  padding: var(--s3) var(--s4);
  background: var(--surface-muted);
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  font-weight: var(--w-medium);
  text-align: start;
  white-space: nowrap;
}
.table td {
  padding: var(--s3) var(--s4);
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
  min-height: 52px;
  height: 52px;
}
.table tbody tr:last-child td {
  border-bottom: 0;
}
/* the wrapper only matters when rows are stacked on a phone; on wide screens it is invisible to layout */
.table td > .cell {
  display: contents;
}
.table tr.clickable {
  cursor: pointer;
}
.table tr.clickable:hover td {
  background: var(--accent-soft);
}
.table th.end,
.table td.end {
  text-align: end;
}
.table td.actions {
  width: 1%;
  white-space: nowrap;
  padding-block: var(--s1);
}
.table .primary-cell {
  font-weight: var(--w-medium);
  color: var(--accent);
}
.table .sub {
  display: block;
  font-size: var(--text-meta);
  color: var(--text-3);
  line-height: 1.4;
  font-weight: var(--w-regular);
}
.table .sort-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  border: 0;
  background: none;
  padding: 0;
  font-weight: inherit;
  color: inherit;
}
.table[aria-busy='true'] tbody {
  opacity: 0.55;
}
.table-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s3);
  padding: var(--s12) var(--s6);
  text-align: center;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  flex-wrap: wrap;
  padding: var(--s2) var(--s4);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-2);
}
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
  max-width: 440px;
  margin-inline: auto;
  text-align: center;
}
.empty .icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--text-2);
  margin-bottom: var(--s2);
}
.empty h3 {
  font-size: var(--text-base);
}
.empty p {
  color: var(--text-2);
  font-size: var(--text-sm);
}
.empty .actions {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
  justify-content: center;
  margin-top: var(--s2);
}
.skeleton {
  display: block;
  height: 14px;
  border-radius: 4px;
  background: var(--surface-sunken);
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton {
    animation: pulse 1500ms ease-in-out infinite;
  }
}

/* key/value lists */
.dl {
  display: grid;
  grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
  gap: var(--s2) var(--s4);
  font-size: var(--text-sm);
}
.dl dt {
  color: var(--text-2);
  display: flex;
  align-items: center;
  gap: var(--s1);
}
.dl dd {
  min-width: 0;
  overflow-wrap: anywhere;
}
.list-rows > * {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 56px;
  padding: var(--s2) var(--s4);
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
}
.list-rows > *:last-child {
  border-bottom: 0;
}
.list-rows > a:hover {
  background: var(--accent-soft);
  text-decoration: none;
}

/* tabs */
.tabs {
  display: flex;
  gap: var(--s1);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--s6);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar {
  display: none;
}
.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  min-height: 44px;
  padding: 0 var(--s4);
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  color: var(--text-2);
  font-size: var(--text-sm);
  font-weight: var(--w-medium);
  white-space: nowrap;
}
.tab:hover {
  color: var(--text);
  text-decoration: none;
}
.tab[aria-selected='true'] {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ---- overlays ---------------------------------------------------------- */
.drawer {
  position: fixed;
  inset-block: 0;
  inset-inline-end: 0;
  z-index: 70;
  width: min(460px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-inline-start: 1px solid var(--border-strong);
  box-shadow: var(--shadow-3);
  animation: drawer-in var(--motion-200) var(--ease-out);
}
[dir='rtl'] .drawer {
  animation-name: drawer-in-rtl;
}
.drawer.wide {
  width: min(640px, 100vw);
}
.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3) var(--s3) var(--s3) var(--s6);
  border-bottom: 1px solid var(--border);
}
[dir='rtl'] .drawer-head {
  padding: var(--s3) var(--s6) var(--s3) var(--s3);
}
.drawer-head h2 {
  font-size: var(--text-h3);
}
.drawer-head .sub {
  font-size: var(--text-sm);
  color: var(--text-2);
}
.drawer-body {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: var(--s6);
}
.drawer:not(.wide) .form-grid {
  grid-template-columns: minmax(0, 1fr);
}
.drawer-foot {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--s6);
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.dialog-wrap {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s4);
}
.dialog {
  width: min(480px, 100%);
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  padding: var(--s6);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  animation: pop-in var(--motion-150) var(--ease-out);
}
.dialog h2 {
  font-size: var(--text-h3);
  margin-bottom: var(--s2);
}
.dialog .body {
  color: var(--text-2);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.dialog .actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s2);
  flex-wrap: wrap;
  margin-top: var(--s6);
}
.menu {
  position: fixed;
  z-index: 90;
  min-width: 200px;
  max-width: min(320px, calc(100vw - 16px));
  padding: var(--s1);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-2);
  animation: pop-in var(--motion-100) var(--ease-out);
}
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 44px;
  padding: var(--s2) var(--s3);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text);
  font-size: var(--text-sm);
  text-align: start;
}
.menu-item:hover,
.menu-item:focus-visible {
  background: var(--surface-sunken);
  text-decoration: none;
}
.menu-item.danger {
  color: var(--bad);
}
.menu-sep {
  height: 1px;
  margin: var(--s1) 0;
  background: var(--border);
}
.menu-label {
  padding: var(--s2) var(--s3) var(--s1);
  font-size: var(--text-meta);
  color: var(--text-3);
}
.toasts {
  position: fixed;
  z-index: 100;
  bottom: var(--s6);
  inset-inline-end: var(--s6);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius);
  background: var(--navy-800);
  color: var(--on-dark);
  font-size: var(--text-sm);
  line-height: 1.6;
  box-shadow: var(--shadow-2);
  animation: toast-in var(--motion-200) var(--ease-out);
}
.toast .icon {
  margin-top: 2px;
}
.toast.ok .icon {
  color: #7ad6a3;
}
.toast.bad .icon {
  color: #ff9d94;
}
.toast .body {
  flex: 1 1 auto;
  min-width: 0;
}
.toast .actions {
  display: flex;
  gap: var(--s3);
  margin-top: var(--s1);
}
.toast button {
  border: 0;
  background: none;
  padding: 0;
  color: #ffc9ad;
  font-weight: var(--w-medium);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.toast .close {
  color: var(--on-dark-2);
  text-decoration: none;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}

/* code blocks (router scripts, API examples) */
.code {
  position: relative;
  direction: ltr;
  text-align: left;
  background: var(--navy-900);
  color: #e6e1d6;
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 0.8125rem;
  line-height: 1.7;
}
.code pre {
  margin: 0;
  padding: var(--s4);
  overflow: auto;
  max-height: 420px;
  white-space: pre;
}
.code .copy {
  position: absolute;
  top: var(--s2);
  right: var(--s2);
}
.code .copy .btn {
  min-height: 36px;
  background: var(--navy-600);
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--on-dark);
}
.steps {
  display: flex;
  gap: var(--s2);
  margin-bottom: var(--s6);
  flex-wrap: wrap;
}
.step {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: var(--text-sm);
  color: var(--text-3);
}
.step .n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  font-size: var(--text-sm);
  font-weight: var(--w-medium);
  background: var(--surface);
}
.step.current {
  color: var(--text);
  font-weight: var(--w-medium);
}
.step.current .n {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.step.done .n {
  background: var(--ok-soft);
  border-color: transparent;
  color: var(--ok);
}
.step + .step::before {
  content: '';
  width: 24px;
  height: 1px;
  background: var(--border-strong);
  margin-inline-end: var(--s2);
}

/* charts */
.chart {
  position: relative;
  width: 100%;
}
.chart svg {
  width: 100%;
  height: auto;
  overflow: visible;
}
.chart text {
  font-family: var(--font);
  font-size: 12px;
  fill: var(--text-3);
}
.chart .grid-line {
  stroke: var(--chart-grid);
  stroke-width: 1;
}
.chart .axis-line {
  stroke: var(--chart-axis);
  stroke-width: 1;
}
.chart .hit {
  fill: transparent;
}
.chart .hit:hover + .mark,
.chart .mark.active {
  opacity: 0.8;
}
.chart-tip {
  position: absolute;
  z-index: 5;
  min-width: 120px;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-2);
  font-size: var(--text-meta);
  line-height: 1.6;
  pointer-events: none;
  white-space: nowrap;
}
.chart-tip .t {
  color: var(--text-3);
}
.chart-tip .v {
  font-size: var(--text-sm);
  font-weight: var(--w-semibold);
  color: var(--text);
}
.legend {
  display: flex;
  gap: var(--s4);
  flex-wrap: wrap;
  font-size: var(--text-sm);
  color: var(--text-2);
}
.legend .key {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
}
.legend .swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex: none;
}
.hbars {
  display: grid;
  gap: var(--s3);
}
.hbar {
  display: grid;
  grid-template-columns: minmax(96px, 30%) minmax(0, 1fr) max-content;
  align-items: center;
  gap: var(--s3);
  font-size: var(--text-sm);
}
.hbar .track {
  height: 12px;
  border-radius: 0 4px 4px 0;
  background: transparent;
}
.hbar .fill {
  height: 12px;
  min-width: 2px;
  border-radius: 0 4px 4px 0;
  background: var(--series-1);
}
[dir='rtl'] .hbar .fill {
  border-radius: 4px 0 0 4px;
}
.meter {
  height: 8px;
  border-radius: 4px;
  background: var(--rust-100);
  overflow: hidden;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
}
.meter.warn {
  background: var(--warn-soft);
}
.meter.warn > span {
  background: #d98a00;
}
.meter.bad {
  background: var(--bad-soft);
}
.meter.bad > span {
  background: var(--bad);
}

/* ---- auth / setup (centered card, no app chrome) ------------------------ */
.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--canvas);
}
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--s6);
  padding: var(--s12);
  text-align: center;
  background: var(--canvas) url('/img/pattern.svg');
  border-inline-end: 1px solid var(--border);
}
.auth-brand::after {
  content: '';
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  height: 96px;
  background: linear-gradient(to bottom, rgba(251, 250, 247, 0), var(--canvas));
  pointer-events: none;
}
.lockup {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s2);
}
.lockup .mark {
  width: 132px;
  height: auto;
  margin-bottom: var(--s4);
}
.lockup .wordmark {
  font-family: 'Sora', var(--font);
  font-size: 2.488rem;
  font-weight: var(--w-semibold);
  line-height: 1.15;
  color: var(--text);
}
.lockup .wordmark .tech {
  color: var(--accent);
}
.lockup .wordmark-ar {
  font-size: 1.728rem;
  font-weight: var(--w-semibold);
  line-height: 1.4;
}
.lockup.small {
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--s3);
}
.lockup.small .mark {
  width: 40px;
  margin: 0;
}
.lockup.small .wordmark {
  font-size: var(--text-h3);
}
.lockup.small .wordmark-ar {
  display: none;
}
.auth-brand .lead {
  max-width: 40ch;
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--text-2);
}
.auth-brand .company {
  padding: var(--s1) var(--s4);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  font-weight: var(--w-medium);
}
.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--s8) var(--s6);
  background: var(--surface);
}
.auth-card {
  width: min(440px, 100%);
}
.auth-card.wide {
  width: min(560px, 100%);
}
.auth-card h2 {
  font-size: var(--text-h2);
  margin-bottom: var(--s1);
}
.auth-card .lead {
  color: var(--text-2);
  margin-bottom: var(--s6);
}
.auth-top {
  align-self: stretch;
  display: flex;
  justify-content: flex-end;
  margin-bottom: auto;
}
.auth-bottom {
  margin-top: auto;
  padding-top: var(--s6);
  font-size: var(--text-sm);
  color: var(--text-3);
  text-align: center;
}

/* ---- motion ------------------------------------------------------------ */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
}
@keyframes drawer-in {
  from {
    opacity: 0;
    transform: translateX(48px);
  }
}
@keyframes drawer-in-rtl {
  from {
    opacity: 0;
    transform: translateX(-48px);
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@keyframes pulse {
  50% {
    opacity: 0.55;
  }
}
@media (prefers-reduced-motion: reduce) {
  .drawer,
  .dialog,
  .menu,
  .popover,
  .toast,
  .tooltip,
  .scrim {
    animation: fade-in var(--motion-100) ease !important;
  }
  .spinner {
    animation-duration: 1500ms;
  }
  .switch .track,
  .switch .track::after,
  .btn {
    transition: none;
  }
}

/* ---- responsive -------------------------------------------------------- */
@media (max-width: 1023.98px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .grid.cols-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 767.98px) {
  .sidebar {
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    z-index: 65;
    height: 100%;
    display: none;
    box-shadow: var(--shadow-3);
  }
  .sidebar.open {
    display: flex;
    animation: fade-in var(--motion-150) var(--ease-out);
  }
  .topbar {
    padding-inline: var(--s3);
  }
  .topbar .menu-btn {
    display: inline-flex;
  }
  .page {
    padding: var(--s4) var(--s4) var(--s16);
  }
  .grid.cols-2,
  .grid.cols-3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-brand {
    padding: var(--s6) var(--s4);
    gap: var(--s3);
    border-inline-end: 0;
    border-bottom: 1px solid var(--border);
  }
  .auth-brand::after {
    display: none;
  }
  .auth-brand .lead {
    display: none;
  }
  .lockup .mark {
    width: 64px;
    margin-bottom: var(--s1);
  }
  .lockup .wordmark {
    font-size: var(--text-h2);
  }
  .lockup .wordmark-ar {
    font-size: var(--text-h3);
  }
  .drawer-body {
    padding: var(--s4);
  }
  .drawer-foot {
    padding: var(--s3) var(--s4);
  }
  .toasts {
    inset-inline: var(--s4);
    bottom: var(--s4);
  }
  .dl {
    grid-template-columns: minmax(0, 1fr);
    gap: 0 0;
  }
  .dl dd {
    margin-bottom: var(--s2);
  }
  /* lists: each row becomes a small block (name first, then "column: value" lines) instead of a wide table */
  .table.stacked,
  .table.stacked tbody {
    display: block;
  }
  .table.stacked thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .table.stacked tbody tr {
    position: relative;
    display: block;
    padding: var(--s3) var(--s4);
    border-bottom: 1px solid var(--hairline);
  }
  .table.stacked tbody tr:last-child {
    border-bottom: 0;
  }
  .table.stacked td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--s3);
    height: auto;
    min-height: 0;
    padding: 2px 0;
    border: 0;
    text-align: start;
  }
  .table.stacked td[data-label]::before {
    content: attr(data-label);
    flex: none;
    max-width: 45%;
    color: var(--text-2);
  }
  .table.stacked td > .cell {
    display: block;
    min-width: 0;
  }
  .table.stacked td[data-label] > .cell {
    text-align: end;
  }
  .table.stacked td:first-child {
    display: block;
    padding-inline-end: var(--s12);
    font-size: var(--text-base);
  }
  .table.stacked td.actions {
    position: absolute;
    top: var(--s1);
    inset-inline-end: var(--s1);
    width: auto;
    padding: 0;
  }
  .table.stacked td.hide-narrow {
    display: none;
  }
  .hide-narrow {
    display: none !important;
  }
}
@media (min-width: 768px) {
  .only-narrow {
    display: none !important;
  }
}
@media (hover: hover) {
  .hover-only {
    opacity: 0;
  }
  tr:hover .hover-only,
  tr:focus-within .hover-only {
    opacity: 1;
  }
}

/* plain lists inside cards, banners and wizards (the reset removes list markers) */
.numbered,
.bullets {
  display: grid;
  gap: var(--s2);
  padding-inline-start: 1.4em;
}
.numbered {
  list-style: decimal;
}
.bullets {
  list-style: disc;
}
