/* ── Google Fonts: Inter ─────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

/* ══════════════════════════════════════════════════════════════
   THEME TOKEN SYSTEM
   All components use semantic vars. Themes only set token values.
   ══════════════════════════════════════════════════════════════ */

/* ── NARLO DAY (Earth Mode) ──────────────────────────────────── */
:root, html[data-theme="light"] {
  /* Brand palette */
  --color-bg:            #F4F1E8;
  --color-sidebar:       #EEE8DA;
  --color-card:          #FFFDF7;
  --color-primary:       #1E2B22;
  --color-highlight:     #E1DDCF;
  --color-accent:        #B78B74;
  --color-text-primary:  #121615;
  --color-text-secondary:#5F665E;
  --color-border:        #D8D1C2;

  /* Semantic layout tokens */
  --bg-base:       var(--color-bg);
  --bg-surface:    var(--color-card);
  --bg-sidebar:    var(--color-sidebar);
  --bg-raised:     #E8E2D4;
  --border:        var(--color-border);
  --border-soft:   #E5DED0;

  /* Typography */
  --text-primary:   var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted:     #A79D93;

  /* Accent system */
  --accent:        var(--color-primary);
  --accent-hover:  #283227;
  --accent-soft:   var(--color-highlight);
  --accent-text:   #1E2B22;
  --accent-ring:   rgba(92,107,79,.18);
  --on-accent:     #E9E9E2;

  /* Nav */
  --nav-active-bg:   var(--color-highlight);
  --nav-active-text: #1E2B22;
  --nav-hover-bg:    #E9E4D7;

  /* Inputs */
  --input-bg:      #FFFCF4;
  --input-border:  #CCC3B2;
  --surface-hover: #E7E0D0;

  /* Misc component compat */
  --blue-600: #1E2B22; --blue-700: #283227; --blue-50: #E5E0D1;
  --green-600: #5C6B4F; --green-700: #1E2B22;
  --slate-50:#FFFCF4; --slate-100:#F4F1E8; --slate-200:#DED6C6;
  --slate-300:#CFC6B7; --slate-400:#A79D93; --slate-500:#6F756C;
  --slate-600:#5F665E; --slate-700:#3E463D; --slate-800:#283227; --slate-900:#121615;
  --red-600:#DC2626; --red-50:#FEF2F2; --red-200:#FECACA;
  --amber-50:#F8EEE8; --amber-200:#E7C3B1; --amber-700:#9A674F;

  /* Layout */
  --nav-w: 240px; --list-w: 360px; --header-h: 66px; --panel-w: 430px; --chat-w: 360px;
  --radius-sm: 7px; --radius: 10px; --radius-lg: 14px; --radius-pill: 999px;
  --shadow-xs: 0 1px 2px rgba(16,24,40,.04);
  --shadow-sm: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.04);
  --shadow:    0 2px 8px rgba(16,24,40,.1),  0 1px 3px rgba(16,24,40,.05);
  --shadow-lg: 0 12px 24px -4px rgba(16,24,40,.12), 0 4px 8px rgba(16,24,40,.06);
  --shadow-xl: 0 20px 40px -8px rgba(16,24,40,.15), 0 8px 16px rgba(16,24,40,.08);

  /* Scrollbar */
  --scrollbar-track:       #E9E3D5;
  --scrollbar-thumb:       #C9BFB0;
  --scrollbar-thumb-hover: #A79D93;
}

/* ── NARLO NIGHT ─────────────────────────────────────────────── */
html[data-theme="dark"] {
  --color-bg:            #0F1211;
  --color-sidebar:       #121615;
  --color-card:          #181E1A;
  --color-primary:       #5C6B4F;
  --color-highlight:     #20291F;
  --color-accent:        #B78B74;
  --color-text-primary:  #DAD6CA;
  --color-text-secondary:#B8B1A7;
  --color-border:        #2C342E;

  --bg-base:      var(--color-bg);
  --bg-surface:   var(--color-card);
  --bg-sidebar:   var(--color-sidebar);
  --bg-raised:    #20271F;
  --border:       var(--color-border);
  --border-soft:  #252D27;

  --text-primary:   var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted:     #827B72;

  --accent:        var(--color-primary);
  --accent-hover:  #7B8A68;
  --accent-soft:   var(--color-highlight);
  --accent-text:   #DED6C6;
  --accent-ring:   rgba(183,139,116,.2);
  --on-accent:     #101410;

  --nav-active-bg:   var(--color-highlight);
  --nav-active-text: #DED6C6;
  --nav-hover-bg:    rgba(255,255,255,.04);

  --input-bg:      #151A16;
  --input-border:  #354033;
  --surface-hover: rgba(255,255,255,.04);

  --blue-600:#5C6B4F; --blue-700:#7B8A68; --blue-50:#20291F;
  --green-600:#5C6B4F; --green-700:#1E2B22;
  --slate-50:#151A16; --slate-100:#181E1A; --slate-200:#2C342E;
  --slate-300:#3D473F; --slate-400:#827B72; --slate-500:#B8B1A7;
  --slate-600:#C8C1B6; --slate-700:#DAD6CA; --slate-800:#E5E1D7; --slate-900:#F1EEE5;
  --red-50:#2D0A0A; --red-200:#7F1D1D;
  --amber-50:#211813; --amber-200:#6E4435; --amber-700:#E4B69C;

  /* Scrollbar */
  --scrollbar-track:       #111511;
  --scrollbar-thumb:       #2B352D;
  --scrollbar-thumb-hover: #465343;
}

/* ── SCENT GRAPHITE / MATRIX ────────────────────────────────── */
html[data-theme="matrix"] {
  --color-bg:             #070C08;
  --color-sidebar:        #0B110D;
  --color-card:           #101711;
  --color-primary:        #A7B5A8;
  --color-highlight:      #17251A;
  --color-accent:         #224D35;
  --color-accent-secondary:#B78B74;
  --color-text-primary:   #DAD6CA;
  --color-text-secondary: #A7B5A8;
  --color-border:         #213024;

  --bg-base:      var(--color-bg);
  --bg-surface:   var(--color-card);
  --bg-sidebar:   var(--color-sidebar);
  --bg-raised:    #152016;
  --border:       var(--color-border);
  --border-soft:  #17241A;

  --text-primary:   var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted:     #657365;

  --accent:        var(--color-primary);
  --accent-hover:  #C1C9BE;
  --accent-soft:   var(--color-highlight);
  --accent-text:   #DAD6CA;
  --accent-ring:   rgba(167,181,168,.16);
  --on-accent:     #07100A;

  --nav-active-bg:   var(--color-highlight);
  --nav-active-text: #DAD6CA;
  --nav-hover-bg:    rgba(167,181,168,.06);

  --input-bg:      #0E150F;
  --input-border:  #28372B;
  --surface-hover: rgba(167,181,168,.05);

  --blue-600:#A7B5A8; --blue-700:#C1C9BE; --blue-50:#17251A;
  --green-600:#224D35; --green-700:#183226;
  --slate-50:#0B110D; --slate-100:#101711; --slate-200:#1E2A20;
  --slate-300:#28372B; --slate-400:#657365; --slate-500:#A7B5A8;
  --slate-600:#B8C2B7; --slate-700:#DAD6CA; --slate-800:#E9E9E2; --slate-900:#F2F1EA;
  --red-50:#1A0800; --red-200:#5A1000; --red-600:#F87171;
  --amber-50:#19120F; --amber-200:#493126; --amber-700:#B78B74;

  /* Scrollbar */
  --scrollbar-track:       #070C08;
  --scrollbar-thumb:       #1B291D;
  --scrollbar-thumb-hover: #304334;
}

/* ══════════════════════════════════════════════════════════════ */

/* Narlo by Scent brand migration overrides.
   These semantic tokens keep app behavior intact while moving the visible
   identity to Narlo Earth Mode and the darker Scent Graphite treatment. */
:root, html[data-theme="light"] {
  --narlo-deep-graphite: #121615;
  --narlo-forest-green: #1E2B22;
  --narlo-moss: #283227;
  --narlo-olive: #5C6B4F;
  --narlo-clay: #B78B74;
  --narlo-sand: #DED6C6;
  --narlo-taupe: #A79D93;
  --narlo-warm-stone: #DAD6CA;
  --narlo-mist: #E9E9E2;

  --color-bg: #F4F1E8;
  --color-sidebar: #EEE8DA;
  --color-card: #FFFDF7;
  --color-primary: var(--narlo-forest-green);
  --color-highlight: #E1DDCF;
  --color-accent: var(--narlo-clay);
  --color-text-primary: var(--narlo-deep-graphite);
  --color-text-secondary: #5F665E;
  --color-border: #D8D1C2;

  --bg-base: var(--color-bg);
  --bg-surface: var(--color-card);
  --bg-sidebar: var(--color-sidebar);
  --bg-raised: #E8E2D4;
  --border: var(--color-border);
  --border-soft: #E5DED0;
  --text-primary: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted: var(--narlo-taupe);
  --accent: var(--color-primary);
  --accent-hover: var(--narlo-moss);
  --accent-soft: var(--color-highlight);
  --accent-text: var(--narlo-forest-green);
  --accent-ring: rgba(92,107,79,.18);
  --on-accent: var(--narlo-mist);
  --brand-mark-bg: var(--narlo-sand);
  --brand-mark-fg: var(--narlo-deep-graphite);
  --brand-parent: var(--narlo-clay);
  --nav-active-bg: var(--color-highlight);
  --nav-active-text: var(--narlo-forest-green);
  --nav-hover-bg: #E9E4D7;
  --input-bg: #FFFCF4;
  --input-border: #CCC3B2;
  --surface-hover: #E7E0D0;

  --blue-600: var(--narlo-forest-green);
  --blue-700: var(--narlo-moss);
  --blue-50: #E5E0D1;
  --green-600: var(--narlo-olive);
  --green-700: var(--narlo-forest-green);
  --slate-50: #FFFCF4;
  --slate-100: #F4F1E8;
  --slate-200: #DED6C6;
  --slate-300: #CFC6B7;
  --slate-400: #A79D93;
  --slate-500: #6F756C;
  --slate-600: #5F665E;
  --slate-700: #3E463D;
  --slate-800: #283227;
  --slate-900: #121615;
  --amber-50: #F8EEE8;
  --amber-200: #E7C3B1;
  --amber-700: #9A674F;
  --scrollbar-track: #E9E3D5;
  --scrollbar-thumb: #C9BFB0;
  --scrollbar-thumb-hover: var(--narlo-taupe);
}

html[data-theme="dark"] {
  --color-bg: #0F1211;
  --color-sidebar: var(--narlo-deep-graphite);
  --color-card: #181E1A;
  --color-primary: var(--narlo-olive);
  --color-highlight: #20291F;
  --color-accent: var(--narlo-clay);
  --color-text-primary: var(--narlo-warm-stone);
  --color-text-secondary: #B8B1A7;
  --color-border: #2C342E;

  --bg-base: var(--color-bg);
  --bg-surface: var(--color-card);
  --bg-sidebar: var(--color-sidebar);
  --bg-raised: #20271F;
  --border: var(--color-border);
  --border-soft: #252D27;
  --text-primary: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted: #827B72;
  --accent: var(--color-primary);
  --accent-hover: #7B8A68;
  --accent-soft: var(--color-highlight);
  --accent-text: var(--narlo-sand);
  --accent-ring: rgba(183,139,116,.2);
  --on-accent: #101410;
  --brand-mark-bg: var(--narlo-sand);
  --brand-mark-fg: var(--narlo-deep-graphite);
  --brand-parent: var(--narlo-clay);
  --nav-active-bg: var(--color-highlight);
  --nav-active-text: var(--narlo-sand);
  --nav-hover-bg: rgba(255,255,255,.04);
  --input-bg: #151A16;
  --input-border: #354033;
  --surface-hover: rgba(255,255,255,.04);

  --blue-600: var(--narlo-olive);
  --blue-700: #7B8A68;
  --blue-50: #20291F;
  --green-600: var(--narlo-olive);
  --green-700: var(--narlo-forest-green);
  --slate-50: #151A16;
  --slate-100: #181E1A;
  --slate-200: #2C342E;
  --slate-300: #3D473F;
  --slate-400: #827B72;
  --slate-500: #B8B1A7;
  --slate-600: #C8C1B6;
  --slate-700: #DAD6CA;
  --slate-800: #E5E1D7;
  --slate-900: #F1EEE5;
  --amber-50: #211813;
  --amber-200: #6E4435;
  --amber-700: #E4B69C;
  --scrollbar-track: #111511;
  --scrollbar-thumb: #2B352D;
  --scrollbar-thumb-hover: #465343;
}

html[data-theme="matrix"] {
  --color-bg: #070C08;
  --color-sidebar: #0B110D;
  --color-card: #101711;
  --color-primary: #A7B5A8;
  --color-highlight: #17251A;
  --color-accent: #224D35;
  --color-accent-secondary: #B78B74;
  --color-text-primary: #DAD6CA;
  --color-text-secondary: #A7B5A8;
  --color-border: #213024;

  --bg-base: var(--color-bg);
  --bg-surface: var(--color-card);
  --bg-sidebar: var(--color-sidebar);
  --bg-raised: #152016;
  --border: var(--color-border);
  --border-soft: #17241A;
  --text-primary: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-muted: #657365;
  --accent: var(--color-primary);
  --accent-hover: #C1C9BE;
  --accent-soft: var(--color-highlight);
  --accent-text: #DAD6CA;
  --accent-ring: rgba(167,181,168,.16);
  --on-accent: #07100A;
  --brand-mark-bg: #A7B5A8;
  --brand-mark-fg: #07100A;
  --brand-parent: #A7B5A8;
  --nav-active-bg: var(--color-highlight);
  --nav-active-text: #DAD6CA;
  --nav-hover-bg: rgba(167,181,168,.06);
  --input-bg: #0E150F;
  --input-border: #28372B;
  --surface-hover: rgba(167,181,168,.05);

  --blue-600: #A7B5A8;
  --blue-700: #C1C9BE;
  --blue-50: #17251A;
  --green-600: #224D35;
  --green-700: #183226;
  --slate-50: #0B110D;
  --slate-100: #101711;
  --slate-200: #1E2A20;
  --slate-300: #28372B;
  --slate-400: #657365;
  --slate-500: #A7B5A8;
  --slate-600: #B8C2B7;
  --slate-700: #DAD6CA;
  --slate-800: #E9E9E2;
  --slate-900: #F2F1EA;
  --amber-50: #19120F;
  --amber-200: #493126;
  --amber-700: #B78B74;
  --scrollbar-track: #070C08;
  --scrollbar-thumb: #1B291D;
  --scrollbar-thumb-hover: #304334;
}

html, body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px; color: var(--text-primary); background: var(--bg-base);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbars ─────────────────────────────────────────────── */
* { scrollbar-width: thin; scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track); }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* ── Utilities ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.screen { min-height: 100vh; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px; border-radius: var(--radius-sm); border: none;
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit; letter-spacing: .01em;
  transition: background .15s, box-shadow .15s, opacity .15s, transform .08s;
  white-space: nowrap; text-decoration: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }

.btn-primary {
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: 0 2px 6px rgba(0,0,0,.22); }

.btn-secondary {
  background: var(--bg-surface); color: var(--text-secondary);
  border: 1.5px solid var(--border); box-shadow: var(--shadow-xs);
}
.btn-secondary:hover:not(:disabled) { background: var(--bg-raised); color: var(--text-primary); border-color: var(--input-border); }

.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover:not(:disabled) { background: var(--nav-hover-bg); color: var(--text-primary); }

.btn-success { background: var(--green-600); color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.btn-success:hover:not(:disabled) { background: var(--green-700); }

.btn-danger  { color: var(--red-600); }
.btn-danger:hover:not(:disabled) { background: var(--red-50); }

.btn-full  { width: 100%; justify-content: center; }
.btn-sm    { padding: 5px 11px; font-size: 12px; }
.btn-icon  { padding: 6px; border-radius: var(--radius-sm); }
.btn-icon-lg { padding: 10px; border-radius: var(--radius-sm); }

/* ── Alerts / Badge ──────────────────────────────────────────── */
.alert { padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px; }
.alert-error { background: var(--red-50); color: var(--red-600); border: 1px solid var(--red-200); }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 6px;
  background: var(--accent); color: var(--on-accent);
  border-radius: var(--radius-pill); font-size: 10px; font-weight: 700;
}

/* ── Login Screen ────────────────────────────────────────────── */
#login-screen {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg-base);
}
.login-card {
  background: var(--bg-surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); border: 1px solid var(--border);
  padding: 44px 40px; width: 100%; max-width: 380px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 800; color: var(--text-primary);
  margin-bottom: 28px; letter-spacing: -.02em;
}
.brand-wordmark { display: inline-flex; align-items: baseline; gap: 5px; }
.brand-parent { color: var(--brand-parent); font-family: Georgia, 'Times New Roman', serif; font-weight: 500; letter-spacing: 0; }
.brand-tagline { font-size: 13px; color: var(--text-muted); font-weight: 400; margin-top: 2px; }
.narlo-mark {
  flex-shrink: 0;
  overflow: visible;
  filter: drop-shadow(0 8px 16px rgba(18,22,21,.12));
}
.narlo-mark__outer { fill: var(--brand-mark-bg); }
.narlo-mark__hollow {
  stroke: var(--brand-mark-fg);
  stroke-width: 2.15;
  stroke-linejoin: round;
  fill: rgba(255,255,255,.18);
}
.login-card h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.login-subtitle { color: var(--text-muted); margin-top: 4px; margin-bottom: 26px; font-size: 14px; }
.auth-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 16px; padding: 3px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.auth-tab { border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); padding: 8px 10px; font: inherit; font-weight: 600; cursor: pointer; }
.auth-tab.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.auth-provider-btn { margin-bottom: 8px; justify-content: center; }
.auth-divider { display: flex; align-items: center; gap: 10px; color: var(--text-muted); font-size: 12px; margin: 16px 0 14px; }
.auth-divider::before, .auth-divider::after { content: ""; height: 1px; flex: 1; background: var(--border); }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 16px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); letter-spacing: .01em; }
.field input {
  padding: 9px 12px; border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm); font-size: 14px;
  color: var(--text-primary); background: var(--input-bg);
  font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.field input::placeholder { color: var(--text-muted); }

#login-error { margin-bottom: 14px; }
#login-form .btn-primary { margin-top: 6px; padding: 11px; font-size: 14px; font-weight: 600; }

.password-wrap { position: relative; display: flex; align-items: center; }
.password-wrap input { flex: 1; padding-right: 38px; }
.password-reveal-btn {
  position: absolute; right: 8px;
  background: none; border: none; cursor: pointer;
  padding: 4px; color: var(--text-muted); display: flex; align-items: center;
  border-radius: 4px; transition: color .15s;
}
.password-reveal-btn:hover { color: var(--text-secondary); }

/* ── App Shell ───────────────────────────────────────────────── */
#app-screen { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.app-header {
  height: var(--header-h); display: flex; align-items: center;
  justify-content: space-between; padding: 0 20px;
  background: var(--bg-sidebar); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs); flex-shrink: 0; z-index: 20;
}
.header-left {
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.header-narlo-logo { flex-shrink: 0; border-radius: 6px; }
.header-page-title {
  font-size: 15px; font-weight: 600; color: var(--text-primary); white-space: nowrap;
}
.header-middle {
  flex: 1; max-width: 480px; margin: 0 20px;
}
.header-right {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}

/* ── App Body Grid ───────────────────────────────────────────── */
.app-body {
  display: grid;
  grid-template-columns: var(--nav-w) 6px 1fr 6px var(--chat-w);
  flex: 1; overflow: hidden;
}

/* ── Resize Handles ──────────────────────────────────────────── */
.resize-handle {
  cursor: col-resize;
  position: relative;
  background: transparent;
  z-index: 10;
  user-select: none;
  -webkit-user-select: none;
}

/* Expanded invisible hit zone so a 6px strip is easy to grab */
.resize-handle::before {
  content: '';
  position: absolute;
  inset: 0;
  left: -5px;
  right: -5px;
  cursor: col-resize;
  z-index: 11;
}

/* Visual pill indicator */
.resize-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 36px;
  border-radius: 3px;
  background: var(--border);
  opacity: 0;
  transition: opacity 0.15s, background-color 0.15s, height 0.1s;
  pointer-events: none;
}

.resize-handle:hover::after {
  opacity: 1;
}

.resize-handle.is-dragging::after {
  opacity: 1;
  background: var(--accent);
  height: 56px;
}

body.is-resizing {
  cursor: col-resize !important;
  user-select: none;
  -webkit-user-select: none;
}

/* ── Main area (holds list + detail) ────────────────────────── */
.main-area {
  display: flex; flex-direction: row;
  overflow: hidden; min-width: 0;
}

/* List panel: full-width by default */
.email-list-panel {
  display: flex; flex-direction: column;
  flex: 1; min-width: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-surface);
  overflow: hidden;
}

/* Main content: hidden until detail is needed */
.main-content {
  display: none; flex-direction: column;
  background: var(--bg-base); overflow-y: auto; overflow-x: hidden;
  flex: 1; min-width: 0;
}

/* Gmail-style: hide list when reading, detail fills full width */
.main-area.split-view .email-list-panel { display: none; }
.main-area.split-view .main-content     { display: flex; justify-content: flex-start; }

/* Panel-only: hide list, show content full-width (profile/settings/quotes) */
.main-area.panel-view .email-list-panel { display: none; }
.main-area.panel-view .main-content     { display: flex; justify-content: flex-start; }

/* ── Nav Sidebar ─────────────────────────────────────────────── */
.nav-sidebar {
  display: flex;
  flex-direction: column;
  padding: 10px 8px;
  gap: 0;
  border-right: 1px solid var(--border);
  background: var(--bg-sidebar);
  overflow-y: auto;
  overflow-x: hidden;
  flex-shrink: 0;
  width: var(--nav-w);
  box-sizing: border-box;
}

.compose-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 6px;
  padding: 9px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
}

/* ── Section divider labels (MAIL, SALES LABELS, TOOLS) ── */
.nav-section-label {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  height: 30px;
  padding: 0 10px;
  margin-top: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}
.nav-section-label > span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-section-label:first-of-type { margin-top: 2px; }

.nav-manage-btn {
  flex-shrink: 0;
  padding: 3px 5px;
  opacity: .55;
  border-radius: var(--radius-sm);
}
.nav-manage-btn:hover { opacity: 1; background: var(--nav-hover-bg); }

/* ── Nav item lists ── */
.nav-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex-shrink: 0;
  width: 100%;
}
.nav-labels { min-height: 4px; }
.nav-spacer  { flex: 1; min-height: 8px; }

.nav-bottom {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  width: 100%;
  gap: 1px;
  border-top: 1px solid var(--border-soft);
  padding-top: 6px;
  box-sizing: border-box;
}

/* ── Individual nav rows ── */
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  height: 34px;
  min-height: 34px;
  flex-shrink: 0;
  width: 100%;
  box-sizing: border-box;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  transition: background .12s, color .12s;
  user-select: none;
  overflow: hidden;
  white-space: nowrap;
}
.nav-item > span:not(.nav-count):not(.nav-label-dot) {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-item svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  opacity: .75;
  transition: opacity .12s;
}
.nav-item:hover { background: var(--nav-hover-bg); color: var(--text-primary); }
.nav-item:hover svg { opacity: 1; }
.nav-item.active {
  background: var(--nav-active-bg);
  color: var(--nav-active-text);
  font-weight: 600;
}
.nav-item.active svg { stroke: var(--accent); opacity: 1; }

.nav-count {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent);
  color: var(--on-accent);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  min-width: 18px;
  text-align: center;
  line-height: 1.6;
}

/* ── Label items ── */
.nav-label-item { gap: 8px; padding-right: 6px; min-width: 0; height: 26px; min-height: 26px; font-size: 11px; }
.nav-label-dot {
  width: 10px;
  max-width: 10px;
  min-width: 10px;
  flex: 0 0 10px;
  height: 18px;
  border-radius: 3px;
  transform: skew(-16deg);
}
.nl-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 11px;
}
.nl-count {
  flex: 0 0 auto;
  background: var(--bg-raised);
  color: var(--text-muted);
  border: 1px solid var(--border);
  font-weight: 600;
}
.nav-label-item.active .nl-name { color: var(--text-primary); font-weight: 600; }
.nav-label-item.active {
  background: var(--nav-hover-bg);
  color: var(--text-primary);
}
.nl-edit-btn {
  display: none;
  flex-shrink: 0;
  padding: 2px 5px;
  opacity: .6;
  border-radius: 4px;
}
.nl-edit-btn:hover { opacity: 1; }
.nav-label-item:hover .nl-edit-btn { display: inline-flex; }
.nav-label-item:hover .nl-count    { display: none !important; }

/* ── Email List Toolbar ──────────────────────────────────────── */
.list-toolbar {
  padding: 12px 14px 10px; border-bottom: 1px solid var(--border-soft);
  background: var(--bg-surface); flex-shrink: 0;
  position: sticky; top: 0; z-index: 5;
}
.list-toolbar-row { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.sync-status { font-size: 11px; color: var(--text-muted); min-height: 16px; }

/* ── Priority toggle ─────────────────────────────────────────── */
.priority-toggle {
  display: flex; border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; flex-shrink: 0;
}
.ptog-btn {
  padding: 3px 10px; font-size: 12px; font-weight: 500;
  color: var(--text-secondary); background: transparent; border: none;
  cursor: pointer; transition: background .12s, color .12s; line-height: 1.4;
}
.ptog-btn.active { background: var(--accent); color: var(--on-accent); }
.ptog-btn:not(.active):hover { background: var(--nav-hover-bg); }

@keyframes spin-icon { to { transform: rotate(360deg); } }
.refresh-spinning { animation: spin-icon .7s linear infinite; }

/* Search — pill-shaped */
.search-wrap { position: relative; }
.search-icon {
  position: absolute; left: 10px; top: 50%;
  transform: translateY(-50%); color: var(--text-muted); pointer-events: none;
}
.search-narlo-icon { border-radius: 5px; }
.search-input {
  width: 100%; padding: 8px 12px 8px 40px;
  border: 1.5px solid var(--border); border-radius: var(--radius-pill);
  font-size: 13px; color: var(--text-primary); background: var(--bg-raised);
  font-family: inherit; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); background: var(--bg-surface); }
.search-input::placeholder { color: var(--text-muted); }

/* Skeleton */
.list-loading { padding: 12px 14px; }
.skeleton-item {
  height: 66px; background: var(--bg-raised); border-radius: var(--radius);
  margin-bottom: 6px; animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.email-list { flex: 1; overflow-y: auto; overflow-x: hidden; }

/* ── Email rows ──────────────────────────────────────────────── */
.email-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px 7px 16px; cursor: pointer; min-height: 44px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg-surface);
  transition: background .1s;
  position: relative;
  min-width: 0; max-width: 100%; overflow: hidden;
}
.email-item.has-atts { align-items: flex-start; padding-top: 10px; padding-bottom: 10px; }
.email-item:hover    { background: var(--surface-hover); }
.email-item.selected { background: var(--accent-soft); border-left: 3px solid var(--accent); padding-left: 13px; }

/* Checkbox */
.ei-check-wrap { display: flex; align-items: center; flex-shrink: 0; }
.ei-cb { width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent); }
.ei-cb:not(:checked) { opacity: 0; }
.email-item:hover .ei-cb, .ei-cb:checked { opacity: 1; }

/* Star button */
.ei-star-btn {
  background: none; border: none; cursor: pointer; padding: 2px;
  color: var(--text-muted); flex-shrink: 0; line-height: 1;
  opacity: 0; transition: opacity .15s;
}
.email-item:hover .ei-star-btn, .ei-star-btn.starred { opacity: 1; }
.ei-star-btn.starred { color: #F59E0B; }

/* Content area */
.ei-content { flex: 1; min-width: 0; }

/* Main row: [from fixed] [body flex] [right shrink] */
.ei-row { display: flex; align-items: baseline; gap: 0; min-width: 0; }

/* Sender — fixed width column */
.ei-from {
  width: 115px; min-width: 115px;
  font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  flex-shrink: 0; padding-right: 10px;
  color: var(--text-secondary);
}
.ei-to-prefix { color: var(--text-muted); font-size: 10.5px; font-weight: 400; }

/* Body: subject — snippet */
.ei-body {
  flex: 1; min-width: 0;
  display: flex; align-items: baseline; overflow: hidden;
}
.ei-subject {
  font-size: 12px; font-weight: 500; color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  flex-shrink: 0; max-width: 55%;
}
.ei-sep     { color: var(--text-muted); flex-shrink: 0; padding: 0 4px; font-size: 11px; opacity: .6; }
.ei-snippet { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }

/* Right side: date swapped for hover actions on hover */
.ei-right { display: flex; align-items: center; flex-shrink: 0; margin-left: 10px; min-width: 48px; justify-content: flex-end; }
.ei-date  { font-size: 10px; color: var(--text-muted); white-space: nowrap; opacity: .8; }
.ei-hover-actions { display: none; align-items: center; gap: 1px; }
.email-item:hover .ei-date          { display: none; }
.email-item:hover .ei-hover-actions { display: flex; }

/* Hover quick-action buttons */
.ei-action-btn {
  background: none; border: none; cursor: pointer;
  padding: 3px 4px; border-radius: var(--radius-sm); line-height: 1;
  color: var(--text-muted); flex-shrink: 0;
}
.ei-action-btn:hover { color: var(--text-primary); background: var(--surface-hover); }
.ei-action-btn svg   { display: block; }

/* Label tags row */
.ei-tags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; padding-left: 130px; }
.ei-tag {
  display: inline-flex; align-items: center;
  padding: 1px 7px; border-radius: var(--radius-pill);
  font-size: 10px; font-weight: 600; border: 1px solid;
  white-space: nowrap; line-height: 1.6;
}

/* Gmail label chips in list */
.ei-gmail-tag {
  display: inline-flex; align-items: center;
  padding: 1px 7px; border-radius: var(--radius-pill);
  font-size: 10px; font-weight: 500; white-space: nowrap; line-height: 1.6;
  background: var(--surface-hover); color: var(--text-secondary);
  border: 1px solid var(--border);
}

/* Attachment chips in list */
.ei-attachments { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; padding-left: 130px; }
.ei-att-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 4px;
  border: 1px solid var(--border); background: var(--bg-surface);
  font-size: 11px; color: var(--text-secondary); cursor: pointer;
  font-family: inherit; line-height: 1.5; white-space: nowrap;
  max-width: 180px; overflow: hidden; text-overflow: ellipsis;
  transition: background .1s, border-color .1s;
}
.ei-att-chip:hover { background: var(--surface-hover); color: var(--text-primary); border-color: var(--text-muted); }

/* Unread — strong but not aggressive */
.email-item.unread .ei-from    { font-weight: 600; color: var(--text-primary); }
.email-item.unread .ei-subject { font-weight: 600; color: var(--text-primary); }
.email-item.unread .ei-snippet { color: var(--text-secondary); }
.email-item.unread .ei-date    { font-weight: 500; color: var(--text-secondary); }

/* Read — same background, reduced weight only */
.email-item:not(.unread) .ei-from    { font-weight: 400; color: var(--text-muted); }
.email-item:not(.unread) .ei-subject { font-weight: 400; color: var(--text-secondary); }
.email-item:not(.unread) .ei-snippet { color: var(--text-muted); }

/* List toolbar actions shown when email is selected */
.list-actions { display: flex; align-items: center; gap: 1px; }
.lt-no-selection .dab-icon-btn { opacity: 0.35; cursor: default; }
.lt-no-selection .dab-icon-btn:hover { background: none; color: inherit; }

.lt-select-all { display: flex; align-items: center; margin-right: auto; }
.lt-select-all input { width: 14px; height: 14px; cursor: pointer; accent-color: var(--accent); }
.lt-bulk-count { font-size: 12px; color: var(--text-secondary); white-space: nowrap; padding-right: 2px; }
.email-item.checked { background: var(--accent-soft) !important; }

#action-toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--text-primary); color: var(--bg-surface);
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 13px; display: flex; align-items: center; gap: 12px;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 9999;
}
#action-toast.visible { opacity: 1; pointer-events: auto; }
#action-toast-btn {
  background: none; border: none; cursor: pointer;
  color: #93c5fd; font-size: 13px; font-weight: 600;
  padding: 0; font-family: inherit;
}
#action-toast-btn:hover { text-decoration: underline; }

.list-empty { padding: 48px 20px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ── Main content ────────────────────────────────────────────── */
.main-content { justify-content: flex-start; }
/* Constrained panels keep their own width */
.compose-panel, .settings-panel { align-self: flex-start; }
/* Email detail stretches to fill all available horizontal space */
.email-detail, .sent-detail { align-self: stretch; width: 100%; }

.empty-state {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; color: var(--text-muted);
  font-size: 14px; min-height: 300px;
}

/* ── Email Detail ────────────────────────────────────────────── */
.email-detail { padding: 0; max-width: none; width: 100%; }

.email-header  { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.email-avatar  {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: var(--on-accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; box-shadow: var(--shadow-sm);
}
.email-meta    { flex: 1; min-width: 0; }
.email-from    { font-size: 15px; font-weight: 700; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.email-address { font-size: 12px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.email-date    { font-size: 12px; color: var(--text-muted); flex-shrink: 0; margin-top: 4px; }

/* From / To / CC compact field rows in detail header */
.email-meta-rows { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.email-meta-row {
  display: flex; align-items: baseline; gap: 5px; font-size: 12px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.email-meta-label { color: var(--text-muted); flex-shrink: 0; width: 28px; text-align: right; font-size: 11px; font-weight: 600; letter-spacing: .01em; }
.email-meta-value { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.email-subject { font-size: 20px; font-weight: 700; color: var(--text-primary); margin-bottom: 14px; line-height: 1.3; }

/* ── Detail action bar (sticky, first child of .main-content) ── */
.detail-action-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center;
  padding: 0 16px; height: 44px;
  background: var(--bg-surface); border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-xs); flex-shrink: 0;
}

/* LEFT — navigation (back + folder label) */
.dab-left {
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0; min-width: 100px;
}

/* CENTER — action icons, visually centred */
.dab-center {
  display: flex; align-items: center; gap: 1px;
  flex: 1; justify-content: center;
}

/* RIGHT — sync status + refresh */
.dab-right {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0; min-width: 100px; justify-content: flex-end;
}

.dab-back-btn {
  font-size: 12px; padding: 4px 8px; gap: 4px;
  color: var(--text-muted); white-space: nowrap; flex-shrink: 0;
}
.dab-back-btn:hover { color: var(--accent); }

.dab-icon-btn {
  padding: 5px 6px; border-radius: var(--radius-sm);
  color: var(--text-muted); flex-shrink: 0; opacity: .75;
  transition: color .12s, background .12s, opacity .12s;
}
.dab-icon-btn:hover:not(:disabled) { color: var(--accent); background: var(--accent-soft); opacity: 1; }
.dab-icon-btn svg { display: block; }
.dab-danger:hover:not(:disabled) { color: var(--red-600) !important; background: var(--red-50) !important; }

.dab-center .toolbar-divider { margin: 0 6px; flex-shrink: 0; }

/* Inner detail content (header, toolbar, body) */
.email-detail-inner {
  padding: 18px 36px 36px; overflow-x: hidden;
}

/* .email-toolbar removed — actions moved to #detail-action-bar */
.toolbar-divider { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }

.section-block { margin-bottom: 22px; }
.section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); margin-bottom: 8px;
}

/* ── Reply direction pills ───────────────────────────────────── */
.reply-dir-pills { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.reply-dir-btn {
  padding: 5px 12px; font-size: 12px; font-weight: 500;
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  color: var(--text-secondary); background: var(--bg-surface);
  cursor: pointer; transition: all .12s; white-space: nowrap;
}
.reply-dir-btn:hover { border-color: var(--accent); color: var(--accent); }
.reply-dir-btn.active {
  background: var(--accent-soft); border-color: var(--accent);
  color: var(--accent-text); font-weight: 600;
}
.draft-intent-input {
  width: 100%; resize: vertical; padding: 8px 10px; font-size: 13px;
  font-family: inherit; border: 1px solid var(--input-border);
  border-radius: var(--radius-sm); background: var(--input-bg);
  color: var(--text-primary); outline: none; margin-bottom: 10px; display: block;
}
.draft-intent-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

.draft-actions { margin-bottom: 22px; }
.draft-content {
  background: var(--bg-surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  font-size: 14px; line-height: 1.75; color: var(--text-secondary);
  white-space: pre-wrap; min-height: 80px; box-shadow: var(--shadow-xs);
}
.draft-buttons { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

.generating { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; padding: 12px 0; }
.spinner {
  width: 15px; height: 15px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin .6s linear infinite; flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.draft-indicator { font-size: 11px; color: var(--text-muted); white-space: nowrap; }

/* ── Reply / Forward Area ────────────────────────────────────── */
.reply-area {
  margin-top: 8px; margin-bottom: 28px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-surface); box-shadow: var(--shadow-sm);
}
.reply-area-head {
  padding: 10px 14px; border-bottom: 1px solid var(--border-soft);
  display: flex; flex-direction: column; gap: 6px; background: var(--bg-raised);
}
.reply-mode-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--accent-text);
}
html[data-theme="light"] .reply-mode-label { color: var(--accent); }
.reply-to-wrap, .reply-subject-wrap { display: flex; align-items: center; gap: 8px; }
.reply-field-label { font-size: 12px; color: var(--text-muted); width: 46px; flex-shrink: 0; }
.reply-to-field { flex: 1; border: none; outline: none; font-size: 13px; color: var(--text-primary); font-family: inherit; background: transparent; }
.reply-subject-text { font-size: 13px; color: var(--text-secondary); }
.reply-textarea {
  width: 100%; padding: 13px 14px; border: none; outline: none; resize: vertical;
  font-size: 14px; font-family: inherit; line-height: 1.65;
  color: var(--text-primary); min-height: 120px; display: block; background: var(--bg-surface);
}
.reply-textarea::placeholder { color: var(--text-muted); }
.reply-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-top: 1px solid var(--border-soft); background: var(--bg-raised);
}

/* ── Attachment zone ─────────────────────────────────────────── */
.attach-zone { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; padding: 6px 14px; }
.attach-btn  { gap: 5px; font-size: 12px; color: var(--text-muted); }
.attach-btn:hover { color: var(--text-primary); }
.attach-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: var(--radius-pill);
  background: var(--accent-soft); color: var(--text-secondary);
  font-size: 11.5px; border: 1px solid var(--border);
  max-width: 200px;
}
.attach-chip-img {
  width: 18px; height: 18px; object-fit: cover; border-radius: 2px; flex-shrink: 0;
}
.attach-chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.attach-chip-remove {
  background: none; border: none; cursor: pointer; padding: 0; line-height: 1;
  color: var(--text-muted); font-size: 14px; flex-shrink: 0;
}
.attach-chip-remove:hover { color: var(--text-primary); }

/* Quick reply */
.quick-reply-textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text-primary); background: var(--input-bg);
  resize: vertical; outline: none; font-family: inherit; line-height: 1.6;
  transition: border-color .15s, box-shadow .15s;
}
.quick-reply-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.quick-reply-textarea::placeholder { color: var(--text-muted); }

/* Reply original */
.reply-original { border-top: 1px solid var(--border-soft); margin-top: 2px; }
.reply-toggle-btn { font-size: 11px; color: var(--text-muted); padding: 6px 14px; gap: 4px; width: 100%; justify-content: flex-start; }
.reply-toggle-btn:hover { color: var(--text-secondary); }
.reply-toggle-btn svg { transition: transform .2s; }
.reply-toggle-btn.open svg { transform: rotate(180deg); }
.reply-original-body {
  padding: 10px 14px 12px; font-size: 13px; line-height: 1.65;
  color: var(--text-muted); white-space: pre-wrap; word-break: break-word;
  border-top: 1px solid var(--border-soft); max-height: 260px; overflow-y: auto;
}

/* Star */
.starred svg { fill: #F59E0B; stroke: #F59E0B; }
.starred span { color: #B45309; }

/* ── Email body ──────────────────────────────────────────────── */
.email-body-text {
  font-size: 14.5px; line-height: 1.75; color: var(--text-primary);
  white-space: pre-wrap; overflow-wrap: anywhere;
  letter-spacing: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px 18px;
  max-width: 100%;
}

/* Quoted reply lines (plain-text emails, lines starting with >) */
.email-quote-line {
  color: var(--text-muted);
  opacity: .85;
  border-left: 2px solid var(--border);
  padding-left: 10px;
  display: block;
  font-size: 13.5px;
}
/* Attribution line ("On Thu ... wrote:") */
.email-quote-attr {
  color: var(--text-muted);
  font-size: 12.5px;
  display: block;
  margin-top: 8px;
}

/* Email signature separator (--) and signature lines in plain-text emails */
.email-sig-sep {
  display: block;
  height: 1px;
  background: var(--border);
  margin: 10px 0 6px;
  opacity: 0.6;
}
.email-signature-line {
  color: var(--text-muted);
  font-size: 13px;
  opacity: 0.8;
  display: block;
}

.email-body-loading { font-size: 13px; color: var(--text-muted); padding: 8px 0; }
.email-body-html {
  width: 100%; max-width: 100%; min-height: 300px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-surface);
  display: block; overflow: hidden;
  box-shadow: var(--shadow-xs);
}
html[data-theme="dark"] .email-body-html { background: #151922; border-color: rgba(148,163,184,.24); }

/* ── Email summary ───────────────────────────────────────────── */
.email-summary-text {
  font-size: 13.5px; line-height: 1.65; color: var(--text-primary);
  background: var(--bg-raised); border-radius: 8px; padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
}
html[data-theme="dark"] .email-summary-text { background: rgba(255,255,255,.045); border-color: rgba(148,163,184,.22); }

/* ── Email attachments ───────────────────────────────────────── */
.attachment-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 6px; background: var(--bg-raised);
  cursor: pointer; transition: background .1s, border-color .1s;
}
.attachment-item:hover { background: var(--surface-hover); border-color: var(--text-muted); }
.attachment-icon { font-size: 16px; flex-shrink: 0; }
.attachment-name { font-size: 13px; font-weight: 500; color: var(--text-primary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-meta { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.attachment-open-icon { color: var(--text-muted); flex-shrink: 0; opacity: 0; transition: opacity .1s; }
.attachment-item:hover .attachment-open-icon { opacity: 1; }

/* ── Detail labels ───────────────────────────────────────────── */
.detail-labels { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.label-chip {
  display: inline-flex; align-items: center;
  padding: 3px 11px; border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; border: 1px solid;
}

/* ── Training Room ───────────────────────────────────────────── */
.training-overlay { position: fixed; inset: 0; background: rgba(8,12,22,.5); z-index: 40; backdrop-filter: blur(3px); }
.training-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: var(--panel-w); background: var(--bg-surface);
  border-left: 1px solid var(--border);
  z-index: 50; display: flex; flex-direction: column; box-shadow: var(--shadow-xl);
}
.training-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.training-title  { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.training-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.msg-draft { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.msg-draft .msg-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 6px; }
.msg-draft .msg-body  { font-size: 13px; line-height: 1.65; color: var(--text-secondary); white-space: pre-wrap; }
.msg-user {
  align-self: flex-end; background: var(--accent); color: var(--on-accent);
  border-radius: var(--radius); padding: 10px 14px; max-width: 82%;
  font-size: 13px; line-height: 1.5; box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.msg-ai { background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-xs); }
.msg-ai .msg-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin-bottom: 6px; }
.msg-ai .msg-body  { font-size: 13px; line-height: 1.65; color: var(--text-secondary); white-space: pre-wrap; }
.tone-insight { margin: 0 16px 8px; padding: 10px 13px; background: var(--amber-50); border: 1px solid var(--amber-200); border-radius: var(--radius-sm); font-size: 12px; color: var(--amber-700); line-height: 1.5; }
.training-footer { flex-shrink: 0; padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; background: var(--bg-surface); }
.training-input-row { display: flex; gap: 8px; align-items: flex-end; }
.training-textarea {
  flex: 1; padding: 10px 12px; border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text-primary);
  background: var(--input-bg); resize: none; outline: none; font-family: inherit; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
.training-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.training-textarea::placeholder { color: var(--text-muted); }
.msg-refining { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; padding: 4px 0; }

/* ── Onboarding ──────────────────────────────────────────────── */
#onboarding-screen { display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; background: var(--bg-base); padding: 40px 16px; }
.onboarding-wrap { width: 100%; max-width: 540px; }
.onboarding-card { background: var(--bg-surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); border: 1px solid var(--border); padding: 36px 40px; }
.onboarding-card h1 { font-size: 22px; font-weight: 700; color: var(--text-primary); }
.ob-question { margin-bottom: 22px; }
.ob-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; }
.ob-optional { font-weight: 400; color: var(--text-muted); }
.ob-options { display: flex; flex-wrap: wrap; gap: 8px; }
.ob-option {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px; border: 1.5px solid var(--input-border);
  border-radius: var(--radius-pill); cursor: pointer; font-size: 13px;
  color: var(--text-secondary); transition: border-color .15s, background .15s; user-select: none;
}
.ob-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.ob-option input[type="radio"] { display: none; }
.ob-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.ob-textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text-primary);
  background: var(--input-bg); resize: none; outline: none; font-family: inherit; line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
.ob-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.ob-textarea::placeholder { color: var(--text-muted); }

/* ── Compose ─────────────────────────────────────────────────── */
.compose-fields { border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; background: var(--bg-surface); box-shadow: var(--shadow-xs); }
.compose-field-row { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-bottom: 1px solid var(--border-soft); }
.compose-field-row:last-child { border-bottom: none; }
.compose-field-label { font-size: 12px; color: var(--text-muted); width: 52px; flex-shrink: 0; font-weight: 500; }
.compose-field-input { flex: 1; border: none; outline: none; font-size: 13px; color: var(--text-primary); font-family: inherit; background: transparent; }
.compose-field-input::placeholder { color: var(--text-muted); }
.compose-panel { padding: 28px 36px; max-width: 760px; }
.compose-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.compose-title { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.compose-tabs { display: flex; margin-bottom: 22px; border-bottom: 2px solid var(--border); }
.compose-tab {
  padding: 8px 18px; font-size: 13px; font-weight: 500; color: var(--text-muted);
  background: none; border: none; font-family: inherit; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -2px; transition: color .15s, border-color .15s;
}
.compose-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.compose-tab:hover:not(.active) { color: var(--text-secondary); }
.compose-tab-panel { display: flex; flex-direction: column; gap: 14px; }
.compose-textarea {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm); font-size: 14px; color: var(--text-primary); background: var(--input-bg);
  resize: vertical; outline: none; font-family: inherit; line-height: 1.65; min-height: 80px;
  transition: border-color .15s, box-shadow .15s;
}
.compose-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.compose-textarea::placeholder { color: var(--text-muted); }

/* ── Label context menu ──────────────────────────────────────── */
.label-ctx-menu { position: fixed; z-index: 300; background: var(--bg-surface); border: 1.5px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px; width: 248px; }
.lcm-section { display: flex; flex-direction: column; }
.lcm-field-row { display: flex; align-items: center; gap: 8px; }
.lcm-name-input { font-size: 13px; }
.lcm-divider { height: 1px; background: var(--border); margin: 10px -10px; width: calc(100% + 20px); }
.lcm-action { width: 100%; justify-content: flex-start; gap: 7px; font-size: 12px; padding: 6px 8px; border-radius: var(--radius-sm); }

/* ── Header avatar ───────────────────────────────────────────── */
.header-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--accent);
  color: var(--on-accent); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
  background-size: cover; background-position: center;
  box-shadow: 0 0 0 2px var(--bg-surface), 0 0 0 3px var(--border);
}
.header-avatar.has-image { background-color: transparent; }

/* ── Label picker ────────────────────────────────────────────── */
.label-picker { position: fixed; z-index: 200; background: var(--bg-surface); border: 1.5px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 10px; min-width: 210px; }
.label-picker-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 8px; padding: 0 2px; }
.label-picker-list { display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow-y: auto; }
.label-picker-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px; color: var(--text-secondary); }
.label-picker-item:hover { background: var(--nav-hover-bg); }
.label-picker-item input[type=checkbox] { accent-color: var(--accent); }
.label-picker-footer { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }

/* ── Modal ───────────────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(6,10,20,.55); z-index: 1000; backdrop-filter: blur(3px); }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); z-index: 1010; background: var(--bg-surface); border-radius: var(--radius-lg); border: 1.5px solid var(--border); box-shadow: var(--shadow-xl); width: 490px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; max-height: 80vh; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.modal-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.modal-body  { padding: 18px 22px; overflow-y: auto; }

/* ── Manage labels ───────────────────────────────────────────── */
.manage-labels-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.manage-labels-empty { font-size: 13px; color: var(--text-muted); padding: 8px 0; }
.manage-label-row { display: flex; align-items: center; gap: 8px; }
.ml-count { font-size: 12px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.manage-labels-add { display: flex; align-items: center; gap: 8px; padding-top: 13px; border-top: 1px solid var(--border); }
.color-input { width: 36px; height: 32px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); padding: 2px 3px; background: var(--bg-surface); cursor: pointer; flex-shrink: 0; }

/* ── Settings / Profile ──────────────────────────────────────── */
.settings-panel { padding: 30px 36px; max-width: 660px; }
.settings-header { margin-bottom: 24px; }
.settings-header h2 { font-size: 20px; font-weight: 700; color: var(--text-primary); }
.settings-body { display: flex; flex-direction: column; }
.settings-section { padding: 22px 0; border-bottom: 1px solid var(--border); }
.settings-section:last-child { border-bottom: none; }
.settings-section-title { font-size: 11px; font-weight: 700; color: var(--text-muted); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .07em; }
.settings-section .field { margin-bottom: 14px; }
.settings-section .field:last-child { margin-bottom: 0; }
.settings-section .field label { color: var(--text-secondary); }
.settings-input {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text-primary);
  background: var(--input-bg); outline: none; font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.settings-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.settings-input:disabled { opacity: .5; cursor: not-allowed; background: var(--bg-raised); }
.settings-input::placeholder { color: var(--text-muted); }
.settings-select {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--text-primary);
  background: var(--input-bg); outline: none; font-family: inherit; cursor: pointer;
}
.settings-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.settings-hint { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-top: 6px; }
.settings-toggle-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 9px 0; }
.settings-toggle-label { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-bottom: 2px; }
.settings-toggle-row .settings-hint { margin-top: 2px; }
.toggle-switch { position: relative; flex-shrink: 0; }
.toggle-switch input { display: none; }
.toggle-track { display: block; width: 40px; height: 22px; border-radius: 11px; background: var(--border); cursor: pointer; transition: background .2s; position: relative; }
.toggle-track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.toggle-switch input:checked + .toggle-track { background: var(--accent); }
.toggle-switch input:checked + .toggle-track::after { transform: translateX(18px); }
.settings-actions { padding-top: 22px; display: flex; align-items: center; gap: 12px; }
.settings-status  { font-size: 13px; color: var(--green-600); font-weight: 500; }

/* 2FA backup codes grid */
.backup-codes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.backup-code-item  { display: block; padding: 6px 10px; font-family: monospace; font-size: 13px; background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-sm); text-align: center; color: var(--text-primary); letter-spacing: .05em; }

/* Mandatory 2FA setup banner */
.twofa-required-banner {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 10px 20px; background: #fef9c3; border-bottom: 1px solid #fde047;
  font-size: 13px; color: #713f12; z-index: 9999; position: relative;
}

/* Theme options */
.theme-options { display: flex; gap: 8px; flex-wrap: wrap; }
.theme-option {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 14px; border: 1.5px solid var(--input-border);
  border-radius: var(--radius-pill); cursor: pointer; font-size: 13px;
  color: var(--text-secondary); transition: border-color .15s, background .15s;
}
.theme-option:hover { border-color: var(--accent); background: var(--accent-soft); }
.theme-option input { display: none; }
.theme-option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
html[data-theme="light"] .theme-option:has(input:checked) { color: var(--accent); }
.theme-option--inactive { opacity: .45; cursor: not-allowed; pointer-events: none; }
.theme-coming-later { font-size: 10px; color: var(--text-muted); font-weight: 400; border: 1px solid var(--input-border); border-radius: 8px; padding: 1px 5px; margin-left: 2px; }

/* Profile avatar */
.profile-avatar-row { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.profile-avatar-fields { flex: 1; }
.profile-avatar-lg { width: 68px; height: 68px; border-radius: 50%; flex-shrink: 0; background: var(--accent); color: var(--on-accent); display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700; background-size: cover; background-position: center; box-shadow: var(--shadow); }
.profile-avatar-lg.has-image { background-color: transparent; }

/* ── Pricing inputs ──────────────────────────────────────────── */
.pct-input-wrap { display: flex; align-items: center; gap: 7px; }
.pct-input      { width: 110px !important; }
.pct-symbol     { font-size: 14px; color: var(--text-muted); }
.settings-hint-inline { font-size: 11px; color: var(--text-muted); font-weight: 400; }

/* ── Full-width list panels (drafts, scheduled) ──────────────── */
#drafts-panel,
#scheduled-panel {
  max-width: none;
  width: 100%;
  padding: 24px 28px;
  box-sizing: border-box;
}

/* ── Quote Builder ───────────────────────────────────────────── */
.quotes-panel { max-width: 960px !important; }
.quote-list { display: flex; flex-direction: column; gap: 8px; }
.quote-list-item { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--radius); background: var(--bg-surface); border: 1.5px solid var(--border); cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .1s; box-shadow: var(--shadow-xs); }
.quote-list-item:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.qli-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.qli-meta  { font-size: 12px; color: var(--text-muted); }
.quote-detail-header { display: flex; align-items: center; gap: 8px; padding-bottom: 18px; margin-bottom: 6px; border-bottom: 1px solid var(--border); }
.quote-items-wrap { overflow-x: auto; margin-top: 12px; }
.quote-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.quote-table th { text-align: left; padding: 7px 9px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); background: var(--bg-raised); border-bottom: 1px solid var(--border); }
.quote-table td { padding: 7px 9px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
.qitem-row:hover { background: var(--surface-hover); }
.qitem-below-floor { background: rgba(251,191,36,.08) !important; }
.qi-input { width: 100%; border: 1.5px solid transparent; border-radius: var(--radius-sm); padding: 4px 7px; font-size: 13px; background: transparent; color: var(--text-primary); transition: border-color .15s, background .15s; font-family: inherit; }
.qi-input:focus { outline: none; border-color: var(--accent); background: var(--input-bg); box-shadow: 0 0 0 2px var(--accent-ring); }
.qi-num { width: 84px; }
.qi-floor, .qi-sugg, .qi-rrp, .qi-customer-margin, .qi-save-status { color: var(--text-muted); font-size: 12px; }
.qi-margin { font-weight: 600; font-size: 12px; }
.qi-margin-warn { color: #F59E0B; }
.qitem-warn { color: #F59E0B; margin-left: 4px; }
.qi-retail-wrap { display: flex; flex-direction: column; gap: 3px; min-width: 92px; }
.qi-retail-source { font-size: 10px; color: var(--text-muted); line-height: 1.2; }
.qi-save-status { min-height: 14px; line-height: 1.2; }
.qi-save-status.is-saving { color: var(--text-muted); }
.qi-save-status.is-saved { color: var(--green-600); }
.qi-save-status.is-failed { color: var(--red-600); }
.qi-overridden { border-color: rgba(245,158,11,.55); background: rgba(245,158,11,.08); }
.quote-items-empty { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }
.quote-summary { margin-top: 14px; padding: 14px 18px; background: var(--bg-raised); border-radius: var(--radius); border: 1px solid var(--border); }
.quote-summary-row { display: flex; flex-wrap: wrap; gap: 18px; font-size: 13px; color: var(--text-secondary); }
.quote-summary-row strong { color: var(--text-primary); }

/* ── Quote Builder v2: Tabs, status, product search, products table ── */
.qb-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.qb-tab { padding: 7px 18px; font-size: 13px; font-weight: 500; border: none; background: none; color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s; font-family: inherit; }
.qb-tab:hover { color: var(--text-primary); }
.qb-tab.qb-tab-active { color: var(--accent); border-bottom-color: var(--accent); }

/* Status badge in detail header */
.quote-status-badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 10px; border-radius: var(--radius-pill); }
.quote-status-badge.qs-draft    { background: var(--bg-raised); color: var(--text-muted); border: 1px solid var(--border); }
.quote-status-badge.qs-approved { background: #dcfce7; color: #166534; }
.quote-status-badge.qs-sent     { background: var(--accent-soft); color: var(--accent); }

/* Quote list item: status + customer indicators */
.qli-customer { font-size: 12px; color: var(--text-secondary); }
.qli-status   { font-size: 10px; font-weight: 700; text-transform: uppercase; padding: 1px 7px; border-radius: var(--radius-pill); flex-shrink: 0; }
.qli-status.qs-draft    { background: var(--bg-raised); color: var(--text-muted); border: 1px solid var(--border); }
.qli-status.qs-approved { background: #dcfce7; color: #166534; }
.qli-status.qs-sent     { background: var(--accent-soft); color: var(--accent); }
.qli-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* Product search in items section */
.product-search-wrap { position: relative; margin-bottom: 10px; }
.product-search-input { max-width: 340px; }
.product-search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 50;
  min-width: 340px; max-width: 480px;
  background: var(--bg-surface); border: 1.5px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  overflow: hidden;
}
.psd-item {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px; cursor: pointer; transition: background .1s;
  border-bottom: 1px solid var(--border-soft);
}
.psd-item:last-child { border-bottom: none; }
.psd-item:hover { background: var(--surface-hover); }
.psd-name  { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.psd-meta  { font-size: 11px; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; }
.psd-empty { padding: 12px 14px; font-size: 13px; color: var(--text-muted); text-align: center; }

/* Items table: new columns */
.qi-qty  { width: 60px; }
.qi-sku  { font-size: 10px; color: var(--text-muted); margin-top: 1px; }
.qi-normal-sell { color: var(--text-muted); font-size: 12px; }

/* Products tab */
.products-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.products-table-wrap { overflow-x: auto; }
.products-table td { white-space: nowrap; }
.products-table .pt-name { white-space: normal; min-width: 160px; }

/* ── Quote Builder: Pricing upload & integrations ────────────── */
.quote-header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pricing-file-label { cursor: pointer; }
.pricing-file-hint { font-size: 12px; color: var(--text-muted); padding: 8px 0 0; }
.pricing-file-hint strong { color: var(--accent-text); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.integration-list { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.integration-item { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-raised); }
.integration-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.integration-badge { font-size: 11px; font-weight: 600; color: var(--text-muted); background: var(--bg-surface); border: 1px solid var(--border); border-radius: var(--radius-pill); padding: 2px 10px; }
.integration-item.available .integration-badge { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }

/* ── Chat to Narlo Panel ───────────────────────────────────────── */
.chat-panel {
  display: flex; flex-direction: column;
  border-left: 1px solid var(--border-soft);
  background: var(--bg-base);
  overflow: hidden;
  min-width: 0;
}
.chat-panel-header {
  padding: 10px 12px 8px; border-bottom: 1px solid var(--border-soft); flex-shrink: 0;
}
.chat-ph-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 6px;
}
.chat-panel-title {
  font-size: 12.5px; font-weight: 600; color: var(--text-secondary); letter-spacing: -.01em;
}
.chat-panel-subtitle {
  font-size: 11px; color: var(--text-muted); margin-top: 1px;
}

/* Layout preset strip */
.layout-presets {
  display: flex; align-items: center; gap: 3px; margin-top: 7px;
}
.layout-preset-btn {
  font-size: 10px; font-weight: 500; line-height: 1;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  white-space: nowrap;
}
.layout-preset-btn:hover {
  border-color: var(--accent);
  color: var(--accent-text);
  background: var(--accent-soft);
}
.layout-preset-btn.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}
.layout-reset-btn {
  font-size: 13px; padding: 2px 5px; line-height: 1;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.layout-reset-btn:hover { color: var(--text-secondary); border-color: var(--border); }
.chat-messages {
  flex: 1; overflow-y: auto;
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
  scroll-behavior: smooth;
}
.chat-msg {
  font-size: 12px; line-height: 1.55; padding: 8px 11px;
  border-radius: var(--radius); word-break: break-word; max-width: 100%;
}
.chat-msg-user {
  background: var(--accent); color: var(--on-accent);
  border-radius: var(--radius) var(--radius) 2px var(--radius);
  align-self: flex-end;
}
.chat-msg-narlo {
  background: var(--bg-surface); color: var(--text-primary);
  border: 1px solid var(--border-soft);
  border-radius: 2px var(--radius) var(--radius) var(--radius);
  align-self: flex-start;
}
.chat-msg-thinking {
  background: var(--bg-surface); color: var(--text-muted);
  border: 1px solid var(--border-soft);
  border-radius: 2px var(--radius) var(--radius) var(--radius);
  align-self: flex-start; font-style: italic;
}
.chat-msg-narlo strong { font-weight: 600; color: var(--text-primary); }
.chat-bullet { padding-left: 12px; position: relative; margin: 1px 0; }
.chat-bullet::before { content: '•'; position: absolute; left: 2px; color: var(--accent); }
.chat-divider { border: none; border-top: 1px dashed var(--border-soft); margin: 6px 0; }
.chat-input-area {
  padding: 8px 10px; border-top: 1px solid var(--border-soft);
  display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0;
}
.chat-textarea {
  flex: 1; resize: none;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 7px 10px;
  font-size: 12px; color: var(--text-primary);
  font-family: inherit; line-height: 1.5; max-height: 100px;
  transition: border-color .15s, box-shadow .15s;
}
.chat-textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
.chat-send-btn { flex-shrink: 0; }
.chat-quick-actions {
  padding: 6px 10px 5px;
  display: flex; flex-wrap: wrap; gap: 4px;
  border-top: 1px solid var(--border-soft); flex-shrink: 0;
}
.narlo-chip {
  font-size: 11px; padding: 3px 8px;
  border-radius: 12px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted);
  cursor: pointer; white-space: nowrap;
  font-family: inherit; line-height: 1.4;
  transition: background .13s, color .13s, border-color .13s;
}
.narlo-chip:hover {
  background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent);
}
.narlo-chip:disabled { opacity: 0.4; cursor: not-allowed; }

/* Draft cards in chat panel */
.narlo-draft-cards { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.narlo-draft-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
}
.odc-header { display: flex; flex-direction: column; gap: 1px; }
.odc-to { font-size: 11px; font-weight: 600; color: var(--text-primary); }
.odc-subject { font-size: 11px; color: var(--text-muted); }
.odc-preview {
  font-size: 11.5px; color: var(--text-secondary); line-height: 1.45;
  white-space: pre-wrap; word-break: break-word;
}
.odc-actions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.odc-btn {
  font-size: 11px; padding: 3px 9px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg-raised);
  color: var(--text-secondary); cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.odc-btn:hover { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent); }
.odc-insert { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.odc-insert:hover { background: var(--accent); color: var(--on-accent); }
.odc-dismiss:hover { background: var(--red-50); color: var(--red-600); border-color: var(--red-600); }

/* Compose-new draft card (single outbound draft from Narlo) */
.narlo-compose-card {
  background: var(--bg-surface); border: 1px solid var(--accent);
  border-radius: var(--radius); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 8px; width: 100%;
}
.occ-header { display: flex; align-items: center; gap: 6px; }
.occ-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--accent-text);
}
.occ-preview {
  font-size: 12px; color: var(--text-secondary); line-height: 1.5;
  white-space: pre-wrap; word-break: break-word;
}
.occ-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.occ-copy   { border-color: var(--border); }
.occ-open   { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.occ-open:hover { background: var(--accent); color: var(--on-accent); }
.occ-improve { border-color: var(--border); }

/* Responsive: collapse chat panel on narrow screens */
@media (max-width: 1180px) {
  .chat-panel  { display: none; }
  #resize-right { display: none; }
  .app-body    { grid-template-columns: var(--nav-w) 6px 1fr; }
}

/* ── Email threading ─────────────────────────────────────────── */

/* Thread count badge in email list */
.thread-count {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-raised); border: 1px solid var(--border);
  border-radius: var(--radius-pill); font-size: 10px; font-weight: 700;
  color: var(--text-muted); padding: 0 6px; min-width: 20px; height: 16px;
  margin-left: 5px; vertical-align: middle; flex-shrink: 0;
}
.email-item.unread .thread-count {
  background: var(--accent-soft); color: var(--accent-text); border-color: transparent;
}

/* Thread above: previous messages in the chain */
.thread-above {
  margin: 24px 0 8px;
}
.thread-above-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted); margin-bottom: 8px;
}
.thread-msg-item {
  border-bottom: 1px solid var(--border-soft);
  cursor: pointer;
}
.thread-msg-item:first-child { border-top: 1px solid var(--border-soft); }
.thread-msg-head {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; transition: background .12s;
}
.thread-msg-item:hover .thread-msg-head { background: var(--surface-hover); padding-left: 8px; padding-right: 8px; border-radius: var(--radius-sm); }
.tm-avatar {
  width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.tm-meta { display: flex; flex-direction: column; flex-shrink: 0; min-width: 130px; }
.tm-from { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.tm-to   { font-size: 11px; color: var(--text-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.tm-date { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.tm-snippet {
  flex: 1; font-size: 12px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tm-chevron {
  flex-shrink: 0; color: var(--text-muted); transition: transform .18s;
}
.tm-chevron.flipped { transform: rotate(180deg); }
.tm-body {
  padding: 10px 0 14px 38px;
  font-size: 13px; line-height: 1.65; color: var(--text-secondary);
  white-space: pre-wrap; word-break: break-word;
  border-top: 1px solid var(--border-soft);
}
/* Divider between last thread message and the latest */
.thread-latest-divider {
  display: flex; align-items: center; gap: 10px;
  margin: 16px 0 18px; color: var(--text-muted); font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .06em;
}
.thread-latest-divider::before,
.thread-latest-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border-soft);
}

/* ── Undo Send Toast ─────────────────────────────────────────── */
#undo-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: var(--radius);
  background: var(--bg-raised); border: 1px solid var(--border);
  box-shadow: var(--shadow-lg); z-index: 9999;
  font-size: 13px; color: var(--text-primary);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
}
#undo-toast.visible {
  opacity: 1; pointer-events: auto;
  transform: translateX(-50%) translateY(0);
}
#undo-toast-msg { font-weight: 500; }
#undo-toast-timer { color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 14px; }
#undo-toast-btn {
  padding: 4px 10px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--on-accent);
  font-size: 12px; font-weight: 600; border: none; cursor: pointer;
  font-family: inherit; transition: background .15s;
}
#undo-toast-btn:hover { background: var(--accent-hover); }

/* ── Thread message actions ──────────────────────────────────── */
.tm-actions {
  display: flex; gap: 6px; padding: 6px 10px 10px 42px;
  border-top: 1px solid var(--border-soft);
}
.tm-action-btn {
  font-size: 12px; padding: 3px 8px; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 4px;
  border-radius: var(--radius-sm);
}
.tm-action-btn:hover { color: var(--accent); background: var(--accent-soft); }

/* ── Send Later modal ────────────────────────────────────────── */
.modal-card {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 1001; background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xl);
  width: 340px; max-width: calc(100vw - 32px);
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px 12px; border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body { padding: 16px 18px; }
.modal-footer {
  display: flex; gap: 8px; justify-content: flex-end;
  padding: 12px 18px; border-top: 1px solid var(--border);
}
.sl-presets { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.sl-preset-btn {
  text-align: left; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--bg-surface); color: var(--text-primary);
  font-size: 13px; font-family: inherit; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.sl-preset-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.sl-label { font-size: 12px; color: var(--text-muted); display: block; margin-bottom: 6px; }

/* ── Scheduled panel ─────────────────────────────────────────── */
.sched-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border-soft); gap: 12px;
}
.sched-item:last-child { border-bottom: none; }
.sched-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sched-to   { font-size: 12px; color: var(--text-muted); }
.sched-subj { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sched-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sched-time  { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.sched-status { font-size: 11px; padding: 2px 7px; border-radius: 10px; font-weight: 500; text-transform: capitalize; }
.sched-status-scheduled  { background: var(--accent-soft); color: var(--accent); }
.sched-status-sent       { background: var(--green-soft, #dcfce7); color: var(--green-700, #15803d); }
.sched-status-failed     { background: var(--red-soft, #fee2e2); color: var(--red-700, #b91c1c); }
.sched-status-cancelled  { background: var(--bg-tertiary); color: var(--text-muted); }
.sched-actions { display: flex; gap: 4px; align-items: center; }

/* ── Drafts panel ────────────────────────────────────────────── */
.draft-item {
  border-bottom: 1px solid var(--border-soft);
  transition: background .1s; cursor: pointer;
}
.draft-item:hover { background: var(--surface-hover); }
.draft-item:last-child { border-bottom: none; }
.draft-item-header { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.draft-item-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-item-time { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.draft-item-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.draft-item-preview { font-size: 12px; color: var(--text-secondary); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.draft-item-actions { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.draft-type-badge { font-size: 10px; font-weight: 600; padding: 1px 7px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); }
.draft-type-badge.draft-type-gmail { background: var(--surface-hover); color: var(--text-secondary); border: 1px solid var(--border); }
.draft-type-badge.draft-type-ai { background: var(--accent-soft); color: var(--accent-text); }
[data-theme="dark"] .draft-type-badge.draft-type-ai { background: var(--accent-soft); color: var(--accent-text); }
.draft-item-readonly { opacity: .92; }
.draft-item-readonly .draft-item-title { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.draft-gmail-hint { font-size: 10px; color: var(--text-muted); margin-left: auto; font-style: italic; }

/* ── Snoozed indicator in email rows ─────────────────────────── */
.ei-snooze-until { font-size: 10px; color: var(--accent); font-weight: 500; white-space: nowrap; }

/* ── Inbox Coach ─────────────────────────────────────────────── */
.nav-coach-badge { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: auto; flex-shrink: 0; }
.coach-panel { display: flex; flex-direction: column; gap: 0; padding: 24px 28px; overflow-y: auto; }
.coach-header { margin-bottom: 14px; }
.coach-header-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; gap: 12px; }
.coach-header-top h2 { font-size: 17px; font-weight: 600; margin: 0; }
.coach-subtitle { font-size: 13px; color: var(--text-secondary); margin: 0; }
.coach-trigger-banner { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid var(--accent); color: var(--accent); font-size: 12px; font-weight: 500; margin-bottom: 16px; }
.coach-loading { display: flex; align-items: center; gap: 10px; padding: 20px 0; color: var(--text-secondary); font-size: 13px; }
.coach-results { display: flex; flex-direction: column; gap: 18px; }
.coach-section { display: flex; flex-direction: column; gap: 6px; }
.coach-section-header { display: flex; align-items: center; gap: 7px; padding: 0 0 4px; border-bottom: 1px solid var(--border); margin-bottom: 2px; }
.coach-section-title { font-size: 12px; font-weight: 600; flex: 1; }
.coach-section-count { font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 10px; }
.coach-section-risks-header    { color: #dc2626; }
.coach-section-risks-header    .coach-section-count { background: #fee2e2; color: #dc2626; }
.coach-section-action-header   { color: var(--accent); }
.coach-section-action-header   .coach-section-count { background: var(--accent-soft); color: var(--accent); }
.coach-section-important-header { color: #d97706; }
.coach-section-important-header .coach-section-count { background: #fef3c7; color: #d97706; }
.coach-section-followup-header { color: #059669; }
.coach-section-followup-header .coach-section-count { background: #d1fae5; color: #059669; }
.coach-section-archive-header  { color: var(--text-secondary); }
.coach-section-archive-header  .coach-section-count { background: var(--surface-hover); color: var(--text-secondary); }
[data-theme="dark"] .coach-section-risks-header    .coach-section-count { background: #450a0a; }
[data-theme="dark"] .coach-section-important-header .coach-section-count { background: #451a03; }
[data-theme="dark"] .coach-section-followup-header .coach-section-count { background: #052e16; }
.coach-item-list { display: flex; flex-direction: column; gap: 6px; }
.coach-item { display: flex; align-items: flex-start; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-primary); transition: border-color .15s; }
.coach-item:hover { border-color: var(--accent-soft); }
.coach-item-body { flex: 1; min-width: 0; }
.coach-item-from { font-size: 11px; color: var(--text-muted); margin-bottom: 1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.coach-item-subject { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 2px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.coach-item-detail { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
.coach-open-btn { flex-shrink: 0; align-self: center; }
.coach-confidence-badge { font-size: 10px; font-weight: 500; padding: 1px 6px; border-radius: 10px; background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--border); }
.coach-archive-footer { display: flex; align-items: center; gap: 12px; padding: 10px 0 2px; border-top: 1px solid var(--border); margin-top: 4px; }
.coach-select-all-label { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); cursor: pointer; flex: 1; }
.coach-empty-result { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 0; color: var(--text-muted); font-size: 13px; text-align: center; }
.coach-archive-cb { flex-shrink: 0; margin-top: 3px; cursor: pointer; }

/* ── Business Memory ─────────────────────────────────────────── */
.memory-panel { display: flex; flex-direction: column; gap: 0; padding: 24px 28px; overflow-y: auto; }
.memory-header { margin-bottom: 4px; }
.memory-header h2 { font-size: 17px; font-weight: 600; margin: 0 0 4px; }
.memory-subtitle { font-size: 13px; color: var(--text-secondary); margin: 0 0 18px; }
.memory-search-row { display: flex; gap: 8px; margin-bottom: 20px; }
.memory-query-input {
  flex: 1; padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--bg-primary); color: var(--text-primary); font-size: 13px;
  outline: none; transition: border-color .15s;
}
.memory-query-input:focus { border-color: var(--accent); }
.memory-empty { padding: 12px 0; }
.memory-empty-label { font-size: 12px; color: var(--text-muted); margin: 0 0 10px; }
.memory-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.memory-chip {
  padding: 5px 11px; border-radius: 14px; border: 1px solid var(--border);
  background: var(--surface-hover); color: var(--text-secondary); font-size: 12px;
  cursor: pointer; transition: border-color .15s, color .15s;
}
.memory-chip:hover { border-color: var(--accent); color: var(--accent); }
.memory-loading { display: flex; align-items: center; gap: 10px; padding: 20px 0; color: var(--text-secondary); font-size: 13px; }
.memory-spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
.memory-results { display: flex; flex-direction: column; gap: 16px; }
.memory-summary-card {
  background: var(--surface-hover); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  font-size: 13px; line-height: 1.6; color: var(--text-primary);
  white-space: pre-wrap;
}
.memory-sources-header { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding-top: 4px; }
.memory-source-list { display: flex; flex-direction: column; gap: 8px; }
.memory-thread-item {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 14px; background: var(--bg-primary);
  transition: border-color .15s;
}
.memory-thread-item:hover { border-color: var(--accent-soft); }
.memory-thread-meta { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 3px; gap: 8px; }
.memory-from { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.memory-date { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.memory-subject { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 3px; display: flex; align-items: center; gap: 6px; }
.memory-snippet { font-size: 12px; color: var(--text-secondary); line-height: 1.4; margin-bottom: 6px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.memory-thread-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 4px; }
.memory-email-count { font-size: 11px; color: var(--text-muted); }
.memory-att-badge { font-size: 10px; font-weight: 500; padding: 1px 6px; border-radius: 10px; background: var(--surface-hover); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Private beta banner ─────────────────────────────────────── */
.beta-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  padding: 5px 16px; text-align: center;
  font-size: 11px; font-weight: 500; letter-spacing: 0.01em;
  color: var(--text-muted); background: var(--bg-secondary);
  border-top: 1px solid var(--border); opacity: 0.75;
  pointer-events: none; user-select: none;
}
