/* Saqir — premium banking AI · light, modern, BofA/Apple-Card inspired */

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ----- Light premium palette ----- */
  --canvas: #F7F5F0;             /* warm off-white background */
  --paper: #FFFFFF;              /* primary surface */
  --paper-soft: #FBF9F4;         /* secondary surface */
  --line: #ECE7DD;               /* hairlines */
  --line-strong: #D9D2C2;        /* defined borders */

  /* Inks */
  --ink-900: #1A1F2E;            /* primary text */
  --ink-700: #3F4656;            /* secondary text */
  --ink-500: #6B7280;            /* tertiary / labels */
  --ink-400: #9098A4;            /* placeholder */
  --ink-300: #C5CAD3;            /* disabled */

  /* Brand */
  --navy-900: #0E1730;
  --navy-800: #182441;
  --navy-700: #1F3155;
  --navy-500: #3A5996;
  --gold-700: #A88835;
  --gold-500: #C9A961;
  --gold-400: #D7BB7C;
  --gold-300: #E5CD9D;
  --gold-100: #F8F0DD;
  --gold-50: #FCF7E8;

  --green: #00A878;
  --green-soft: #E5F6EE;
  --red: #D6342B;
  --red-soft: #FCE9E7;
  --voice: #6E5BFA;
  --email: #4A6FA5;
  --app:   #00A878;       /* mobile-app channel — fresh green, distinct from --voice/--email */

  /* ----- AI / "intelligence" accent ----- *
   * The colour Saqir speaks in: thinking states, voice waveform,
   * citation marks, AI-generated suggestions, the avatar's listening
   * pulse. Distinct from --green (success/positive) and from the
   * brand gold (premium identity) so the customer can read at a
   * glance whether what they're seeing is data, action, or AI. */
  --intel-500: #0F8E91;
  --intel-300: #5DBABD;
  --intel-100: #DBEFEF;
  --intel-50:  #EFF8F8;

  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 6px 24px rgba(15, 23, 42, 0.07);
  --shadow-lg: 0 16px 48px rgba(15, 23, 42, 0.10);
  --shadow-card: 0 1px 0 rgba(255,255,255,0.5) inset, 0 1px 2px rgba(15,23,42,0.04), 0 8px 24px rgba(15,23,42,0.06);

  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --font: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-ar: 'Tajawal', 'Inter', sans-serif;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, "Liberation Mono", Menlo, monospace;

  /* ============================================================
     Type system — the single source of truth for all text on the
     page. Every component must compose from these tokens; no raw
     font-size / letter-spacing / line-height numbers anywhere else.
     ------------------------------------------------------------
     Hierarchy (visual weight, top → bottom):

       display        — page hero (serif, salutation, big numbers)
       title-1        — section heroes inside the briefing
       title-2        — card headlines, opportunity titles
       title-3        — sidebar history titles, list headings
       body           — paragraph text, default reading
       body-sm        — secondary body, descriptions
       label          — pill buttons, action labels, tags
       caption        — meta info under a title
       eyebrow        — uppercase section labels, taxonomy
       mono           — numbers, codes, tabular data

     Font families are fixed PER ROLE so the page reads consistently:
       display → serif (Playfair)
       title-1/2/3, body, body-sm, label, caption → sans (Inter)
       eyebrow, mono → monospace
     ============================================================ */

  /* Display — for the salutation and hero numbers. Always serif. */
  --t-display-family:    var(--font-display);
  --t-display-size:      28px;
  --t-display-weight:    500;
  --t-display-lh:        1.2;
  --t-display-track:     -0.4px;

  /* Title 1 — section heroes (e.g. "Past 14 days · next 14 days"). */
  --t-title-1-family:    var(--font-display);
  --t-title-1-size:      18px;
  --t-title-1-weight:    500;
  --t-title-1-lh:        1.3;
  --t-title-1-track:     -0.2px;

  /* Title 2 — card headlines, opportunity titles. */
  --t-title-2-family:    var(--font-display);
  --t-title-2-size:      16px;
  --t-title-2-weight:    500;
  --t-title-2-lh:        1.3;
  --t-title-2-track:     -0.1px;

  /* Title 3 — sidebar history titles, small list headings. */
  --t-title-3-family:    var(--font);
  --t-title-3-size:      13px;
  --t-title-3-weight:    500;
  --t-title-3-lh:        1.4;
  --t-title-3-track:     0;

  /* Body — paragraph reading text. */
  --t-body-family:       var(--font);
  --t-body-size:         14px;
  --t-body-weight:       400;
  --t-body-lh:           1.55;
  --t-body-track:        0;

  /* Body-sm — secondary body, descriptions. */
  --t-body-sm-family:    var(--font);
  --t-body-sm-size:      12.5px;
  --t-body-sm-weight:    400;
  --t-body-sm-lh:        1.5;
  --t-body-sm-track:     0;

  /* Label — pill buttons, action text, tags. Slight weight. */
  --t-label-family:      var(--font);
  --t-label-size:        13px;
  --t-label-weight:      500;
  --t-label-lh:          1.2;
  --t-label-track:       0;

  /* Caption — meta info under a title (e.g. relative time + msg count). */
  --t-caption-family:    var(--font);
  --t-caption-size:      11.5px;
  --t-caption-weight:    400;
  --t-caption-lh:        1.4;
  --t-caption-track:     0;

  /* Eyebrow — uppercase section labels, taxonomy markers. */
  --t-eyebrow-family:    var(--font-mono);
  --t-eyebrow-size:      10.5px;
  --t-eyebrow-weight:    600;
  --t-eyebrow-lh:        1.2;
  --t-eyebrow-track:     0.14em;

  /* Mono — numbers, references, tabular data. */
  --t-mono-family:       var(--font-mono);
  --t-mono-size:         12px;
  --t-mono-weight:       500;
  --t-mono-lh:           1.4;
  --t-mono-track:        0.02em;

  /* Semantic text colour roles — typography should always pick from
     this small set, never reach for ink-* directly inside a component. */
  --text-primary:    var(--ink-900);
  --text-secondary:  var(--ink-700);
  --text-tertiary:   var(--ink-500);
  --text-quaternary: var(--ink-400);
  --text-accent:     var(--gold-700);
  --text-on-dark:    #FFFFFF;
}

/* Utility classes — apply ONE on any element to use a typography role.
   Combine with a colour utility (e.g. .t-secondary) for full styling.
   Existing components still use the variables above directly; these
   classes are for new markup. */
.t-display    { font-family: var(--t-display-family);    font-size: var(--t-display-size);    font-weight: var(--t-display-weight);    line-height: var(--t-display-lh);    letter-spacing: var(--t-display-track); }
.t-title-1    { font-family: var(--t-title-1-family);    font-size: var(--t-title-1-size);    font-weight: var(--t-title-1-weight);    line-height: var(--t-title-1-lh);    letter-spacing: var(--t-title-1-track); }
.t-title-2    { font-family: var(--t-title-2-family);    font-size: var(--t-title-2-size);    font-weight: var(--t-title-2-weight);    line-height: var(--t-title-2-lh);    letter-spacing: var(--t-title-2-track); }
.t-title-3    { font-family: var(--t-title-3-family);    font-size: var(--t-title-3-size);    font-weight: var(--t-title-3-weight);    line-height: var(--t-title-3-lh);    letter-spacing: var(--t-title-3-track); }
.t-body       { font-family: var(--t-body-family);       font-size: var(--t-body-size);       font-weight: var(--t-body-weight);       line-height: var(--t-body-lh);       letter-spacing: var(--t-body-track); }
.t-body-sm    { font-family: var(--t-body-sm-family);    font-size: var(--t-body-sm-size);    font-weight: var(--t-body-sm-weight);    line-height: var(--t-body-sm-lh);    letter-spacing: var(--t-body-sm-track); }
.t-label      { font-family: var(--t-label-family);      font-size: var(--t-label-size);      font-weight: var(--t-label-weight);      line-height: var(--t-label-lh);      letter-spacing: var(--t-label-track); }
.t-caption    { font-family: var(--t-caption-family);    font-size: var(--t-caption-size);    font-weight: var(--t-caption-weight);    line-height: var(--t-caption-lh);    letter-spacing: var(--t-caption-track); }
.t-eyebrow    { font-family: var(--t-eyebrow-family);    font-size: var(--t-eyebrow-size);    font-weight: var(--t-eyebrow-weight);    line-height: var(--t-eyebrow-lh);    letter-spacing: var(--t-eyebrow-track); text-transform: uppercase; }
.t-mono       { font-family: var(--t-mono-family);       font-size: var(--t-mono-size);       font-weight: var(--t-mono-weight);       line-height: var(--t-mono-lh);       letter-spacing: var(--t-mono-track); font-variant-numeric: tabular-nums; }

.t-primary    { color: var(--text-primary); }
.t-secondary  { color: var(--text-secondary); }
.t-tertiary   { color: var(--text-tertiary); }
.t-quaternary { color: var(--text-quaternary); }
.t-accent     { color: var(--text-accent); }

/* Numerals: any class showing money, time, counts gets tabular alignment.
   Add to .ui-kv-value / .acct-balance / etc. wherever digits should line up. */
.t-tabular { font-variant-numeric: tabular-nums; }

html, body { height: 100%; }
body {
  font-family: var(--font);
  background:
    radial-gradient(circle at 0% 0%, rgba(201, 169, 97, 0.08), transparent 35%),
    radial-gradient(circle at 100% 100%, rgba(58, 89, 150, 0.06), transparent 40%),
    var(--canvas);
  color: var(--ink-900);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}
body[dir="rtl"] { font-family: var(--font-ar); }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }

/* ============================================================
   UI primitives — shared building blocks
   ------------------------------------------------------------
   .ui-card · .ui-btn (+ .primary/.ghost/.danger) · .ui-pill
   .ui-kv-row · .ui-kv-list
   These are the design-system surfaces used by `cardEl`,
   `actionBtnHTML`, `pillHTML`, `kvListHTML` in app.js. Any
   render function using those helpers picks up these styles
   automatically — and stays consistent when we tweak tokens.
   ============================================================ */

.ui-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow-xs);
  text-align: start;
}
.ui-card.subtle { background: var(--paper-soft); box-shadow: none; }
.ui-card.tinted {
  background: linear-gradient(180deg, var(--gold-50), var(--paper));
  border-color: var(--gold-300);
}

/* Pill button — the canonical "send into chat" action.
   Default = quiet ghost-on-paper; .primary = navy CTA;
   .ghost = transparent; .danger = soft red. */
.ui-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--t-label-family);
  font-size: var(--t-label-size);
  font-weight: var(--t-label-weight);
  line-height: var(--t-label-lh);
  letter-spacing: var(--t-label-track);
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease,
              color 0.15s ease, transform 0.15s ease;
  white-space: nowrap;
}
.ui-btn:hover {
  border-color: var(--ink-900);
  background: var(--ink-900);
  color: var(--paper);
  transform: translateY(-1px);
}
.ui-btn:active { transform: translateY(0); }
.ui-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.ui-btn.primary {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff;
}
.ui-btn.primary:hover { background: var(--gold-700); border-color: var(--gold-700); }
.ui-btn.primary::after { content: " →"; font-family: var(--font-mono); }

.ui-btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink-700);
  padding-inline: 12px;
}
.ui-btn.ghost:hover {
  background: var(--paper-soft);
  border-color: var(--line);
  color: var(--ink-900);
  transform: none;
}

.ui-btn.danger {
  background: var(--red-soft);
  border-color: var(--red-soft);
  color: var(--red);
}
.ui-btn.danger:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* Status pill. Tone is the single axis of variation. */
.ui-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  line-height: var(--t-eyebrow-lh);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  color: var(--text-tertiary);
}
.ui-pill[data-tone="positive"] {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(0, 168, 120, 0.30);
}
.ui-pill[data-tone="warning"] {
  color: var(--gold-700);
  background: var(--gold-50);
  border-color: var(--gold-300);
}
.ui-pill[data-tone="danger"] {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(214, 52, 43, 0.30);
}

/* Key/value row + list — used by confirmation cards (transfer,
   block-card) and any future "fact sheet" surface. */
.ui-kv-list { display: flex; flex-direction: column; gap: 2px; }
.ui-kv-row {
  display: grid;
  grid-template-columns: minmax(64px, auto) 1fr;
  gap: 14px;
  padding: 6px 0;
  align-items: baseline;
}
.ui-kv-label {
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  line-height: var(--t-eyebrow-lh);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.ui-kv-value {
  font-family: var(--t-body-sm-family);
  font-size: var(--t-body-sm-size);
  font-weight: 500;
  line-height: var(--t-body-sm-lh);
  color: var(--text-primary);
  text-align: end;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

/* ============================================================ */

.app-shell { display: grid; grid-template-columns: 320px 1fr; height: 100vh; padding: 14px; gap: 14px; }
/* In RTL the grid container's inline axis flips: track 1 (320px) renders
   on the right, track 2 (1fr) on the left. The sidebar is the first DOM
   child so it lands in track 1 automatically — i.e. on the right. No
   explicit grid-column placement needed; previous overrides were
   placing it back on the left. */

/* ============ Sidebar ============ */
.sidebar {
  background: var(--paper);
  background-image:
    radial-gradient(circle at 100% 0%, rgba(201, 169, 97, 0.10), transparent 40%),
    radial-gradient(circle at 0% 100%, rgba(58, 89, 150, 0.04), transparent 40%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 22px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 4px; }
.brand-mark {
  width: 42px; height: 42px;
  background: linear-gradient(140deg, var(--navy-700), var(--navy-900));
  color: var(--gold-400);
  border-radius: 12px;
  display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(14, 23, 48, 0.18), inset 0 1px 0 rgba(255,255,255,0.06);
}
.brand-mark svg { width: 26px; height: 26px; }
.brand-mark.brand-mark-photo {
  background: transparent;
  box-shadow: 0 4px 12px rgba(14, 23, 48, 0.18);
  overflow: hidden;
  padding: 0;
}
.brand-mark.brand-mark-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.brand-title {
  font-family: var(--t-display-family);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: var(--t-display-track);
  color: var(--text-primary);
}
.brand-sub {
  font-family: var(--t-caption-family);
  font-size: var(--t-caption-size);
  font-weight: var(--t-caption-weight);
  line-height: var(--t-caption-lh);
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* Customer pill */
.customer-pill {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: linear-gradient(140deg, var(--gold-50), var(--paper));
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-xs);
}
.customer-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid var(--gold-300);
  box-shadow: 0 2px 6px rgba(15,23,42,0.08);
}
.customer-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.customer-name {
  font-family: var(--t-title-3-family);
  font-size: var(--t-title-3-size);
  font-weight: 600;
  line-height: var(--t-title-3-lh);
  color: var(--text-primary);
}
.customer-id {
  font-family: var(--t-mono-family);
  font-size: 10.5px;
  font-weight: var(--t-mono-weight);
  line-height: var(--t-mono-lh);
  letter-spacing: var(--t-mono-track);
  color: var(--text-tertiary);
  margin-top: 2px;
  /* Masked phone/ID always reads L→R, never re-ordered by the RTL bidi
     algorithm inside the Arabic sidebar. */
  direction: ltr;
  unicode-bidi: isolate;
}

.new-chat-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  background: var(--ink-900);
  color: var(--paper);
  border-radius: 12px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.18s ease;
  box-shadow: 0 2px 8px rgba(15,23,42,0.12);
}
.new-chat-btn:hover {
  background: var(--navy-700);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15,23,42,0.18);
}
.new-chat-btn svg { color: var(--gold-400); }
/* In RTL the + icon should follow the label visually on the right side. */
[dir="rtl"] .new-chat-btn { flex-direction: row-reverse; }

.sidebar-section { display: flex; flex-direction: column; gap: 4px; min-height: 0; }
.sidebar-section.history-section { flex: 1; overflow-y: auto; padding-right: 2px; }
.sidebar-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--ink-400);
  font-weight: 600;
  padding: 6px 6px 4px;
}
.sidebar-footer { display: flex; flex-direction: column; gap: 10px; flex-shrink: 0; padding-top: 4px; }

/* ===== Sidebar history search =====
   Single input with a leading magnifier glyph and a ⌘K hint. Doubles as
   the discovery surface that replaces the old "Quick Actions" — type
   anything to filter past conversations, or hit ⌘K to focus from
   anywhere in the app. */
.history-search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 2px;
}
.history-search-ico {
  position: absolute;
  inset-inline-start: 12px;
  color: var(--ink-400);
  pointer-events: none;
}
.history-search input {
  flex: 1;
  width: 100%;
  border: 1px solid var(--line);
  background: var(--paper-soft);
  color: var(--text-primary);
  border-radius: 10px;
  font-family: var(--t-body-sm-family);
  font-size: var(--t-body-sm-size);
  font-weight: var(--t-body-sm-weight);
  line-height: var(--t-body-sm-lh);
  padding: 9px 50px 9px 32px;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.history-search input::placeholder { color: var(--ink-400); }
.history-search input:hover { border-color: var(--line-strong); background: var(--paper); }
.history-search input:focus-visible {
  border-color: var(--gold-500);
  background: var(--paper);
  box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.18);
}
.history-search input::-webkit-search-cancel-button { display: none; }
.history-search-kbd {
  position: absolute;
  inset-inline-end: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-quaternary);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 2px 6px;
  pointer-events: none;
  user-select: none;
}
.history-search input:focus ~ .history-search-kbd,
.history-search input:not(:placeholder-shown) ~ .history-search-kbd { opacity: 0.4; }

/* ============================================================
   Language picker — replaces the old two-pill switcher.
   Compact button shows current language in its native script;
   clicking opens a popover above with the full list (six langs).
   Single source of truth for chat + voice.
   ============================================================ */
/* Language picker — Claude desktop style.
   Trigger row reads as a settings link ("Language ▸ English"); menu pops
   up with one row per language in the format "Native (Region) ✓". Clean,
   minimal, no flags or chrome. */
.lang-picker { position: relative; align-self: start; }

.lang-picker-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-700);
  font-family: var(--t-label-family);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  text-align: start;
}
.lang-picker-btn:hover {
  background: var(--paper-soft);
  color: var(--ink-900);
  border-color: var(--ink-400);
}
.lang-picker-btn:focus-visible {
  outline: none;
  background: var(--paper-soft);
  box-shadow: 0 0 0 2px rgba(201, 169, 97, 0.18);
}
.lang-picker-btn.open {
  background: var(--paper-soft);
  color: var(--ink-900);
  border-color: var(--intel-500);
}

.lp-globe { color: var(--ink-700); flex-shrink: 0; transition: color 0.12s ease; }
.lang-picker-btn:hover .lp-globe,
.lang-picker-btn.open  .lp-globe { color: var(--intel-500); }

.lp-abbr {
  min-width: 1.5ch;
  text-align: center;
  letter-spacing: 0.02em;
}
.lp-abbr[lang="ar"] { font-family: "Tajawal", inherit; font-size: 15px; line-height: 1; }
.lp-abbr[lang="zh"] { font-size: 14px; }
.lp-abbr[lang="hi"] { font-size: 14px; }

.lp-caret {
  color: var(--ink-400);
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.lang-picker-btn.open .lp-caret { transform: rotate(180deg); }

/* Menu pops UP and to the right (Claude opens to the right; we open
   straight up because we're in a narrow sidebar footer). Wider than the
   trigger so each row breathes. */
.lang-picker-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  inset-inline-start: 0;
  min-width: 240px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 40;
  animation: lpFade 0.16s ease;
  max-height: 360px;
  overflow-y: auto;
}
.lang-picker-menu[hidden] { display: none; }
@keyframes lpFade {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

.lp-item {
  display: grid;
  grid-template-columns: 1fr 14px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-align: start;
  font-family: inherit;
  color: var(--ink-800);
  transition: background 0.1s ease;
}
.lp-item:hover, .lp-item:focus-visible {
  background: var(--paper-soft);
  outline: none;
}
.lp-item.active { color: var(--ink-900); }
.lp-item-name {
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.3;
}
.lp-item-region {
  color: var(--text-tertiary);
  font-weight: 400;
}
.lp-check {
  display: grid; place-items: center;
  color: var(--ink-700);
  opacity: 0;
  transition: opacity 0.1s ease;
}
.lp-item.active .lp-check { opacity: 1; }

/* Legacy two-pill switcher — hidden if any old markup ever shows up */
.lang-switcher { display: none; }
.lang-btn { display: none; }
.status-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px;
  background: var(--green-soft);
  border-radius: 999px;
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  line-height: var(--t-eyebrow-lh);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  color: var(--green);
  align-self: flex-start;
}
.status-pill .dot {
  width: 6px; height: 6px; background: var(--green); border-radius: 50%;
  animation: pulse 2s infinite;
}
.status-pill.error { background: var(--red-soft); color: var(--red); }
.status-pill.error .dot { background: var(--red); animation: none; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 168, 120, 0.5); }
  70% { box-shadow: 0 0 0 6px rgba(0, 168, 120, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 168, 120, 0); }
}

/* ===== History list — redesigned =====
   Each item: topic icon (colour-tinted) + title + meta (relative time +
   message count). Pin / delete actions surface on hover, never on idle.
   Active item gets a gold left rule so the customer always knows where
   they are without scanning every line. */
.history-list { display: flex; flex-direction: column; gap: 2px; padding: 0 2px; }
.history-empty {
  font-family: var(--t-body-sm-family);
  font-size: var(--t-body-sm-size);
  color: var(--text-quaternary);
  padding: 14px 6px;
  font-style: italic;
  text-align: start;
}
.history-group-label {
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  line-height: var(--t-eyebrow-lh);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  color: var(--text-quaternary);
  padding: 14px 6px 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.history-group-label.history-group-pinned { color: var(--gold-700); }
.history-group-label.history-group-pinned svg { fill: currentColor; }
.history-pinned-section + .history-group-label:first-of-type { padding-top: 12px; }

/* Item: a 4-column grid — left rule slot · icon · body (title+meta) ·
   trailing actions (pin/delete, hover-only) */
.history-item {
  position: relative;
  display: grid;
  grid-template-columns: 3px 28px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px 9px 4px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  border-radius: 10px;
  font-family: var(--font);
  text-align: start;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
  cursor: pointer;
  min-width: 0;
}
.history-item::before {
  content: "";
  grid-column: 1;
  align-self: stretch;
  background: transparent;
  border-radius: 3px;
  transition: background 0.18s ease;
}
.history-item:hover {
  background: var(--paper-soft);
  border-color: var(--line);
  color: var(--ink-900);
}
.history-item.active {
  background: var(--gold-50);
  border-color: var(--gold-300);
  color: var(--ink-900);
}
.history-item.active::before {
  background: linear-gradient(180deg, var(--gold-500), var(--gold-400));
}

/* Topic icon — small chip whose tone hue maps to the conversation
   category (transfer / card / bill / etc.). The eye picks up category
   at a glance without reading a single word. */
.history-icon {
  grid-column: 2;
  width: 28px; height: 28px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 14px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  color: var(--ink-700);
  flex-shrink: 0;
  transition: transform 0.18s ease;
}
.history-item:hover .history-icon { transform: scale(1.05); }
.history-icon[data-tone="transfer"] { background: #EDF1FB; border-color: rgba(58,89,150,0.20); }
.history-icon[data-tone="card"]     { background: #FBEFE7; border-color: rgba(181,65,31,0.18); }
.history-icon[data-tone="bill"]     { background: #FCF7E8; border-color: var(--gold-300); }
.history-icon[data-tone="txn"]      { background: #FBF9F4; border-color: var(--line-strong); }
.history-icon[data-tone="insight"]  { background: #F4F0E5; border-color: var(--line-strong); }
.history-icon[data-tone="deposit"]  { background: #E8F2EC; border-color: rgba(0,168,120,0.20); }
.history-icon[data-tone="balance"]  { background: var(--gold-50); border-color: var(--gold-300); }
.history-icon[data-tone="alert"]    { background: #FCE9E7; border-color: rgba(214,52,43,0.22); }
.history-icon[data-tone="salary"]   { background: #E8F2EC; border-color: rgba(0,168,120,0.20); }
.history-icon[data-tone="chat"]     { background: var(--paper-soft); border-color: var(--line); }

.history-body {
  grid-column: 3;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.history-item .history-title {
  font-family: var(--t-title-3-family);
  font-size: var(--t-title-3-size);
  font-weight: var(--t-title-3-weight);
  line-height: var(--t-title-3-lh);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  /* Let each title's own characters decide its direction so English titles
     don't get truncated from the wrong end when the sidebar is RTL. */
  unicode-bidi: plaintext;
}
.history-item .history-meta {
  font-family: var(--t-mono-family);
  font-size: 10.5px;                  /* sidebar-tight; one notch below mono */
  font-weight: var(--t-mono-weight);
  letter-spacing: var(--t-mono-track);
  color: var(--text-quaternary);
  font-variant-numeric: tabular-nums;
}

/* Trailing actions — pin and delete. Hidden by default, slide in on hover.
   Pin stays visible when actually pinned so the user can always unpin. */
.history-actions {
  grid-column: 4;
  display: flex;
  gap: 2px;
  align-items: center;
  opacity: 0;
  transform: translateX(4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
  /* When idle (opacity 0) the actions are visually gone but still in
     the DOM. Disable pointer-events so they never silently steal a
     click from the row body. Re-enabled on hover/focus below. */
  pointer-events: none;
}
.history-item:hover .history-actions,
.history-item:focus-within .history-actions {
  opacity: 1;
  transform: translateX(0);
  pointer-events: auto;
}
/* Icons inside the action spans must NOT capture clicks — that way
   `e.target` for any pin/delete tap is the parent span, and the
   directly-attached handler always fires. */
.history-pin svg, .history-delete svg { pointer-events: none; }
.history-icon, .history-icon svg { pointer-events: none; }
/* The pin should always be reachable when the item is pinned — give
   that case its own pointer-events override so an unpin click works
   without needing a hover. */
.history-pin.pinned { pointer-events: auto; }
.history-pin.pinned ~ * { /* keep pinned visible */ }

.history-pin, .history-delete {
  width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 6px;
  color: var(--ink-500);
  background: transparent;
  cursor: pointer;
  transition: all 0.14s ease;
}
.history-pin:hover {
  background: var(--gold-50);
  color: var(--gold-700);
}
.history-pin.pinned {
  color: var(--gold-700);
  opacity: 1;
}
.history-item .history-pin.pinned {
  /* Force visible even without hover, so user can always toggle off */
  opacity: 1;
}
.history-item:not(:hover):not(:focus-within) .history-pin.pinned {
  position: relative;
}
.history-delete:hover { background: var(--red-soft); color: var(--red); }

/* When an item is pinned, give the actions a permanent home */
.history-item .history-pin.pinned {
  visibility: visible !important;
}
.history-pinned-section .history-actions {
  opacity: 1;
  transform: none;
  pointer-events: auto;   /* always clickable inside the pinned section */
}

/* Pinned section background tint (very subtle) — sets it apart from
   recent without being noisy */
.history-pinned-section {
  margin-bottom: 4px;
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--line);
}

/* ===== Phase 2: history preview + frequent-hint =====
   - Preview line: bot's last reply, one-line truncated, shown beneath
     the title in lighter ink. Adds context without raising visual weight.
   - Frequent-hint star: appears next to the title for items the customer
     has reopened ≥ 3 times in the last 7 days. A nudge to pin. */
.history-item .history-preview {
  font-family: var(--t-caption-family);
  font-size: var(--t-caption-size);
  font-weight: var(--t-caption-weight);
  line-height: var(--t-caption-lh);
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
  unicode-bidi: plaintext;
}
.history-item.active .history-preview { color: var(--ink-700); }
.history-item .history-meta { margin-top: 1px; }

.history-frequent-hint {
  display: inline-block;
  margin-inline-start: 4px;
  color: var(--gold-500);
  font-size: 11px;
  vertical-align: middle;
  line-height: 1;
  transform: translateY(-1px);
}
.history-item.frequent .history-icon::after {
  content: "";
  position: absolute;
  /* tiny gold dot to flag frequency without being noisy */
}

/* ===== Phase 2: Command Palette =====
   Slides in below the search input when the customer types `/`.
   Translucent paper-white surface, sharp typography, monospace command
   names so they read as code. Mouse + keyboard friendly. */
.cmd-palette {
  position: absolute;
  top: calc(100% + 6px);
  left: 2px;
  right: 2px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 8px 6px 6px;
  z-index: 50;
  max-height: 360px;
  overflow-y: auto;
  animation: cmdPalIn 0.16s ease;
}
.cmd-palette[hidden] { display: none; }
@keyframes cmdPalIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.cmd-palette-hint {
  font-family: var(--t-eyebrow-family);
  font-size: 10px;
  font-weight: var(--t-eyebrow-weight);
  letter-spacing: 0.10em;
  color: var(--text-quaternary);
  padding: 2px 8px 8px;
}
.cmd-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cmd-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s ease;
}
.cmd-item:hover, .cmd-item.active {
  background: var(--gold-50);
}
.cmd-item.active { box-shadow: inset 3px 0 0 var(--gold-500); padding-inline-start: 7px; }
.cmd-ico {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
}
.cmd-item.active .cmd-ico {
  background: var(--paper);
  border-color: var(--gold-300);
}
.cmd-body {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.cmd-name {
  font-family: var(--t-mono-family);
  font-size: 12.5px;
  font-weight: var(--t-mono-weight);
  letter-spacing: var(--t-mono-track);
  color: var(--text-primary);
}
.cmd-args {
  color: var(--text-quaternary);
  font-weight: 400;
  margin-inline-start: 6px;
}
.cmd-desc {
  font-family: var(--t-caption-family);
  font-size: var(--t-caption-size);
  font-weight: var(--t-caption-weight);
  line-height: var(--t-caption-lh);
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============ Main chat ============ */
.chat-main {
  display: flex; flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  min-width: 0;
  overflow: hidden;
}

.chat-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}
.chat-header-left { display: flex; align-items: center; gap: 14px; }
.bot-avatar {
  position: relative;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid; place-items: center;
  box-shadow: 0 2px 8px rgba(14, 23, 48, 0.15);
  flex-shrink: 0;
  /* The mark itself is a circular SVG, so we don't need overflow:hidden;
     letting the .thinking pulse ring extend slightly beyond the rim. */
}
.bot-avatar img { width: 100%; height: 100%; display: block; border-radius: 50%; }

/* "Saqir is thinking" pulse ring — appears when the JS layer adds
   .thinking to the bot avatar (during a chat-completion request). The
   ring uses --intel-500 so the customer reads "AI processing" without
   ambiguity. Soft, non-distracting, infinite while active. */
.bot-avatar::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--intel-500);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.bot-avatar.thinking::after {
  animation: mz-thinking-pulse 1.6s ease-out infinite;
}
@keyframes mz-thinking-pulse {
  0%   { opacity: 0;    transform: scale(0.95); }
  50%  { opacity: 0.55; transform: scale(1.06); }
  100% { opacity: 0;    transform: scale(1.14); }
}

/* ==============================================================
   Falcon-image avatar enhancements.
   When the bot-avatar contains the falcon PNG/JPG, the image gets
   a subtle breathe and an overlay teal glow positioned over the
   bird's eye. Layer on top of the existing image — no SVG needed.

   The .has-eye-glow modifier is opt-in; only added to .bot-avatar
   instances rendering the falcon image so it doesn't pollute every
   avatar variant.
   ============================================================== */
@keyframes mz-bot-breathe {
  0%, 100% { transform: scale(1.000); }
  50%      { transform: scale(1.018); }
}
@keyframes mz-eye-pulse {
  0%, 100% { opacity: 0.45; transform: translate(-50%, -50%) scale(0.9); }
  50%      { opacity: 1.00; transform: translate(-50%, -50%) scale(1.25); }
}

.bot-avatar.has-eye-glow,
.avatar.bot.has-eye-glow {
  background: #FFFFFF;       /* clean circle behind the falcon image */
  position: relative;
  overflow: hidden;
  border-radius: 50%;
}
.bot-avatar.has-eye-glow img,
.avatar.bot.has-eye-glow img {
  animation: mz-bot-breathe 5s ease-in-out infinite;
  transform-origin: center center;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* Eye glow overlay — positioned at the falcon's eye location.
   Coords are in % of avatar size, calibrated for the supplied falcon
   image where the eye sits at roughly 60% from left, 38% from top. */
.bot-avatar.has-eye-glow::before,
.avatar.bot.has-eye-glow::before {
  content: "";
  position: absolute;
  top: 38%;
  left: 60%;
  width: 22%;
  height: 22%;
  border-radius: 50%;
  background:
    radial-gradient(circle,
      rgba(255, 255, 255, 0.95) 0%,
      rgba(93, 186, 189, 0.85) 18%,
      rgba(15, 142, 145, 0.55) 45%,
      rgba(15, 142, 145, 0) 75%
    );
  filter: blur(0.5px);
  pointer-events: none;
  animation: mz-eye-pulse 3s ease-in-out infinite;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .bot-avatar.has-eye-glow img,
  .bot-avatar.has-eye-glow::before,
  .avatar.bot.has-eye-glow img,
  .avatar.bot.has-eye-glow::before {
    animation: none;
  }
}
.bot-name {
  font-family: var(--t-title-2-family);
  font-size: var(--t-title-2-size);
  font-weight: 600;
  line-height: var(--t-title-2-lh);
  letter-spacing: var(--t-title-2-track);
  color: var(--text-primary);
  display: flex; align-items: center; gap: 8px;
}
.bot-name .bot-status-dot {
  width: 7px; height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}
.bot-status {
  font-family: var(--t-caption-family);
  font-size: var(--t-caption-size);
  font-weight: var(--t-caption-weight);
  line-height: var(--t-caption-lh);
  color: var(--text-tertiary);
  margin-top: 2px;
}
.chat-header-right { display: flex; align-items: center; gap: 12px; }
.header-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-500);
  display: grid; place-items: center;
  transition: all 0.15s ease;
  background: var(--paper);
}
.header-btn:hover { background: var(--paper-soft); color: var(--ink-900); border-color: var(--gold-300); }

/* ---- Channel switcher ---- */
.channel-switcher {
  display: inline-flex;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 3px;
  gap: 2px;
}
.channel-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  background: transparent;
  border-radius: 8px;
  color: var(--text-tertiary);
  font-family: var(--t-label-family);
  font-size: var(--t-label-size);
  font-weight: var(--t-label-weight);
  line-height: var(--t-label-lh);
  transition: all 0.15s ease;
}
.channel-tab:hover { color: var(--text-primary); }
.channel-tab.active {
  background: var(--paper);
  color: var(--text-primary);
  box-shadow: var(--shadow-xs);
  border: 1px solid var(--line);
}
.channel-tab.active[data-channel="voice"] { color: var(--voice); border-color: rgba(110,91,250,0.3); }
.channel-tab.active[data-channel="email"] { color: var(--email); border-color: rgba(74,111,165,0.3); }
.channel-tab.active[data-channel="app"]   { color: var(--app);   border-color: rgba(0,168,120,0.3); }

/* ============ Messages ============ */
.messages {
  flex: 1; overflow-y: auto;
  padding: 28px 28px 12px;
  display: flex; flex-direction: column;
  gap: 18px;
  scroll-behavior: smooth;
}

/* Welcome */
.welcome {
  margin: auto;
  text-align: center;
  max-width: 660px;
  padding: 24px 20px;
  animation: fadeUp 0.6s ease;
}
.welcome-mark {
  width: 64px; height: 64px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--gold-100), var(--gold-50));
  border: 1px solid var(--gold-300);
  color: var(--gold-700);
  display: grid; place-items: center;
  box-shadow: 0 8px 28px rgba(201, 169, 97, 0.20);
}
.welcome-mark svg { width: 38px; height: 38px; }
.welcome h1 {
  font-family: var(--font-display);
  font-size: 32px; font-weight: 600;
  color: var(--ink-900);
  margin-bottom: 8px;
  letter-spacing: -0.4px;
}
.welcome p {
  color: var(--ink-500);
  font-size: 15px;
  line-height: 1.6;
  max-width: 540px;
  margin: 0 auto;
}

.insights {
  margin: 24px auto 0;
  max-width: 580px;
  display: flex; flex-direction: column; gap: 8px;
}
.insight {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  text-align: start;
  font-size: 13.5px;
  color: var(--ink-700);
  box-shadow: var(--shadow-xs);
  transition: all 0.18s ease;
}
.insight:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.insight.salary_credit { border-left: 3px solid var(--green); }
.insight.bill_due { border-left: 3px solid var(--gold-500); }
.insight .ico {
  width: 26px; height: 26px;
  border-radius: 7px;
  display: grid; place-items: center;
  background: var(--paper-soft);
  font-size: 14px;
}
.insight strong { color: var(--ink-900); font-weight: 600; }

.welcome-cards {
  margin-top: 24px;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 580px;
  margin-left: auto; margin-right: auto;
}
.welcome-card {
  text-align: start;
  padding: 14px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 13px;
  color: var(--ink-700);
  line-height: 1.45;
  transition: all 0.18s ease;
  display: flex; align-items: center; gap: 10px;
  box-shadow: var(--shadow-xs);
}
.welcome-card:hover {
  border-color: var(--gold-400);
  background: var(--gold-50);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.welcome-card .ico {
  width: 30px; height: 30px;
  background: var(--paper-soft);
  border-radius: 8px;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 15px;
}

/* ============================================================
   BRIEFING — Saqir's morning briefing (redesigned)
   Five blocks, in priority order:
     1. eyebrow + salutation sentence (Saqir's voice)
     2. attention card (calm; only when there's something)
     3. money clock (single 14-day timeline visualisation)
     4. pulse strip (4 terse status one-liners)
     5. worth thinking about (verb-first opportunities)
   The whole thing is meant to read like a personal banker's note,
   not a fintech dashboard. Quiet typography, generous breathing.
   ============================================================ */

/* Subtle fonts — pairs with the existing Inter / Playfair Display */
:root {
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Consolas, monospace;
}

.briefing {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 22px 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  font-family: var(--font);
}

/* ---- 1. Eyebrow + salutation ---- */
.bf-head { padding: 6px 2px 0; text-align: start; }
.bf-eyebrow {
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  line-height: var(--t-eyebrow-lh);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.bf-eyebrow-sep { color: var(--ink-300); }
.bf-eyebrow-session { color: var(--text-secondary); }

.bf-salutation {
  font-family: var(--t-display-family);
  font-size: var(--t-display-size);
  font-weight: var(--t-display-weight);
  line-height: var(--t-display-lh);
  letter-spacing: var(--t-display-track);
  color: var(--text-primary);
  max-width: 640px;
}
.bf-salutation .bf-name {
  font-style: italic;
  color: var(--gold-700);
  font-weight: 500;
}
/* Dirham currency symbol — inline glyph that inherits text color/size.
   Rendered by format.js dhSymbol() as an inline <svg>; fill="currentColor"
   picks up the surrounding text color automatically. */
.dh-symbol {
  height: 0.95em;
  width: auto;
  display: inline-block;
  vertical-align: -0.12em;
  color: inherit;
}

/* Highlight AED amounts inside the salutation without colour-coding */
.bf-salutation .bf-num {
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, transparent 65%, var(--gold-100) 65%);
  padding: 0 2px;
  white-space: nowrap;
  /* Keep the symbol + number L→R inside RTL Arabic paragraphs */
  direction: ltr;
  unicode-bidi: isolate;
}
.bf-salutation .bf-num .dh-symbol {
  height: 0.9em;
  vertical-align: -0.1em;
  margin-left: 1px;
}

/* ============================================================
   Salutation BLOCKS — the new mass-market layout.
   Each topic gets its own row: emoji + headline + value, with
   real whitespace between blocks. Designed for a customer who
   has never used a banking app — scannable in <2 seconds.
   ============================================================ */
.bf-greeting {
  font-family: var(--t-display-family);
  font-size: 22px;
  font-weight: 500;
  color: var(--gold-700);
  margin: 4px 0 18px;
  letter-spacing: -0.3px;
}
.bf-salu-blocks {
  display: flex;
  flex-direction: column;
  gap: 18px;       /* whitespace between topics — Philippe's carriage-return */
  max-width: 560px;
  margin: 0 0 8px;
}
.bf-salu-block {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: flex-start;
}
.bf-salu-icon {
  font-size: 24px;
  line-height: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  flex-shrink: 0;
}
.bf-salu-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding-top: 2px;
}
.bf-salu-headline {
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-500);
  letter-spacing: 0;
}
.bf-salu-value {
  font-family: var(--t-title-2-family);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink-900);
  line-height: 1.4;
  letter-spacing: -0.1px;
  font-variant-numeric: tabular-nums;
}

/* Tighter on small screens */
@media (max-width: 600px) {
  .bf-greeting { font-size: 19px; margin-bottom: 14px; }
  .bf-salu-blocks { gap: 14px; }
  .bf-salu-value { font-size: 15.5px; }
}

/* RTL */
[dir="rtl"] .bf-salu-block { grid-template-columns: 36px 1fr; }

/* ---- 2. Attention card ---- */
/* Calm, ink-on-paper. Gold left-rule for the accent (no terracotta panel). */
.bf-attention {
  position: relative;
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 18px;
  padding: 4px 4px 4px 0;
  margin-top: 6px;
}
.bf-attention-rule {
  background: linear-gradient(180deg, var(--gold-500), var(--gold-300));
  border-radius: 4px;
  align-self: stretch;
}
.bf-attention-body {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 26px 20px;
  box-shadow: var(--shadow-xs);
}
.bf-attention-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-700);
  margin-bottom: 14px;
}
.bf-attention-glyph {
  width: 6px; height: 6px;
  background: var(--gold-500);
  border-radius: 50%;
  animation: bfBreath 2.6s ease-in-out infinite;
}
@keyframes bfBreath {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.55; transform: scale(1.5); }
}
.bf-attention-when { color: var(--ink-500); letter-spacing: 0.06em; text-transform: none; }

.bf-attention-q {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 500;
  line-height: 1.32;
  color: var(--ink-900);
  letter-spacing: -0.1px;
  margin-bottom: 18px;
  max-width: 56ch;
}
.bf-attention-anchor {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}
.bf-anchor-amount {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.5px;
  font-variant-numeric: tabular-nums;
}
.bf-anchor-merchant {
  font-size: 14px;
  color: var(--ink-500);
}
.bf-attention-why {
  font-size: 14px;
  color: var(--ink-700);
  line-height: 1.55;
  margin-bottom: 14px;
}
.bf-attention-meta {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink-500);
  letter-spacing: 0.04em;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
}
.bf-attention-meta .bf-meta-key { color: var(--ink-400); margin-right: 4px; }
.bf-attention-meta .bf-meta-pair { white-space: nowrap; }
.bf-attention-meta .bf-meta-dot { color: var(--ink-300); }

.bf-attention-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.bf-action {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  color: var(--ink-900);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.bf-action:hover {
  border-color: var(--ink-900);
  background: var(--ink-900);
  color: var(--paper);
  transform: translateY(-1px);
}
.bf-action.primary {
  background: var(--navy-900);
  border-color: var(--navy-900);
  color: #fff;
}
.bf-action.primary:hover {
  background: var(--gold-700);
  border-color: var(--gold-700);
}
.bf-action.primary::after { content: " →"; font-family: var(--font-mono); }

/* ---- 3. Money clock ---- */
.bf-clock-head { margin-bottom: 6px; padding: 0 2px; }
.bf-clock-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink-900);
  letter-spacing: -0.1px;
  margin-bottom: 2px;
}
.bf-clock-sub { font-size: 12.5px; color: var(--ink-500); }
.bf-clock-stage {
  position: relative;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 4px 0 0;
  overflow: hidden;
}
.bf-mc-svg { width: 100%; height: auto; display: block; }

/* SVG marker styles */
.bf-mc-stem { stroke: var(--line-strong); stroke-width: 1; stroke-dasharray: 2 3; }
.bf-mc-event .bf-mc-bead {
  fill: var(--paper);
  stroke-width: 1.6;
  transition: all 0.18s ease;
  cursor: pointer;
}
.bf-mc-event.in  .bf-mc-bead { stroke: var(--green); }
.bf-mc-event.out .bf-mc-bead { stroke: var(--ink-700); }
.bf-mc-event:hover .bf-mc-bead,
.bf-mc-event:focus .bf-mc-bead { transform-origin: center; transform: scale(1.18); outline: none; }
.bf-mc-event.in:hover  .bf-mc-bead,
.bf-mc-event.in:focus  .bf-mc-bead { fill: var(--green); }
.bf-mc-event.out:hover .bf-mc-bead,
.bf-mc-event.out:focus .bf-mc-bead { fill: var(--ink-900); }
.bf-mc-event:focus { outline: none; }

.bf-mc-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  fill: var(--ink-700);
  font-weight: 600;
}
.bf-mc-event.in .bf-mc-label  { fill: var(--green); }
.bf-mc-event.out .bf-mc-label { fill: var(--ink-700); }
.bf-mc-sub {
  font-family: var(--font);
  font-size: 10.5px;
  fill: var(--ink-500);
}
.bf-mc-axis {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  fill: var(--ink-400);
}
.bf-mc-today {
  stroke: var(--gold-500);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
  opacity: 0.85;
}
.bf-mc-today-lbl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  fill: var(--gold-700);
  font-weight: 600;
}

/* Hover/focus callout — pinned to a bead */
.bf-mc-callout {
  position: absolute;
  pointer-events: none;
  background: var(--ink-900);
  color: var(--paper);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 140px;
  box-shadow: var(--shadow-md);
  transform: translate(-50%, -100%);
  font-size: 12px;
}
.bf-mc-callout[data-placement="below"] { transform: translate(-50%, 0); }
.bf-mc-callout .bf-cal-when {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-300);
  margin-bottom: 3px;
}
.bf-mc-callout .bf-cal-amt {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.bf-mc-callout[data-direction="in"]  .bf-cal-amt { color: #6BE7B6; }
.bf-mc-callout[data-direction="out"] .bf-cal-amt { color: #fff; }
.bf-mc-callout .bf-cal-title { font-size: 12px; color: rgba(255,255,255,0.78); margin-top: 1px; }

/* ---- 4. Pulse ---- */
.bf-pulse-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink-900);
  margin-bottom: 8px;
  padding: 0 2px;
  letter-spacing: -0.1px;
}
.bf-pulse-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.bf-pulse-tile {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  position: relative;
  transition: border-color 0.15s ease;
}
.bf-pulse-tile:hover { border-color: var(--line-strong); }
.bf-pulse-tile::before {
  content: "";
  position: absolute;
  top: 12px;
  inset-inline-start: 0;
  width: 3px;
  height: 14px;
  border-radius: 0 3px 3px 0;
  background: var(--ink-300);
}
.bf-pulse-tile[data-tone="positive"]::before { background: var(--green); }
.bf-pulse-tile[data-tone="muted"]::before    { background: var(--gold-500); }
.bf-pulse-key {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-500);
  margin-bottom: 6px;
}
.bf-pulse-val {
  font-size: 13.5px;
  color: var(--ink-900);
  font-weight: 500;
  line-height: 1.4;
}

/* ---- 5. Worth thinking about ---- */
.bf-recos-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  color: var(--ink-900);
  margin-bottom: 6px;
  padding: 0 2px;
  letter-spacing: -0.1px;
}
.bf-recos-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; }
.bf-recos-list li { display: contents; }
.bf-reco {
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: start;
  gap: 12px;
  width: 100%;
  text-align: start;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 14px 4px;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  transition: background 0.15s ease, padding 0.15s ease;
}
.bf-reco:last-of-type { border-bottom: 0; }
.bf-reco:hover {
  background: var(--gold-50);
  padding-inline: 12px;
  border-radius: 8px;
}
.bf-reco-arrow {
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--gold-700);
  margin-top: 1px;
  transition: transform 0.18s ease;
}
.bf-reco:hover .bf-reco-arrow { transform: translateX(3px); }
.bf-reco-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bf-reco-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-900);
  letter-spacing: -0.1px;
}
.bf-reco-detail { font-size: 13px; color: var(--ink-700); line-height: 1.5; }

/* ---- Stagger reveal (kept light) ---- */
.briefing .reveal {
  opacity: 0;
  transform: translateY(8px);
  animation: bfRise 0.55s ease forwards;
}
.briefing .r1 { animation-delay: 0.05s; }
.briefing .r2 { animation-delay: 0.18s; }
.briefing .r3 { animation-delay: 0.32s; }
.briefing .r4 { animation-delay: 0.46s; }
.briefing .r5 { animation-delay: 0.60s; }
@keyframes bfRise { to { opacity: 1; transform: translateY(0); } }

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .briefing { padding: 16px 16px 24px; gap: 20px; }
  .bf-salutation { font-size: 20px; }
  .bf-attention-q { font-size: 18px; }
  .bf-anchor-amount { font-size: 24px; }
  .bf-pulse-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---- RTL ---- */
[dir="rtl"] .bf-attention { grid-template-columns: 1fr 4px; direction: rtl; }
[dir="rtl"] .bf-action.primary::after { content: " ←"; }
[dir="rtl"] .bf-reco-arrow { transform: scaleX(-1); }
[dir="rtl"] .bf-reco:hover .bf-reco-arrow { transform: scaleX(-1) translateX(3px); }
/* Mirror trailing arrow on primary action buttons (used in attention deck) */
[dir="rtl"] .ui-btn.primary::after { content: " ←"; }
/* Mirror the carousel prev/next chevrons so visual direction matches RTL nav */
[dir="rtl"] .bf-att-arrow svg { transform: scaleX(-1); }
/* Force the prev/next pair to render in reverse visual order in RTL so
   "next" sits physically on the left where Arabic readers expect forward
   motion. Pairs with the SVG mirror above. */
[dir="rtl"] .bf-att-nav { flex-direction: row-reverse; }
/* Mirror the standalone "→" pseudo in quick-action chips */
[dir="rtl"] .quick-action::before { content: "←"; }

/* ============================================================
   BRIEFING v3 — FAANG-grade redesign
   ------------------------------------------------------------
   New blocks:
     .bf-att      — attention deck (Tinder-style stack of cards)
     .bf-cf       — cash flow river (smooth area chart + tooltip)
     .bf-products — product chips with expand-on-tap
     .bf-opps     — opportunities with reveal-the-math
     .bf-prompts  — smart contextual quick prompts
   Shared: .bf-section-eyebrow (small monospace section label)
   Legacy .bf-attention/.bf-clock/.bf-pulse/.bf-recos selectors
   above are kept untouched but no longer rendered.
   ============================================================ */

.bf-section-eyebrow {
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  line-height: var(--t-eyebrow-lh);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* Section-head pattern reused in cash-flow / products / opportunities */
.bf-cf-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 12px;
}
.bf-cf-title {
  font-family: var(--t-title-1-family);
  font-size: var(--t-title-1-size);
  font-weight: var(--t-title-1-weight);
  line-height: var(--t-title-1-lh);
  letter-spacing: var(--t-title-1-track);
  color: var(--text-primary);
  margin-top: 4px;
}

/* ============================================================
   ATTENTION DECK
   ============================================================ */
.bf-att-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 2px 14px;
}
.bf-att-count {
  font-family: var(--t-title-1-family);
  font-size: var(--t-title-1-size);
  font-weight: var(--t-title-1-weight);
  line-height: var(--t-title-1-lh);
  letter-spacing: var(--t-title-1-track);
  color: var(--text-primary);
  margin-top: 4px;
}
.bf-att-nav { display: flex; gap: 6px; }
.bf-att-arrow {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink-700);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
}
.bf-att-arrow:hover:not(:disabled) {
  border-color: var(--gold-500);
  color: var(--gold-700);
  background: var(--gold-50);
  transform: translateY(-1px);
}
.bf-att-arrow:disabled { opacity: 0.30; cursor: not-allowed; }

/* Stage: card stack with peek behind */
.bf-att-stage {
  position: relative;
  min-height: 320px;
  perspective: 1200px;
}
.bf-att-card {
  position: absolute;
  inset: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition:
    transform 0.42s cubic-bezier(.22,.78,.32,1),
    opacity 0.32s ease,
    box-shadow 0.32s ease,
    filter 0.32s ease;
  display: grid;
  grid-template-columns: 4px 1fr;
  gap: 18px;
  overflow: hidden;
  will-change: transform, opacity;
}
.bf-att-card[data-position="active"] {
  transform: translateY(0) scale(1);
  opacity: 1;
  box-shadow: var(--shadow-md);
  filter: none;
  cursor: default;
}
.bf-att-card[data-position="below"] {
  transform: translateY(14px) scale(0.965);
  opacity: 0.62;
  box-shadow: var(--shadow-xs);
  filter: saturate(0.85);
}
.bf-att-card[data-position="below"][data-position="below"]:nth-of-type(n+3) {
  transform: translateY(28px) scale(0.92);
  opacity: 0.30;
}
.bf-att-card[data-position="above"] {
  transform: translateY(-260px) scale(0.96);
  opacity: 0;
  pointer-events: none;
}

.bf-att-rule {
  background: linear-gradient(180deg, var(--gold-500), var(--gold-300));
  border-radius: 4px;
  align-self: stretch;
}
.bf-att-card[data-tone="warning"] .bf-att-rule {
  background: linear-gradient(180deg, var(--gold-700), var(--gold-500));
}
.bf-att-card[data-tone="positive"] .bf-att-rule {
  background: linear-gradient(180deg, var(--green), #8BD9B6);
}
.bf-att-card[data-tone="neutral"] .bf-att-rule {
  background: linear-gradient(180deg, var(--ink-500), var(--ink-300));
}
.bf-att-body { padding: 22px 26px 22px 0; min-width: 0; }

.bf-att-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  line-height: var(--t-eyebrow-lh);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  color: var(--text-accent);
  margin-bottom: 14px;
}
.bf-att-card[data-tone="positive"] .bf-att-tag { color: var(--green); }
.bf-att-card[data-tone="neutral"]  .bf-att-tag { color: var(--ink-700); }
.bf-att-glyph {
  width: 6px; height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: bfBreath 2.6s ease-in-out infinite;
}
.bf-att-when { color: var(--ink-500); letter-spacing: 0.06em; text-transform: none; }

.bf-att-headline {
  font-family: var(--t-display-family);
  font-size: 22px;                          /* slightly tighter than salutation */
  font-weight: var(--t-display-weight);
  line-height: var(--t-display-lh);
  letter-spacing: var(--t-display-track);
  color: var(--text-primary);
  margin-bottom: 12px;
}
.bf-att-anchor {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 12px 14px;
  background: var(--paper-soft);
  border-radius: 10px;
  margin-bottom: 12px;
}
.bf-att-amt {
  font-family: var(--t-display-family);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: var(--t-display-track);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  /* Keep numeric amounts (incl. leading minus) reading L→R even in RTL,
     so "−AED 17,783" doesn't render as "AED 17,783−". */
  direction: ltr;
  unicode-bidi: isolate;
}
.bf-att-mer {
  font-family: var(--t-body-sm-family);
  font-size: var(--t-body-sm-size);
  color: var(--text-tertiary);
}
.bf-att-why {
  font-family: var(--t-body-family);
  font-size: var(--t-body-size);
  font-weight: var(--t-body-weight);
  line-height: var(--t-body-lh);
  color: var(--text-secondary);
  margin-bottom: 14px;
}
.bf-att-meta {
  font-family: var(--t-mono-family);
  font-size: var(--t-mono-size);
  font-weight: var(--t-mono-weight);
  line-height: var(--t-mono-lh);
  letter-spacing: var(--t-mono-track);
  color: var(--text-tertiary);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.bf-att-meta .bf-meta-key { color: var(--ink-400); margin-right: 4px; }
.bf-att-meta .bf-meta-pair { white-space: nowrap; }
.bf-att-meta .bf-meta-dot { color: var(--ink-300); }
.bf-att-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.bf-att-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-top: 16px;
}
.bf-att-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: var(--line-strong);
  cursor: pointer;
  transition: all 0.18s ease;
}
.bf-att-dot:hover { background: var(--ink-500); }
.bf-att-dot.active {
  width: 22px;
  border-radius: 4px;
  background: var(--gold-500);
}

/* ============================================================
   CASH FLOW RIVER
   ============================================================ */
.bf-cf-legend {
  display: flex;
  gap: 8px;
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  line-height: var(--t-eyebrow-lh);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  color: var(--text-tertiary);
  align-items: center;
}
.bf-cf-leg {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.bf-cf-leg::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink-500);
}
.bf-cf-leg.in::before  { background: var(--green); }
.bf-cf-leg.out::before { background: var(--ink-700); }

.bf-cf-stage {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px 6px 0;
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.bf-cf-svg { width: 100%; height: auto; display: block; cursor: crosshair; }

.bf-cf-line {
  fill: none;
  stroke: var(--gold-700);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bf-cf-area { fill: url(#bfCfFill); }
.bf-cf-grid {
  stroke: var(--line);
  stroke-width: 0.6;
  stroke-dasharray: 2 4;
  opacity: 0.7;
}
.bf-cf-today {
  stroke: var(--gold-500);
  stroke-width: 1.2;
  stroke-dasharray: 3 3;
  opacity: 0.8;
}
.bf-cf-today-lbl {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  fill: var(--gold-700);
  font-weight: 600;
}
.bf-cf-axis {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  fill: var(--ink-400);
}
.bf-cf-event { cursor: pointer; }
.bf-cf-evt-bead {
  fill: var(--paper);
  stroke-width: 2;
  transition: all 0.18s ease;
}
.bf-cf-event.in  .bf-cf-evt-bead { stroke: var(--green); }
.bf-cf-event.out .bf-cf-evt-bead { stroke: var(--ink-700); }
.bf-cf-event:hover .bf-cf-evt-bead,
.bf-cf-event:focus .bf-cf-evt-bead { transform: scale(1.4); transform-origin: center; }
.bf-cf-event.in:hover  .bf-cf-evt-bead { fill: var(--green); }
.bf-cf-event.out:hover .bf-cf-evt-bead { fill: var(--ink-700); }

.bf-cf-hover {
  stroke: var(--gold-500);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0.65;
  pointer-events: none;
}
.bf-cf-hover-dot {
  fill: var(--gold-700);
  stroke: var(--paper);
  stroke-width: 2;
  pointer-events: none;
}
.bf-cf-tip {
  position: absolute;
  pointer-events: none;
  background: var(--ink-900);
  color: var(--paper);
  padding: 10px 12px;
  border-radius: 10px;
  min-width: 150px;
  box-shadow: var(--shadow-md);
  transform: translate(-50%, -100%);
  font-size: 12px;
  z-index: 5;
}
.bf-cf-tip-when {
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  color: var(--gold-300);
  margin-bottom: 4px;
}
.bf-cf-tip-bal {
  font-family: var(--t-title-1-family);
  font-size: var(--t-title-1-size);
  font-weight: 600;
  letter-spacing: var(--t-title-1-track);
  font-variant-numeric: tabular-nums;
}
.bf-cf-tip-evt {
  margin-top: 4px;
  font-family: var(--t-caption-family);
  font-size: var(--t-caption-size);
  color: rgba(255, 255, 255, 0.78);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.bf-cf-tip-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-300);
}
.bf-cf-tip-dot.in  { background: #6BE7B6; }
.bf-cf-tip-dot.out { background: #FFE6CB; }

/* ============================================================
   PRODUCT CHIPS
   ============================================================ */
.bf-chips {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.bf-chip {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bf-chip:hover { border-color: var(--line-strong); }
.bf-chip.open { border-color: var(--gold-300); box-shadow: var(--shadow-xs); }

.bf-chip-head {
  display: grid;
  grid-template-columns: 28px 1fr auto 24px;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: start;
  transition: background 0.15s ease;
}
.bf-chip-head:hover { background: var(--paper-soft); }
.bf-chip-trend {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-500);
  background: var(--paper-soft);
  border: 1px solid var(--line);
}
.bf-chip-trend[data-trend="up"]      { color: var(--green);    background: var(--green-soft); border-color: rgba(0,168,120,0.30); }
.bf-chip-trend[data-trend="down"]    { color: var(--red);      background: var(--red-soft);   border-color: rgba(214,52,43,0.30); }
.bf-chip-trend[data-trend="warning"] { color: var(--gold-700); background: var(--gold-50);    border-color: var(--gold-300); }

.bf-chip-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.bf-chip-label {
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  line-height: var(--t-eyebrow-lh);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.bf-chip-value {
  font-family: var(--t-title-1-family);
  font-size: var(--t-title-1-size);
  font-weight: var(--t-title-1-weight);
  line-height: var(--t-title-1-lh);
  letter-spacing: var(--t-title-1-track);
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.bf-chip-delta {
  font-family: var(--t-mono-family);
  font-size: var(--t-mono-size);
  font-weight: var(--t-mono-weight);
  line-height: var(--t-mono-lh);
  letter-spacing: var(--t-mono-track);
  color: var(--text-tertiary);
  white-space: nowrap;
}
.bf-chip-delta[data-trend="up"]      { color: var(--green); }
.bf-chip-delta[data-trend="down"]    { color: var(--red); }
.bf-chip-delta[data-trend="warning"] { color: var(--gold-700); }

.bf-chip-caret {
  color: var(--ink-400);
  display: grid; place-items: center;
  transition: transform 0.22s ease;
}
.bf-chip.open .bf-chip-caret { transform: rotate(180deg); color: var(--gold-700); }

.bf-chip-body {
  padding: 0 18px 16px 60px;
  border-top: 1px solid var(--line);
  background: var(--paper-soft);
  animation: bfChipExpand 0.22s ease;
}
.bf-chip-body[hidden] { display: none; }
.bf-chip-body-title {
  font-family: var(--t-title-3-family);
  font-size: var(--t-title-3-size);
  font-weight: 600;
  line-height: var(--t-title-3-lh);
  letter-spacing: var(--t-title-3-track);
  color: var(--text-primary);
  margin: 14px 0 8px;
}
.bf-chip-body .ui-kv-list { margin-bottom: 12px; }
.bf-chip-cta { margin-top: 8px; }
@keyframes bfChipExpand {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   OPPORTUNITIES (reveal-the-math)
   ============================================================ */
.bf-opps-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.bf-opp {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.bf-opp:hover { border-color: var(--line-strong); }
.bf-opp.open { border-color: var(--gold-300); box-shadow: var(--shadow-xs); }
.bf-opp-head { padding: 16px 18px; }
.bf-opp-tag {
  display: inline-block;
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  line-height: var(--t-eyebrow-lh);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  color: var(--text-accent);
  margin-bottom: 6px;
}
.bf-opp-title {
  font-family: var(--t-title-2-family);
  font-size: var(--t-title-2-size);
  font-weight: var(--t-title-2-weight);
  line-height: var(--t-title-2-lh);
  letter-spacing: var(--t-title-2-track);
  color: var(--text-primary);
  margin-bottom: 4px;
}
.bf-opp-summary {
  font-family: var(--t-body-sm-family);
  font-size: var(--t-body-sm-size);
  font-weight: var(--t-body-sm-weight);
  line-height: var(--t-body-sm-lh);
  color: var(--text-secondary);
  margin-bottom: 12px;
}
.bf-opp-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bf-opp-toggle {
  font-family: var(--t-label-family);
  font-size: var(--t-label-size);
  font-weight: var(--t-label-weight);
  line-height: var(--t-label-lh);
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--line-strong);
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.bf-opp-toggle:hover {
  border-color: var(--gold-500);
  color: var(--gold-700);
  background: var(--gold-50);
}
.bf-opp-toggle svg { transition: transform 0.22s ease; }
.bf-opp.open .bf-opp-toggle svg { transform: rotate(180deg); }
.bf-opp.open .bf-opp-toggle { border-color: var(--gold-500); color: var(--gold-700); background: var(--gold-50); }
.bf-opp-math {
  padding: 14px 18px 16px;
  background: var(--paper-soft);
  border-top: 1px solid var(--line);
  animation: bfChipExpand 0.22s ease;
}
.bf-opp-math[hidden] { display: none; }

/* ============================================================
   SMART PROMPTS
   ============================================================ */
.bf-prompts {
  padding-top: 8px;
  margin-top: -4px;
  border-top: 1px dashed var(--line);
}
.bf-prompts-label {
  font-family: var(--t-eyebrow-family);
  font-size: var(--t-eyebrow-size);
  font-weight: var(--t-eyebrow-weight);
  line-height: var(--t-eyebrow-lh);
  letter-spacing: var(--t-eyebrow-track);
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 10px;
  padding-top: 14px;
}
.bf-prompts-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bf-prompt {
  font-size: 12.5px !important;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 720px) {
  .bf-att-stage { min-height: 360px; }
  .bf-att-headline { font-size: 19px; }
  .bf-att-amt { font-size: 18px; }
  .bf-att-body { padding-right: 16px; padding-block: 18px; }
  .bf-chip-head { grid-template-columns: 24px 1fr auto 20px; gap: 10px; padding: 12px 14px; }
  .bf-chip-value { font-size: 15px; }
  .bf-chip-body { padding-inline: 14px; padding-bottom: 14px; }
}

/* Message rows */
.message-row {
  display: flex;
  gap: 14px;
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  animation: messageIn 0.35s cubic-bezier(0.21, 0.61, 0.35, 1);
}
.message-row.user { flex-direction: row-reverse; }
body[dir="rtl"] .message-row.user { flex-direction: row; }

@keyframes messageIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.avatar {
  width: 38px; height: 38px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  display: grid; place-items: center;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.bot { background: var(--ink-900); }

.bubble-wrap { max-width: 86%; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.bubble {
  padding: 13px 17px;
  border-radius: 16px;
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bubble.bot {
  background: var(--paper);
  color: var(--ink-900);
  border-top-left-radius: 4px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-xs);
}
.bubble.user {
  background: var(--ink-900);
  color: var(--paper);
  border-top-right-radius: 4px;
}
body[dir="rtl"] .bubble.bot { border-top-left-radius: 16px; border-top-right-radius: 4px; }
body[dir="rtl"] .bubble.user { border-top-right-radius: 16px; border-top-left-radius: 4px; }
.bubble.bot.error { background: var(--red-soft); border-color: rgba(214, 52, 43, 0.25); }

.bubble strong {
  color: var(--ink-900);
  font-weight: 600;
  background: linear-gradient(180deg, transparent 60%, var(--gold-100) 60%);
  padding: 0 2px;
}
.bubble.user strong { color: var(--gold-300); background: none; font-weight: 600; }
.bubble em { font-style: italic; color: var(--ink-500); }

/* ============ Rich response cards ============ */
.cards-container { display: flex; flex-direction: column; gap: 8px; }

/* Account card */
.card.account {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  transition: all 0.18s ease;
}
.card.account:hover { border-color: var(--gold-400); transform: translateY(-1px); }
.card.account.credit {
  background: linear-gradient(140deg, var(--navy-800), var(--navy-900));
  border: none;
  color: var(--paper);
  position: relative;
  overflow: hidden;
}
.card.account.credit::before {
  content: "";
  position: absolute;
  top: -40px; right: -40px;
  width: 140px; height: 140px;
  background: radial-gradient(circle, rgba(201,169,97,0.20), transparent 60%);
}
.card.account.credit .acct-name, .card.account.credit .acct-balance { color: var(--paper); }
.card.account.credit .acct-no, .card.account.credit .acct-meta { color: rgba(255,255,255,0.65); }
.card.account .acct-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 20px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
}
.card.account.credit .acct-icon { background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.15); color: var(--gold-300); }
.card.account .acct-info { flex: 1; min-width: 0; position: relative; z-index: 1; }
.card.account .acct-name { font-size: 13.5px; font-weight: 600; color: var(--ink-900); }
.card.account .acct-no { font-family: ui-monospace, monospace; font-size: 11px; color: var(--ink-500); margin-top: 2px; letter-spacing: 0.5px; }
.card.account .acct-balance { font-size: 20px; font-weight: 700; color: var(--ink-900); letter-spacing: -0.4px; position: relative; z-index: 1; }
.card.account .acct-balance .currency { font-size: 11px; font-weight: 500; color: var(--ink-500); margin-left: 4px; }
.card.account .acct-balance .currency .dh-symbol { height: 0.7em; vertical-align: -0.05em; }
.card.account .acct-meta { font-size: 11px; color: var(--ink-500); margin-top: 4px; text-align: end; }

/* Transactions */
.card.transactions {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.tx-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s ease;
}
.tx-row:last-child { border-bottom: none; }
.tx-row:hover { background: var(--paper-soft); }
.tx-icon {
  width: 38px; height: 38px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 16px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
}
.tx-icon.salary { background: var(--green-soft); border-color: rgba(0,168,120,0.20); }
.tx-icon.dining { background: #FFF1E0; border-color: #FFE0B8; }
.tx-icon.groceries { background: #E8F5EE; border-color: #C9E5D4; }
.tx-icon.transport { background: #E8F0FB; border-color: #CADAF1; }
.tx-icon.shopping { background: #FAEFFA; border-color: #ECD8EB; }
.tx-icon.utility { background: #FFF4DC; border-color: #FAE2A6; }
.tx-icon.telecom { background: #E5EEFA; border-color: #CFDDF1; }
.tx-icon.subscription { background: #EFE9FB; border-color: #DCD2F2; }
.tx-icon.school { background: #DCEEFF; border-color: #BBD9F4; }
.tx-icon.healthcare { background: #FBE4E1; border-color: #F2C5BE; }
.tx-info { flex: 1; min-width: 0; }
.tx-merchant { font-size: 13.5px; font-weight: 500; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-meta { font-size: 11px; color: var(--ink-500); margin-top: 2px; }
.tx-amount { font-size: 14px; font-weight: 600; color: var(--ink-900); white-space: nowrap; }
.tx-amount.credit { color: var(--green); }

/* Confirm cards */
.card.transfer_confirm, .card.card_action_confirm {
  background: linear-gradient(140deg, var(--gold-50), var(--paper));
  border: 1px solid var(--gold-300);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.confirm-title { font-size: 10px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--gold-700); font-weight: 600; margin-bottom: 10px; }
.confirm-amount { font-size: 30px; font-weight: 700; color: var(--ink-900); letter-spacing: -0.6px; }
.confirm-amount .currency { font-size: 13px; font-weight: 500; color: var(--ink-500); margin-left: 4px; }
.confirm-amount .currency .dh-symbol { height: 0.55em; vertical-align: 0.05em; }
.confirm-row { display: flex; justify-content: space-between; align-items: center; padding: 7px 0; font-size: 13px; }
.confirm-row .lbl { color: var(--ink-500); }
.confirm-row .val { color: var(--ink-900); font-weight: 500; }
.confirm-divider { height: 1px; background: var(--line); margin: 10px 0; }

/* Executed (success) */
.card.executed {
  background: linear-gradient(140deg, var(--green-soft), var(--paper));
  border: 1px solid rgba(0, 168, 120, 0.25);
  border-radius: 14px;
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
}
.card.executed .exec-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--green); margin-bottom: 10px; }
.card.executed .exec-ref { font-family: ui-monospace, monospace; font-size: 11px; color: var(--ink-500); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); }

/* Bills */
.card.bills {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.bill-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.bill-row:last-child { border-bottom: none; }
.bill-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 16px;
  background: var(--gold-50);
  color: var(--gold-700);
}
.bill-info { flex: 1; min-width: 0; }
.bill-payee { font-size: 13.5px; font-weight: 500; color: var(--ink-900); }
.bill-due { font-size: 11px; color: var(--ink-500); margin-top: 2px; }
.bill-amount { font-size: 14px; font-weight: 600; color: var(--ink-900); }
.bill-due-pill {
  display: inline-block; padding: 1px 7px; border-radius: 6px;
  font-size: 10px; background: var(--paper-soft); color: var(--ink-700); font-weight: 500; margin-left: 6px;
  border: 1px solid var(--line);
}
.bill-due-pill.urgent { background: var(--red-soft); color: var(--red); border-color: rgba(214,52,43,0.25); }

/* Insights */
.card.insights {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow-card);
}
.insights-total { font-size: 10px; color: var(--ink-500); text-transform: uppercase; letter-spacing: 1.6px; font-weight: 600; }
.insights-amount { font-size: 30px; font-weight: 700; color: var(--ink-900); letter-spacing: -0.6px; margin-top: 4px; }
.insights-amount .currency { font-size: 13px; color: var(--ink-500); margin-left: 4px; }
.insights-amount .currency .dh-symbol { height: 0.55em; vertical-align: 0.05em; }
.insights-bars { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.insights-row { display: flex; align-items: center; gap: 12px; }
.insights-row .cat { font-size: 12.5px; color: var(--ink-700); width: 95px; text-transform: capitalize; font-weight: 500; }
.insights-row .bar-track { flex: 1; height: 8px; background: var(--paper-soft); border-radius: 4px; overflow: hidden; border: 1px solid var(--line); }
.insights-row .bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold-500), var(--gold-400)); border-radius: 4px; }
.insights-row .amt { font-size: 12px; color: var(--ink-700); font-weight: 600; min-width: 80px; text-align: end; }

/* Recurring */
.card.recurring {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.rec-header { padding: 14px 18px; background: var(--paper-soft); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.rec-header .lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--ink-500); font-weight: 600; }
.rec-header .total { font-size: 16px; font-weight: 700; color: var(--ink-900); }
.rec-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.rec-row:last-child { border-bottom: none; }
.rec-icon { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; font-size: 14px; background: var(--gold-50); }
.rec-info { flex: 1; }
.rec-merchant { font-size: 13px; font-weight: 500; color: var(--ink-900); }
.rec-cat { font-size: 11px; color: var(--ink-500); margin-top: 2px; text-transform: capitalize; }
.rec-amt { font-size: 13px; font-weight: 600; color: var(--ink-900); }

/* ===========================================================
   Cliff warning card — proactive forward-looking pre-warning.
   Soft cliff = warm gold treatment; hard cliff = subtle red
   accent. Designed to feel like a heads-up note, not an alarm.
   =========================================================== */
.card.cliff-warning {
  background: var(--gold-50);
  border: 1px solid var(--gold-300);
  border-radius: 14px;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-card);
}
.card.cliff-warning.hard {
  background: var(--red-soft);
  border-color: rgba(214, 52, 43, 0.30);
}

.cliff-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cliff-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--gold-300);
  color: var(--gold-700);
}
.cliff-pill.hard {
  background: rgba(214, 52, 43, 0.15);
  color: var(--red);
}
.cliff-when {
  font-size: 11.5px;
  color: var(--ink-500);
  font-weight: 500;
}
.cliff-headline {
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-900);
  font-weight: 500;
}
.cliff-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 12px;
  color: var(--ink-700);
  align-items: center;
}
.cliff-trigger { font-weight: 500; }
.cliff-short {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--red);
}
.card.cliff-warning.soft .cliff-short { color: var(--gold-700); }
.cliff-recovery { color: var(--ink-500); }

/* Mitigation action buttons. Shared between cliff_warning and
   cashflow_forecast cards — same `.cliff-actions` wrapper. */
.cliff-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.cliff-action-btn {
  display: inline-flex;
  align-items: center;
  padding: 8px 14px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-900);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: start;
  line-height: 1.3;
}
.cliff-action-btn:hover {
  background: var(--paper-soft);
  border-color: var(--ink-700);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.cliff-action-btn:active { transform: translateY(0); }
.card.cliff-warning.hard .cliff-action-btn:hover {
  border-color: var(--red);
}

/* ===========================================================
   Cashflow forecast card — full 14-day runway view with an
   inline SVG sparkline. Used on explicit "what's coming up?"
   asks and as the expanded form of a cliff warning.
   =========================================================== */
.card.cashflow-forecast {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  padding: 14px 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
}
.cf-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.cf-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-500);
}
.cf-starting {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--ink-700);
}
.cashflow-spark {
  width: 100%;
  height: 90px;
  display: block;
  background: var(--paper-soft);
  border-radius: 8px;
  padding: 4px;
}
.cf-headline {
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-700);
}
.cf-events {
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}
.cf-event {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 12.5px;
  padding: 4px 0;
}
.cf-event-date {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-500);
  font-weight: 500;
}
.cf-event-label {
  color: var(--ink-900);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cf-event-amt {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.cf-event.outflow .cf-event-amt { color: var(--ink-900); }
.cf-event.inflow .cf-event-amt { color: var(--green); }
.cf-event.is-cliff .cf-event-label { color: var(--red); }
.cf-event.is-cliff .cf-event-amt { color: var(--red); }

/* RTL adjustments — cliff buttons + event grid are direction-friendly
   already, but the action pills look better right-aligned in Arabic. */
[dir="rtl"] .cliff-actions { justify-content: flex-end; }
[dir="rtl"] .cf-event { grid-template-columns: auto 1fr 90px; }

/* ===========================================================
   Empty-state placeholder shared across new card types.
   =========================================================== */
.card-empty {
  padding: 16px;
  color: var(--ink-500);
  text-align: center;
  font-size: 13px;
}

/* ===========================================================
   Generic small badges (Sharia, Urgent, etc.)
   =========================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  margin-left: 8px;
  border-radius: 4px;
}
.badge.sharia {
  background: var(--green-soft);
  color: var(--green);
}
.badge.urgent {
  background: var(--red-soft);
  color: var(--red);
}
[dir="rtl"] .badge { margin-left: 0; margin-right: 8px; }

/* ===========================================================
   Loans card — active loan rows with progress bar
   =========================================================== */
.card.loans {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.loans-head {
  padding: 14px 18px;
  background: var(--paper-soft);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.loans-head .lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-500);
  font-weight: 600;
}
.loans-head .total {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
}
.loan-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.loan-row:last-child { border-bottom: none; }
.loan-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 16px;
  background: var(--gold-50);
}
.loan-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-900);
  display: flex;
  align-items: center;
}
.loan-meta {
  font-size: 11.5px;
  color: var(--ink-500);
  margin-top: 1px;
}
.loan-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}
.lp-track {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--line);
  overflow: hidden;
}
.lp-fill {
  height: 100%;
  background: var(--gold-500);
  transition: width 0.3s ease;
}
.lp-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-500);
  font-weight: 500;
}
.loan-meta-2 {
  font-size: 11px;
  color: var(--ink-700);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.loan-amount {
  text-align: end;
  font-size: 17px;
  font-weight: 600;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.loan-amount .currency {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--ink-500);
  margin-left: 4px;
}
.loan-amount .currency .dh-symbol { height: 0.8em; vertical-align: -0.05em; }

/* ===========================================================
   Investments card — portfolio with per-holding rows
   =========================================================== */
.card.investments {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.inv-head {
  padding: 14px 18px;
  background: var(--paper-soft);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.inv-head .lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-500);
  font-weight: 600;
}
.inv-totals { text-align: end; }
.inv-totals .value {
  display: block;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}
.inv-totals .change {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
}
.change.up { color: var(--green); }
.change.down { color: var(--red); }
.inv-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.inv-row:last-child { border-bottom: none; }
.inv-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 16px;
  background: var(--gold-50);
}
.inv-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-900);
  display: flex;
  align-items: center;
}
.inv-meta {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
}
.inv-amount {
  text-align: end;
  font-variant-numeric: tabular-nums;
}
.inv-amount .amt {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-900);
}
.inv-amount .amt .currency {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 500;
  color: var(--ink-500);
  margin-left: 4px;
}
.inv-amount .amt .currency .dh-symbol { height: 0.85em; vertical-align: -0.05em; }
.inv-amount .change {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
}

/* ===========================================================
   Rewards card — points + cashback + tier progress
   =========================================================== */
.card.rewards {
  background: linear-gradient(135deg, var(--gold-50), var(--paper-soft));
  border: 1px solid var(--gold-300);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-card);
}
.rw-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.rw-tier-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
  background: var(--ink-900);
  color: var(--text-on-dark);
}
.rw-tier-badge.tier-platinum { background: var(--ink-900); }
.rw-tier-badge.tier-gold { background: var(--gold-700); }
.rw-tier-badge.tier-silver { background: var(--ink-500); }
.rw-tier-next {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-500);
  font-weight: 500;
}
.rw-headline-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.rw-bigblock {
  background: var(--paper);
  border-radius: 10px;
  padding: 12px;
  border: 1px solid var(--line);
}
.rw-block-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-500);
  font-weight: 600;
  margin-bottom: 4px;
}
.rw-block-value {
  font-size: 22px;
  font-weight: 600;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.rw-block-meta {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 2px;
}
.rw-tier-progress {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rw-tier-bar {
  height: 6px;
  border-radius: 3px;
  background: var(--paper);
  border: 1px solid var(--line);
  overflow: hidden;
}
.rw-tier-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-500), var(--gold-700));
  transition: width 0.3s ease;
}
.rw-tier-meta {
  font-size: 11px;
  color: var(--ink-700);
  font-variant-numeric: tabular-nums;
}
.rw-activity {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
.rw-activity-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-500);
  font-weight: 600;
  margin-bottom: 2px;
}
.rw-activity-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.rw-activity-merchant {
  color: var(--ink-900);
  font-weight: 500;
}
.rw-activity-when {
  font-size: 10.5px;
  color: var(--ink-500);
  margin-top: 1px;
}
.rw-activity-pts {
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  text-align: end;
}
.rw-activity-pts.up { color: var(--green); }
.rw-activity-pts.down { color: var(--ink-500); }
.rw-activity-cb {
  display: block;
  font-size: 10px;
  color: var(--green);
  margin-top: 1px;
}

/* ===========================================================
   Cases card — open disputes / complaints / requests
   =========================================================== */
.card.cases {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.case-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.case-row:last-child { border-bottom: none; }
.case-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.case-status {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 4px;
}
.case-status.open { background: var(--red-soft); color: var(--red); }
.case-status.in_review { background: var(--gold-100); color: var(--gold-700); }
.case-status.resolved { background: var(--green-soft); color: var(--green); }
.case-status.closed { background: var(--line); color: var(--ink-500); }
.case-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-900);
  flex: 1;
}
.case-amount {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-700);
}
.case-summary {
  font-size: 12.5px;
  color: var(--ink-700);
  line-height: 1.5;
}
.case-meta {
  display: flex;
  gap: 12px;
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 2px;
}
.case-eta {
  font-family: var(--font-mono);
  font-weight: 500;
}
.case-update {
  font-size: 11.5px;
  color: var(--ink-700);
  background: var(--paper-soft);
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 2px solid var(--gold-500);
  margin-top: 4px;
}

/* ===========================================================
   UAE services card — Salik / DEWA / RTA / Etisalat etc.
   =========================================================== */
.card.uae-services {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.uae-head {
  padding: 12px 16px;
  background: var(--paper-soft);
  border-bottom: 1px solid var(--line);
}
.uae-head .lbl {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-500);
  font-weight: 600;
}
.uae-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.uae-row:last-child { border-bottom: none; }
.uae-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 16px;
  background: var(--gold-50);
}
.uae-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-900);
  display: flex;
  align-items: center;
}
.uae-meta {
  font-size: 11.5px;
  color: var(--ink-500);
  margin-top: 2px;
}
.uae-amount {
  text-align: end;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-900);
  font-variant-numeric: tabular-nums;
}

/* Quick actions */
.quick-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.quick-action {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--ink-700);
  font-weight: 500;
  transition: all 0.15s ease;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}
.quick-action:hover {
  background: var(--gold-50);
  border-color: var(--gold-400);
  color: var(--ink-900);
  transform: translateY(-1px);
}
.quick-action::before { content: "→"; color: var(--gold-500); font-size: 12px; }

/* Citations */
.citations { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.citation-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1.6px; color: var(--ink-500); font-weight: 600; margin-bottom: 8px; }
.citation-cards { display: flex; flex-direction: column; gap: 6px; }
.citation-card {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--ink-700);
}
.citation-card .doc-icon { width: 22px; height: 22px; background: var(--intel-100); border-radius: 5px; display: grid; place-items: center; color: var(--intel-500); flex-shrink: 0; }
.citation-card .doc-icon svg { width: 13px; height: 13px; }
.citation-card .title { flex: 1; font-weight: 500; color: var(--ink-900); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citation-card .id {
  font-family: ui-monospace, monospace;
  font-size: 10.5px; color: var(--ink-500);
  background: var(--paper);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--line);
}

/* Typing — uses the intel accent so 'Saqir is thinking' reads distinctly
   from generic UI greys. The dots are the bot's voice colour. */
.typing { display: flex; gap: 5px; padding: 4px 2px; align-items: center; }
.typing span:not(.typing-label) { width: 7px; height: 7px; background: var(--intel-500); border-radius: 50%; animation: bounce 1.3s infinite ease-in-out both; }
.typing span:not(.typing-label):nth-of-type(1) { animation-delay: -0.30s; }
.typing span:not(.typing-label):nth-of-type(2) { animation-delay: -0.15s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(0.65); opacity: 0.5; } 40% { transform: scale(1); opacity: 1; } }

/* Verification-mode typing indicator — used while Cohere is checking the
   Emirates ID digits. The label sits before the dots so the customer sees
   "Saqir is verifying your identity ..." instead of three dots. */
.typing.verifying {
  gap: 8px;
  padding: 4px 6px;
  font-size: 13px;
  color: var(--ink-700);
}
.typing.verifying .typing-label {
  font-weight: 500;
  letter-spacing: 0.01em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.typing.verifying .typing-label::before {
  content: "🔒";
  font-size: 12px;
}
.typing.verifying span:not(.typing-label) {
  background: var(--gold-500, #C9A961);
  width: 6px; height: 6px;
}

/* User bubble shown after typing verification digits — masks the input
   visually with a monospace look + a small "verified" hint underneath. */
.message-row.user.verification-input .bubble.user {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  letter-spacing: 0.22em;
  background: linear-gradient(135deg, rgba(201, 169, 97, 0.12), rgba(201, 169, 97, 0.04));
  border: 1px solid rgba(201, 169, 97, 0.30);
}
.message-row.user.verification-input .bubble-wrap::after {
  content: "🔒 verification digits — protected";
  display: block;
  text-align: end;
  margin-top: 4px;
  font-size: 10.5px;
  color: var(--ink-500, #6b6b6b);
  letter-spacing: 0.02em;
  opacity: 0.75;
}

.streaming-caret { display: inline-block; width: 2px; height: 1.05em; background: var(--ink-700); margin-left: 2px; vertical-align: text-bottom; animation: blink 1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* Channel banner / badge */
.channel-banner {
  display: flex; align-items: center; gap: 12px;
  max-width: 820px; width: 100%;
  margin: 0 auto;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 13px;
  background: linear-gradient(90deg, var(--gold-50), var(--paper));
  border: 1px solid var(--gold-300);
  color: var(--ink-700);
  animation: messageIn 0.4s ease;
  box-shadow: var(--shadow-xs);
}
.channel-banner .ico {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper);
  color: var(--gold-700);
  border: 1px solid var(--gold-300);
  flex-shrink: 0;
}
.channel-banner.voice { background: linear-gradient(90deg, rgba(110,91,250,0.10), var(--paper)); border-color: rgba(110,91,250,0.40); }
.channel-banner.voice .ico { color: var(--voice); border-color: rgba(110,91,250,0.40); }
.channel-banner.app .ico { color: var(--app); border-color: rgba(0,168,120,0.40); }
.channel-banner.email { background: linear-gradient(90deg, rgba(74,111,165,0.10), var(--paper)); border-color: rgba(74,111,165,0.40); }
.channel-banner.email .ico { color: var(--email); border-color: rgba(74,111,165,0.40); }
.channel-banner strong { color: var(--ink-900); font-weight: 600; }

.bubble-channel {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--ink-500);
  margin-bottom: 2px;
  padding-left: 4px;
}
.bubble-channel svg { width: 10px; height: 10px; }
.bubble-channel.voice { color: var(--voice); }
.bubble-channel.email { color: var(--email); }
.bubble-channel.app   { color: var(--app); }

/* ============ Composer ============ */
.composer {
  padding: 18px 28px 22px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}
.composer-inner {
  display: flex; align-items: flex-end; gap: 8px;
  max-width: 820px;
  margin: 0 auto;
  background: var(--paper-soft);
  border: 1.5px solid var(--line);
  border-radius: 24px;
  padding: 8px 8px 8px 20px;
  transition: all 0.2s ease;
}
.composer-inner:focus-within {
  border-color: var(--gold-400);
  background: var(--paper);
  box-shadow: 0 0 0 4px rgba(201, 169, 97, 0.12), var(--shadow-md);
}
#composerInput {
  flex: 1; background: transparent; border: none; outline: none; resize: none;
  font-family: var(--t-body-family);
  font-size: var(--t-body-size);
  font-weight: var(--t-body-weight);
  line-height: var(--t-body-lh);
  color: var(--text-primary);
  max-height: 160px; padding: 9px 0 8px;
}
#composerInput::placeholder { color: var(--text-quaternary); }
.send-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--ink-900);
  color: var(--paper);
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: all 0.18s ease;
  box-shadow: 0 2px 8px rgba(15,23,42,0.18);
}
.send-btn:disabled { background: var(--line-strong); color: var(--paper); cursor: not-allowed; box-shadow: none; }
.send-btn:not(:disabled):hover { background: var(--navy-700); transform: scale(1.05); }
body[dir="rtl"] .send-btn svg { transform: scaleX(-1); }

/* Composer in pending state — visible cue that input is locked while
   Saqir is preparing a reply. Applied across web, app, and email. */
.composer--pending .composer-inner {
  background: rgba(0,0,0,0.035);
  border-color: var(--line-strong, var(--line));
  box-shadow: none;
}
.composer--pending #composerInput { cursor: not-allowed; }
#composerInput:disabled,
#iphoneInput:disabled,
#emailInput:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.composer-hint {
  text-align: center;
  font-family: var(--t-caption-family);
  font-size: var(--t-caption-size);
  font-weight: var(--t-caption-weight);
  line-height: var(--t-caption-lh);
  color: var(--text-tertiary);
  margin-top: 12px;
}

/* ============ Channel-specific theming ============ */
body.channel-voice .send-btn:not(:disabled) { background: var(--voice); }
body.channel-voice .composer-inner:focus-within { border-color: var(--voice); box-shadow: 0 0 0 4px rgba(110,91,250,0.12); }
body.channel-app .send-btn:not(:disabled) { background: var(--app); }
body.channel-app .composer-inner:focus-within { border-color: var(--app); box-shadow: 0 0 0 4px rgba(0,168,120,0.12); }

/* ============================================================
   App channel — iPhone takeover modal.
   When App is selected, an iPhone-shaped overlay opens (like the
   Voice and Email takeovers), with the bank's mobile app inside.
   The styling below renders everything from the phone bezel to
   the in-app chat bubbles, status bar, and home indicator.
   ============================================================ */
.iphone-frame {
  position: relative;
  width: 388px;
  height: 800px;
  margin: 24px auto;
  background: #0B1020;
  border-radius: 56px;
  padding: 14px;
  box-shadow:
    0 0 0 2px #2A3440,
    0 0 0 3px #0B1020,
    0 30px 80px rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

/* The screen — inset inside the phone bezel */
.iphone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  background: #FFFFFF;
  border-radius: 44px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Dynamic Island — modern iPhone signature */
.iphone-island {
  position: absolute;
  top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 110px; height: 32px;
  background: #000;
  border-radius: 20px;
  z-index: 6;
}

/* iOS status bar */
.iphone-statusbar {
  position: relative;
  height: 50px;
  padding: 16px 30px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-family: -apple-system, "SF Pro Text", "Inter", sans-serif;
  font-weight: 600;
  font-size: 15px;
  color: #000;
  flex-shrink: 0;
  z-index: 2;
}
.iphone-statusbar .time { letter-spacing: -0.2px; }
.iphone-statusbar .right {
  display: flex; gap: 5px; align-items: center;
}
.iphone-statusbar .right svg { width: 17px; height: 11px; }
.iphone-statusbar .right .battery {
  width: 25px; height: 12px;
  border: 1.5px solid #000;
  border-radius: 3px;
  position: relative;
}
.iphone-statusbar .right .battery::before {
  content: "";
  position: absolute;
  inset: 1.5px;
  background: #000;
  border-radius: 1px;
}
.iphone-statusbar .right .battery::after {
  content: "";
  position: absolute;
  right: -3px; top: 3px;
  width: 2px; height: 4px;
  background: #000;
  border-radius: 0 1px 1px 0;
}

/* Bank-app header bar (inside the phone) */
.iphone-app-header {
  height: 64px;
  padding: 8px 18px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid #E8E5DD;
  background: #FFFFFF;
  flex-shrink: 0;
  z-index: 2;
}
.iphone-app-header .back-btn {
  background: none; border: 0; padding: 6px;
  color: var(--app); cursor: pointer;
  display: grid; place-items: center;
}
.iphone-app-header .back-btn svg { width: 22px; height: 22px; }
.iphone-app-header .app-saqir {
  width: 36px; height: 36px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--paper-soft);
}
.iphone-app-header .app-saqir img {
  width: 100%; height: 100%; display: block;
}
.iphone-app-header .app-titles { flex: 1; }
.iphone-app-header .app-name {
  font-family: -apple-system, "SF Pro Text", "Inter", sans-serif;
  font-size: 15px; font-weight: 600; color: #1A1A1A;
}
.iphone-app-header .app-status {
  font-size: 11px; color: var(--ink-500);
  display: flex; align-items: center; gap: 5px;
}
.iphone-app-header .app-status::before {
  content: ""; width: 6px; height: 6px;
  border-radius: 50%; background: var(--app);
}
.iphone-app-header .header-actions {
  display: flex; gap: 4px;
}
.iphone-app-header .header-actions button {
  background: none; border: 0; padding: 8px;
  color: var(--ink-700); cursor: pointer;
  display: grid; place-items: center;
}
.iphone-app-header .header-actions svg { width: 18px; height: 18px; }

/* Chat surface inside the phone */
.iphone-chat {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 12px;
  background: linear-gradient(180deg, #F7F5F0, #FBF9F4);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-family: -apple-system, "SF Pro Text", "Inter", sans-serif;
}
.iphone-chat::-webkit-scrollbar { width: 0; }

/* Time-stamp pill between messages */
.iphone-chat .ic-timestamp {
  align-self: center;
  font-size: 11px;
  color: var(--ink-500);
  margin: 6px 0 2px;
  font-weight: 500;
}

/* iOS Messages-style bubbles */
.iphone-chat .ic-bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 20px;
  font-size: 14.5px;
  line-height: 1.4;
  word-wrap: break-word;
}
.iphone-chat .ic-bubble.user {
  align-self: flex-end;
  background: var(--app);
  color: #FFFFFF;
  border-bottom-right-radius: 6px;
}
.iphone-chat .ic-bubble.bot {
  align-self: flex-start;
  background: #FFFFFF;
  color: #1A1A1A;
  border: 1px solid #ECE7DD;
  border-bottom-left-radius: 6px;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.02);
}
.iphone-chat .ic-typing {
  align-self: flex-start;
  display: flex; gap: 4px;
  padding: 10px 14px;
  background: #FFFFFF;
  border: 1px solid #ECE7DD;
  border-radius: 20px;
  border-bottom-left-radius: 6px;
}
.iphone-chat .ic-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ink-400);
  animation: ic-typing 1.3s infinite ease-in-out both;
}
.iphone-chat .ic-typing span:nth-child(1) { animation-delay: -0.30s; }
.iphone-chat .ic-typing span:nth-child(2) { animation-delay: -0.15s; }
@keyframes ic-typing {
  0%, 80%, 100% { transform: scale(0.65); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* iOS-style suggested-action chips below a Saqir reply */
.iphone-chat .ic-actions {
  align-self: flex-start;
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 0 0 0 4px;
  max-width: 90%;
}
.iphone-chat .ic-action {
  background: #FFFFFF;
  border: 1px solid var(--app);
  color: var(--app);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}
.iphone-chat .ic-action:hover {
  background: var(--app);
  color: #FFFFFF;
}

/* Rich-card stack rendered inside the phone (cliff warnings, transactions,
   etc. — anything other than the bespoke .ic-card account row). Constrains
   the wider web .card layouts to the iPhone canvas. */
.iphone-chat .ic-rich-cards {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0;
}
.iphone-chat .ic-rich-cards .card {
  max-width: 100%;
  box-sizing: border-box;
}

/* Bank-card mini-card (for balances etc.) inside the phone */
.iphone-chat .ic-card {
  align-self: stretch;
  margin: 4px 0;
  background: #FFFFFF;
  border: 1px solid #ECE7DD;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}
.iphone-chat .ic-card .ic-card-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: var(--gold-50);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.iphone-chat .ic-card .ic-card-info { flex: 1; min-width: 0; }
.iphone-chat .ic-card .ic-card-name {
  font-size: 13.5px; font-weight: 500; color: #1A1A1A;
}
.iphone-chat .ic-card .ic-card-no {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--ink-500);
}
.iphone-chat .ic-card .ic-card-amount {
  font-size: 16px; font-weight: 600; color: #1A1A1A;
  text-align: end;
  font-variant-numeric: tabular-nums;
}

/* Composer at the bottom */
.iphone-composer {
  flex-shrink: 0;
  padding: 8px 12px 6px;
  background: #FFFFFF;
  border-top: 1px solid #ECE7DD;
  display: flex;
  gap: 8px;
  align-items: center;
}
.iphone-composer input {
  flex: 1;
  border: 1px solid #ECE7DD;
  border-radius: 22px;
  padding: 10px 16px;
  font-size: 14.5px;
  font-family: -apple-system, "SF Pro Text", "Inter", sans-serif;
  background: #F7F5F0;
  color: #1A1A1A;
  outline: none;
  transition: border-color 0.15s ease;
}
.iphone-composer input:focus {
  border-color: var(--app);
  background: #FFFFFF;
}
.iphone-composer input::placeholder { color: var(--ink-400); }
.iphone-composer .ic-send {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 0;
  background: var(--app);
  color: #FFFFFF;
  display: grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.15s ease;
}
.iphone-composer .ic-send:disabled {
  background: var(--ink-300);
  cursor: not-allowed;
}
.iphone-composer .ic-send svg { width: 18px; height: 18px; }
.iphone-composer .face-id-hint {
  font-size: 10.5px;
  color: var(--ink-500);
  text-align: center;
  padding-top: 3px;
  letter-spacing: 0.02em;
}

/* Home indicator at the bottom */
.iphone-home-indicator {
  height: 18px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
}
.iphone-home-indicator::before {
  content: "";
  width: 130px; height: 5px;
  background: #1A1A1A;
  border-radius: 3px;
}
body.channel-voice .bubble.user { background: #4836B7; }

body.channel-email .send-btn:not(:disabled) { background: var(--email); }
body.channel-email .composer-inner:focus-within { border-color: var(--email); box-shadow: 0 0 0 4px rgba(74,111,165,0.12); }

/* ============ Channel takeover overlays ============ */
.channel-overlay {
  position: fixed;
  inset: 14px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow: auto;
  border-radius: var(--radius-lg);
  animation: fadeIn 0.25s ease;
}
/* Voice channel sits on a pure-white field — the card delineates itself
   via shadow + a faint navy border. */
.channel-overlay.voice {
  background: #FFFFFF;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.channel-overlay.voice .voice-call {
  border-color: rgba(14, 23, 48, 0.10);
  box-shadow:
    0 24px 48px rgba(14, 23, 48, 0.12),
    0 4px 14px rgba(14, 23, 48, 0.06);
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.channel-overlay-close {
  position: absolute;
  top: 22px; right: 22px;
  width: 36px; height: 36px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.20);
  color: var(--paper);
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 18px;
  transition: all 0.15s ease;
  z-index: 2;
}
.channel-overlay-close:hover { background: rgba(255,255,255,0.20); }
.channel-overlay.voice .channel-overlay-close {
  background: #FFFFFF;
  border-color: rgba(14, 23, 48, 0.10);
  color: var(--ink-700);
  box-shadow: 0 2px 8px rgba(14, 23, 48, 0.08);
}
.channel-overlay.voice .channel-overlay-close:hover {
  background: var(--gold-50, #FCF7E8);
  border-color: var(--gold-300);
}

/* WhatsApp phone frame removed in May 2026 (CBUAE directive — banks
   may not use WhatsApp or any instant-messaging platform for customer
   communication). All `.whatsapp-*`, `.wa-*`, and `--whatsapp` rules
   are intentionally absent. */

/* Voice call overlay */
/* ===== Voice channel — private-concierge treatment =====
   White card, navy + gold accents, monogram instead of headshot.
   Card is height-capped + uses an internal scroller so transcript /
   tool cards never push content off the viewport. */
.voice-call {
  width: 460px;
  max-width: calc(100vw - 32px);
  max-height: min(740px, calc(100vh - 48px));
  background: #FFFFFF;
  border-radius: 22px;
  padding: 22px 26px 18px;
  color: var(--ink-900);
  text-align: center;
  box-shadow:
    0 28px 60px rgba(14, 23, 48, 0.18),
    0 2px 6px rgba(14, 23, 48, 0.06);
  border: 1px solid rgba(14, 23, 48, 0.06);
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
/* Header + footer stay put; transcript + cards absorb leftover height. */
.voice-call .vc-status,
.voice-call .vc-name,
.voice-call .vc-subline,
.voice-call .vc-avatar,
.voice-call .voice-waveform,
.voice-call .vc-lang,
.voice-call .voice-controls,
.voice-call .vc-engine,
.voice-call .vc-typebox { flex-shrink: 0; }
.voice-call .vc-status {
  font-size: 10px;
  letter-spacing: 2.2px;
  text-transform: uppercase;
  color: var(--gold-700);
  font-weight: 600;
}
.voice-call .vc-name {
  font-family: var(--font-display);
  font-size: 30px;
  margin: 2px 0 4px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: 0.01em;
}
.voice-call .vc-subline {
  font-size: 12px;
  color: var(--ink-500);
  letter-spacing: 0.04em;
}
.voice-call .vc-avatar {
  width: 68px; height: 68px;
  margin: 8px auto 6px;
  border-radius: 50%;
  position: relative;
  display: grid; place-items: center;
}
.voice-call .vc-avatar .vc-monogram,
.voice-call .vc-avatar img {
  width: 100%; height: 100%;
  display: block;
  border-radius: 50%;
  object-fit: cover;
}
/* Soft halo behind the falcon avatar in voice mode — same teal accent
   as the chat header's thinking pulse, gives the call a sense of
   active "presence". */
.voice-call .vc-avatar::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--intel-500);
  opacity: 0.45;
  animation: mz-thinking-pulse 2s ease-out infinite;
  pointer-events: none;
}
.voice-call .vc-mono-bg { fill: var(--navy-900); }
.voice-call .vc-mono-ring {
  fill: none;
  stroke: var(--gold-500);
  stroke-width: 1.5;
  opacity: 0.85;
}
.voice-call .vc-mono-letter {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 600;
  fill: var(--gold-300);
  letter-spacing: 0.02em;
}
.voice-waveform {
  display: flex; align-items: flex-end; justify-content: center;
  gap: 5px;
  height: 22px;
  margin: 2px 0 12px;
}
.voice-waveform span {
  width: 3px;
  background: linear-gradient(180deg, var(--gold-500), var(--gold-300));
  border-radius: 3px;
  animation: wf 1.4s ease-in-out infinite;
  opacity: 0.55;
}
.voice-waveform span:nth-child(1) { animation-delay: 0s; }
.voice-waveform span:nth-child(2) { animation-delay: 0.12s; }
.voice-waveform span:nth-child(3) { animation-delay: 0.24s; }
.voice-waveform span:nth-child(4) { animation-delay: 0.12s; }
.voice-waveform span:nth-child(5) { animation-delay: 0s; }
@keyframes wf { 0%, 100% { height: 4px; } 50% { height: 20px; } }

/* ===== Voice call — two-pane layout =====
   Above 720px viewport width, the card splits into:
     · left pane:  status / name / avatar / waveform / lang / controls / engine
     · right pane: live transcript on top + tool-cards deck pinned below
   Below 720px, .vc-right-pane collapses to display:contents so transcript and
   cards re-flow inline with the rest of the column — preserving the original
   stacked layout on narrow screens. */
@media (min-width: 720px) {
  .voice-call {
    width: min(880px, calc(100vw - 32px));
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
    column-gap: 24px;
    row-gap: 0;
    grid-template-areas:
      "status    rightpane"
      "name      rightpane"
      "subline   rightpane"
      "avatar    rightpane"
      "waveform  rightpane"
      "lang      rightpane"
      "controls  rightpane"
      "typebox   rightpane"
      "engine    rightpane";
    align-items: start;
  }
  .voice-call .vc-status      { grid-area: status; }
  .voice-call .vc-name        { grid-area: name; }
  .voice-call .vc-subline     { grid-area: subline; }
  .voice-call .vc-avatar      { grid-area: avatar; }
  .voice-call .voice-waveform { grid-area: waveform; }
  .voice-call .vc-lang        { grid-area: lang; margin-top: 12px; }
  .voice-call .voice-controls { grid-area: controls; margin-top: 14px; }
  .voice-call .vc-typebox     { grid-area: typebox; margin-top: 10px; }
  .voice-call .vc-engine      { grid-area: engine; margin-top: 10px; }
  .voice-call .vc-right-pane {
    grid-area: rightpane;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 0;
    align-self: stretch;
    height: 100%;
  }
  .voice-call .vc-right-pane .voice-transcript {
    flex: 1 1 0;
    min-height: 120px;
    margin-bottom: 0;
  }
  .voice-call .vc-right-pane .voice-cards {
    flex: 0 0 auto;
    max-height: 240px;
    overflow: hidden;
    margin-bottom: 0;
  }
  /* No cards yet: hide the dedicated left pane so the layout is identical
     across all three voice frames. JS adds `.has-cards` on the wrap the
     first time the active frame receives card data (tool.cards on
     realtime, complete.cards on streaming, /api/chat data.cards on
     Azure), which re-shows the pane via the rule below. */
  .voice-call:not(.has-cards) .vc-left-pane { display: none; }

  /* ===== Voice call — three-pane layout (any frame with cards) =====
     Once the active voice frame receives card data the wrap gets
     `.has-cards` and we expand into a 3-column grid:
       · left pane:   card deck — its own pane, full call height
       · centre pane: status / name / avatar / waveform / lang / controls / engine
       · right pane:  live transcript */
  .voice-call.has-cards {
    width: min(1140px, calc(100vw - 32px));
    grid-template-columns: minmax(240px, 1fr) minmax(0, 0.95fr) minmax(0, 1.1fr);
    column-gap: 22px;
    grid-template-areas:
      "leftpane  status    rightpane"
      "leftpane  name      rightpane"
      "leftpane  subline   rightpane"
      "leftpane  avatar    rightpane"
      "leftpane  waveform  rightpane"
      "leftpane  lang      rightpane"
      "leftpane  controls  rightpane"
      "leftpane  typebox   rightpane"
      "leftpane  engine    rightpane";
  }
  .voice-call.has-cards .vc-left-pane {
    display: flex;
    flex-direction: column;
    grid-area: leftpane;
    min-height: 0;
    align-self: stretch;
    height: 100%;
  }
  .voice-call.has-cards .vc-left-pane .voice-cards {
    flex: 1 1 auto;
    max-height: none;
    margin-bottom: 0;
    overflow: hidden;
  }
  .voice-call.has-cards .vc-left-pane .vc-deck-stage {
    /* Taller dedicated pane — let account / transactions cards breathe
       rather than squeezing them into the original 172px. */
    height: clamp(220px, 42vh, 360px);
  }
}

/* On narrow screens the pane wrappers disappear from the box tree so
   transcript and cards stack inline with the rest of the flex-column. */
@media (max-width: 719.98px) {
  .vc-right-pane,
  .vc-left-pane { display: contents; }
}

.voice-transcript {
  background: var(--gold-50, #FCF7E8);
  border: 1px solid rgba(201, 169, 97, 0.22);
  border-radius: 12px;
  padding: 12px 14px;
  text-align: start;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink-900);
  flex: 1 1 0;
  min-height: 80px;
  overflow-y: auto;
  margin-bottom: 10px;
}
.voice-transcript .lbl {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: var(--gold-700);
  font-weight: 700;
  margin-bottom: 6px;
}
.voice-transcript .you,
.voice-transcript .saqir {
  font-size: 13px;
  line-height: 1.55;
  margin-top: 6px;
  color: var(--ink-900);
  word-wrap: break-word;
  overflow-wrap: anywhere;
}
.voice-transcript .you::before  { content: "You · ";   opacity: 0.65; font-weight: 600; color: var(--ink-700); }
.voice-transcript .saqir::before { content: "Saqir · "; color: var(--gold-700); font-weight: 700; }

.voice-controls { display: flex; justify-content: center; gap: 14px; margin-top: 4px; }
.vc-btn {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid rgba(201, 169, 97, 0.55);
  color: var(--navy-900);
  display: grid; place-items: center;
  cursor: pointer;
  transition: all 0.18s ease;
  box-shadow: 0 4px 12px rgba(14, 23, 48, 0.08);
}
.vc-btn:hover {
  background: var(--gold-50, #FCF7E8);
  border-color: var(--gold-500);
  transform: translateY(-1px);
}
.vc-btn.end {
  background: #B33A3D;
  border-color: #B33A3D;
  color: #fff;
}
.vc-btn.end:hover { background: #952F32; border-color: #952F32; transform: translateY(-1px); }

/* Mic mute state — visible red treatment + icon swap so the user knows
   audio capture is paused at the hardware level. */
.vc-btn .mic-off { display: none; }
.vc-btn.muted .mic-on { display: none; }
.vc-btn.muted .mic-off { display: block; }
.vc-btn.muted {
  background: #B33A3D;
  border-color: #952F32;
  color: #fff;
  box-shadow: 0 4px 12px rgba(179, 58, 61, 0.28);
}
.vc-btn.muted:hover {
  background: #952F32;
  border-color: #7d2528;
  transform: translateY(-1px);
}
/* Freeze waveform while muted so the visual matches reality. */
.voice-waveform.muted span {
  animation-play-state: paused !important;
  opacity: 0.25;
}

/* ===== Voice channel — live state polish ===== */

/* Soft gold halo around the monogram when listening */
.voice-call .vc-avatar[data-kind="listening"] {
  animation: vcMonoPulse 1.6s ease-out infinite;
  border-radius: 50%;
}
@keyframes vcMonoPulse {
  0%   { box-shadow: 0 0 0 0   rgba(201, 169, 97, 0.45); }
  70%  { box-shadow: 0 0 0 14px rgba(201, 169, 97, 0); }
  100% { box-shadow: 0 0 0 0    rgba(201, 169, 97, 0); }
}
.voice-call .vc-avatar[data-kind="speaking"] {
  animation: vcMonoSpeak 1.0s ease-out infinite;
  border-radius: 50%;
}
@keyframes vcMonoSpeak {
  0%   { box-shadow: 0 0 0 0   rgba(58, 89, 150, 0.40); }
  60%  { box-shadow: 0 0 0 12px rgba(58, 89, 150, 0); }
  100% { box-shadow: 0 0 0 0   rgba(58, 89, 150, 0); }
}
.voice-call .vc-avatar[data-kind="thinking"] { opacity: 0.85; }

/* Waveform — energise when listening / speaking */
.voice-waveform[data-kind="listening"] span,
.voice-waveform[data-kind="speaking"] span {
  animation-duration: 0.7s !important;
  opacity: 0.95;
}
.voice-waveform[data-kind="speaking"] span {
  background: linear-gradient(180deg, var(--navy-500), var(--navy-700));
}
.voice-waveform[data-kind="idle"] span,
.voice-waveform[data-kind="thinking"] span,
.voice-waveform[data-kind="error"] span {
  animation-play-state: paused;
  opacity: 0.30;
}

/* Mic button live state */
.vc-btn[data-kind="listening"] {
  background: var(--gold-50, #FCF7E8);
  border-color: var(--gold-500);
  color: var(--gold-700);
  animation: vcMonoPulse 1.6s ease-out infinite;
}
.vc-btn[data-kind="speaking"] {
  background: rgba(58, 89, 150, 0.08);
  border-color: var(--navy-500);
  color: var(--navy-700);
}

/* ============================================================
   Voice-modal language chip — Claude/Apple-style ambient control.
   Replaces the old row of 6 loud pills. Sits below the status line
   as a single calm "Speaking in {language} ▾" link; tap to reveal
   a popover with the same Native (Region) ✓ rows used elsewhere.
   ============================================================ */
.vc-lang {
  position: relative;
  margin: 0 0 16px;
  display: flex;
  justify-content: center;
}
.vc-lang-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px 6px 11px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(14, 23, 48, 0.08);
  border-radius: 999px;
  color: var(--ink-700);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
  backdrop-filter: blur(8px);
}
.vc-lang-chip:hover {
  background: #FFFFFF;
  border-color: rgba(14, 23, 48, 0.16);
  color: var(--ink-900);
  transform: translateY(-1px);
}
.vc-lang-chip:focus-visible {
  outline: none;
  border-color: var(--intel-500, #0F8E91);
  box-shadow: 0 0 0 3px rgba(15, 142, 145, 0.18);
}
.vc-lang-chip.open {
  background: #FFFFFF;
  border-color: var(--intel-500, #0F8E91);
  color: var(--ink-900);
}
.vc-lang-globe {
  color: var(--intel-500, #0F8E91);
  flex-shrink: 0;
  opacity: 0.85;
}
.vc-lang-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.vc-lang-current {
  /* The native-script word inside the chip — keep it slightly heavier so
     it reads as "the language you're in" rather than blending in. */
  color: var(--ink-900);
  font-weight: 600;
}
.vc-lang-caret {
  color: var(--ink-400);
  transition: transform 0.22s ease;
  flex-shrink: 0;
}
.vc-lang-chip.open .vc-lang-caret { transform: rotate(180deg); color: var(--intel-500, #0F8E91); }

/* Popover — opens upward from the chip. Translucent paper, soft shadow,
   centered above the chip so it feels anchored to it. */
.vc-lang-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 260px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(14, 23, 48, 0.10);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 12px 40px rgba(14, 23, 48, 0.16), 0 2px 8px rgba(14, 23, 48, 0.06);
  z-index: 50;
  animation: vcLangFade 0.18s ease;
  backdrop-filter: blur(10px);
}
.vc-lang-popover[hidden] { display: none; }
@keyframes vcLangFade {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
/* Tiny pointer notch under the popover to anchor it to the chip */
.vc-lang-popover::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: rgba(255, 255, 255, 0.98);
  filter: drop-shadow(0 1px 0 rgba(14, 23, 48, 0.08));
}
.vc-lp-title {
  padding: 6px 12px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  border-bottom: 1px solid rgba(14, 23, 48, 0.06);
  margin-bottom: 4px;
}
.vc-lp-list {
  display: flex;
  flex-direction: column;
}
.vc-lp-item {
  display: grid;
  grid-template-columns: 1fr 14px;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  text-align: start;
  font-family: inherit;
  color: var(--ink-800);
  transition: background 0.1s ease;
}
.vc-lp-item:hover, .vc-lp-item:focus-visible {
  background: rgba(15, 142, 145, 0.06);
  outline: none;
}
.vc-lp-item.active { color: var(--ink-900); }
.vc-lp-name {
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.3;
}
.vc-lp-region {
  color: var(--text-tertiary);
  font-weight: 400;
}
.vc-lp-check {
  display: grid; place-items: center;
  color: var(--intel-500, #0F8E91);
  opacity: 0;
  transition: opacity 0.12s ease;
}
.vc-lp-item.active .vc-lp-check { opacity: 1; }

/* RTL: flip the popover notch alignment for Arabic */
[dir="rtl"] .vc-lang-text { direction: rtl; }
[dir="rtl"] .vc-lp-item { text-align: right; }

/* Status colours */
.voice-call .vc-status[data-kind="listening"] { color: var(--gold-700); }
.voice-call .vc-status[data-kind="speaking"] { color: var(--navy-700); }
.voice-call .vc-status[data-kind="thinking"] { color: var(--ink-500); font-style: italic; }
.voice-call .vc-status[data-kind="error"]   { color: #B33A3D; }

/* Interim (live) transcript */
.voice-transcript .you.interim {
  opacity: 0.6;
  font-style: italic;
  color: var(--ink-700);
}
.voice-transcript .you.interim::after { content: " …"; opacity: 0.7; }
.voice-transcript .system {
  font-size: 11px;
  font-style: italic;
  color: var(--ink-500);
  margin: 4px 0;
}
.voice-transcript .interim { opacity: 0.6; }

/* Engine credit */
.voice-call .vc-engine {
  margin-top: 10px;
  font-size: 9.5px;
  color: var(--ink-400);
  text-align: center;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Subtle "tap monogram to interrupt" hint. Text is i18n-driven — JS
   writes the localised string to `data-interrupt-badge` on #vcAvatar
   (see wireInterruptZone in voice-shared.js) and the CSS just renders
   whatever is there. Falls back to an empty string in legacy locales. */
.voice-call .vc-avatar[data-kind="speaking"]::after {
  content: attr(data-interrupt-badge);
  position: absolute;
  bottom: -18px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  color: var(--ink-500);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

/* ===== Voice channel — Card Deck ============================================
   Cards from each Saqir turn are grouped into a "deck". Decks live in their
   own panel below the transcript so they don't push transcript content out
   of view. Only the active deck is centred; previous/next decks peek from
   the sides to give a tactile stack-of-cards feel. Prev/next buttons + dots
   let the customer navigate back through earlier turns.
============================================================================== */
.voice-cards {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  padding: 10px 12px 12px;
  background: linear-gradient(180deg, #FFFFFF 0%, var(--gold-50, #FCF7E8) 100%);
  border: 1px solid rgba(201, 169, 97, 0.30);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(14, 23, 48, 0.06);
  animation: vcCardIn 0.3s ease-out both;
}
.voice-cards[data-empty="true"] { display: none; }

.vc-deck-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}
.vc-deck-label {
  text-align: center;
  min-width: 0;
}
.vc-deck-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--navy-900);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vc-deck-meta {
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--gold-700);
  font-weight: 600;
  margin-top: 2px;
}
.vc-deck-nav {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid rgba(201, 169, 97, 0.45);
  color: var(--navy-900);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(14, 23, 48, 0.06);
}
.vc-deck-nav:hover:not(:disabled) {
  background: var(--gold-50, #FCF7E8);
  border-color: var(--gold-500);
  transform: translateY(-1px);
}
.vc-deck-nav:disabled {
  opacity: 0.30;
  cursor: not-allowed;
  box-shadow: none;
}

.vc-deck-stage {
  position: relative;
  height: 172px;            /* shows ~2 account cards with internal scroll for more */
  perspective: 800px;
}
.vc-deck {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 2px;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 12px;
  transition:
    transform 0.42s cubic-bezier(.22,.78,.32,1),
    opacity 0.35s ease,
    filter 0.35s ease;
  will-change: transform, opacity;
}
.vc-deck[data-position="active"] {
  transform: translateX(0) scale(1) rotate(0deg);
  opacity: 1;
  filter: none;
  pointer-events: auto;
}
.vc-deck[data-position="before"] {
  transform: translateX(-22px) scale(0.94) rotate(-2.5deg);
  opacity: 0;
  pointer-events: none;
  filter: blur(1px);
}
.vc-deck[data-position="after"] {
  transform: translateX(22px) scale(0.94) rotate(2.5deg);
  opacity: 0;
  pointer-events: none;
  filter: blur(1px);
}

.vc-deck::-webkit-scrollbar { width: 4px; }
.vc-deck::-webkit-scrollbar-thumb {
  background: rgba(201, 169, 97, 0.4);
  border-radius: 4px;
}

.vc-deck .card {
  background: #FFFFFF;
  border: 1px solid rgba(201, 169, 97, 0.30);
  color: var(--ink-900);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(14, 23, 48, 0.05);
  text-align: start;
  flex-shrink: 0;
}
.vc-deck .card .acct-name,
.vc-deck .card .tx-merchant,
.vc-deck .card .bill-payee { color: var(--ink-900); }
.vc-deck .card .acct-no,
.vc-deck .card .tx-meta,
.vc-deck .card .bill-due { color: var(--ink-500); }
.vc-deck .card.account {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}
.vc-deck .card .acct-icon {
  font-size: 22px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--gold-50, #FCF7E8);
  border-radius: 10px;
  border: 1px solid rgba(201, 169, 97, 0.25);
}
.vc-deck .card .acct-balance {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--navy-900);
}
.vc-deck .card .acct-balance .currency {
  font-size: 12px;
  color: var(--gold-700);
  margin-left: 4px;
  letter-spacing: 0.06em;
}
.vc-deck .card .acct-balance .currency .dh-symbol { height: 0.65em; vertical-align: -0.02em; }
.vc-deck .card .acct-meta {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 2px;
}
.vc-deck .card.transactions { padding: 6px 8px; }
.vc-deck .card .tx-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(14, 23, 48, 0.04);
}
.vc-deck .card .tx-row:last-child { border-bottom: 0; }
.vc-deck .card .tx-icon {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--gold-50, #FCF7E8);
  border-radius: 8px;
  font-size: 15px;
}
.vc-deck .card .tx-merchant { font-size: 13px; font-weight: 600; }
.vc-deck .card .tx-meta { font-size: 11px; }
.vc-deck .card .tx-amount {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--navy-900);
}
.vc-deck .card .tx-amount.credit { color: #2D7A4A; }

.vc-deck-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  min-height: 8px;
}
.vc-deck-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  background: rgba(14, 23, 48, 0.18);
  cursor: pointer;
  transition: all 0.18s ease;
}
.vc-deck-dot:hover { background: rgba(14, 23, 48, 0.35); }
.vc-deck-dot.active {
  background: var(--gold-500);
  width: 18px;
  border-radius: 4px;
}

/* Tiny breadcrumb in the transcript that links back to the deck this turn
   produced. Customer can click it to jump back to the relevant cards. */
.vc-deck-marker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 6px 0;
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gold-700);
  background: #FFFFFF;
  border: 1px solid rgba(201, 169, 97, 0.40);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
  width: max-content;
}
.vc-deck-marker:hover {
  background: var(--gold-50, #FCF7E8);
  border-color: var(--gold-500);
  transform: translateY(-1px);
}
.vc-deck-marker-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gold-500);
  display: inline-block;
}

/* ---- Inline cards (rendered inside the transcript, attached to the
   Saqir turn that produced them). Each group has a thin gold separator and
   a soft slide-up fade-in so multi-turn results read as a clean timeline. */
.voice-transcript .vc-inline-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0 10px;
  padding-top: 8px;
  border-top: 1px dashed rgba(201, 169, 97, 0.45);
  animation: vcCardIn 0.32s ease-out both;
}
@keyframes vcCardIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.voice-transcript .vc-inline-cards .card {
  background: #FFFFFF;
  border: 1px solid rgba(201, 169, 97, 0.30);
  color: var(--ink-900);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(14, 23, 48, 0.05);
  text-align: start;
}
.voice-transcript .vc-inline-cards .card .acct-name,
.voice-transcript .vc-inline-cards .card .tx-merchant,
.voice-transcript .vc-inline-cards .card .bill-payee { color: var(--ink-900); }
.voice-transcript .vc-inline-cards .card .acct-no,
.voice-transcript .vc-inline-cards .card .tx-meta,
.voice-transcript .vc-inline-cards .card .bill-due { color: var(--ink-500); }
.voice-transcript .vc-inline-cards .card.account {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
}
.voice-transcript .vc-inline-cards .card .acct-icon {
  font-size: 22px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  background: var(--gold-50, #FCF7E8);
  border-radius: 10px;
  border: 1px solid rgba(201, 169, 97, 0.25);
}
.voice-transcript .vc-inline-cards .card .acct-balance {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  color: var(--navy-900);
}
.voice-transcript .vc-inline-cards .card .acct-balance .currency {
  font-size: 12px;
  color: var(--gold-700);
  margin-left: 4px;
  letter-spacing: 0.06em;
}
.voice-transcript .vc-inline-cards .card .acct-balance .currency .dh-symbol { height: 0.65em; vertical-align: -0.02em; }
.voice-transcript .vc-inline-cards .card .acct-meta {
  font-size: 11px;
  color: var(--ink-500);
  margin-top: 2px;
}
/* Transactions list — tighter, scoped padding so rows breathe */
.voice-transcript .vc-inline-cards .card.transactions {
  padding: 6px 8px;
}
.voice-transcript .vc-inline-cards .card .tx-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 6px;
  border-bottom: 1px solid rgba(14, 23, 48, 0.04);
}
.voice-transcript .vc-inline-cards .card .tx-row:last-child { border-bottom: 0; }
.voice-transcript .vc-inline-cards .card .tx-icon {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--gold-50, #FCF7E8);
  border-radius: 8px;
  font-size: 15px;
}
.voice-transcript .vc-inline-cards .card .tx-merchant { font-size: 13px; font-weight: 600; }
.voice-transcript .vc-inline-cards .card .tx-meta { font-size: 11px; }
.voice-transcript .vc-inline-cards .card .tx-amount {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  color: var(--navy-900);
}
.voice-transcript .vc-inline-cards .card .tx-amount.credit { color: #2D7A4A; }

/* Type-to-talk input on the fallback frame */
.vc-typebox { margin-top: 10px; }
.vc-typebox input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(14, 23, 48, 0.12);
  background: #FFFFFF;
  color: var(--ink-900);
  outline: none;
  font-size: 13px;
  transition: border-color 0.15s ease;
}
.vc-typebox input:focus { border-color: var(--gold-500); }

/* Email modal */
.email-thread {
  width: 720px;
  max-height: 88vh;
  background: var(--paper);
  border-radius: 18px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.30);
  display: flex;
  flex-direction: column;
}
.email-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--line);
}
.email-subject { font-size: 18px; font-weight: 600; color: var(--ink-900); margin-bottom: 8px; }
.email-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-500); }
.email-meta .avatar { width: 30px; height: 30px; }
.email-meta strong { color: var(--ink-900); }
.email-list { flex: 1; overflow-y: auto; padding: 16px 22px; display: flex; flex-direction: column; gap: 16px; }
.email-msg { padding: 14px 16px; background: var(--paper-soft); border: 1px solid var(--line); border-radius: 10px; }
.email-msg-from { font-size: 12.5px; color: var(--ink-500); margin-bottom: 8px; }
.email-msg-from strong { color: var(--ink-900); }
.email-body { font-size: 14px; color: var(--ink-900); line-height: 1.6; white-space: pre-wrap; }
.email-composer { border-top: 1px solid var(--line); padding: 14px 22px; }
.email-composer textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 60px;
}
.email-composer .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; }
.email-composer button {
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
}
.email-composer .send {
  background: var(--email);
  color: white;
}

/* ============ Responsive ============ */
/* Phase 1 mobile: scale the desktop view to fit narrow viewports.
   Below 1280px we render the body at a fixed desktop width (1280px) and
   apply transform: scale() so the entire desktop UI (including fixed-
   position channel overlays — a transformed ancestor becomes the
   containing block for `position: fixed` descendants) shrinks uniformly
   to fit the viewport. The previous (max-width: 900px) block flattened
   the sidebar into a horizontal strip and HID the conversation list and
   customer pill — that made things worse on phones, so it's removed.
   A proper mobile-first responsive redesign comes in a Phase-2 branch. */
@media (max-width: 1279px) {
  :root {
    --app-scale: calc(100vw / 1280px);
  }
  html {
    overflow: hidden;
    width: 100vw;
    height: 100vh;
  }
  body {
    width: 1280px;
    height: calc(100vh / var(--app-scale));
    transform: scale(var(--app-scale));
    transform-origin: top left;
  }
  body[dir="rtl"] {
    transform-origin: top right;
  }
  /* .app-shell uses height: 100vh — under transform, that resolves to
     100% of the *visual* viewport, leaving empty space below the scaled
     shell. Override it to fill the (logical) body height instead. */
  .app-shell {
    height: calc(100vh / var(--app-scale));
  }
}

/* ----- Brand-letter bolding for "Saqir" -----------------------------
   The brand chrome runs Playfair Display (sidebar title, header bot-name,
   voice card) and Inter (composer hint, iPhone) at font-weight: 600. A
   default <strong> only steps to 700 — and Playfair was originally loaded
   only at 500/600, so 700+ silently fell back to 600 (no visible change).
   We now load 700/800/900 of every brand face from Google Fonts and ALSO
   tint the brand letters with the gold accent so they pop as a redundant
   signal that doesn't rely on font weight alone. ---------------------- */
.brand-title strong,
.bot-name strong,
.composer-hint strong,
.iphone-app-header .app-name strong,
.voice-call .vc-name strong,
.saqir strong {
  font-weight: 900;
  color: var(--gold-700);
}
