/* ═══════════════════════════════════════════════════════════════
   RPlay Outlook — Light/Dark redesign
   One stylesheet, both themes. Brand navy + orb gradient.
   ═══════════════════════════════════════════════════════════════ */

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

:root {
  /* RPlay brand accent — mint/teal (single source: RPlay-Stijlgids §3) */
  --orb-blue: #2DD1A7;     /* primary mint (var name kept to limit churn) */
  --orb-cyan: #5EDDC0;     /* primary light */
  --orb-violet: #1FB88F;   /* primary dark */
  --grad-orb: #2DD1A7;     /* solid mint fill — theme-aware (see light override) */
  --grad-orb-soft: linear-gradient(135deg, rgba(45,209,167,0.16), rgba(31,184,143,0.10));
  --accent-deep: #15937A;  /* deeper teal for solid bubbles (premium, not neon) */
  --on-accent: #04140E;    /* text on mint — theme-aware (see light override) */

  /* System status — success unified to brand mint (one green); amber/red reserved */
  --ok: #2DD1A7;
  --warn: #F59E0B;
  --bad: #EF4444;

  /* Spacing (tight for the pane) */
  --xs: 4px; --sm: 6px; --md: 10px; --lg: 14px; --xl: 20px; --xxl: 28px;

  /* Radius */
  --r-sm: 7px; --r-md: 11px; --r-lg: 16px; --r-full: 999px;

  /* Type */
  --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Inter', system-ui, sans-serif;
  --mono: 'SF Mono', ui-monospace, 'Menlo', monospace;
  --t-xs: 11px; --t-sm: 12px; --t-base: 13px; --t-md: 14px; --t-lg: 16px; --t-xl: 19px;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── DARK (brand, default) ── */
[data-theme="dark"] {
  --bg-deep: #020617;     /* brand deep navy — the canvas */
  --bg-surface: #070C18;  /* cards */
  --bg-raised: #0E1422;   /* inputs, inner tiles */
  --bg-hover: #161E2E;
  --border: #1D2840;
  --border-strong: #2C3A57;
  --text-hi: #E8E8E8;     /* brand foreground — not pure white */
  --text: #BFC6D2;
  --text-mid: #828C9E;    /* card titles live here — readable */
  --text-low: #525C72;
  --shadow-pane: 0 24px 70px -20px rgba(0,0,0,0.72), 0 0 0 1px rgba(255,255,255,0.03);
  --shadow-pop: 0 18px 50px -12px rgba(0,0,0,0.68);
  --orb-shadow: 0 0 20px rgba(45,209,167,0.4);
  --chip-tint: rgba(45,209,167,0.13);
  --scrim: rgba(1,3,9,0.66);
  --bubble-asst: rgba(255,255,255,0.05);
  color-scheme: dark;
}

/* ── LIGHT ── */
[data-theme="light"] {
  --orb-blue: #0E9E78;     /* darker mint for legible text/borders on white */
  --orb-cyan: #0E9E78;
  --orb-violet: #0B7F60;
  --grad-orb: #16C09A;     /* one green in light — lighter, fresher mint */
  --on-accent: #FFFFFF;    /* white icons/text on the mint buttons (light) */
  --accent-deep: #0B7F60;  /* deeper teal for solid bubbles */
  --ok: #16C09A;     /* lighter mint — matches fills, consistent */
  --bg-deep: #EEF1F6;
  --bg-surface: #FFFFFF;
  --bg-raised: #F4F6FA;
  --bg-hover: #EAEEF4;
  --border: #E4E8EF;
  --border-strong: #CCD3DE;
  --text-hi: #0D1320;
  --text: #2D3542;
  --text-mid: #5E6878;    /* readable card titles */
  --text-low: #97A0B0;
  --shadow-pane: 0 24px 70px -24px rgba(20,30,55,0.32), 0 0 0 1px rgba(20,30,55,0.05);
  --shadow-pop: 0 18px 50px -14px rgba(20,30,55,0.28);
  --orb-shadow: 0 0 16px rgba(45,209,167,0.3);
  --chip-tint: rgba(45,209,167,0.12);
  --scrim: rgba(30,40,60,0.34);
  --bubble-asst: #F4F6FA;
  color-scheme: light;
}

html, body {
  height: 100%;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
}
.workspace { display: flex; height: 100vh; width: 100%; }

/* ════════════ MAIL HOST (Outlook reading pane — context only) ════════════ */
.mailhost {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  background:
    radial-gradient(120% 60% at 12% 0%, rgba(45,209,167,0.06), transparent 55%),
    #0A0E16;
  color: #C7CDD8;
  transition: none;
}
body.theme-light-bg .mailhost {
  background:
    radial-gradient(120% 60% at 12% 0%, rgba(45,209,167,0.06), transparent 55%),
    #E6EAF1;
  color: #2D3542;
}
.mh-ribbon {
  display: flex; align-items: center; gap: 12px;
  height: 46px; padding: 0 16px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
}
body.theme-light-bg .mh-ribbon { border-bottom-color: rgba(20,30,55,0.08); background: rgba(255,255,255,0.5); }
.mh-dots { display: flex; gap: 7px; }
.mh-dots i { width: 11px; height: 11px; border-radius: 50%; opacity: 0.85; }
.mh-dots i:nth-child(1){ background:#FF5F57; } .mh-dots i:nth-child(2){ background:#FEBC2E; } .mh-dots i:nth-child(3){ background:#28C840; }
.mh-app { font-size: 12.5px; font-weight: 700; opacity: 0.65; letter-spacing: 0.01em; }
.mh-search {
  margin-left: auto; width: min(320px, 40%); height: 28px;
  border-radius: 8px; background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.07);
  display: flex; align-items: center; gap: 8px; padding: 0 11px;
  font-size: 12px; opacity: 0.55;
}
body.theme-light-bg .mh-search { background: rgba(20,30,55,0.04); border-color: rgba(20,30,55,0.08); }
.mh-search svg { width: 14px; height: 14px; }

.mh-read { flex: 1; min-height: 0; overflow-y: auto; padding: 30px clamp(24px, 6vw, 76px); }
.mh-read-inner { max-width: 760px; }
.mh-subject { font-size: clamp(20px, 2.4vw, 26px); font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; }
.mh-from { display: flex; align-items: center; gap: 12px; margin: 22px 0; }
.mh-av { width: 44px; height: 44px; border-radius: 50%; background: linear-gradient(135deg,#3A4358,#272E3F); display: grid; place-items: center; color: #D6DCE6; font-weight: 700; font-size: 15px; flex-shrink: 0; }
.mh-from-meta { min-width: 0; }
.mh-from-name { font-size: 14px; font-weight: 650; }
.mh-from-name b { font-weight: 650; }
.mh-from-sub { font-size: 12.5px; opacity: 0.6; margin-top: 2px; }
.mh-date { margin-left: auto; font-size: 12.5px; opacity: 0.55; white-space: nowrap; }
.mh-body { font-size: 14.5px; line-height: 1.72; }
.mh-body p { margin: 0 0 15px; opacity: 0.92; }
.mh-body p.dim { opacity: 0.62; }
.mh-attach {
  display: inline-flex; align-items: center; gap: 11px; margin-top: 10px;
  padding: 11px 15px; border-radius: 11px;
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08);
}
body.theme-light-bg .mh-attach { background: rgba(255,255,255,0.7); border-color: rgba(20,30,55,0.1); }
.mh-attach .ext { font-size: 10px; font-weight: 800; letter-spacing: 0.04em; padding: 3px 6px; border-radius: 4px; background: var(--grad-orb); color: var(--on-accent); }
.mh-attach .anm { font-size: 13px; font-weight: 600; }
.mh-attach .asz { font-size: 12px; opacity: 0.55; }

/* ════════════════ HARNESS (outside the pane) ════════════════ */

.harness {
  position: absolute;
  top: 16px; left: 16px;
  z-index: 40;
  width: 308px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 13px;
  border-radius: 14px;
  background: rgba(8,11,18,0.62);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.09);
  box-shadow: 0 14px 44px -14px rgba(0,0,0,0.55);
}
body.theme-light-bg .harness { background: rgba(255,255,255,0.74); border-color: rgba(20,30,55,0.1); }
.harness-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.harness-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255,255,255,0.6);
  display: flex;
  align-items: center;
  gap: 8px;
}
body.theme-light-bg .harness-title { color: rgba(20,30,55,0.55); }
.harness-title .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--grad-orb);
  box-shadow: 0 0 10px rgba(45,209,167,0.7);
}

/* segmented theme toggle */
.seg {
  display: inline-flex;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.10);
  border-radius: var(--r-full);
  padding: 3px;
  gap: 2px;
}
body.theme-light-bg .seg { background: rgba(20,30,55,0.05); border-color: rgba(20,30,55,0.10); }
.seg button {
  border: none;
  background: transparent;
  color: rgba(255,255,255,0.55);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 13px;
  border-radius: var(--r-full);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.18s var(--ease);
}
body.theme-light-bg .seg button { color: rgba(20,30,55,0.5); }
.seg button svg { width: 13px; height: 13px; }
.seg button.on {
  background: var(--grad-orb);
  color: var(--on-accent);
  box-shadow: 0 2px 10px rgba(45,209,167,0.4);
}

/* screen switcher pills */
.switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.switcher button {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.7);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: var(--r-full);
  cursor: pointer;
  transition: all 0.16s var(--ease);
}
body.theme-light-bg .switcher button { border-color: rgba(20,30,55,0.12); background: rgba(255,255,255,0.5); color: rgba(20,30,55,0.65); }
.switcher button:hover { border-color: var(--orb-blue); color: var(--orb-blue); }
body.theme-light-bg .switcher button:hover { color: var(--orb-blue); }
.switcher button.on {
  background: var(--chip-tint);
  border-color: var(--orb-blue);
  color: var(--orb-blue);
}
body.theme-light-bg .switcher button.on { color: var(--orb-blue); background: var(--chip-tint); }

/* bubble-style row in harness */
.bubble-seg-row { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; }
.bubble-seg-lab { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: rgba(255,255,255,0.4); }
body.theme-light-bg .bubble-seg-lab { color: rgba(20,30,55,0.45); }
.seg.sm button { padding: 4px 10px; font-size: 11px; }

/* ════════════════ HOST CHROME + PANE ════════════════ */

.host {
  width: 420px;
  flex-shrink: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  box-shadow: -24px 0 60px -24px rgba(0,0,0,0.55);
  position: relative;
  z-index: 5;
}

/* Outlook host strip (not ours — context only) */
.host-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 12px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.host-strip .ht-tab {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-hi);
  display: flex; align-items: center; gap: 6px;
}
.host-strip .ht-tab .pin { color: var(--orb-blue); }
.host-strip .ht-tab.muted { color: var(--text-low); font-weight: 500; margin-left: 2px; }
.host-strip .ht-spacer { flex: 1; }
.host-strip .ht-x { color: var(--text-low); display: flex; }

/* The actual RPlay pane */
.pane {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-deep);
  color: var(--text);
  overflow: hidden;
  position: relative;
  font-size: var(--t-base);
  transition: color 0.3s var(--ease);
}

/* ── Header ── */
.hd {
  display: flex;
  align-items: center;
  gap: var(--sm);
  height: 50px;
  padding: 0 var(--md);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.hd-sender {
  display: flex;
  align-items: center;
  gap: 9px;
  background: none; border: none;
  cursor: pointer;
  min-width: 0;
  flex: 1;
  font-family: var(--font);
  padding: 4px 6px 4px 4px;
  margin: -4px -6px -4px -4px;
  border-radius: var(--r-md);
  transition: background 0.15s;
}
.hd-sender:hover { background: var(--bg-raised); }
.avatar {
  position: relative;
  width: 34px; height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  display: grid; place-items: center;
  background: var(--bg-raised);
  font-size: 12px; font-weight: 700; color: var(--text-hi);
}
/* contact ring = the SOLE owner of ok/warn/bad colours */
.avatar::after {
  content: '';
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--ring, var(--border-strong));
  -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%);
          mask: radial-gradient(circle, transparent 60%, #000 61%);
}
.avatar.known { --ring: var(--ok); }
.avatar.partial { --ring: var(--warn); }
.avatar.unknown { --ring: var(--bad); }
.hd-meta { min-width: 0; display: flex; flex-direction: column; gap: 1px; text-align: left; }
.hd-name {
  font-size: var(--t-md); font-weight: 650; color: var(--text-hi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.hd-sub {
  font-size: var(--t-xs); color: var(--text-mid);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 5px;
}
.hd-sub .ring-label { color: var(--ring-label, var(--text-mid)); font-weight: 600; }
.avatar.known + .hd-meta .ring-label,
.hd-sender.known .ring-label { color: var(--text-mid); }
.icon-btn {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--bg-raised);
  color: var(--text-mid);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
}
.icon-btn:hover { color: var(--text-hi); border-color: var(--border-strong); }
.icon-btn svg { width: 16px; height: 16px; }

/* ── Tab bar ── */
.tabs {
  display: flex;
  height: 42px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  padding: 0 var(--sm);
}
.tab {
  flex: 1;
  border: none; background: none;
  color: var(--text-mid);
  font-family: var(--font);
  font-size: var(--t-base);
  font-weight: 600;
  cursor: pointer;
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: color 0.15s;
}
.tab .tab-ico { width: 15px; height: 15px; opacity: 0.7; }
.tab:hover:not(.disabled) { color: var(--text-hi); }
.tab.disabled { opacity: 0.32; cursor: default; }
.tab.active { color: var(--text-hi); }
.tab.active .tab-ico { opacity: 1; }
.tab .underline {
  position: absolute; left: 14px; right: 14px; bottom: -1px; height: 2.5px;
  border-radius: 2px;
  background: var(--grad-orb);
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.2s var(--ease), transform 0.25s var(--ease-spring);
}
.tab.active .underline { opacity: 1; transform: scaleX(1); }

/* ── Screen scroll body ── */
.body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}
.body::-webkit-scrollbar { width: 5px; }
.body::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
.screen { display: none; flex-direction: column; }
.screen.active { display: flex; animation: fade 0.28s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }

/* ════════════════ SHARED CARD + CHIP + PILL ════════════════ */

.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--md) var(--md) var(--lg);
}
.card + .card { margin-top: var(--md); }
.card-hd {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sm);
  margin-bottom: var(--sm);
}
.card-title {
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-mid);           /* readable, not disabled */
  display: flex; align-items: center; gap: 7px;
}
.card-title .tk {
  width: 14px; height: 14px; color: var(--orb-blue); opacity: 0.85;
}

/* pill idiom #1 — TINTED = state (never an action) */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-full);
  font-size: var(--t-xs); font-weight: 650;
  white-space: nowrap;
}
.pill .pdot { width: 6px; height: 6px; border-radius: 50%; }
.pill.state { background: var(--chip-tint); color: var(--orb-blue); }
.pill.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.pill.live { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pill.live .pdot { background: var(--ok); box-shadow: 0 0 6px var(--ok); animation: blink 1.6s var(--ease) infinite; }
@keyframes blink { 0%,100%{opacity:1;} 50%{opacity:0.35;} }

/* meta chips — sentiment / urgency. Deliberately NOT traffic-light pills:
   labelled, neutral surface, tiny scaled dot. Lives on Summary, not header. */
.meta-row { display: flex; flex-wrap: wrap; gap: 6px; }
.meta-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-full);
  background: var(--bg-raised);
  border: 1px solid var(--border);
  font-size: var(--t-xs); font-weight: 600; color: var(--text);
}
.meta-chip .mlabel { color: var(--text-mid); font-weight: 600; }
.meta-chip .mdot { width: 7px; height: 7px; border-radius: 2px; }
.mdot.neu { background: var(--text-low); }
.mdot.pos { background: var(--ok); }
.mdot.neg { background: var(--bad); }
.mdot.u-low { background: var(--text-low); }
.mdot.u-med { background: var(--warn); }
.mdot.u-high { background: var(--bad); }

/* pill idiom #2 — OUTLINED = action */
.act {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 12px;
  border-radius: var(--r-full);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--text);
  font-family: var(--font);
  font-size: var(--t-xs); font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: all 0.15s;
}
.act:hover { border-color: var(--orb-blue); color: var(--orb-blue); background: var(--chip-tint); }
.act svg { width: 12px; height: 12px; }
.act.tiny { padding: 3px 10px; }

/* primary = orb gradient, reserved for the one focal CTA per surface */
.btn-orb {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: none; border-radius: var(--r-sm);
  background: var(--grad-orb);
  color: var(--on-accent);
  font-family: var(--font); font-size: var(--t-sm); font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px -3px rgba(45,209,167,0.5);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.btn-orb:hover { filter: brightness(1.06); box-shadow: 0 6px 18px -3px rgba(45,209,167,0.6); }
.btn-orb:active { transform: translateY(1px); }
.btn-orb svg { width: 14px; height: 14px; }
/* icon-only round variant (Place in draft) */
.btn-orb.round { width: 38px; height: 38px; padding: 0; border-radius: 50%; flex-shrink: 0; justify-content: center; box-shadow: var(--orb-shadow); }
.btn-orb.round svg { width: 17px; height: 17px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: transparent; color: var(--text);
  font-family: var(--font); font-size: var(--t-sm); font-weight: 600;
  cursor: pointer; transition: all 0.15s;
}
.btn-ghost:hover { background: var(--bg-raised); color: var(--text-hi); }

/* empty / null line — no full card */
.null-line { font-size: var(--t-sm); color: var(--text-low); font-style: italic; }

/* ════════════════ REPLY ════════════════ */
.reply { padding: var(--md); gap: var(--md); height: 100%; flex: 1; min-height: 0; }
.reply-card {
  display: flex; flex-direction: column;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  min-height: 0;
  overflow: hidden;
}
.reply-card.instruct { flex: 0 1 auto; max-height: 52%; }   /* sizes to content, caps so draft keeps room */
.reply-card.draft { flex: 1 1 auto; }       /* draft gets the room */
.rc-hd {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sm);
  padding: var(--sm) var(--md);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.rc-hd-l { display: flex; align-items: center; gap: 8px; min-width: 0; }
.rc-label { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-mid); }
.rc-icons { display: flex; align-items: center; gap: 2px; }
.rc-ic {
  width: 28px; height: 28px; display: grid; place-items: center;
  border: none; background: transparent; border-radius: var(--r-sm);
  color: var(--text-mid); cursor: pointer; transition: all 0.15s;
}
.rc-ic:hover { color: var(--text-hi); background: var(--bg-raised); }
.rc-ic svg { width: 15px; height: 15px; }
.rc-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--md); }

/* instruction textarea */
.rc-textarea {
  width: 100%; border: none; background: transparent; outline: none; resize: none;
  color: var(--text-hi); font-family: var(--font); font-size: var(--t-base); line-height: 1.5;
  min-height: 46px;
}
.rc-textarea::placeholder { color: var(--text-low); }
.rc-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 var(--md) var(--md); }

/* footer with input-mode cluster */
.rc-ft {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sm); padding: var(--sm) var(--md);
  border-top: 1px solid var(--border); flex-shrink: 0;
}
.input-modes { display: flex; align-items: center; gap: 4px; }
.mode-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 12px 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--r-full);
  background: transparent; color: var(--text-mid);
  font-family: var(--font); font-size: var(--t-xs); font-weight: 600;
  cursor: pointer; transition: all 0.16s;
}
.mode-btn svg { width: 16px; height: 16px; }
.mode-btn:hover { color: var(--text-hi); border-color: var(--border-strong); }
.mode-btn.mic.rec { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); animation: micglow 1.4s var(--ease) infinite; }
@keyframes micglow { 0%,100%{box-shadow:0 0 0 rgba(239,68,68,0);} 50%{box-shadow:0 0 12px rgba(239,68,68,0.4);} }
.mode-btn.convo.live {
  color: var(--on-accent); border-color: transparent;
  background: var(--grad-orb);
  box-shadow: var(--orb-shadow);
  animation: convoglow 1.8s var(--ease) infinite;
}
@keyframes convoglow { 0%,100%{box-shadow:0 0 12px rgba(45,209,167,0.4);} 50%{box-shadow:0 0 20px rgba(45,209,167,0.65);} }
.rc-hint { font-size: var(--t-xs); color: var(--text-low); }

/* conversation transcript */
.bubbles { display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 86%; padding: 8px 11px; border-radius: 13px; font-size: 12.5px; line-height: 1.45; }
.bubble.user { align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.asst { align-self: flex-start; border-bottom-left-radius: 4px; }

/* ── bubble style options (switchable) ── */
/* TINT (default): soft mint wash, full-contrast text — readable, on-brand, not loud */
[data-bubble="tint"] .bubble.user { background: var(--chip-tint); color: var(--text-hi); border: 1px solid color-mix(in srgb, var(--ok) 36%, transparent); }
[data-bubble="tint"] .bubble.asst { background: var(--bubble-asst); border: 1px solid var(--border); color: var(--text); }
/* NEUTRAL: user = raised grey (iMessage-style), accent reserved for buttons only */
[data-bubble="neutral"] .bubble.user { background: var(--bg-hover); color: var(--text-hi); border: 1px solid var(--border-strong); }
[data-bubble="neutral"] .bubble.asst { background: transparent; border: 1px solid var(--border); color: var(--text); }
/* SOLID: deep premium teal, white text (not neon mint) */
[data-bubble="solid"] .bubble.user { background: var(--accent-deep); color: #fff; }
[data-bubble="solid"] .bubble.asst { background: var(--bubble-asst); border: 1px solid var(--border); color: var(--text); }
/* EDGE: neutral card with a thin accent edge — quietest, very legible */
[data-bubble="edge"] .bubble.user { background: var(--bg-raised); color: var(--text-hi); border: 1px solid var(--border); border-right: 3px solid var(--ok); border-bottom-right-radius: 4px; }
[data-bubble="edge"] .bubble.asst { background: var(--bg-raised); color: var(--text); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); }

/* conversational composer (instruction card) */
.thread { display: flex; flex-direction: column; gap: 8px; }
.empty-instruct { display: flex; flex-direction: column; gap: 10px; }
.empty-hint { font-size: var(--t-sm); color: var(--text-mid); line-height: 1.45; }
.composer { display: flex; align-items: flex-end; gap: 8px; padding: var(--sm) var(--md); border-top: 1px solid var(--border); flex-shrink: 0; }
.composer-ta { flex: 1; resize: none; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--bg-raised); color: var(--text-hi); font-family: var(--font); font-size: var(--t-base); padding: 8px 11px; outline: none; min-height: 38px; max-height: 84px; line-height: 1.4; transition: border-color 0.15s; }
.composer-ta:focus { border-color: var(--orb-blue); }
.composer-ta::placeholder { color: var(--text-low); }
.composer-btns { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.cbtn { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-strong); background: transparent; color: var(--text-mid); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; transition: all 0.15s; }
.cbtn svg { width: 18px; height: 18px; }
.cbtn:hover { color: var(--text-hi); border-color: var(--border-strong); }
.cbtn.send { background: var(--grad-orb); color: var(--on-accent); border-color: transparent; box-shadow: var(--orb-shadow); }
.cbtn.send:hover { filter: brightness(1.06); }
.cbtn.mic.rec { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); animation: micglow 1.4s var(--ease) infinite; }
.cbtn.convo.live { background: var(--grad-orb); color: var(--on-accent); border-color: transparent; box-shadow: var(--orb-shadow); animation: convoglow 1.8s var(--ease) infinite; }

/* dictate recording bar (replaces textarea while recording) */
.rec-state { flex: 1; display: flex; align-items: center; gap: 9px; height: 38px; padding: 0 12px; border-radius: var(--r-md); background: color-mix(in srgb, var(--bad) 9%, transparent); border: 1px solid color-mix(in srgb, var(--bad) 28%, transparent); }
.rec-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--bad); animation: pulseDot 1.2s var(--ease) infinite; flex-shrink: 0; }
@keyframes pulseDot { 0%,100%{ opacity: .55; transform: scale(1);} 50%{ opacity: 1; transform: scale(1.25);} }
.rec-text { font-size: var(--t-sm); color: var(--text); font-weight: 600; }
.rec-wave { display: inline-flex; align-items: flex-end; gap: 2px; height: 14px; }
.rec-wave i { width: 2.5px; background: var(--bad); border-radius: 2px; animation: eq 0.9s var(--ease) infinite; }
.rec-wave i:nth-child(2){ animation-delay: .15s; } .rec-wave i:nth-child(3){ animation-delay: .3s; } .rec-wave i:nth-child(4){ animation-delay: .45s; } .rec-wave i:nth-child(5){ animation-delay: .2s; }
.rec-time { margin-left: auto; font-variant-numeric: tabular-nums; font-size: var(--t-sm); color: var(--text-mid); font-family: var(--mono); }
.rec-stop { border: none; background: var(--bad); color: #fff; font-family: var(--font); font-size: var(--t-xs); font-weight: 700; padding: 5px 11px; border-radius: var(--r-full); cursor: pointer; flex-shrink: 0; }

/* AI thinking bubble — animated dots + seconds */
.think-bubble { align-self: flex-start; display: inline-flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 13px; background: var(--bubble-asst); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.think-dots { display: inline-flex; gap: 4px; }
.think-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--orb-blue); animation: thinkdot 1.3s var(--ease) infinite; }
.think-dots i:nth-child(2){ animation-delay: .18s; } .think-dots i:nth-child(3){ animation-delay: .36s; }
@keyframes thinkdot { 0%,65%,100%{ opacity: .3; transform: translateY(0); } 32%{ opacity: 1; transform: translateY(-4px); } }
.think-time { font-size: var(--t-xs); color: var(--text-low); font-variant-numeric: tabular-nums; font-family: var(--mono); }

/* AI reply card generating cue (dots + seconds) */
.draft-cue-dots { display: inline-flex; gap: 3px; align-items: center; }
.draft-cue-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--orb-blue); animation: thinkdot 1.3s var(--ease) infinite; }
.draft-cue-dots i:nth-child(2){ animation-delay: .18s; } .draft-cue-dots i:nth-child(3){ animation-delay: .36s; }
.reply-card.generating { animation: genGlow 1.8s var(--ease) infinite; }
@keyframes genGlow { 0%,100%{ border-color: var(--border); } 50%{ border-color: var(--orb-blue); } }

/* RAISED listening cue — filled tint + animated dot, reads in both themes */
.listening {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px;
  border-radius: var(--r-full);
  background: color-mix(in srgb, var(--orb-cyan) 18%, transparent);
  color: var(--orb-cyan);
  font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.05em;
  border: 1px solid color-mix(in srgb, var(--orb-cyan) 35%, transparent);
}
[data-theme="light"] .listening { color: #0B7F60; }
.listening .eq { display: inline-flex; align-items: flex-end; gap: 2px; height: 11px; }
.listening .eq i { width: 2.5px; background: currentColor; border-radius: 2px; animation: eq 1s var(--ease) infinite; }
.listening .eq i:nth-child(1){ height: 40%; animation-delay: 0s; }
.listening .eq i:nth-child(2){ height: 100%; animation-delay: .18s; }
.listening .eq i:nth-child(3){ height: 65%; animation-delay: .36s; }
.listening .eq i:nth-child(4){ height: 85%; animation-delay: .12s; }
@keyframes eq { 0%,100%{ transform: scaleY(0.4);} 50%{ transform: scaleY(1);} }

/* the AI reply text */
.draft-text { font-size: var(--t-base); line-height: 1.55; color: var(--text-hi); white-space: pre-wrap; }
.draft-text .greet { color: var(--text-hi); }

/* subtle, single done-cue (replaces the debug telemetry) */
.done-cue { display: inline-flex; align-items: center; gap: 5px; font-size: var(--t-xs); color: var(--text-low); }
.done-cue svg { width: 12px; height: 12px; color: var(--ok); }

/* unified reply-shaping action row — single line, horizontal scroll */
.shape-row {
  display: flex; flex-wrap: nowrap; gap: 6px;
  padding: var(--sm) var(--md);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-mask: linear-gradient(to right, #000 calc(100% - 22px), transparent);
          mask: linear-gradient(to right, #000 calc(100% - 22px), transparent);
}
.shape-row::-webkit-scrollbar { height: 0; display: none; }
.shape-row .act { flex-shrink: 0; }

/* dropdown (Translate, etc.) — pops upward (used at pane bottom) */
.dd { position: relative; }
.dd-menu {
  position: absolute; bottom: calc(100% + 6px); left: 0;
  min-width: 150px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  padding: 5px;
  display: none; flex-direction: column; gap: 1px;
  z-index: 12;
  animation: pop 0.16s var(--ease-spring);
}
.dd.open .dd-menu { display: flex; }
.dd-menu button {
  border: none; background: transparent;
  text-align: left; padding: 7px 10px; border-radius: var(--r-sm);
  font-family: var(--font); font-size: var(--t-sm); font-weight: 500; color: var(--text);
  cursor: pointer; transition: background 0.12s; white-space: nowrap;
}
.dd-menu button:hover { background: var(--bg-raised); color: var(--text-hi); }
.dd-menu button.cur { color: var(--orb-blue); font-weight: 650; }

/* draggable divider */
.divider {
  flex-shrink: 0; height: 14px; margin: -7px 0; cursor: row-resize;
  display: grid; place-items: center; position: relative; z-index: 2;
}
.divider::after { content: ''; width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); transition: background 0.15s, width 0.15s; }
.divider:hover::after, .divider.pinned::after { background: var(--ok); width: 54px; }

/* ════════════════ ANALYSE ════════════════ */
.analyse { padding: var(--md); gap: var(--md); }
.summary-text { font-size: var(--t-base); line-height: 1.55; color: var(--text); }
.summary-text p + p { margin-top: 8px; }
.kv { display: flex; align-items: center; justify-content: space-between; gap: var(--sm); padding: 2px 0; }
.kv .name { font-weight: 650; color: var(--text-hi); font-size: var(--t-base); }
.action-item { display: flex; align-items: flex-start; gap: 9px; padding: 4px 0; font-size: var(--t-base); color: var(--text); line-height: 1.45; }
.action-item .ck { flex-shrink: 0; width: 16px; height: 16px; color: var(--ok); margin-top: 1px; }
.date-item { display: flex; align-items: center; gap: 9px; padding: 6px var(--sm); margin: 0 calc(-1*var(--sm)); border-radius: var(--r-sm); cursor: pointer; transition: background 0.15s; }
.date-item:hover { background: var(--bg-raised); }
.date-item .dlabel { font-size: var(--t-xs); font-weight: 700; color: var(--orb-blue); white-space: nowrap; }
.date-item .ddesc { font-size: var(--t-base); color: var(--text); flex: 1; }
.date-item .dcal { color: var(--text-low); }

/* documents */
.doc {
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--bg-raised); padding: var(--sm) var(--md);
  margin-top: var(--sm);
}
.doc:first-of-type { margin-top: 0; }
.doc-hd { display: flex; align-items: center; gap: 8px; }
.doc-check { width: 15px; height: 15px; accent-color: var(--orb-blue); cursor: pointer; flex-shrink: 0; }
.doc-type { font-size: 9px; font-weight: 800; letter-spacing: 0.04em; padding: 2px 5px; border-radius: 3px; background: var(--warn); color: #241606; flex-shrink: 0; }
.doc-name { flex: 1; min-width: 0; font-size: var(--t-sm); font-weight: 600; color: var(--text-hi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-size { font-size: var(--t-xs); color: var(--text-low); flex-shrink: 0; }
.doc-desc { font-size: var(--t-sm); color: var(--text-mid); line-height: 1.45; margin-top: 6px; }
.doc-acts { display: flex; gap: 6px; margin-top: var(--sm); }
.doc-result { margin-top: var(--sm); padding-top: var(--sm); border-top: 1px dashed var(--border); }
.doc-result .rlabel { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--orb-blue); margin-bottom: 4px; }
.doc-result .rtext { font-size: var(--t-sm); line-height: 1.5; color: var(--text); }

/* skeleton (loading) */
.sk { height: 10px; border-radius: 5px; background: linear-gradient(90deg, var(--bg-raised) 25%, var(--border) 37%, var(--bg-raised) 63%); background-size: 400% 100%; animation: shimmer 1.4s var(--ease) infinite; }
.sk + .sk { margin-top: 8px; }
@keyframes shimmer { 0%{background-position:100% 50%;} 100%{background-position:0 50%;} }

/* ════════════════ KNOWLEDGE ════════════════ */
.knowledge { height: 100%; padding: 0; gap: 0; }

/* fixed header: FAQ|Glossary seg + search */
.kn-head { flex-shrink: 0; padding: var(--md) var(--md) var(--md); display: flex; flex-direction: column; gap: var(--sm); border-bottom: 1px solid var(--border); }
.kn-seg { display: inline-flex; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--r-full); padding: 3px; align-self: flex-start; }
.kn-seg button { border: none; background: transparent; color: var(--text-mid); font-family: var(--font); font-size: var(--t-sm); font-weight: 600; padding: 5px 16px; border-radius: var(--r-full); cursor: pointer; transition: all 0.16s; }
.kn-seg button.on { background: var(--bg-surface); color: var(--text-hi); box-shadow: 0 1px 4px rgba(0,0,0,0.18); }
.kn-search { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg-surface); transition: border-color 0.15s; }
.kn-search:focus-within { border-color: var(--orb-blue); }
.kn-search svg { width: 15px; height: 15px; color: var(--text-mid); flex-shrink: 0; }
.kn-search input { flex: 1; border: none; background: transparent; outline: none; color: var(--text-hi); font-family: var(--font); font-size: var(--t-base); }
.kn-search input::placeholder { color: var(--text-low); }

/* scrollable list */
.kn-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: var(--md); display: none; flex-direction: column; gap: var(--md); }
.kn-scroll.on { display: flex; }
.kn-empty { text-align: center; color: var(--text-low); font-size: var(--t-sm); font-style: italic; padding: var(--xl) var(--md); }

/* shared card + tools */
.kn-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: var(--sm) var(--md) var(--md); }
.kn-card.hide { display: none; }
.kn-card-tools { display: flex; align-items: center; gap: 6px; }
.kn-expand { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 7px; border: none; background: transparent; cursor: pointer; color: var(--text-mid); font-family: var(--font); font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 6px 0; text-align: left; }
.kn-expand .chev { width: 13px; height: 13px; transition: transform 0.2s var(--ease); flex-shrink: 0; }
.kn-card.open .kn-expand .chev { transform: rotate(90deg); }
.kn-del { width: 26px; height: 26px; display: grid; place-items: center; flex-shrink: 0; border: none; background: transparent; border-radius: var(--r-sm); color: var(--text-low); cursor: pointer; transition: all 0.15s; }
.kn-del:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 13%, transparent); }
.kn-del svg { width: 15px; height: 15px; }

/* FAQ */
.faq-q { font-size: var(--t-base); font-weight: 650; color: var(--text-hi); line-height: 1.4; margin-top: 2px; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.kn-card.open .faq-q { -webkit-line-clamp: unset; overflow: visible; }
.faq-a { font-size: var(--t-sm); color: var(--text); line-height: 1.5; margin-top: 8px; display: none; }
.kn-card.open .faq-a { display: block; }
.faq-foot { display: none; align-items: center; justify-content: space-between; gap: var(--sm); margin-top: var(--md); }
.kn-card.open .faq-foot { display: flex; }
.faq-urls { display: flex; flex-wrap: wrap; gap: 5px; }
.url-chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 5px 3px 9px; border-radius: var(--r-full); background: var(--chip-tint); color: var(--orb-blue); font-size: var(--t-xs); font-weight: 600; }
.url-chip svg.lk { width: 11px; height: 11px; flex-shrink: 0; }
.url-chip .x { width: 15px; height: 15px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; opacity: 0.65; }
.url-chip .x:hover { opacity: 1; background: rgba(45,209,167,0.22); }
.url-chip .x svg { width: 9px; height: 9px; }
.used { font-size: var(--t-xs); color: var(--text-low); white-space: nowrap; }

/* Glossary */
.gl-expand { flex: 1; min-width: 0; }
.gl-expand .gl-name { font-size: var(--t-base); font-weight: 650; color: var(--text-hi); text-transform: none; letter-spacing: 0; }
.gl-lang { font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-low); border: 1px solid var(--border); border-radius: var(--r-full); padding: 2px 8px; flex-shrink: 0; align-self: center; }
.gl-vars { display: none; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 11px; }
.kn-card.open .gl-vars { display: flex; }
.var-add { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px 4px 9px; border-radius: var(--r-full); background: transparent; border: 1px dashed var(--border-strong); color: var(--text-mid); font-family: var(--font); font-size: var(--t-xs); font-weight: 600; cursor: pointer; transition: all 0.15s; }
.var-add:hover { border-color: var(--orb-blue); color: var(--orb-blue); }
.var-add svg { width: 11px; height: 11px; }
.var-input { width: 116px; padding: 4px 10px; border-radius: var(--r-full); border: 1px solid var(--orb-blue); background: var(--bg-raised); color: var(--text-hi); font-family: var(--font); font-size: var(--t-xs); outline: none; }
.var-chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 5px 4px 10px; border-radius: var(--r-full); background: var(--bg-raised); border: 1px solid var(--border); color: var(--text); font-size: var(--t-xs); font-weight: 500; }
.var-chip .x { width: 15px; height: 15px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; opacity: 0.6; }
.var-chip .x:hover { opacity: 1; background: color-mix(in srgb, var(--bad) 15%, transparent); color: var(--bad); }
.var-chip .x svg { width: 9px; height: 9px; }

/* fixed add bar (one per sub-tab) */
.kn-addbar { flex-shrink: 0; padding: var(--sm) var(--md); border-top: 1px solid var(--border); background: var(--bg-surface); display: none; gap: var(--sm); }
.kn-addbar.on { display: flex; }

.add-row { display: flex; gap: var(--sm); }
.add-input { flex: 1; height: 38px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--bg-surface); color: var(--text-hi); font-family: var(--font); font-size: var(--t-base); outline: none; }
.add-input::placeholder { color: var(--text-low); }
.add-input:focus { border-color: var(--orb-blue); }

/* ════════════════ SETTINGS ════════════════ */
.settings { padding: var(--md) var(--md) var(--xl); gap: 2px; }
.set-group { padding: var(--md) 0; border-bottom: 1px solid var(--border); }
.set-group:last-child { border-bottom: none; }
.set-title { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--text-mid); margin-bottom: var(--md); }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sm); padding: 6px 0; }
.set-row .label { font-size: var(--t-base); color: var(--text); }
.set-row .val { font-size: var(--t-base); color: var(--text-hi); font-weight: 600; }

/* profile identity (read-only, confirmed — NOT greyed) */
.profile { display: flex; align-items: center; gap: var(--md); padding: 2px 0 var(--sm); }
.profile .pf-av { width: 42px; height: 42px; border-radius: 50%; background: var(--grad-orb); display: grid; place-items: center; color: var(--on-accent); font-weight: 700; font-size: 15px; flex-shrink: 0; }
.profile .pf-info { min-width: 0; }
.profile .pf-name { font-size: var(--t-md); font-weight: 650; color: var(--text-hi); }
.profile .pf-mail { font-size: var(--t-sm); color: var(--text-mid); }
.profile .pf-verified { display: inline-flex; align-items: center; gap: 4px; font-size: var(--t-xs); color: var(--ok); margin-top: 2px; }
.profile .pf-verified svg { width: 12px; height: 12px; }

.select-wrap { position: relative; }
.select {
  appearance: none; -webkit-appearance: none;
  height: 36px; padding: 0 30px 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--bg-surface); color: var(--text-hi);
  font-family: var(--font); font-size: var(--t-base); font-weight: 600; cursor: pointer; outline: none;
}
.select-wrap::after { content: ''; position: absolute; right: 11px; top: 50%; width: 7px; height: 7px; border-right: 2px solid var(--text-mid); border-bottom: 2px solid var(--text-mid); transform: translateY(-70%) rotate(45deg); pointer-events: none; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--sm); }
.dom-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 11px; border-radius: var(--r-full); background: var(--chip-tint); color: var(--orb-blue); font-size: var(--t-sm); font-weight: 600; }
.dom-chip .rm { width: 16px; height: 16px; display: grid; place-items: center; border-radius: 50%; cursor: pointer; opacity: 0.7; }
.dom-chip .rm:hover { opacity: 1; background: rgba(45,209,167,0.2); }
.set-hint { font-size: var(--t-xs); color: var(--text-mid); margin-bottom: var(--sm); }

/* theme segmented (drives the pane) */
.theme-seg { display: inline-flex; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--r-full); padding: 3px; }
.theme-seg button { border: none; background: transparent; color: var(--text-mid); font-family: var(--font); font-size: var(--t-sm); font-weight: 600; padding: 6px 14px; border-radius: var(--r-full); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; transition: all 0.16s; }
.theme-seg button svg { width: 14px; height: 14px; }
.theme-seg button.on { background: var(--bg-surface); color: var(--text-hi); box-shadow: 0 1px 4px rgba(0,0,0,0.2); }

/* subscription / fair-use */
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sm); margin-bottom: var(--md); }
.sub-plan { display: flex; align-items: center; gap: 8px; }
.sub-plan .pname { font-size: var(--t-md); font-weight: 700; color: var(--text-hi); }
.meter { margin-bottom: var(--md); }
.meter-top { display: flex; align-items: center; justify-content: space-between; font-size: var(--t-sm); margin-bottom: 6px; }
.meter-top .m-label { color: var(--text-mid); }
.meter-top .m-val { color: var(--text-hi); font-weight: 600; font-variant-numeric: tabular-nums; }
.meter-bar { height: 7px; border-radius: var(--r-full); background: var(--bg-raised); overflow: hidden; }
.meter-fill { height: 100%; border-radius: var(--r-full); background: var(--grad-orb); }
.renews { font-size: var(--t-xs); color: var(--text-low); }

/* ════════════════ CONTACT POPUP ════════════════ */
.scrim {
  position: absolute; inset: 0; z-index: 30;
  background: var(--scrim);
  backdrop-filter: blur(2px);
  display: none; align-items: center; justify-content: center; padding: var(--md);
}
.scrim.open { display: flex; animation: fade 0.2s var(--ease); }
.modal {
  width: 100%; max-width: 340px; max-height: 92%;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: pop 0.22s var(--ease-spring);
}
@keyframes pop { from { opacity: 0; transform: scale(0.94) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-hd { display: flex; align-items: center; gap: var(--sm); padding: var(--md) var(--lg); border-bottom: 1px solid var(--border); }
.modal-hd .mtitle { font-size: var(--t-lg); font-weight: 700; color: var(--text-hi); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: var(--md) var(--lg) var(--lg); overflow-y: auto; }
.modal-ft { display: flex; gap: var(--sm); justify-content: flex-end; padding: var(--md) var(--lg); border-top: 1px solid var(--border); }

/* field state differentiation */
.field { margin-bottom: var(--md); }
.field-lab { display: flex; align-items: center; justify-content: space-between; font-size: var(--t-xs); font-weight: 600; color: var(--text-mid); margin-bottom: 5px; }
.field-lab .src { font-size: 10px; font-weight: 600; color: var(--text-low); display: inline-flex; align-items: center; gap: 3px; }
.field-lab .src svg { width: 10px; height: 10px; }
.field-in {
  width: 100%; height: 38px; padding: 0 11px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--bg-surface); color: var(--text-hi);
  font-family: var(--font); font-size: var(--t-base); outline: none;
  transition: border-color 0.15s;
}
.field-in:focus { border-color: var(--orb-blue); }
.field-in::placeholder { color: var(--text-low); }
/* read-only / confirmed (e.g. email from header) — distinct, not "disabled looking" */
.field-in.readonly { background: var(--bg-raised); border-style: dashed; color: var(--text); cursor: default; }
/* empty — clearly awaiting input */
.field.empty .field-in { border-style: dashed; border-color: var(--border); }

.modal-meta { font-size: var(--t-xs); color: var(--text-low); margin-top: 4px; }

/* header actions cluster + small icon button */
.header-actions { display: flex; align-items: center; gap: 5px; flex-shrink: 0; }
.icon-btn.sm { width: 28px; height: 28px; }
.icon-btn.sm svg { width: 15px; height: 15px; }
.modal-acts { display: flex; align-items: center; gap: 3px; flex-shrink: 0; }
.act.ico { padding: 4px 8px; }
.act.ico svg { width: 13px; height: 13px; }

/* QR / vCard view inside contact modal */
.qr-view { display: none; flex-direction: column; align-items: center; gap: var(--md); padding: var(--lg) var(--lg) var(--xl); text-align: center; }
.modal.show-qr .modal-body, .modal.show-qr .modal-ft { display: none; }
.modal.show-qr .qr-view { display: flex; animation: qrIn 0.42s var(--ease-spring); }
@keyframes qrIn { from { opacity: 0; transform: perspective(600px) rotateY(-32deg) scale(0.88); } to { opacity: 1; transform: none; } }
.qr-card { background: #fff; border-radius: var(--r-md); padding: 15px; box-shadow: 0 10px 30px -8px rgba(0,0,0,0.4); line-height: 0; }
.qr-card svg { display: block; }
.qr-name { font-size: var(--t-md); font-weight: 700; color: var(--text-hi); }
.qr-role { font-size: var(--t-sm); color: var(--text-mid); margin-top: 2px; }
.qr-hint { font-size: var(--t-xs); color: var(--text-low); display: inline-flex; align-items: center; gap: 6px; }
.qr-hint svg { width: 13px; height: 13px; }

/* CONTACTS search pane (slides over the pane body) */
.cpane { position: absolute; inset: 0; z-index: 28; background: var(--bg-deep); display: none; flex-direction: column; }
.cpane.open { display: flex; animation: slideOver 0.26s var(--ease-spring); }
@keyframes slideOver { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
.cpane-hd { display: flex; align-items: center; gap: var(--sm); height: 50px; padding: 0 var(--md); border-bottom: 1px solid var(--border); background: var(--bg-surface); flex-shrink: 0; }
.cpane-title { font-size: var(--t-md); font-weight: 700; color: var(--text-hi); flex: 1; display: flex; align-items: center; }
.cpane-search { margin: var(--md); display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 13px; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--bg-surface); flex-shrink: 0; transition: border-color 0.15s; }
.cpane-search:focus-within { border-color: var(--orb-blue); }
.cpane-search svg { width: 17px; height: 17px; color: var(--text-mid); flex-shrink: 0; }
.cpane-search input { flex: 1; border: none; background: transparent; outline: none; color: var(--text-hi); font-family: var(--font); font-size: var(--t-md); }
.cpane-search input::placeholder { color: var(--text-low); }
.cpane-list { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--md) var(--md); }
.cpane-empty { text-align: center; color: var(--text-low); font-size: var(--t-sm); font-style: italic; padding: var(--xl); }
.cgroup { margin-bottom: var(--md); }
.cgroup.hide { display: none; }
.cgroup-h { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-mid); padding: 7px 2px 5px; position: sticky; top: 0; background: var(--bg-deep); z-index: 1; }
.crow { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px var(--sm); border: none; background: transparent; border-radius: var(--r-md); cursor: pointer; text-align: left; font-family: var(--font); transition: background 0.14s; }
.crow:hover { background: var(--bg-hover); }
.crow.hide { display: none; }
.crow-av { width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; display: grid; place-items: center; background: var(--bg-raised); color: var(--text-hi); font-weight: 700; font-size: 12px; position: relative; }
.crow-av::after { content: ''; position: absolute; inset: -2px; border-radius: 50%; border: 2px solid var(--ring, transparent); -webkit-mask: radial-gradient(circle, transparent 60%, #000 61%); mask: radial-gradient(circle, transparent 60%, #000 61%); }
.crow-av.known { --ring: var(--ok); } .crow-av.partial { --ring: var(--warn); } .crow-av.unknown { --ring: var(--bad); }
.crow-info { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 1px; }
.crow-name { font-size: var(--t-base); font-weight: 600; color: var(--text-hi); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow-sub { font-size: var(--t-xs); color: var(--text-mid); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crow-chev { color: var(--text-low); flex-shrink: 0; display: flex; }

/* DOC CHAT popup */
.modal.docchat-modal { max-width: 360px; height: min(560px, 88%); }
.docchat-doc { display: flex; align-items: center; gap: 8px; padding: var(--sm) var(--lg); border-bottom: 1px solid var(--border); background: var(--bg-raised); font-size: var(--t-xs); color: var(--text-mid); flex-shrink: 0; }
.docchat-doc svg { flex-shrink: 0; }
.docchat-body { flex: 1; min-height: 0; overflow-y: auto; padding: var(--md) var(--lg); display: flex; flex-direction: column; gap: 8px; }
.docchat-input { display: flex; align-items: flex-end; gap: 9px; padding: var(--sm) var(--lg) var(--md); border-top: 1px solid var(--border); flex-shrink: 0; }
.docchat-input textarea { flex: 1; resize: none; border: 1px solid var(--border-strong); border-radius: var(--r-md); background: var(--bg-raised); color: var(--text-hi); font-family: var(--font); font-size: var(--t-base); padding: 9px 11px; outline: none; max-height: 90px; min-height: 38px; line-height: 1.4; transition: border-color 0.15s; }
.docchat-input textarea:focus { border-color: var(--orb-blue); }
.docchat-send { width: 38px; height: 38px; border-radius: 50%; border: none; background: var(--grad-orb); color: var(--on-accent); display: grid; place-items: center; cursor: pointer; flex-shrink: 0; box-shadow: var(--orb-shadow); transition: filter 0.15s; }
.docchat-send:hover { filter: brightness(1.06); }
.docchat-send svg { width: 16px; height: 16px; }

/* tiny copy/save toast */
.toast { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(8px); z-index: 50; background: var(--text-hi); color: var(--bg-deep); font-size: var(--t-sm); font-weight: 650; padding: 8px 16px; border-radius: var(--r-full); box-shadow: var(--shadow-pop); opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s var(--ease-spring); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── composer modes: textarea only in text mode ── */
#instructCard[data-mode="dictate"] .composer-ta,
#instructCard[data-mode="converse"] .composer-ta { display: none; }
/* buttons stay put; greyed when unavailable */
.cbtn.disabled { opacity: 0.35; pointer-events: none; }
.composer-hint { display: none; flex: 1; font-size: var(--t-xs); color: var(--text-low); align-self: center; }
#instructCard[data-mode="dictate"] .composer-hint,
#instructCard[data-mode="converse"] .composer-hint { display: block; }
/* mode pill: RECORDING variant (dictate) */
.listening.rec { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }
[data-theme="light"] .listening.rec { color: var(--bad); }
/* live/pending dictation bubble (style-agnostic accent outline) */
.bubble.pending { outline: 1.5px dashed color-mix(in srgb, var(--ok) 60%, transparent); outline-offset: -1.5px; }
.bubble.pending::after { content: ' ▍'; opacity: 0.6; animation: caret 0.9s steps(1) infinite; }
@keyframes caret { 0%,100%{ opacity: 0.6; } 50%{ opacity: 0; } }
.cbtn.send.pulse { animation: sendpulse 1.2s var(--ease) infinite; }
@keyframes sendpulse { 0%,100%{ box-shadow: var(--orb-shadow); } 50%{ box-shadow: 0 0 22px rgba(45,209,167,0.75); } }
/* AI reply wand (automatic reply) — same neutral colour as copy/close */
.rc-ic.wand.spin svg { animation: wandspin 0.7s var(--ease); }
@keyframes wandspin { 0%{ transform: rotate(0) scale(1); } 50%{ transform: rotate(-18deg) scale(1.15); } 100%{ transform: rotate(0) scale(1); } }

/* ── translate dropdown: per-language rows + add ── */
.dd-row { display: flex; align-items: center; }
.dd-row .dd-pick { flex: 1; text-align: left; }
.dd-row .dd-rm { width: 22px; height: 22px; display: grid; place-items: center; border: none; background: transparent; color: var(--text-low); border-radius: var(--r-sm); cursor: pointer; opacity: 0.7; }
.dd-row .dd-rm:hover { opacity: 1; color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.dd-row .dd-rm svg { width: 11px; height: 11px; }
.dd-add { color: var(--orb-blue) !important; font-weight: 700 !important; border-top: 1px solid var(--border); margin-top: 4px; padding-top: 9px !important; display: flex; align-items: center; gap: 6px; }
.dd-add svg { width: 13px; height: 13px; }

/* ── knowledge count badge + head row ── */
.kn-headrow { display: flex; align-items: center; gap: var(--sm); }
.kn-count { margin-left: auto; font-size: var(--t-xs); font-weight: 700; color: var(--text-mid); font-variant-numeric: tabular-nums; }

/* inline link (analyse contact name, company → colleagues) */
.link-inline { color: var(--orb-blue); cursor: pointer; font-weight: 600; background: none; border: none; font-family: var(--font); font-size: inherit; padding: 0; }
.link-inline:hover { text-decoration: underline; }
.kv .name.link-inline { font-size: var(--t-base); }
.company-pill { display: inline-flex; align-items: center; gap: 5px; max-width: 150px; }
.company-pill .cp-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.company-pill svg { width: 12px; height: 12px; flex-shrink: 0; }
/* field with inline action (Company → colleagues) */
.field-colleagues { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; font-weight: 600; color: var(--orb-blue); cursor: pointer; }
.field-colleagues svg { width: 11px; height: 11px; }

/* ── reply-scope dropdown (Reply to sender / all), sits next to Translate ── */
.rc-ft-l { display: flex; align-items: center; gap: 6px; min-width: 0; }
.scope-menu { min-width: 192px; }
.scope-pick {
  display: flex !important; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; padding: 8px 10px !important;
}
.scope-pick .sp-row { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--text-mid); }
.scope-pick .sp-row svg { width: 13px; height: 13px; flex-shrink: 0; }
.scope-pick .sp-sub { font-size: var(--t-xs); color: var(--text-low); padding-left: 20px; }
.scope-pick:hover { background: var(--bg-raised); }
.scope-pick.cur .sp-row { color: var(--orb-blue); }
.scope-pick.cur .sp-row svg { color: var(--orb-blue); }
#scopeDD .dd-btn #scopeLabel { font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Narrow screens: drop the mail context, just dock the pane full-width */
@media (max-width: 820px) {
  .mailhost { display: none; }
  .host { width: 100%; box-shadow: none; }
  .harness { width: calc(100% - 32px); max-width: 360px; }
}
