/* Valere — Aurisage design system.
   The token blocks below are the Aurisage brand tokens verbatim. Everything
   after them is Valere's product layer. Never hardcode a colour or a size:
   if a token does not exist for it, it probably should not be used. */
/* ============================================================
   Aurisage — Fonts
   IBM Plex Sans Arabic typeface (bilingual Latin + Arabic). Provided by brand.
   Weights: 300 Light · 400 Regular · 500 Medium · 700 Bold
   ============================================================ */

@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("assets/fonts/IBMPlexSansArabic-Light.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("assets/fonts/IBMPlexSansArabic-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("assets/fonts/IBMPlexSansArabic-Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans Arabic";
  src: url("assets/fonts/IBMPlexSansArabic-Bold.woff2") format("woff2");
@font-face{font-family:"IBM Plex Sans Arabic";src:url("IBMPlexSansArabic-SemiBold.woff2") format("woff2");font-weight:600;font-style:normal;font-display:swap}
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
/* ============================================================
   Aurisage — Spacing, Radius, Shadow, Motion, Layout
   4px base grid.
   ============================================================ */

:root {
  /* Spacing — 4px base */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4 */
  --space-2: 0.5rem;   /* 8 */
  --space-3: 0.75rem;  /* 12 */
  --space-4: 1rem;     /* 16 */
  --space-5: 1.25rem;  /* 20 */
  --space-6: 1.5rem;   /* 24 */
  --space-8: 2rem;     /* 32 */
  --space-10: 2.5rem;  /* 40 */
  --space-12: 3rem;    /* 48 */
  --space-16: 4rem;    /* 64 */
  --space-20: 5rem;    /* 80 */
  --space-24: 6rem;    /* 96 */

  /* Radius — gentle, humanist. Nothing sharp. */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Border widths */
  --border-hairline: 1px;
  --border-thick: 1.5px;

  /* Shadows — soft, low, warm-tinted (green-black), never harsh */
  --shadow-xs: 0 1px 2px rgba(17, 47, 28, 0.06);
  --shadow-sm: 0 1px 3px rgba(17, 47, 28, 0.08), 0 1px 2px rgba(17, 47, 28, 0.05);
  --shadow-md: 0 4px 12px rgba(17, 47, 28, 0.08), 0 2px 4px rgba(17, 47, 28, 0.05);
  --shadow-lg: 0 12px 28px rgba(17, 47, 28, 0.12), 0 4px 8px rgba(17, 47, 28, 0.06);
  --shadow-xl: 0 24px 56px rgba(17, 47, 28, 0.16), 0 8px 16px rgba(17, 47, 28, 0.08);

  /* Focus ring */
  --ring-width: 3px;
  --ring-offset: 2px;

  /* Motion — calm, confident easing. No bounce. */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);   /* @kind other */
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1); /* @kind other */
  --dur-fast: 120ms; /* @kind other */
  --dur-base: 200ms; /* @kind other */
  --dur-slow: 320ms; /* @kind other */

  /* Layout */
  --container-sm: 640px;
  --container-md: 860px;
  --container-lg: 1120px;
  --container-xl: 1320px;
}
/* ============================================================
   Aurisage — Color Tokens
   From "New Identity (Colors only)". Six families, each with a
   6-step scale. Names reference Saudi geography.

   Scale semantics (per family):
     900  Depth / Shadow   — deepest, for text-on-tint & shadows
     700  Primary          — the family's core brand tone
     500  Bridge           — mid, for accents & secondary fills
     300  Outline          — borders, dividers, muted strokes
     100  Fill             — soft tinted fills, chips
     50   Background        — page & section wash
   ============================================================ */

:root {
  /* ---- IDENTITY GREEN · Primary (Shadaab) ---- */
  --green-900: #112f1c;
  --green-700: #1e4e37;
  --green-500: #4a8266;
  --green-300: #9fccaf;
  --green-100: #cee7d3;
  --green-50:  #eef6f0;

  /* ---- TUWAIQ GOLD · Secondary ---- */
  --gold-900: #2e2511;
  --gold-700: #57441f;
  --gold-500: #8f7033;
  --gold-300: #ccb783;
  --gold-100: #e3d7b3;
  --gold-50:  #f5eddc;

  /* ---- LAVENDER PURPLE · Complementary ---- */
  --purple-900: #201438;
  --purple-700: #433661;
  --purple-500: #7667ac;
  --purple-300: #bab1e0;
  --purple-100: #dad5f0;
  --purple-50:  #eceaf4;

  /* ---- SOUTHERN RED · Caution ---- */
  --red-900: #2e1111;
  --red-700: #5c3030;
  --red-500: #944f4d;
  --red-300: #cfacaa;
  --red-100: #e6cecd;
  --red-50:  #f5e9e9;

  /* ---- AHSAA BLUE · Functional ---- */
  --blue-900: #11212d;
  --blue-700: #1e4154;
  --blue-500: #488092;
  --blue-300: #91bcc9;
  --blue-100: #c4dce4;
  --blue-50:  #e4eff4;

  /* ---- SARAWAT GRAY · Neutral ---- */
  --gray-900: #1f1e1a;
  --gray-700: #45423b;
  --gray-500: #7c766b;
  --gray-300: #c4bfb8;
  --gray-100: #e2ded9;
  --gray-50:  #f4f1ee;

  /* Pure ends */
  --white: #ffffff;
  --black: #14130f;

  /* ============================================================
     SEMANTIC ALIASES — reference these in product code
     ============================================================ */

  /* Brand */
  --brand:            var(--green-700);
  --brand-deep:       var(--green-900);
  --brand-bridge:     var(--green-500);
  --brand-secondary:  var(--gold-700);
  --brand-accent:     var(--purple-700);

  /* Surfaces */
  --surface-page:      var(--gray-50);
  --surface-card:      var(--white);
  --surface-sunken:    var(--gray-100);
  --surface-brand:     var(--green-700);
  --surface-brand-soft: var(--green-50);
  --surface-inverse:   var(--green-900);

  /* Text */
  --text-strong:   var(--gray-900);
  --text-body:     var(--gray-700);
  --text-muted:    var(--gray-500);
  --text-on-brand: var(--green-50);
  --text-brand:    var(--green-700);
  --text-link:     var(--green-700);

  /* Borders */
  --border-subtle: var(--gray-100);
  --border-default: var(--gray-300);
  --border-strong: var(--gray-500);
  --border-brand:  var(--green-300);

  /* Feedback */
  --info:        var(--blue-700);
  --info-fill:   var(--blue-50);
  --info-border: var(--blue-300);
  --caution:        var(--red-700);
  --caution-fill:   var(--red-50);
  --caution-border: var(--red-300);
  --success:        var(--green-700);
  --success-fill:   var(--green-50);
  --success-border: var(--green-300);
  --highlight:        var(--gold-700);
  --highlight-fill:   var(--gold-50);
  --highlight-border: var(--gold-300);

  /* Focus ring */
  --focus-ring: var(--green-500);
}
/* ============================================================
   Aurisage — Typography Tokens
   Type is set in IBM Plex Sans Arabic. The Aurisage wordmark ("AURIsage") pairs a
   heavy sans with a proprietary serif "sage" — that serif is a
   logo asset, NOT a system font. All UI/body text uses IBM Plex Sans Arabic.
   ============================================================ */

:root {
  /* Families */
  --font-sans: "IBM Plex Sans Arabic", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: var(--font-sans);
  --font-display: var(--font-sans);
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Weights (IBM Plex Sans Arabic ships 300/400/500/700) */
  --fw-light: 300;   /* @kind font */
  --fw-regular: 400; /* @kind font */
  --fw-medium: 500;  /* @kind font */
  --fw-bold: 700;    /* @kind font */

  /* Type scale — 1.20 minor-third, 16px base */
  --text-2xs: 0.6875rem;  /* 11px */
  --text-xs:  0.75rem;    /* 12px */
  --text-sm:  0.875rem;   /* 14px */
  --text-md:  1rem;       /* 16px — base */
  --text-lg:  1.125rem;   /* 18px */
  --text-xl:  1.375rem;   /* 22px */
  --text-2xl: 1.75rem;    /* 28px */
  --text-3xl: 2.25rem;    /* 36px */
  --text-4xl: 3rem;       /* 48px */
  --text-5xl: 4rem;       /* 64px */

  /* Line heights */
  --leading-tight: 1.1;
  --leading-snug: 1.25;
  --leading-normal: 1.5;
  --leading-relaxed: 1.65;

  /* Letter spacing — IBM Plex Sans Arabic is a touch wide; display tightens, labels track out */
  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;
  --tracking-label: 0.08em;  /* uppercase eyebrows / labels */
}
/* ============================================================
   Aurisage — Base / reset. Light element defaults so specimen
   cards and kits inherit brand type without extra work.
   ============================================================ */

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

body {
  font-family: var(--font-body);
  font-weight: var(--fw-regular);
  font-size: var(--text-md);
  line-height: var(--leading-normal);
  color: var(--text-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--text-strong);
  font-weight: var(--fw-bold);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
}

p { margin: 0; }

a {
  color: var(--text-link);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover { color: var(--green-500); }

/* Eyebrow / label utility used across specimens */
.aur-eyebrow {
  font-size: var(--text-xs);
  font-weight: var(--fw-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--text-muted);
}

code, pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

/* ============================================================
   VALERE — product layer
   Bilingual by construction: every directional rule uses logical
   properties (inline-start/end, margin-inline) so the Arabic RTL
   view is the same stylesheet mirrored, not a second theme.
   ============================================================ */

html { height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  background: var(--surface-page);
  color: var(--text-body);
}
[dir="rtl"] body { font-feature-settings: "liga" 1; }

.va-app { display: flex; flex-direction: column; min-height: 100vh; }

/* ---- header ---- */
.va-header {
  display: flex; align-items: center; gap: var(--space-6);
  padding: var(--space-4) var(--space-8);
  background: var(--surface-card);
  border-bottom: var(--border-hairline) solid var(--border-subtle);
  position: sticky; top: 0; z-index: 20;
}
.va-header__logo { height: 26px; display: block; }
.va-header__nav { display: flex; gap: var(--space-1); margin-inline-start: var(--space-4); }
.va-header__spacer { flex: 1; }
.va-navlink {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--text-body);
  font-size: var(--text-sm); font-weight: var(--fw-medium);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.va-navlink:hover { background: var(--green-50); color: var(--text-brand); }
.va-navlink[aria-current="page"] { background: var(--green-50); color: var(--text-brand); }

/* ---- layout ---- */
.va-main { flex: 1; padding: var(--space-8); max-width: 1560px; width: 100%; margin: 0 auto; }
.va-page-head { display: flex; align-items: flex-end; gap: var(--space-4); margin-bottom: var(--space-6); }
.va-page-head h1 { font-size: var(--text-2xl); }
.va-page-head p { color: var(--text-muted); font-size: var(--text-sm); margin-top: var(--space-1); }
.va-eyebrow {
  font-size: var(--text-xs); font-weight: var(--fw-medium);
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted);
}

/* ---- card ---- */
.va-card {
  background: var(--surface-card);
  border: var(--border-hairline) solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
}
.va-card__head {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-bottom: var(--border-hairline) solid var(--border-subtle);
}
.va-card__head h2 { font-size: var(--text-md); font-weight: var(--fw-bold); }
.va-card__body { padding: var(--space-5); }
.va-card--soft { background: var(--surface-brand-soft); border-color: var(--border-brand); }

/* ---- buttons ---- */
.va-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  border: var(--border-hairline) solid transparent;
  font: inherit; font-size: var(--text-sm); font-weight: var(--fw-medium);
  cursor: pointer; white-space: nowrap;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out),
              border-color var(--dur-fast) var(--ease-out);
}
.va-btn:active { transform: translateY(1px); }
.va-btn:focus-visible { outline: var(--ring-width) solid var(--green-100); outline-offset: var(--ring-offset); }
.va-btn--primary { background: var(--green-700); color: var(--white); }
.va-btn--primary:hover { background: var(--green-900); }
.va-btn--secondary { background: var(--surface-card); color: var(--text-body); border-color: var(--border-default); }
.va-btn--secondary:hover { background: var(--green-50); border-color: var(--border-brand); color: var(--text-brand); }
.va-btn--ghost { background: transparent; color: var(--text-body); }
.va-btn--ghost:hover { background: var(--green-50); color: var(--text-brand); }
.va-btn--sm { padding: var(--space-1) var(--space-2); font-size: var(--text-xs); }
.va-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- form controls ---- */
.va-field { display: flex; flex-direction: column; gap: var(--space-2); }
.va-label { font-size: var(--text-sm); font-weight: var(--fw-medium); color: var(--text-strong); }
.va-hint { font-size: var(--text-xs); color: var(--text-muted); }
.va-input, .va-select {
  font: inherit; font-size: var(--text-sm);
  padding: var(--space-2) var(--space-3);
  border: var(--border-thick) solid var(--border-default);
  border-radius: var(--radius-md);
  background: var(--surface-card); color: var(--text-strong);
  width: 100%;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.va-input:focus, .va-select:focus {
  outline: none; border-color: var(--green-500); box-shadow: 0 0 0 var(--ring-width) var(--green-100);
}
.va-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.va-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-4); }

/* ---- badges ---- */
.va-badge {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 2px var(--space-2); border-radius: var(--radius-pill);
  font-size: var(--text-xs); font-weight: var(--fw-medium);
  background: var(--gray-100); color: var(--text-body);
  border: var(--border-hairline) solid transparent;
}
.va-badge--registry { background: var(--green-50); color: var(--green-700); border-color: var(--green-300); }
.va-badge--asking   { background: var(--gold-50); color: var(--gold-700); border-color: var(--gold-300); }
.va-badge--manual   { background: var(--purple-50); color: var(--purple-700); border-color: var(--purple-300); }
.va-badge--draft    { background: var(--gray-100); color: var(--text-body); }
.va-badge--in_review{ background: var(--blue-50); color: var(--blue-700); border-color: var(--blue-300); }
.va-badge--issued   { background: var(--green-50); color: var(--green-700); border-color: var(--green-300); }
.va-badge--weak     { background: var(--red-50); color: var(--red-700); border-color: var(--red-300); }

/* ---- notices ---- */
.va-notice {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  border: var(--border-hairline) solid var(--info-border);
  background: var(--info-fill); color: var(--blue-900);
}
.va-notice--caution { border-color: var(--caution-border); background: var(--caution-fill); color: var(--red-900); }
.va-notice--block { border-color: var(--red-300); background: var(--red-50); color: var(--red-900); }
.va-notice__dismiss { margin-inline-start: auto; }

/* ---- tables & the comp grid ---- */
.va-table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.va-table th, .va-table td {
  padding: var(--space-2) var(--space-3);
  text-align: start;
  border-bottom: var(--border-hairline) solid var(--border-subtle);
}
.va-table th {
  font-weight: var(--fw-medium); color: var(--text-muted);
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: 0.04em;
  background: var(--gray-50); position: sticky; top: 0; z-index: 1;
}
.va-table tbody tr:hover { background: var(--green-50); }
.va-num { font-variant-numeric: tabular-nums; text-align: end; }

.va-grid-wrap { overflow: auto; max-height: 62vh; }
.va-grid-table { border-collapse: separate; border-spacing: 0; font-size: var(--text-sm); }
.va-grid-table th, .va-grid-table td {
  padding: var(--space-2) var(--space-3); white-space: nowrap;
  border-bottom: var(--border-hairline) solid var(--border-subtle);
}
.va-grid-table thead th {
  position: sticky; top: 0; z-index: 2; background: var(--gray-50);
  font-size: var(--text-xs); font-weight: var(--fw-medium); color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: var(--border-thick) solid var(--border-default);
}
.va-grid-table tbody th {
  position: sticky; inset-inline-start: 0; z-index: 1; background: var(--surface-card);
  text-align: start; font-weight: var(--fw-medium); color: var(--text-strong);
  border-inline-end: var(--border-hairline) solid var(--border-subtle);
  min-width: 190px;
}
.va-grid-table thead th:first-child { inset-inline-start: 0; z-index: 3; }
.va-row-group td, .va-row-group th {
  background: var(--green-50); color: var(--green-900);
  font-size: var(--text-xs); font-weight: var(--fw-medium);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.va-row-total td, .va-row-total th { font-weight: var(--fw-bold); background: var(--gray-50); }

.va-cell {
  font: inherit; font-size: var(--text-sm); font-variant-numeric: tabular-nums;
  width: 5.5rem; text-align: end;
  padding: var(--space-1) var(--space-2);
  border: var(--border-hairline) solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-strong);
}
.va-cell:hover { border-color: var(--border-default); }
.va-cell:focus { outline: none; border-color: var(--green-500); box-shadow: 0 0 0 2px var(--green-100); background: var(--white); }
.va-cell--overridden { background: var(--gold-50); border-color: var(--gold-300); font-weight: var(--fw-medium); }
.va-cell--capped { color: var(--gold-700); }
.va-cell--negative { color: var(--red-700); }

/* ---- map ---- */
.va-map { height: 100%; min-height: 320px; border-radius: var(--radius-lg); overflow: hidden; background: var(--gray-100); }
.va-pin {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: var(--radius-pill);
  background: var(--green-700); color: var(--white);
  font-size: 11px; font-weight: var(--fw-bold);
  border: 2px solid var(--white); box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.va-pin--subject { background: var(--gold-700); width: 34px; height: 34px; }
.va-pin--approx { border-style: dashed; opacity: 0.8; }
.va-pin--selected { outline: 3px solid var(--green-300); }

/* ---- workspace layout ---- */
.va-workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr) 360px; gap: var(--space-5); align-items: start; }
@media (max-width: 1400px) { .va-workspace { grid-template-columns: 300px minmax(0, 1fr); } .va-workspace__side { grid-column: 1 / -1; } }
@media (max-width: 1000px) { .va-workspace { grid-template-columns: 1fr; } }

.va-stat { display: flex; flex-direction: column; gap: var(--space-1); }
.va-stat__value { font-size: var(--text-xl); font-weight: var(--fw-bold); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.va-stat__label { font-size: var(--text-xs); color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }

.va-suggestion {
  display: flex; flex-direction: column; gap: var(--space-1);
  padding: var(--space-3); border-radius: var(--radius-md);
  border: var(--border-hairline) solid var(--border-subtle);
  background: var(--surface-card); cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.va-suggestion:hover { border-color: var(--border-brand); box-shadow: var(--shadow-sm); }
.va-suggestion__top { display: flex; align-items: center; gap: var(--space-2); }
.va-suggestion__rate { font-weight: var(--fw-bold); color: var(--text-strong); font-variant-numeric: tabular-nums; }
.va-suggestion__meta { font-size: var(--text-xs); color: var(--text-muted); }

.va-stack { display: flex; flex-direction: column; gap: var(--space-3); }
.va-row { display: flex; align-items: center; gap: var(--space-3); }
.va-spacer { flex: 1; }
.va-muted { color: var(--text-muted); }
.va-empty { padding: var(--space-8); text-align: center; color: var(--text-muted); font-size: var(--text-sm); }

/* ---- sensitivity ---- */
.va-tornado { display: flex; flex-direction: column; gap: var(--space-2); }
.va-tornado__row { display: grid; grid-template-columns: 130px 1fr 90px; gap: var(--space-2); align-items: center; font-size: var(--text-xs); }
.va-tornado__track { position: relative; height: 16px; background: var(--gray-100); border-radius: var(--radius-pill); }
.va-tornado__bar { position: absolute; top: 0; height: 100%; background: var(--green-500); border-radius: var(--radius-pill); }
.va-tornado__mid { position: absolute; top: -3px; bottom: -3px; width: 1px; background: var(--border-strong); }

/* ---- misc ---- */
.va-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--green-100); border-top-color: var(--green-700);
  animation: va-spin 700ms linear infinite;
}
@keyframes va-spin { to { transform: rotate(360deg); } }
.va-toast {
  position: fixed; inset-block-end: var(--space-6); inset-inline-end: var(--space-6);
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  background: var(--green-900); color: var(--green-50); font-size: var(--text-sm);
  box-shadow: var(--shadow-lg); z-index: 60;
}
.va-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
