/* ============================================================================
 * Mawahib — design system, Tadrij-aligned (OneAI family theme)
 *
 * Re-tuned May 2026 to match Tadrij (oneai-tadrij) so the two products read
 * as one family. Two design voices:
 *
 *   • navy — the platform: data, structure, navigation, primary CTAs.
 *            Deep CBUAE-flag navy (#0E1730 family).
 *   • gold — the AI Agents: any AI-generated suggestion, narrative, draft,
 *            or agent badge is tinted with a warm sophisticated gold.
 *
 * Important: legacy CSS variable names from the previous Mawahib palette
 * (--gold, --gold-dark, --ink, --line, etc.) are preserved as aliases so
 * the existing vanilla-JS components that reference them keep working —
 * they now resolve to the Tadrij-aligned values.
 *
 * Source palette: oneai-tadrij/frontend/app/globals.css.
 * ============================================================================ */
:root {
  /* ── Surfaces — warm off-white papers (Tadrij canvas / paper / paper-soft) */
  --bg-canvas:     #F7F5F0;  /* page canvas */
  --bg-elevated:   #FFFFFF;  /* cards */
  --bg-surface:    #FBF9F4;  /* nested / inputs */
  --bg-surface-hi: #F1ECE2;  /* hovered (slightly warmer than line) */

  /* ── Ink (text) — Tadrij ink-900 → ink-300 ─────────────────────────────── */
  --foreground:        #1A1F2E;
  --foreground-muted:  #3F4656;
  --foreground-subtle: #6B7280;
  --foreground-faint:  #9098A4;

  /* ── Borders — Tadrij line / line-strong ───────────────────────────────── */
  --border:        #ECE7DD;
  --border-strong: #D9D2C2;

  /* ── Navy — platform / data voice (Tadrij navy family) ─────────────────── */
  --navy-50:  #EEF2FA;
  --navy-100: #D8E1F2;
  --navy-200: #ABBCDE;
  --navy-300: #7A95C5;
  --navy-400: #4F76B0;
  --navy-500: #3A5996;
  --navy-600: #2C467A;
  --navy-700: #1F3155;
  --navy-800: #182441;
  --navy-900: #0E1730;

  /* ── Gold — AI Agent voice (Tadrij gold family) ────────────────────────── */
  --gold-50:   #FCF7E8;
  --gold-100:  #F8F0DD;
  --gold-200:  #ECDCB7;
  --gold-300:  #E5CD9D;
  --gold-400:  #D7BB7C;
  --gold-500:  #C9A961;  /* primary AI accent */
  --gold-600:  #B89348;
  --gold-700:  #A88835;
  --gold-800:  #876C2A;
  --gold-900:  #604A1E;

  /* ── Semantic — Tadrij green / red / warning ───────────────────────────── */
  --success:      #00A878;
  --success-soft: #E5F6EE;
  --warning:      #A88835;        /* banking gold = caution */
  --warning-soft: #FCF7E8;
  --danger:       #D6342B;
  --danger-soft:  #FCE9E7;
  --info:         #4A6FA5;
  --info-soft:    #E6EEF8;

  /* ── Aurora — gold-led gradient for AI-voice accents ───────────────────── */
  --aurora: linear-gradient(135deg, #E5CD9D 0%, #C9A961 50%, #A88835 100%);
  --aurora-soft: linear-gradient(135deg, #F8F0DD 0%, #FCF7E8 100%);

  /* ── Shadow — Tadrij's warm ink-tinted card shadow ─────────────────────── */
  --shadow-card: 0 1px 0 0 #ECE7DD,
                 0 1px 3px -1px rgba(13, 19, 38, 0.05),
                 0 1px 2px -1px rgba(13, 19, 38, 0.04);
  --shadow-pop:  0 2px 4px -2px rgba(13, 19, 38, 0.07),
                 0 8px 24px -8px rgba(13, 19, 38, 0.09);

  /* ── Radius scale ──────────────────────────────────────────────────────── */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* ── Typography — Inter (body) + Playfair Display (display) + Tajawal (Arabic) */
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-ar:      'Tajawal', 'Inter', sans-serif;

  /* ── Legacy aliases — keep existing JS/CSS that reads these working ────── */
  --bg:        var(--bg-canvas);
  --surface:   var(--bg-elevated);
  --ink:       var(--foreground);
  --ink-2:     var(--foreground-muted);
  --muted:     var(--foreground-subtle);
  --line:      var(--border);
  --line-2:    var(--border);
  --gold:      var(--gold-700);
  --gold-2:    var(--gold-500);
  --gold-dark: var(--gold-800);
  --ok:        var(--success);
  --warn:      var(--warning);
  --bad:       var(--danger);
  --shadow:    var(--shadow-card);
  /* Legacy font aliases — JS that hard-codes 'Manrope' is overridden via
     the body font-family below; `--font-serif` resolves to Playfair Display
     so any class reading var(--font-serif) automatically updates. */
  --font-serif: var(--font-display);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font-sans);
  background: var(--bg-canvas);
  color: var(--foreground);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
.boot { padding: 48px; color: var(--foreground-subtle); }

/* =========================================================================
 * Login
 * ========================================================================= */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-canvas) 0%, #FBF9F4 100%);
}
.login-card {
  background: var(--bg-elevated);
  padding: 40px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  width: 380px;
  border: 1px solid var(--border);
}
.brand { text-align: center; margin-bottom: 24px; }
.brand h1 {
  font-family: var(--font-display);
  font-size: 38px;
  font-weight: 600;
  margin: 8px 0 0;
  /* Uppercase wordmark — match Tadrij's TADRIJ treatment */
  letter-spacing: 2px;
  color: var(--navy-900);
  line-height: 1;
}
/* The hidden AI inside "Mawahib" — the 'a' (4th letter) and 'i' (6th
   letter) are tinted with the aurora gold gradient so "AI" reads
   inside the wordmark without a separate badge. Background-clip:text
   keeps the gradient mapped to the letter shapes. */
.brand h1 .brand-ai {
  background: var(--aurora);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.brand .tagline {
  color: var(--gold-700);
  font-weight: 600;
  letter-spacing: 4px;
  font-size: 11px;
  text-transform: uppercase;
  margin-top: 4px;
}
form label {
  display: block;
  margin: 12px 0;
  font-weight: 500;
  color: var(--foreground-muted);
  font-size: 13px;
}
form input {
  display: block;
  width: 100%;
  padding: 10px 12px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--bg-surface);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
form input:focus {
  outline: none;
  border-color: var(--navy-500);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(58, 89, 150, 0.15);
}
form button {
  display: block;
  width: 100%;
  padding: 12px;
  margin-top: 16px;
  background: var(--navy-700);
  color: white;
  border: 0;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.15s, transform 0.15s;
}
form button:hover {
  background: var(--navy-800);
  transform: translateY(-1px);
}
.error {
  color: var(--danger);
  min-height: 1.4em;
  margin-top: 8px;
  font-size: 13px;
}
.hints {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--foreground-muted);
}
.hints strong {
  display: block;
  margin-bottom: 6px;
  color: var(--navy-700);
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 11px;
}
.hints code {
  background: var(--bg-surface);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, 'JetBrains Mono', monospace;
  color: var(--foreground-muted);
  border: 1px solid var(--border);
}

/* =========================================================================
 * App shell — Tadrij-style icon-rail sidebar
 *
 * White rail, navy active pill, warm-ink inactive labels. The sidebar
 * reserves 64px of grid track but expands to 288px on hover, overflowing
 * the column so the main content never shifts. Floats above /main with
 * z-index + shadow so the expansion reads like a drawer opening, not a
 * layout reflow.
 *
 * Visual treatment matches Tadrij's `components/shell/side-nav.tsx`:
 *   • bg-elevated (white) background with a warm-grey right border
 *   • Active item = solid navy-700 pill with white icon + 2px aurora rail
 *   • Inactive item = warm-ink text, lifts 1px + border ring on hover
 *   • Group headings = foreground-faint, fade in only when expanded
 * ========================================================================= */
.shell {
  display: grid;
  grid-template-columns: 64px 1fr 340px;
  height: 100vh;
  position: relative;
}

/* Permanent copilot right panel */
.copilot-panel {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  height: 100vh;
  overflow: hidden;
  background: var(--bg-elevated);
}

/* ── Sidebar ─────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--bg-elevated);
  color: var(--foreground);
  padding: 14px 0 10px;
  width: 64px;
  height: 100vh;
  position: relative;
  z-index: 20;
  overflow: hidden;        /* clips collapsed-state labels horizontally */
  transition: width 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
}
.sidebar:hover,
.sidebar:focus-within {
  width: 288px;
  box-shadow: var(--shadow-pop);
  /* overflow stays hidden — only .sidebar nav scrolls.  This keeps the
     brand pinned at the top and the user footer pinned at the bottom. */
}

/* ── Brand block — collapsed = falcon centred on the rail;
 * expanded = falcon at the start + wordmark beside it. */
.sidebar .brand-mini {
  display: flex;
  align-items: center;
  justify-content: center;      /* collapsed: centre the falcon */
  gap: 12px;
  padding: 4px 8px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
  flex-shrink: 0;
}
.sidebar:hover .brand-mini,
.sidebar:focus-within .brand-mini {
  justify-content: flex-start;
  padding: 4px 18px 14px;
}
.sidebar .brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}
.sidebar .brand-text {
  display: none;                /* hidden when collapsed */
  flex-direction: column;
  line-height: 1.1;
}
.sidebar:hover .brand-text,
.sidebar:focus-within .brand-text { display: flex; }

.sidebar .brand-mini h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  color: var(--navy-900);
  /* Uppercase wordmark — a touch more letter-spacing reads cleaner */
  letter-spacing: 1.2px;
  line-height: 1;
}
/* "AI" hidden inside Mawahib — the two letters 'a' (4th) and 'i' (6th)
   are tinted with the aurora gold so the eye picks out "AI" inside the
   wordmark without a separate badge. */
.sidebar .brand-mini h1 .brand-ai {
  background: var(--aurora);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
}
.sidebar .brand-mini small {
  color: var(--foreground-subtle);
  font-size: 9.5px;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-top: 6px;
}

/* ── Nav items — Tadrij rounded-tile treatment ──────────────────────── */
.sidebar nav {
  flex: 1;
  min-height: 0;
  padding: 0 6px;
  overflow-y: auto;        /* nav itself scrolls when content exceeds — */
  overflow-x: hidden;      /* keeps the footer from being pushed out.    */
}
.sidebar nav::-webkit-scrollbar { width: 4px; }
.sidebar nav::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
.sidebar nav a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;        /* collapsed default — icon centers on the 64px rail */
  gap: 12px;
  padding: 7px 8px;
  margin-bottom: 2px;
  color: var(--foreground-muted);
  text-decoration: none;
  font-size: 13px;
  border-radius: 12px;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s, border-color 0.15s, justify-content 0s;
}
/* When the rail expands, the icon shifts to the start of the row so the
 * label has room beside it. */
.sidebar:hover nav a,
.sidebar:focus-within nav a {
  justify-content: flex-start;
  padding: 7px 10px;
}
.sidebar nav a:hover {
  color: var(--foreground);
  background: var(--bg-surface);
  border-color: var(--border);
}
.sidebar nav a.active {
  color: white;
  background: var(--navy-700);
  border-color: var(--navy-700);
  box-shadow: 0 8px 22px -8px rgba(31, 49, 85, 0.5);
}
/* 2px aurora-gold accent rail on the start edge of the active tile. */
.sidebar nav a.active::before {
  content: "";
  position: absolute;
  inset-inline-start: -8px;
  top: 50%;
  transform: translateY(-50%);
  height: 22px;
  width: 2px;
  border-radius: 2px;
  background: var(--aurora);
}
.sidebar nav a .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--foreground-muted);
}
.sidebar nav a:hover .nav-icon { color: var(--navy-700); }
.sidebar nav a.active .nav-icon { color: white; }
/* Labels — display: none when collapsed so the row's flex layout treats
 * the icon as the only child, which lets `justify-content: center` actually
 * center it.  An opacity-based hide would still take layout space and
 * push the icon off-centre. */
.sidebar nav a .nav-label {
  display: none;
  font-weight: 500;
  letter-spacing: 0.1px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar:hover nav a .nav-label,
.sidebar:focus-within nav a .nav-label { display: inline-block; }
.sidebar nav a.active .nav-label { font-weight: 600; }

/* Indented exec-mode child items — indentation only applies when the
 * rail is expanded, otherwise it would push the icon off-centre on the
 * 64px rail. */
.sidebar nav a.nav-indent { padding-left: 8px; }
.sidebar:hover nav a.nav-indent,
.sidebar:focus-within nav a.nav-indent { padding-left: 26px; }

/* ── Group headings — entirely hidden when collapsed.  The rail uses
 * vertical spacing alone to separate groups; the small-caps labels are
 * only useful when there's room to read them. */
.sidebar nav .group {
  display: none;
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--foreground-faint);
  padding: 14px 12px 4px;
  align-items: center;
  justify-content: space-between;
}
.sidebar:hover nav .group,
.sidebar:focus-within nav .group { display: flex; }
.sidebar nav .group.group-sub { padding-left: 26px; }
.sidebar nav .group.group-toggle {
  cursor: pointer;
  user-select: none;
  color: var(--foreground-muted);
}
.sidebar nav .group.group-toggle:hover { color: var(--foreground); }
.sidebar nav .group .group-label { display: inline-block; }
.sidebar nav .group .group-arrow {
  font-size: 14px;
  color: var(--gold-700);
  transition: transform 0.15s ease;
}

/* ── "Me" footer — collapsed = just the sign-out icon centred on the
 * rail; expanded = name + role above + sign-out button with label. */
.sidebar .me {
  padding: 12px 8px;
  border-top: 1px solid var(--border);
  margin-top: 6px;
  font-size: 12px;
  color: var(--foreground-muted);
  flex-shrink: 0;
  background: var(--bg-elevated);
  display: flex;
  flex-direction: column;
  align-items: center;             /* collapsed: contents centred on rail */
}
.sidebar:hover .me,
.sidebar:focus-within .me {
  padding: 12px 18px;
  align-items: flex-start;         /* expanded: contents left-aligned */
}
.sidebar .me .name,
.sidebar .me .role {
  display: none;                   /* hidden when collapsed */
}
.sidebar:hover .me .name,
.sidebar:focus-within .me .name {
  display: block;
  color: var(--foreground);
  font-weight: 600;
}
.sidebar:hover .me .role,
.sidebar:focus-within .me .role {
  display: block;
  color: var(--gold-700);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.sidebar .me button {
  /* Collapsed default: icon-only square, no label, no margin. */
  margin: 0;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--foreground-muted);
  padding: 6px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.sidebar:hover .me button,
.sidebar:focus-within .me button {
  margin-top: 8px;
  padding: 5px 10px;
}
.sidebar .me button:hover {
  color: var(--navy-700);
  border-color: var(--navy-300);
  background: var(--bg-surface);
}
.sidebar .me .sign-out-label {
  display: none;                   /* label hidden when collapsed */
}
.sidebar:hover .me .sign-out-label,
.sidebar:focus-within .me .sign-out-label { display: inline; }
.sidebar:hover .me .sign-out-label,
.sidebar:focus-within .me .sign-out-label { opacity: 1; }

/* ── Main content area — Tadrij hero treatment ──────────────────────── */

/* ── Main content area ───────────────────────────────────────────────── */
.main {
  overflow-y: auto;
  padding: 32px 40px;
  background: var(--bg-canvas);
}

/* Page header — Tadrij hero treatment: gold aurora accent bar on the
   left of the title; the title block lifts off the page. */
.main header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  padding: 4px 0 16px 18px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.main header::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 6px;
  bottom: 22px;
  width: 4px;
  border-radius: 2px;
  background: var(--aurora);
}
.main h2 {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  margin: 0;
  color: var(--foreground);
  letter-spacing: 0.2px;
  line-height: 1.15;
}
.main .subtitle {
  color: var(--foreground-muted);
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 0.1px;
}

/* Cards lift slightly on hover — same micro-motion Tadrij uses across
   its dashboard tiles so the surface feels interactive. */
.card {
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.card:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-pop);
  border-color: var(--border-strong);
}

/* =========================================================================
 * Cards & grid
 * ========================================================================= */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-card);
}
.card h3 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--foreground);
}
.card h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--navy-700);
  margin: 0 0 8px;
}
.card.kpi { padding: 18px; }
.card.kpi .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--foreground-subtle);
}
.card.kpi .value {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.1;
  margin-top: 4px;
  color: var(--foreground);
  font-feature-settings: "tnum";
}
.card.kpi .hint {
  color: var(--foreground-muted);
  font-size: 12px;
  margin-top: 2px;
}

/* =========================================================================
 * Pills
 * ========================================================================= */
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.pill.ok    { background: var(--success-soft); color: var(--success); }
.pill.warn  { background: var(--warning-soft); color: var(--warning); }
.pill.bad   { background: var(--danger-soft);  color: var(--danger); }
.pill.muted { background: var(--bg-surface-hi); color: var(--foreground-muted); }
.pill.gold  { background: var(--gold-100);     color: var(--gold-800); }
.pill.navy  { background: var(--navy-50);      color: var(--navy-700); }

/* =========================================================================
 * Buttons — primary uses navy (platform voice). Gold reserved for AI accents.
 * ========================================================================= */
.btn {
  display: inline-block;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--navy-700);
  background: var(--navy-700);
  color: white;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:hover {
  background: var(--navy-800);
  border-color: var(--navy-800);
  transform: translateY(-1px);
}
.btn.ghost {
  background: transparent;
  color: var(--navy-700);
  border-color: var(--border);
}
.btn.ghost:hover {
  background: var(--navy-50);
  border-color: var(--navy-200);
  color: var(--navy-800);
}
.btn.gold {
  background: var(--gold-700);
  border-color: var(--gold-700);
  color: white;
}
.btn.gold:hover {
  background: var(--gold-800);
  border-color: var(--gold-800);
}
.btn.danger {
  background: var(--danger);
  border-color: var(--danger);
}
.btn.danger:hover { background: #B82922; border-color: #B82922; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* =========================================================================
 * Tables
 * ========================================================================= */
table.list { width: 100%; border-collapse: collapse; font-size: 13px; }
table.list th, table.list td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}
table.list th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--foreground-subtle);
  font-weight: 600;
}
table.list tr:hover td { background: var(--bg-surface); }
table.list td.right, table.list th.right { text-align: right; }

/* =========================================================================
 * Agent bar — AI-voice surface. Aurora gold gradient.
 * ========================================================================= */
.agent-bar {
  background: var(--aurora-soft);
  border: 1px solid var(--gold-200);
  border-left: 3px solid var(--gold-500);
  padding: 12px 16px;
  border-radius: var(--radius);
  margin: 12px 0;
  display: flex;
  align-items: center;
  gap: 12px;
}
.agent-bar .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--gold-800);
  font-weight: 700;
}
.agent-bar .name { font-weight: 600; color: var(--foreground); }

/* =========================================================================
 * Evidence + timeline
 * ========================================================================= */
.evidence {
  border-left: 3px solid var(--gold-500);
  padding: 6px 10px;
  margin: 4px 0;
  background: var(--gold-50);
  font-size: 12px;
  color: var(--foreground-muted);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 12px;
}
.timeline li .ts {
  color: var(--foreground-subtle);
  margin-right: 8px;
  font-variant-numeric: tabular-nums;
}

/* =========================================================================
 * Key/value definition list
 * ========================================================================= */
dl.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  margin: 0;
  font-size: 13px;
}
dl.kv dt {
  color: var(--foreground-subtle);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  align-self: center;
  font-weight: 600;
}
dl.kv dd { margin: 0; color: var(--foreground); }

/* =========================================================================
 * Form controls
 * ========================================================================= */
textarea, select, input[type="text"], input[type="number"] {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font: inherit;
  background: var(--bg-surface);
  color: var(--foreground);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
textarea:focus, select:focus, input[type="text"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: var(--navy-500);
  background: var(--bg-elevated);
  box-shadow: 0 0 0 3px rgba(58, 89, 150, 0.15);
}

/* =========================================================================
 * Copilot composer — scoped override so the textarea inside the
 * form-pill flattens against its container.  The global textarea rule
 * above gives every form-control a border + focus ring; inside the
 * copilot's form-pill we don't want that — the form-pill itself owns
 * the border and the focus highlight.
 * ========================================================================= */
.copilot-composer {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 4px 4px 10px;
  transition: border-color 0.15s;
}
/* Tadrij just shifts the border colour — no glow halo around the pill. */
.copilot-composer:focus-within {
  border-color: var(--navy-300);
}
.copilot-composer textarea {
  flex: 1;
  min-height: 24px;
  max-height: 120px;
  resize: none;
  border: 0;
  background: transparent;
  padding: 4px 0;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  color: var(--foreground);
  border-radius: 0;
  box-shadow: none;
  outline: none;
}
.copilot-composer textarea:focus {
  border: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
}
.copilot-composer textarea::placeholder {
  color: var(--foreground-subtle);
}
.copilot-composer .copilot-send {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 0;
  flex-shrink: 0;
  cursor: pointer;
  padding: 0;
  margin: 0;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  /* Idle — soft surface (warm off-white) with a clearly-visible ink
     icon.  Same shape as Tadrij's send button at rest. */
  background: var(--bg-surface);
  color: var(--foreground-muted);
}
.copilot-composer .copilot-send:hover {
  background: var(--bg-surface-hi);
  color: var(--navy-700);
}
.copilot-composer .copilot-send.has-text {
  background: var(--navy-700);
  color: #FFFFFF;
  box-shadow: var(--shadow-card);
}
.copilot-composer .copilot-send.has-text:hover {
  background: var(--navy-600);
}
.copilot-composer .copilot-send svg {
  display: block;            /* removes the inline-svg baseline gap */
}

/* =========================================================================
 * Utility classes — preserved class names (do not rename)
 * ========================================================================= */
.muted-text { color: var(--foreground-subtle); }
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}
.bias-good { color: var(--success); }
.bias-bad  { color: var(--danger); }
.center    { text-align: center; }

/* =========================================================================
 * Tabs
 * ========================================================================= */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tabs a {
  padding: 8px 14px;
  color: var(--foreground-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  font-weight: 500;
  font-size: 13px;
  transition: color 0.15s, border-color 0.15s;
}
.tabs a:hover { color: var(--navy-700); }
.tabs a.active {
  color: var(--navy-700);
  border-bottom-color: var(--navy-500);
}

/* =========================================================================
 * Empty + error banners
 * ========================================================================= */
.empty {
  padding: 48px;
  text-align: center;
  color: var(--foreground-subtle);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}
.error-banner {
  padding: 12px 16px;
  background: var(--danger-soft);
  border: 1px solid #F5BABA;
  color: var(--danger);
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}
.scroll-x { overflow-x: auto; }

/* =========================================================================
 * Persona switcher — fixed top-right dropdown used by the Executive demo
 * to "View as" each persona without signing out.
 * ========================================================================= */
.persona-switcher {
  position: fixed;
  top: 18px;
  right: 360px;   /* sits to the left of the 340px copilot column + 20px margin */
  z-index: 1100;
}
.persona-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  font: inherit;
  color: var(--foreground);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.persona-trigger:hover {
  border-color: var(--navy-300);
  box-shadow: var(--shadow-pop);
}
.persona-trigger.open {
  border-color: var(--navy-500);
}
.persona-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--navy-700);
  color: white;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.4px;
  flex-shrink: 0;
}
.persona-meta { text-align: left; line-height: 1.15; }
.persona-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--foreground);
}
.persona-role {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--gold-700);
}
.persona-chevron {
  display: inline-flex;
  align-items: center;
  color: var(--foreground-subtle);
  margin-left: 2px;
}
.persona-trigger.open .persona-chevron { transform: rotate(180deg); }

.persona-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 280px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 8px 6px;
  max-height: 80vh;
  overflow-y: auto;
}
.persona-menu-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--foreground-faint);
  padding: 8px 10px 4px;
}
.persona-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--foreground);
  font-size: 13px;
  transition: background 0.12s;
}
.persona-option:hover { background: var(--bg-surface); }
.persona-option.active {
  background: var(--navy-50);
  outline: 1px solid var(--navy-200);
}
.persona-option.active .persona-option-label { color: var(--navy-700); }
.persona-option-icon {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.persona-option-text { flex: 1; min-width: 0; }
.persona-option-label { font-weight: 600; font-size: 13px; }
.persona-option-sub {
  font-size: 11px;
  color: var(--foreground-subtle);
  margin-top: 1px;
}
.persona-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 8px;
}
.persona-account-row {
  display: flex; align-items: center; gap: 10px;
  padding: 4px 10px 8px;
}
.persona-signout {
  display: block;
  width: calc(100% - 16px);
  margin: 4px 8px 4px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--foreground-muted);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.persona-signout:hover {
  border-color: var(--danger);
  color: var(--danger);
  background: var(--danger-soft);
}

/* Make room at the top of the main column for the floating switcher so
 * that page headers don't slip underneath it on narrow screens. */
.main { padding-top: 64px; }

/* =========================================================================
 * Language picker — used by the persona switcher dropdown + login page
 * ========================================================================= */
.persona-lang-row {
  display: flex; gap: 6px; padding: 6px 8px;
}
.persona-lang-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 10px; border: 1px solid var(--border);
  background: var(--bg-elevated); border-radius: var(--radius-sm);
  cursor: pointer; font: inherit;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.persona-lang-btn:hover {
  background: var(--bg-surface); border-color: var(--gold-300);
}
.persona-lang-btn.active {
  background: var(--gold-50); border-color: var(--gold-500); color: var(--gold-800);
}
.persona-lang-code {
  font-size: 9.5px; font-weight: 700; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--foreground-subtle);
}
.persona-lang-btn.active .persona-lang-code { color: var(--gold-700); }
.persona-lang-native { font-size: 12px; font-weight: 600; }

/* Login page — small language switcher in the corner */
.login-lang-row {
  display: flex; gap: 4px; justify-content: flex-end; margin-bottom: 8px;
}
.login-lang-btn {
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg-elevated);
  border-radius: 999px; cursor: pointer; color: var(--foreground-muted);
  transition: all 0.12s;
}
.login-lang-btn:hover { border-color: var(--gold-300); color: var(--gold-700); }
.login-lang-btn.active {
  border-color: var(--gold-500); background: var(--gold-50); color: var(--gold-800);
}

/* =========================================================================
 * RTL — Arabic layout adjustments
 *
 * Sidebar moves to the right, copilot panel to the left, persona switcher
 * anchors to the left, page header aurora rail flips to the right edge.
 * Reverse-row flex helpers handle the icon + label realignment.
 * ========================================================================= */
.locale-ar, .locale-ar body {
  font-family: var(--font-ar);
}
[dir="rtl"] .shell {
  grid-template-columns: 340px 1fr 64px;   /* copilot left · main · sidebar right */
}
[dir="rtl"] .sidebar {
  border-right: 0;
  border-left: 1px solid var(--border);
}
[dir="rtl"] .copilot-panel {
  border-left: 0;
  border-right: 1px solid var(--border);
}
[dir="rtl"] .persona-switcher {
  right: auto;
  left: 360px;
}
[dir="rtl"] .persona-menu {
  right: auto;
  left: 0;
}
[dir="rtl"] .main header {
  padding: 4px 18px 16px 0;
}
[dir="rtl"] .main header::before {
  left: auto;
  right: 0;
}
[dir="rtl"] .sidebar nav a.active::before {
  inset-inline-start: auto;
  inset-inline-end: -8px;
}
[dir="rtl"] .persona-trigger { flex-direction: row-reverse; }
[dir="rtl"] .persona-meta    { text-align: right; }
[dir="rtl"] .persona-option-text  { text-align: right; }
/* Tabular numerals in Arabic stay LTR for readability of large counts. */
[dir="rtl"] .pf-screen-title, [dir="rtl"] [style*="tabular-nums"] {
  direction: ltr; unicode-bidi: embed;
}
