/* ============================================================
   experience.css — the presentation layer.

   Loaded after styles.css. It does not introduce a second palette: every
   colour below resolves through a brand.css token, so a workspace's appearance
   (tokens, or a brand pack in brands/packs.js) restyles all of it, and a
   workspace that sets nothing renders with Reglio's own values.

   New tokens a brand MAY set (all optional, all with fallbacks here):
     --brand-product-accent-ink   the accent as text on light surfaces
     --brand-accent-gradient      decorative accent (loader, active marks)
     --brand-nav-*                navigation surface and its ink
     --brand-hero-*               dashboard greeting band
     --brand-chart-*              chart series
     --brand-loader-surface       start-up screen
   ============================================================ */

:root {
  /* The accent as TEXT. A bright accent can be a perfect button fill and
     still fail contrast as 13px text on white; brands like that supply a
     deeper ink. Everyone else: the accent itself, exactly as before. */
  --primary-ink: var(--brand-product-accent-ink, var(--primary));
  --accent-gradient: var(--brand-accent-gradient, var(--primary));

  /* Chart — defaults are the colours the chart has always drawn. */
  --chart-total: var(--brand-chart-total, #3B82F6);
  --chart-approved: var(--brand-chart-approved, #10B981);
  --chart-rejected: var(--brand-chart-rejected, #EF4444);
  --chart-flagged: var(--brand-chart-flagged, #F59E0B);
  --chart-pending: var(--brand-chart-pending, #6B7280);
  --chart-grid: var(--border);
  --chart-axis: var(--text-muted);
  --chart-axis-soft: var(--text-muted);
  --chart-axis-future: var(--border);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --focus-halo: 0 0 0 3px color-mix(in srgb, var(--primary) 26%, transparent);
}

/* ── Type ──────────────────────────────────────────────────────
   Body copy at a readable weight; the display face carries headings. */
body { font-weight: 450; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
h1, h2, h3, h4,
.page-title, .section-title, .settings-panel-title, .modal-title, .auth-title,
.reglio-hero-title, .dash-chart-title, .dash-panel-title, .detail-section-title,
.doc-selection-head h2, .wizard-title, .handoff-mobile-title {
  font-family: var(--brand-font-display);
  letter-spacing: -0.015em;
}
.page-title { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.page-subtitle { font-size: 14px; line-height: 1.55; color: var(--text-secondary); }
.section-title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }

/* ── The branded loader ────────────────────────────────────────
   A tenant look is its logo, alone and centred, on the brand's own surface,
   with a thin progress line and a small "Powered by" at the foot. The neutral
   look is the progress line only. */
.brand-loader {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 24px calc(24px + env(safe-area-inset-bottom, 0px));
  background: var(--boot-surface, var(--brand-loader-surface, var(--bg)));
  color: var(--text-secondary);
}
.brand-loader.is-dark { color: rgba(255, 255, 255, 0.72); }
.brand-loader-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  width: min(360px, 78vw);
}
.brand-loader-logo {
  display: block;
  width: 100%;
  max-width: 320px;
  height: auto;
  max-height: 34vh;
  object-fit: contain;
}
.brand-loader-progress {
  position: relative;
  width: min(148px, 46%);
  height: 3px;
  border-radius: 999px;
  overflow: hidden;
  background: color-mix(in srgb, currentColor 16%, transparent);
}
.brand-loader-progress span {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 42%;
  border-radius: inherit;
  background: var(--boot-accent, var(--accent-gradient));
  animation: brand-loader-sweep 1.35s var(--ease-out) infinite;
}
.brand-loader.is-neutral .brand-loader-progress { width: 120px; }
.brand-loader.is-neutral .brand-loader-progress span { background: var(--text-muted); }
@keyframes brand-loader-sweep {
  0%   { transform: translateX(-110%); }
  100% { transform: translateX(260%); }
}
[dir="rtl"] .brand-loader-progress span { animation-name: brand-loader-sweep-rtl; }
@keyframes brand-loader-sweep-rtl {
  0%   { transform: translateX(110%); }
  100% { transform: translateX(-260%); }
}
.brand-loader-attribution {
  position: absolute;
  inset-inline: 0;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--brand-font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
/* Subordinate by size and by a quieter label — never by fading the mark
   itself, which only made it look washed out. */
.brand-loader-attribution span { opacity: 0.75; }
.brand-loader-attribution img { display: block; height: 15px; width: auto; }
@media (prefers-reduced-motion: no-preference) {
  .brand-loader.is-tenant .brand-loader-logo { animation: brand-loader-in 0.5s var(--ease-out) both; }
}
@keyframes brand-loader-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .brand-loader-progress span { animation: none; width: 100%; opacity: 0.55; }
}
@media (max-width: 480px) {
  .brand-loader-stage { width: min(260px, 72vw); gap: 24px; }
}

/* ── Header / navigation ──────────────────────────────────────
   Token-driven surface: a brand with a dark navigation (data-nav-tone)
   renders a navy bar with the white-type mark; everyone else keeps a light
   bar. The active item is a filled pill, not a 2px underline. */
.header {
  background: var(--brand-nav-surface, var(--white));
  border-bottom: 1px solid var(--brand-nav-line, var(--border));
  box-shadow: 0 1px 0 color-mix(in srgb, var(--text) 3%, transparent);
  gap: 16px;
}
.header-logo { display: flex; align-items: center; flex: 0 1 auto; min-width: 0; padding-inline-end: 8px; }
/* Desktop and tablet only: the phone header keeps styles.css's width cap,
   which is what stops a wordmark running under the workspace switcher. */
@media (min-width: 476px) {
  :root[data-tenant-logo] .header-logo img {
    max-height: 44px;
    max-width: 220px;
  }
}
@media (min-width: 981px) {
  :root[data-tenant-logo] .header-logo img { max-height: 48px; max-width: 240px; }
}
.header-logo img { transition: opacity 0.2s ease; }
.header-logo:hover img { opacity: 0.88; }
.header-nav { gap: 2px; align-items: center; }
.nav-btn {
  position: relative;
  padding: 8px 14px;
  border-radius: 999px;
  border-bottom: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--brand-nav-ink-soft, var(--text-secondary));
  transition: background-color 0.16s ease, color 0.16s ease;
}
.nav-btn:hover {
  color: var(--brand-nav-ink, var(--text));
  background: var(--brand-nav-raised, var(--bg));
}
.nav-btn.active {
  color: var(--brand-nav-active-ink, var(--primary-ink));
  background: var(--brand-nav-active, var(--primary-light));
  border-bottom: 0;
  border-radius: 999px;
  font-weight: 600;
}
.header .icon-btn { color: var(--brand-nav-ink-soft, var(--text-secondary)); }
.header .icon-btn:hover { background: var(--brand-nav-raised, var(--bg)); color: var(--brand-nav-ink, var(--text)); }
.workspace-switcher select {
  border-color: var(--brand-nav-line, var(--border));
  background-color: var(--brand-nav-raised, var(--bg));
  color: var(--brand-nav-ink, var(--text));
  border-radius: 10px;
  font-weight: 500;
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.workspace-switcher select:hover { border-color: color-mix(in srgb, var(--brand-nav-ink, var(--text)) 28%, transparent); }
.workspace-switcher select:focus-visible { outline: none; box-shadow: var(--focus-halo); }
.workspace-switcher option { color: var(--text); background: var(--white); }
.header .lang-switch { background: var(--brand-nav-raised, var(--bg)); border-color: var(--brand-nav-line, var(--border)); }
.header .lang-switch-option { color: var(--brand-nav-ink-soft, var(--text-secondary)); }
.header .lang-switch-option:not(.active):hover { color: var(--brand-nav-ink, var(--text)); }
.lang-switch-option.active { color: var(--on-primary); }
.profile-btn {
  border-radius: 999px;
  padding: 4px 12px 4px 4px;
  background: var(--brand-nav-raised, var(--bg));
  border-color: var(--brand-nav-line, var(--border));
  color: var(--brand-nav-ink, var(--text));
}
[dir="rtl"] .profile-btn { padding: 4px 4px 4px 12px; }
.profile-btn:hover { border-color: color-mix(in srgb, var(--brand-nav-ink, var(--text)) 24%, transparent); }
.profile-avatar { width: 32px; height: 32px; color: var(--on-primary); background: var(--primary); font-size: 12px; }
.profile-name { font-size: 13px; font-weight: 600; color: var(--brand-nav-ink, var(--text)); line-height: 1.2; }
.profile-org { font-size: 11.5px; color: var(--brand-nav-ink-soft, var(--text-secondary)); line-height: 1.2; }
.header .mobile-nav-toggle { color: var(--brand-nav-ink, var(--text)); }
.header .mobile-nav-toggle:hover { background: var(--brand-nav-raised, var(--bg)); }
.mobile-nav-item.active { color: var(--primary-ink); }
.dropdown { border-radius: var(--radius); padding: 6px; box-shadow: var(--shadow-lg); }
.dropdown-item { border-radius: calc(var(--radius) - 4px); font-weight: 500; }
/* Phones: the language pill moves into the menu drawer (below), which gives
   the brand mark the width to be read at 40px instead of squeezed to ~30. */
.mobile-nav-lang { display: none; }
@media (max-width: 475px) {
  :root[data-tenant-logo] .header-logo img { max-height: 40px; }
  .header-right > .lang-switch { display: none; }
  .profile-btn { padding: 2px; }
  .mobile-nav-lang {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 16px;
    margin-bottom: 6px;
    border-bottom: 1px solid var(--border-light);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
  }
  /* styles.css hides the pill below 340px because the header had no room;
     in the drawer there is room at every width. */
  .mobile-nav-lang .lang-switch { display: inline-flex; }
}
@media (max-width: 340px) {
  :root[data-tenant-logo] .header-logo img { max-height: 34px; }
}

/* ── Surfaces ─────────────────────────────────────────────── */
.main-content { background: var(--bg); }
.card {
  border-color: var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.modal { border-radius: var(--radius-xl); }

/* ── Buttons ──────────────────────────────────────────────────
   One system: 38px, 10px-ish radius from the brand, a real focus halo, a
   pressed state, and a disabled state that reads as disabled. */
.btn {
  min-height: 38px;
  padding: 9px 16px;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.2;
  border: 1px solid transparent;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.08s ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus-halo); }
.btn:disabled, .btn[disabled] { opacity: 0.5; cursor: not-allowed; box-shadow: none; }
.btn-primary {
  background: var(--primary);
  color: var(--on-primary);
  box-shadow: 0 1px 2px color-mix(in srgb, var(--primary) 30%, transparent), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }
.btn-outline {
  color: var(--primary-ink);
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  background: transparent;
}
.btn-outline:hover:not(:disabled) { background: var(--primary-light); border-color: var(--primary); }
.btn-ghost {
  background: var(--white);
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--bg); border-color: color-mix(in srgb, var(--text) 18%, var(--border)); }
.btn-success { color: #fff; }
.btn-danger { color: #fff; }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--danger) 88%, #000); }

/* ── Form fields ─────────────────────────────────────────────── */
.input, .select-input, .doc-selection-select {
  min-height: 40px;
  border-radius: calc(var(--radius) - 2px);
  border-color: var(--border);
  background-color: var(--white);
  color: var(--text);
  transition: border-color 0.16s ease, box-shadow 0.16s ease;
}
.input::placeholder { color: var(--text-muted); opacity: 1; }
.input:hover, .select-input:hover, .doc-selection-select:hover { border-color: color-mix(in srgb, var(--text) 22%, var(--border)); }
.input:focus, .select-input:focus, .doc-selection-select:focus,
.input:focus-visible, .select-input:focus-visible, .doc-selection-select:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-halo);
}
.field-label, .filter-label { color: var(--text-secondary); font-weight: 600; }
.filter-label { font-size: 11.5px; letter-spacing: 0.04em; }
/* iOS zooms on focus below 16px and never zooms back — re-asserted here
   because the rules above come later than styles.css's own guard. */
@media (hover: none) and (pointer: coarse) {
  input, select, textarea,
  .input, .select-input, .doc-selection-select { font-size: 16px; min-height: 44px; }
  .btn { min-height: 44px; }
  /* A radio or checkbox is not a text field: the 44px floor belongs to the
     row that carries it (its label), and applied to the control itself it
     stretched every document option card on a phone. */
  input[type="radio"], input[type="checkbox"] { min-height: 0; }
  .doc-selection-option { min-height: 52px; align-items: center; }
}

/* ── Tabs, badges, tables ──────────────────────────────────── */
.tab-btn.active { color: var(--primary-ink); border-bottom-color: var(--primary); }
.badge { border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; letter-spacing: 0.005em; }
.chip.selected { color: var(--on-primary); }
.chip:hover:not(.selected) { color: var(--primary-ink); }
thead tr { background: var(--bg); }
th { font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; color: var(--text-secondary); }
td { font-size: 13.5px; color: var(--text); }
tr.clickable td { transition: background-color 0.12s ease; }
tr.clickable:hover td { background: color-mix(in srgb, var(--primary) 5%, var(--white)); }
.breadcrumb-current { color: var(--primary-ink); }
.doc-selection-change { color: var(--primary-ink); }
.flow-card:hover .flow-card-arrow { color: var(--primary-ink); }
.reglio-eyebrow { color: var(--primary-ink); font-size: 11.5px; letter-spacing: 0.1em; }

/* ── Dashboard greeting band ──────────────────────────────────
   The strongest branded surface after the navigation. A brand with a hero
   surface token (a dark band with a controlled accent light, say) gets it here;
   everyone else keeps the wash band they had. */
.reglio-hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  gap: 24px;
  padding: 30px 32px;
  margin-bottom: 20px;
  border-radius: var(--radius-xl);
  border-color: var(--brand-hero-line, var(--brand-wash-hero-line));
  background: var(--brand-hero-surface, linear-gradient(135deg, var(--brand-wash-hero-from), var(--brand-wash-hero-mid) 46%, var(--brand-wash-hero-to)));
  color: var(--brand-hero-ink, var(--text));
  box-shadow: var(--shadow);
}
/* The brand's own mark as a quiet watermark, when it supplies one. */
.reglio-hero::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset-block: -18%;
  inset-inline-end: -2%;
  width: 34%;
  max-width: 360px;
  background: var(--brand-hero-watermark, none) no-repeat center / contain;
  opacity: 0.07;
  pointer-events: none;
}
.reglio-hero .reglio-eyebrow { color: var(--brand-hero-eyebrow, var(--primary-ink)); margin-bottom: 10px; }
.reglio-hero-title {
  font-size: clamp(28px, 3.3vw, 40px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--brand-hero-ink, var(--text));
  margin-bottom: 10px;
}
.reglio-hero-copy { font-size: 15px; line-height: 1.6; color: var(--brand-hero-ink-soft, var(--text-secondary)); max-width: 60ch; }
.reglio-hero-actions { margin-top: 22px; }
.reglio-hero .btn-ghost {
  background: color-mix(in srgb, var(--brand-hero-ink, var(--text)) 6%, transparent);
  color: var(--brand-hero-ink, var(--text));
  border-color: color-mix(in srgb, var(--brand-hero-ink, var(--text)) 22%, transparent);
}
.reglio-hero .btn-ghost:hover:not(:disabled) { background: color-mix(in srgb, var(--brand-hero-ink, var(--text)) 12%, transparent); }
.reglio-hero-metrics { align-content: center; gap: 10px; }
.reglio-hero-metric {
  padding: 14px 18px;
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.reglio-hero-metric span { font-size: 13px; font-weight: 500; color: var(--brand-hero-ink-soft, var(--text-secondary)); }
.reglio-hero-metric strong { font-family: var(--brand-font-display); font-size: 16px; font-weight: 600; color: var(--brand-hero-ink, var(--text)); }
/* Status words on the band read against the band, not the page. */
.reglio-hero-metric strong.success { color: var(--brand-hero-success, var(--success)); }
.reglio-hero-metric strong.warning { color: var(--brand-hero-warning, var(--warning)); }
.reglio-hero-metric strong.danger { color: var(--brand-hero-danger, var(--danger)); }
@media (max-width: 560px) {
  .reglio-hero { padding: 20px 18px; border-radius: var(--radius-lg); }
  .reglio-hero::after { width: 60%; opacity: 0.05; }
}

/* ── KPI cards ────────────────────────────────────────────────── */
.dash-kpi-grid { gap: 14px; margin-bottom: 20px; align-items: stretch; }
.dash-kpi-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px 16px;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}
.dash-kpi-card:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--kpi-color, var(--primary)) 30%, var(--border)); }
.dash-kpi-head { display: flex; align-items: center; gap: 8px; min-height: 18px; }
.dash-kpi-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: var(--kpi-color, var(--primary));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--kpi-color, var(--primary)) 14%, transparent);
}
.dash-kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.dash-kpi-value {
  font-family: var(--brand-font-display);
  font-size: clamp(24px, 2.6vw, 32px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.dash-kpi-card.kpi-risk .dash-kpi-value { color: var(--kpi-color); }
.dash-kpi-btn {
  align-self: flex-start;
  margin-top: 6px;
  min-height: 30px;
  padding: 5px 12px;
  font-size: 12.5px;
  border-radius: 999px;
  gap: 4px;
}
.dash-kpi-meta { font-size: 12px; color: var(--text-muted); }
.dash-kpi-trend { display: flex; align-items: center; gap: 6px; min-height: 18px; font-size: 12px; color: var(--text-muted); }
/* The "?" beside Approval rate: hover AND keyboard focus reveal it. */
.tip-wrap { position: relative; display: inline-flex; align-items: center; }
.tip-trigger {
  width: 16px; height: 16px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--text-muted); color: var(--text-muted);
  font-size: 10px; font-weight: 700; line-height: 1; cursor: help;
}
.tip-box {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  width: 232px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  background: var(--brand-dark, #1E293B);
  color: #fff;
  font-size: 12px;
  font-weight: 450;
  line-height: 1.5;
  text-transform: none;
  letter-spacing: 0;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  pointer-events: none;
}
.tip-wrap:hover .tip-box, .tip-wrap:focus-within .tip-box { display: block; }
@media (max-width: 475px) {
  .dash-kpi-value { font-size: 24px; }
  .tip-box { left: auto; inset-inline-end: -12px; transform: none; }
}

/* ── Dashboard panels ─────────────────────────────────────────── */
.dash-panel { padding: 20px 22px; }
.dash-panel-title { font-size: 15.5px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.dash-panel-sub { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 14px; }
.dash-panel-empty { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.dash-panel-empty.is-centered { text-align: center; padding: 14px 0; }
.dash-wait-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 10px;
  margin-inline: -10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.14s ease;
}
.dash-wait-row + .dash-wait-row { border-top: 1px solid var(--border-light); }
.dash-wait-row:hover, .dash-wait-row:focus-visible { background: var(--bg); outline: none; }
.dash-wait-row:focus-visible { box-shadow: var(--focus-halo); }
.dash-wait-who { min-width: 0; }
.dash-wait-name { font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-wait-id { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 11.5px; color: var(--text-muted); letter-spacing: 0.01em; }
.dash-wait-age { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: 0 0 auto; }
.dash-wait-time {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
}
.dash-wait-label { font-size: 11px; color: var(--text-muted); }
.dash-outcome + .dash-outcome { margin-top: 14px; }
.dash-outcome-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 7px; }
.dash-outcome-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.dash-outcome-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--outcome-color); }
.dash-outcome-value { font-size: 13.5px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.dash-outcome-value span { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.dash-outcome-track { height: 6px; border-radius: 999px; overflow: hidden; background: var(--border-light); }
.dash-outcome-fill { height: 100%; border-radius: inherit; background: var(--outcome-color); transition: width 0.6s var(--ease-out); }

/* ── Chart card ───────────────────────────────────────────────── */
.dash-chart-card { padding-bottom: 4px; }
.dash-chart-title { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.dash-chart-sub { font-size: 12.5px; color: var(--text-secondary); }
.chart-desktop-header { padding: 20px 22px 0; }
.dash-range {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.dash-range-btn {
  padding: 5px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.dash-range-btn:hover { color: var(--text); }
.dash-range-btn.is-active { background: var(--white); color: var(--primary-ink); box-shadow: var(--shadow-sm); }
.dash-icon-btn, .dash-period-btn, .dash-filter-btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}
.dash-icon-btn { width: 36px; flex: 0 0 auto; }
.dash-icon-btn:disabled { opacity: 0.35; cursor: default; }
.dash-period-btn { flex: 1; min-width: 0; padding: 0 12px; color: var(--text); }
.dash-filter-btn { padding: 0 12px; color: var(--text); }
.dash-icon-btn:hover:not(:disabled), .dash-period-btn:hover, .dash-filter-btn:hover { border-color: color-mix(in srgb, var(--text) 22%, var(--border)); }
.dash-filter-btn.is-active { border-color: var(--primary); background: var(--primary-light); color: var(--primary-ink); }
.dash-export-btn { min-height: 36px; height: 36px; padding: 0 12px; font-size: 12.5px; }
.dash-legend { display: flex; flex-wrap: wrap; gap: 16px; padding: 14px 22px 0; }
.dash-legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; color: var(--text-secondary); }
.chart-pad { padding: 10px 22px 16px; }
.dash-summary { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border-light); }
.dash-summary-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--bg); border: 1px solid var(--border-light);
}
.dash-summary-dot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.dash-summary-label { font-size: 12px; color: var(--text-secondary); }
.dash-summary-value { font-size: 12px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
#dash-chart-tip { background: var(--brand-dark, #1E293B) !important; }

/* ── Sessions ─────────────────────────────────────────────────── */
.sessions-stat-strip, .compliance-strip {
  padding: 5px;
  gap: 6px;
  border-radius: var(--radius-lg);
  background: var(--bg);
  border-color: var(--border);
}
.sessions-stat, .compliance-stat {
  padding: 12px 16px;
  border-radius: calc(var(--radius-lg) - 5px);
  box-shadow: var(--shadow-sm);
}
.sessions-stat-value, .compliance-stat-value {
  font-family: var(--brand-font-display);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.sessions-stat-label, .compliance-stat-label { font-size: 11.5px; letter-spacing: 0.05em; }
.filter-bar { border-radius: var(--radius-lg); }
.table-wrap { border-radius: var(--radius-lg); }
.page-num-btn { border-radius: 8px; }

/* ── Session detail ───────────────────────────────────────────── */
.detail-case-title { font-size: 24px; }
.detail-section-title { font-size: 18px; font-weight: 600; margin-bottom: 18px; }
.detail-subsection-title { font-size: 11.5px; letter-spacing: 0.07em; color: var(--text-secondary); }
.detail-row { font-size: 13.5px; padding: 11px 0; }
.detail-key { color: var(--text-secondary); font-weight: 500; }
.detail-val { font-weight: 600; color: var(--text); }
.session-avatar { color: var(--on-primary); box-shadow: 0 0 0 4px var(--primary-light); }
.signal-card { border-radius: var(--radius); }
.compliance-notice { border-radius: var(--radius); font-size: 13px; }
.compliance-notice strong { font-size: 13.5px; }

/* ── Settings ─────────────────────────────────────────────────
   The sidebar reads as navigation, the panel as a document. settings.js
   injects its layout sheet after this one, so these rules are scoped one
   level deeper to refine it rather than race it. */
.settings-root .settings-panel-title { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin-bottom: 28px; }
.settings-root .settings-desktop-sidebar {
  background: var(--bg);
  border-inline-end: 1px solid var(--border);
  padding: 28px 14px;
}
.settings-root .settings-desktop-panel { padding: 44px 56px; }
.settings-root .settings-desktop-panel > * { max-width: 920px; }
.settings-desktop-sidebar .settings-nav-group-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 6px;
}
.settings-desktop-sidebar .settings-nav-btn {
  position: relative;
  padding: 10px 12px;
  margin-bottom: 2px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
  background: transparent;
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.settings-desktop-sidebar .settings-nav-btn:hover { background: color-mix(in srgb, var(--text) 5%, transparent); color: var(--text); }
.settings-desktop-sidebar .settings-nav-btn .settings-nav-icon { opacity: 0.6; }
.settings-desktop-sidebar .settings-nav-btn[data-active="true"] {
  background: var(--white);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.settings-desktop-sidebar .settings-nav-btn[data-active="true"]::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 3px;
  background: var(--primary);
}
.settings-desktop-sidebar .settings-nav-btn[data-active="true"] .settings-nav-icon { opacity: 1; color: var(--primary-ink); }
.settings-desktop-sidebar .settings-nav-btn.is-locked { color: var(--text-muted); }
.settings-desktop-sidebar .settings-nav-btn:focus-visible { outline: none; box-shadow: var(--focus-halo); }
.settings-root .s-row { padding: 18px 0; }
.api-key-row, .integration-card { border-radius: var(--radius); }

/* ── Empty states ─────────────────────────────────────────────
   One treatment everywhere a list or chart has nothing to show: a tinted
   icon tile, a short title, an optional line of explanation. */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 40px 16px;
  text-align: center;
}
.empty-state.is-chart { min-height: 200px; padding: 24px 16px; }
.empty-state-icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  color: var(--primary-ink);
  background: var(--primary-light);
}
.empty-state.is-error .empty-state-icon { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.empty-state-title { font-family: var(--brand-font-display); font-size: 15px; font-weight: 600; color: var(--text); white-space: normal; }
.empty-state-body { font-size: 13px; line-height: 1.55; color: var(--text-secondary); max-width: 46ch; white-space: normal; }
td.table-empty { padding: 8px 20px; }
tr:hover td.table-empty { background: transparent; }
.compliance-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 36px 8px 30px; }
.compliance-empty-title { font-family: var(--brand-font-display); font-size: 16px; font-weight: 600; margin-bottom: 0; }
.compliance-empty-body { font-size: 13px; }
.dash-panel-empty { padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg); }
.dash-panel-empty.is-centered { padding: 18px 12px; }
html.lang-ar .empty-state-title, html.lang-ar .compliance-empty-title { font-family: var(--brand-font-arabic); }

/* ── Hosted verification ──────────────────────────────────────
   The applicant's journey, from the workspace's brand bar to a small
   "Powered by" at the foot. Everything reads tokens, so every hosted state
   (intro, selection, capture, processing, result) stays in one brand. */
.hosted-page .verification-shell { gap: 16px; padding-block: 20px 8px; }
@media (max-width: 720px) {
  .hosted-page .verification-shell { padding-block: 8px 4px; }
}
.hosted-brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 20px;
  border-radius: var(--radius-lg);
  background: var(--brand-nav-surface, var(--white));
  border: 1px solid var(--brand-nav-line, var(--border));
  box-shadow: var(--shadow-sm);
}
.hosted-brand-logo {
  display: block;
  height: 44px;
  width: auto;
  max-width: min(240px, 58vw);
  object-fit: contain;
}
.hosted-brand-secure {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  color: var(--brand-nav-active-ink, var(--primary-ink));
  background: var(--brand-nav-active, var(--primary-light));
}
.verification-intro { padding: 26px 28px; border-radius: var(--radius-lg); }
.verification-intro h1 { font-weight: 600; letter-spacing: -0.025em; }
.verification-intro p { font-size: 15px; line-height: 1.6; }
.verification-guidance div {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg);
  border-color: var(--border-light);
  position: relative;
}
.verification-guidance strong { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.verification-guidance span { font-size: 12.5px; line-height: 1.5; }
.doc-selection-head h2 { font-size: 21px; font-weight: 600; }
.doc-selection-head p { font-size: 14px; }
.doc-selection-option {
  padding: 13px 15px;
  border-radius: var(--radius);
  transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}
.doc-selection-option:hover { border-color: color-mix(in srgb, var(--primary) 60%, var(--border)); }
.doc-selection-option:has(input:checked) { box-shadow: 0 0 0 1px var(--primary); }
.doc-selection-option:has(input:focus-visible) { box-shadow: var(--focus-halo); }
.doc-selection-continue { min-height: 44px; }
.verification-card { border-radius: var(--radius-lg); }
.verification-side-title { font-family: var(--brand-font-display); font-size: 15.5px; font-weight: 600; }
.verification-status { border-radius: var(--radius); }
.verification-status strong { font-size: 13.5px; }
.verification-status span { font-size: 12.5px; line-height: 1.5; }
.verification-step { font-size: 12.5px; }
.handoff-trigger { color: var(--primary-ink); border-radius: calc(var(--radius) - 2px); }
.handoff-trigger:hover { color: var(--on-primary); }
.handoff-qr { border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 12px; }
.verification-result-panel { border-radius: var(--radius); }
/* A footnote, not a co-brand: a 12px mark against a 44px brand bar. The mark
   renders at full strength (crisp, 3x artwork) and the label is muted text —
   quiet by size, not washed out by opacity. */
.hosted-powered {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 10px 0 calc(8px + env(safe-area-inset-bottom, 0px));
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.hosted-powered img { height: 12px; width: auto; display: block; }
.handoff-mobile:not(.is-capturing) { flex-direction: column; gap: 10px; }
.handoff-powered { padding-top: 4px; }
.hosted-powered .hosted-powered-white { display: none; }
[data-theme="dark"] .hosted-powered .hosted-powered-ink { display: none; }
[data-theme="dark"] .hosted-powered .hosted-powered-white { display: block; }
@media (max-width: 720px) {
  .hosted-brand-bar { padding: 10px 14px; border-radius: var(--radius); }
  .hosted-brand-logo { height: 34px; }
  .hosted-brand-secure { padding: 5px 10px; font-size: 12px; }
  .verification-intro { padding: 18px 16px; }
  /* Capturing on a phone: the bar gives the camera its room. */
  .hosted-page .verification-shell.is-capturing .hosted-brand-bar { padding: 8px 12px; }
  .hosted-page .verification-shell.is-capturing .hosted-brand-logo { height: 26px; }
}
@media (max-width: 380px) {
  .hosted-brand-secure span, .hosted-brand-secure { font-size: 11.5px; }
  .hosted-brand-logo { height: 30px; }
}

/* The branded shell behind hosted completion / error cards. */
.auth-shell-branded .auth-panel { border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
.auth-title { font-weight: 600; letter-spacing: -0.02em; }
:root[data-tenant-logo] .auth-logo { max-height: 72px; }
:root[data-tenant-logo] .auth-logo-large { max-height: 88px; max-width: min(300px, 100%); }

/* ── Phone handoff ──────────────────────────────────────────── */
.handoff-mobile-card { border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); }
:root[data-tenant-logo] .handoff-mobile-logo { max-height: 56px; max-width: min(240px, 72vw); }
.handoff-mobile-title { font-weight: 600; letter-spacing: -0.02em; }
.handoff-mobile-steps li { border-radius: var(--radius); }
.handoff-mobile-steps li::before { background: var(--primary); color: var(--on-primary); }
.handoff-mobile-meter span.is-done { background: var(--accent-gradient); }

/* ── Skeletons ────────────────────────────────────────────────
   Content placeholders after start-up, drawn in the shape of what they stand
   for: brand-toned, one slow sheen, nothing that flickers. */
.skeleton, .auth-skeleton-line {
  background: color-mix(in srgb, var(--text) 7%, var(--white));
  opacity: 1;
}
.skeleton {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 6px;
}
.skeleton-text { height: 12px; width: 60%; }
.skeleton-text.is-sub { height: 10px; width: 42%; margin-top: 8px; opacity: 0.7; }
.skeleton-text.is-heading { height: 16px; margin-bottom: 22px; }
.skeleton-title { height: 26px; width: min(280px, 60%); border-radius: 8px; }
.skeleton-avatar { width: 72px; height: 72px; border-radius: 50%; margin-bottom: 16px; }
.skeleton-heading { margin: 4px 0 24px; }
.skeleton-card { min-height: 180px; }
.skeleton-pair { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border-light); }
.skeleton-pair:last-child { border-bottom: 0; }
.skeleton-row td { padding-block: 18px; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton::after {
    content: "";
    position: absolute;
    inset: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--white) 55%, transparent), transparent);
    animation: skeleton-sheen 1.8s ease-in-out infinite;
  }
}
@keyframes skeleton-sheen { to { transform: translateX(100%); } }
[dir="rtl"] .skeleton::after { animation-direction: reverse; }
[data-theme="dark"] .skeleton { background: color-mix(in srgb, var(--text) 9%, var(--white)); }

/* ── Arabic ────────────────────────────────────────────────────
   Arabic takes the brand's Arabic face everywhere, headings included; the
   Latin display face has no Arabic glyphs, so without this headings fell
   back to a system face mid-page. Slightly larger, never condensed. */
html.lang-ar h1, html.lang-ar h2, html.lang-ar h3, html.lang-ar h4,
html.lang-ar .page-title, html.lang-ar .section-title, html.lang-ar .settings-panel-title,
html.lang-ar .modal-title, html.lang-ar .auth-title, html.lang-ar .reglio-hero-title,
html.lang-ar .dash-chart-title, html.lang-ar .dash-panel-title, html.lang-ar .detail-section-title,
html.lang-ar .dash-kpi-value, html.lang-ar .sessions-stat-value, html.lang-ar .compliance-stat-value,
html.lang-ar .reglio-hero-metric strong, html.lang-ar .verification-side-title,
html.lang-ar .doc-selection-head h2, html.lang-ar .handoff-mobile-title,
html.lang-ar .brand-loader-attribution {
  font-family: var(--brand-font-arabic);
  letter-spacing: 0;
}
html.lang-ar .reglio-hero-title { line-height: 1.3; }
html.lang-ar .dash-kpi-label, html.lang-ar .sessions-stat-label, html.lang-ar .compliance-stat-label,
html.lang-ar .reglio-eyebrow, html.lang-ar th, html.lang-ar .detail-subsection-title,
html.lang-ar .filter-label { letter-spacing: 0; text-transform: none; font-size: 12.5px; }
html.lang-ar .nav-btn { font-size: 14.5px; }
[dir="rtl"] .dash-wait-age { align-items: flex-start; }
[dir="rtl"] .tip-box { left: auto; right: 50%; transform: translateX(50%); }
@media (max-width: 475px) {
  [dir="rtl"] .tip-box { right: auto; inset-inline-end: -12px; transform: none; }
}

/* ── Dark mode, brand-aware ───────────────────────────────────
   settings.js's dark sheet now reads --brand-dm-* tokens (defaults: the
   charcoal it always used); these cover the surfaces added here. */
[data-theme="dark"] .dash-range-btn.is-active,
[data-theme="dark"] .sessions-stat,
[data-theme="dark"] .compliance-stat { background: var(--white); }
[data-theme="dark"] .dash-icon-btn, [data-theme="dark"] .dash-period-btn,
[data-theme="dark"] .dash-filter-btn { background: var(--white); }
[data-theme="dark"] .tip-box { background: var(--brand-dm-raised, #252527); }
/* The dark sheet paints every hero figure one colour; the status words keep
   their meaning (and their contrast) on the band. */
[data-theme="dark"] .reglio-hero-metric strong.success { color: var(--brand-hero-success, var(--success)); }
[data-theme="dark"] .reglio-hero-metric strong.warning { color: var(--brand-hero-warning, var(--warning)); }
[data-theme="dark"] .reglio-hero-metric strong.danger { color: var(--brand-hero-danger, var(--danger)); }
/* The deep "High risk" red is drawn for light cards; on a dark card it
   takes the dark-mode danger colour instead. */
[data-theme="dark"] .dash-kpi-card.kpi-risk .dash-kpi-value { color: var(--danger); }
[data-theme="dark"] .dash-kpi-card.kpi-risk .dash-kpi-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 16%, transparent);
}

/* ── Motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .btn, .nav-btn, .dash-kpi-card, .dash-wait-row, .dash-outcome-fill,
  .doc-selection-option, .dash-range-btn { transition: none; }
  .btn:active:not(:disabled) { transform: none; }
}
