/* MailLens — design tokens + base */

/* ── Self-hosted Geist fonts (GDPR-safe, no Google Fonts) ── */
@font-face {
  font-family: 'Geist';
  src: url('/static/fonts/Geist-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist';
  src: url('/static/fonts/Geist-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist';
  src: url('/static/fonts/Geist-SemiBold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist';
  src: url('/static/fonts/Geist-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/static/fonts/GeistMono-Regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/static/fonts/GeistMono-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('/static/fonts/GeistMono-SemiBold.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}

:root {
  --bg-0: oklch(0.16 0.022 252);
  --bg-1: oklch(0.20 0.024 252);
  --bg-2: oklch(0.235 0.025 252);
  --bg-3: oklch(0.275 0.026 252);
  --bg-hover: oklch(0.30 0.028 252);
  --border: oklch(0.32 0.022 252);
  --border-strong: oklch(0.40 0.025 252);
  --border-soft: oklch(0.27 0.020 252);
  --text: oklch(0.97 0.004 252);
  --text-2: oklch(0.82 0.010 252);
  --text-3: oklch(0.65 0.015 252);
  --text-4: oklch(0.50 0.018 252);
  --teal: oklch(0.80 0.135 195);
  --teal-2: oklch(0.72 0.130 195);
  --teal-dim: oklch(0.55 0.090 195);
  --teal-bg: oklch(0.32 0.060 195 / 0.25);
  --teal-glow: oklch(0.80 0.135 195 / 0.15);
  --u-low: oklch(0.70 0.020 252);
  --u-low-bg: oklch(0.30 0.020 252 / 0.6);
  --u-med: oklch(0.82 0.130 85);
  --u-med-bg: oklch(0.35 0.080 85 / 0.30);
  --u-high: oklch(0.74 0.155 45);
  --u-high-bg: oklch(0.36 0.110 45 / 0.30);
  --u-crit: oklch(0.70 0.190 25);
  --u-crit-bg: oklch(0.36 0.140 25 / 0.32);
  --pos: oklch(0.78 0.140 155);
  --pos-bg: oklch(0.34 0.080 155 / 0.28);
  --neu: oklch(0.78 0.020 252);
  --neu-bg: oklch(0.30 0.020 252 / 0.6);
  --neg: oklch(0.74 0.150 30);
  --neg-bg: oklch(0.36 0.110 30 / 0.28);
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 14px;
  --shadow-1: 0 1px 0 oklch(1 0 0 / 0.04) inset, 0 1px 2px oklch(0 0 0 / 0.4);
  --shadow-2: 0 1px 0 oklch(1 0 0 / 0.05) inset, 0 8px 24px oklch(0 0 0 / 0.35);
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
}

[data-theme="light"] {
  --bg-0: oklch(0.985 0.003 252);
  --bg-1: oklch(1 0 0);
  --bg-2: oklch(0.965 0.005 252);
  --bg-3: oklch(0.945 0.006 252);
  --bg-hover: oklch(0.93 0.007 252);
  --border: oklch(0.90 0.006 252);
  --border-strong: oklch(0.82 0.008 252);
  --border-soft: oklch(0.94 0.005 252);
  --text: oklch(0.20 0.020 252);
  --text-2: oklch(0.32 0.018 252);
  --text-3: oklch(0.50 0.015 252);
  --text-4: oklch(0.62 0.012 252);
  --teal: oklch(0.58 0.130 195);
  --teal-2: oklch(0.50 0.125 195);
  --teal-dim: oklch(0.42 0.110 195);
  --teal-bg: oklch(0.92 0.040 195 / 0.6);
  --teal-glow: oklch(0.58 0.130 195 / 0.15);
  --u-low: oklch(0.45 0.015 252);
  --u-low-bg: oklch(0.92 0.005 252);
  --u-med: oklch(0.52 0.140 70);
  --u-med-bg: oklch(0.95 0.045 80);
  --u-high: oklch(0.55 0.165 35);
  --u-high-bg: oklch(0.95 0.040 40);
  --u-crit: oklch(0.52 0.190 25);
  --u-crit-bg: oklch(0.94 0.045 25);
  --pos: oklch(0.50 0.140 155);
  --pos-bg: oklch(0.94 0.045 155);
  --neu: oklch(0.45 0.015 252);
  --neu-bg: oklch(0.93 0.005 252);
  --neg: oklch(0.55 0.155 30);
  --neg-bg: oklch(0.95 0.040 30);
  --shadow-1: 0 1px 0 oklch(1 0 0 / 0.6) inset, 0 1px 2px oklch(0 0 0 / 0.06);
  --shadow-2: 0 1px 0 oklch(1 0 0 / 0.7) inset, 0 8px 24px oklch(0 0 0 / 0.08);
}
[data-theme="light"] ::-webkit-scrollbar-thumb { background: oklch(0.85 0.008 252); border-color: var(--bg-0); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: oklch(0.78 0.010 252); }
[data-theme="light"] .sb-new { color: oklch(0.99 0 0); }
[data-theme="light"] .btn-primary { color: oklch(0.99 0 0); }
[data-theme="light"] .t-msg-avatar { border-color: var(--bg-0); }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}
button { font-family: inherit; color: inherit; cursor: pointer; }
textarea, input { font-family: inherit; }
::selection { background: var(--teal-glow); color: var(--text); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: oklch(0.30 0.02 252); border-radius: 10px; border: 2px solid var(--bg-0); }
::-webkit-scrollbar-thumb:hover { background: oklch(0.38 0.025 252); }

/* ── App shell ── */
.app { display: grid; grid-template-rows: 52px 1fr; height: 100vh; }

.topnav {
  display: flex; align-items: center; gap: 14px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-0);
  position: relative; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; font-size: 14.5px; letter-spacing: -0.01em; }
.brand-mark {
  width: 22px; height: 22px; border-radius: 6px;
  background: linear-gradient(135deg, var(--teal) 0%, var(--teal-dim) 100%);
  position: relative; display: grid; place-items: center; flex-shrink: 0;
  box-shadow: 0 0 0 1px oklch(1 0 0 / 0.05) inset, 0 1px 2px oklch(0 0 0 / 0.4);
}
.brand-mark::after { content: ''; position: absolute; width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--bg-0); top: 6px; left: 6px; }
.brand-mark::before { content: ''; position: absolute; width: 4px; height: 1.5px; background: var(--bg-0); border-radius: 1px; bottom: 5.5px; right: 4.5px; transform: rotate(45deg); }
.beta-badge { font-family: var(--font-mono); font-size: 10px; font-weight: 500; padding: 2px 6px; border-radius: 4px; background: var(--teal-bg); color: var(--teal); border: 1px solid oklch(0.55 0.090 195 / 0.4); letter-spacing: 0.04em; text-transform: uppercase; }
.topnav-divider { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.nav-search { width: 320px; display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 8px; color: var(--text-3); font-size: 13px; transition: all 0.12s; cursor: text; }
.nav-search:hover { border-color: var(--border-strong); }
.nav-search .kbd { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-4); padding: 1px 5px; border: 1px solid var(--border); border-radius: 4px; background: var(--bg-0); }
.crumb { display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 13px; }
.crumb strong { color: var(--text-2); font-weight: 500; }
.crumb-sep { color: var(--text-4); }
.topnav-spacer { flex: 1; }
.nav-icon-btn { width: 30px; height: 30px; display: grid; place-items: center; background: transparent; border: 1px solid transparent; border-radius: 7px; color: var(--text-3); transition: all 0.12s; }
.nav-icon-btn:hover { background: var(--bg-1); color: var(--text); border-color: var(--border-soft); }
.theme-toggle { display: inline-flex; background: var(--bg-1); border: 1px solid var(--border); border-radius: 7px; padding: 2px; }
.tt-btn { width: 26px; height: 24px; display: grid; place-items: center; background: transparent; border: none; border-radius: 5px; color: var(--text-3); transition: color 0.12s, background 0.12s; }
.tt-btn:hover { color: var(--text-2); }
.tt-btn.active { background: var(--bg-3); color: var(--text); box-shadow: 0 1px 0 oklch(1 0 0 / 0.06) inset, 0 1px 2px oklch(0 0 0 / 0.25); }
[data-theme="light"] .tt-btn.active { box-shadow: 0 1px 0 oklch(1 0 0 / 0.6) inset, 0 1px 2px oklch(0 0 0 / 0.06); }
.user-chip { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; background: var(--bg-1); border: 1px solid var(--border); border-radius: 999px; }
.user-chip .uc-avatar { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, oklch(0.65 0.13 320), oklch(0.55 0.14 280)); display: grid; place-items: center; font-size: 10.5px; font-weight: 600; color: white; }
.user-chip .uc-name { font-size: 12.5px; color: var(--text-2); }

.main { display: grid; grid-template-columns: 280px 1fr; overflow: hidden; min-height: 0; }

/* ── Sidebar ── */
.sidebar { border-right: 1px solid var(--border); background: var(--bg-0); display: flex; flex-direction: column; min-height: 0; position: relative; overflow: hidden; }
.sb-section { padding: 14px 14px 8px; }
.sb-new { width: 100%; display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--teal); color: oklch(0.18 0.030 195); border: none; border-radius: 8px; font-weight: 600; font-size: 13px; letter-spacing: -0.005em; box-shadow: 0 1px 0 oklch(1 0 0 / 0.15) inset, 0 0 0 1px oklch(0.55 0.090 195 / 0.5), 0 4px 12px oklch(0.55 0.090 195 / 0.25); transition: all 0.12s; }
.sb-new:hover { background: oklch(0.85 0.135 195); transform: translateY(-1px); }
.sb-new .plus { width: 16px; height: 16px; display: grid; place-items: center; background: oklch(0 0 0 / 0.15); border-radius: 4px; font-size: 13px; font-weight: 700; }
.sb-new .kbd { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; padding: 1px 5px; background: oklch(0 0 0 / 0.15); border-radius: 4px; }
.sb-tabs { display: flex; gap: 2px; padding: 0 12px 4px; border-bottom: 1px solid var(--border); }
.sb-tab { background: transparent; border: none; padding: 8px 8px; font-size: 12px; color: var(--text-3); font-weight: 500; border-bottom: 1.5px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 5px; transition: color 0.12s; }
.sb-tab .count { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-4); background: var(--bg-1); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border-soft); }
.sb-tab:hover { color: var(--text-2); }
.sb-tab.active { color: var(--text); border-bottom-color: var(--teal); }
.sb-tab.active .count { color: var(--teal); border-color: oklch(0.55 0.090 195 / 0.5); background: var(--teal-bg); }

/* ── Filter pills ── */
.sb-pills { display: flex; gap: 6px; padding: 0 14px 10px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.sb-pill { display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px 3px 10px; font-size: 11.5px; font-weight: 500; color: var(--text-3); transition: all 0.12s; }
.sb-pill:hover { color: var(--text-2); border-color: var(--border-strong); background: var(--bg-1); }
.sb-pill .sb-pill-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-4); flex-shrink: 0; }
.sb-pill.lvl-high .sb-pill-dot { background: var(--u-high); }
.sb-pill.lvl-med  .sb-pill-dot { background: var(--u-med); }
.sb-pill.lvl-low  .sb-pill-dot { background: var(--u-low); }
.sb-pill-count { font-family: var(--font-mono); font-size: 10px; color: var(--text-4); font-weight: 500; letter-spacing: 0.02em; }
.sb-pill.active { background: var(--teal-bg); color: var(--teal); border-color: oklch(0.55 0.090 195 / 0.5); box-shadow: 0 0 0 3px var(--teal-glow); }
.sb-pill.active .sb-pill-dot { background: var(--teal); }
.sb-pill.active .sb-pill-count { color: var(--teal); }

.sb-list { flex: 1; overflow-y: auto; padding: 6px 8px 12px; min-height: 0; }
.sb-group-label { font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.06em; padding: 12px 8px 6px; }
.u-badge { display: inline-flex; align-items: center; gap: 4px; font-family: var(--font-mono); font-size: 10px; font-weight: 500; padding: 1.5px 6px 1.5px 5px; border-radius: 4px; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1.4; }
.u-badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.u-badge.low  { color: var(--u-low);  background: var(--u-low-bg); }
.u-badge.med  { color: var(--u-med);  background: var(--u-med-bg); }
.u-badge.high { color: var(--u-high); background: var(--u-high-bg); }
.u-badge.crit { color: var(--u-crit); background: var(--u-crit-bg); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 oklch(0.70 0.190 25 / 0.4); } 50% { box-shadow: 0 0 0 4px oklch(0.70 0.190 25 / 0); } }
.tag { display: inline-flex; align-items: center; font-size: 10.5px; padding: 1px 6px; border-radius: 4px; background: var(--bg-2); border: 1px solid var(--border-soft); color: var(--text-3); font-weight: 500; }
.sb-foot { border-top: 1px solid var(--border); padding: 10px 10px 10px 14px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.sb-foot-stats { flex: 1; font-size: 11.5px; color: var(--text-3); }
.sb-foot-stats strong { color: var(--text-2); font-weight: 500; }
.sb-foot-bar { margin-top: 4px; height: 3px; background: var(--bg-2); border-radius: 2px; overflow: hidden; }
.sb-foot-bar-fill { height: 100%; background: linear-gradient(90deg, var(--teal-dim), var(--teal)); width: 0%; transition: width 0.3s; }
.sb-foot-actions { display: flex; gap: 2px; flex-shrink: 0; }

/* ── Workspace ── */
.workspace { display: flex; flex-direction: column; overflow: hidden; background: var(--bg-0); min-height: 0; }
.ws-head { display: flex; align-items: center; gap: 16px; padding: 14px 24px; border-bottom: 1px solid var(--border); background: var(--bg-0); flex-shrink: 0; }
.ws-title { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.seg { display: inline-flex; background: var(--bg-1); border: 1px solid var(--border); border-radius: 8px; padding: 2px; }
.seg-btn { background: transparent; border: none; padding: 5px 12px; font-size: 12.5px; color: var(--text-3); font-weight: 500; border-radius: 6px; display: flex; align-items: center; gap: 6px; transition: all 0.12s; }
.seg-btn:hover { color: var(--text-2); }
.seg-btn.active { background: var(--bg-3); color: var(--text); box-shadow: 0 1px 0 oklch(1 0 0 / 0.06) inset, 0 1px 2px oklch(0 0 0 / 0.3); }
.ws-actions { display: flex; align-items: center; gap: 6px; }
.btn-ghost { background: transparent; border: 1px solid var(--border); border-radius: 7px; padding: 5px 10px; font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; transition: all 0.12s; }
.btn-ghost:hover { background: var(--bg-1); border-color: var(--border-strong); color: var(--text); }
.btn-ghost.btn-sm { padding: 4px 8px; font-size: 12px; }
.btn-primary { background: var(--teal); color: oklch(0.18 0.030 195); border: none; border-radius: 7px; padding: 6px 12px; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; box-shadow: 0 1px 0 oklch(1 0 0 / 0.15) inset, 0 0 0 1px oklch(0.55 0.090 195 / 0.5); transition: all 0.12s; }
.btn-primary:hover { background: oklch(0.85 0.135 195); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.ws-body { flex: 1; overflow-y: auto; min-height: 0; }
.ws-inner { max-width: 1080px; margin: 0 auto; padding: 24px 32px 64px; }

/* ── Input panel ── */
.input-panel { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-2); margin-bottom: 24px; }
.ip-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--bg-0); }
.ip-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; font-size: 11px; color: white; flex-shrink: 0; background: linear-gradient(135deg, oklch(0.65 0.13 320), oklch(0.55 0.14 280)); }
.ip-name-input { background: transparent; border: none; outline: none; font-size: 13px; font-family: var(--font-sans); color: var(--text); padding: 0; min-width: 0; width: 200px; font-weight: 500; }
.ip-name-input::placeholder { color: var(--text-4); font-weight: 400; }
.ip-meta { display: flex; align-items: center; gap: 10px; margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.ip-textarea { width: 100%; min-height: 200px; border: none; outline: none; background: transparent; color: var(--text-2); padding: 16px 18px; font-size: 13.5px; line-height: 1.65; resize: vertical; font-family: var(--font-sans); display: block; }
.ip-textarea::placeholder { color: var(--text-4); }
.ip-foot { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--bg-0); }
.ip-foot .meta { font-family: var(--font-mono); font-size: 11px; color: var(--text-4); display: flex; align-items: center; gap: 10px; }
.ip-foot .meta .sep { width: 1px; height: 10px; background: var(--border); }

/* ── Results grid ── */
.results-head { display: flex; align-items: center; gap: 10px; margin: 4px 0 14px; }
.results-head h2 { font-size: 13px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-4); margin: 0; font-family: var(--font-mono); }
.results-head .ts { font-family: var(--font-mono); font-size: 11px; color: var(--text-4); }
.results-head .rdot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-4); }
.grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; }
.card { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.card-head { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-4); }
.card-head .ico { width: 18px; height: 18px; display: grid; place-items: center; border-radius: 5px; background: var(--bg-2); border: 1px solid var(--border-soft); color: var(--text-2); }
.card-head .spacer { flex: 1; }
.card-h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; color: var(--text); }
.card-sub { font-size: 13px; color: var(--text-3); line-height: 1.5; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

/* Urgency meter */
.urg-meter { display: flex; gap: 4px; margin-top: 2px; }
.urg-step { flex: 1; height: 6px; border-radius: 3px; background: var(--bg-2); }
.urg-step.on-low  { background: var(--u-low); }
.urg-step.on-med  { background: var(--u-med); }
.urg-step.on-high { background: var(--u-high); }
.urg-step.on-crit { background: var(--u-crit); box-shadow: 0 0 8px oklch(0.70 0.190 25 / 0.5); }

/* Response time */
.rt-clock { display: flex; align-items: baseline; gap: 6px; }
.rt-num { font-family: var(--font-mono); font-size: 26px; font-weight: 500; letter-spacing: -0.02em; color: var(--text); }
.rt-unit { font-size: 13px; color: var(--text-3); }
.rt-by { font-family: var(--font-mono); font-size: 11px; color: var(--text-3); }

/* Summary */
.summary-text { font-size: 14px; line-height: 1.6; color: var(--text-2); letter-spacing: -0.005em; }
.summary-text strong { color: var(--text); font-weight: 600; }
.summary-text mark { background: var(--teal-bg); color: var(--teal); padding: 0 4px; border-radius: 3px; }

/* Actions */
.action-list { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.action { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--border-soft); transition: border-color 0.12s; cursor: pointer; user-select: none; }
.action:hover { border-color: var(--border-strong); }
.action.done { opacity: 0.55; }
.action.done .action-text { text-decoration: line-through; color: var(--text-3); }
.action-check { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; flex-shrink: 0; background: transparent; transition: all 0.12s; }
.action.done .action-check { background: var(--teal); border-color: var(--teal); color: var(--bg-0); }
.action-text { font-size: 13.5px; color: var(--text); letter-spacing: -0.005em; }
.action-meta { display: flex; align-items: center; gap: 6px; }
.action-due { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); padding: 2px 6px; background: var(--bg-1); border: 1px solid var(--border-soft); border-radius: 4px; }
.action-due.overdue { color: var(--u-high); border-color: oklch(0.74 0.155 45 / 0.4); }

/* Reply card */
.reply-card { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-top: 14px; }
.reply-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.reply-head .ico { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--teal-bg); color: var(--teal); }
.reply-head h3 { margin: 0; font-size: 13.5px; font-weight: 600; letter-spacing: -0.005em; color: var(--text); }
.reply-head .sub { font-size: 12px; color: var(--text-3); }
.reply-head .spacer { flex: 1; }
.reply-action { background: transparent; border: 1px solid var(--border); border-radius: 6px; padding: 4px 10px; font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 5px; transition: all 0.12s; }
.reply-action:hover { color: var(--text); border-color: var(--border-strong); }
.reply-action.copied { color: var(--teal); border-color: oklch(0.55 0.090 195 / 0.5); }
.reply-body { padding: 18px 20px; font-size: 14px; line-height: 1.65; color: var(--text-2); letter-spacing: -0.005em; white-space: pre-wrap; font-family: var(--font-sans); min-height: 80px; }
.reply-body.streaming { opacity: 0.7; }
.tone-bar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--bg-0); flex-wrap: wrap; }
.tone-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0; }
.tone-pills { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; }
.tone-pill { background: var(--bg-1); border: 1px solid var(--border); border-radius: 999px; padding: 5px 11px; font-size: 12px; color: var(--text-2); font-weight: 500; display: flex; align-items: center; gap: 6px; transition: all 0.12s; }
.tone-pill:hover { background: var(--bg-2); border-color: var(--border-strong); color: var(--text); }
.tone-pill.active { background: var(--teal-bg); color: var(--teal); border-color: oklch(0.55 0.090 195 / 0.5); box-shadow: 0 0 0 3px var(--teal-glow); }
.tone-pill .swatch { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tone-pill:disabled { opacity: 0.5; cursor: not-allowed; }
.tone-foot-actions { display: flex; gap: 6px; margin-left: auto; flex-shrink: 0; }

/* Thread timeline */
.thread-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 24px; }
.thread-title { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; margin: 0; }
.thread-meta { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-3); }
.thread-meta .stars { font-family: var(--font-mono); font-size: 11px; color: var(--text-4); padding: 1px 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-1); }
.t-msgs { display: flex; flex-direction: column; position: relative; }
.t-msgs::before { content: ''; position: absolute; left: 19px; top: 38px; bottom: 38px; width: 1px; background: var(--border); }
.t-msg { position: relative; padding: 14px 0 14px 56px; }
.t-msg-avatar { position: absolute; left: 8px; top: 14px; width: 24px; height: 24px; border-radius: 50%; background: var(--bg-2); border: 2px solid var(--bg-0); display: grid; place-items: center; font-size: 10px; font-weight: 600; color: white; z-index: 1; }
.t-msg-card { background: var(--bg-1); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.t-msg-card.highlight { border-color: oklch(0.55 0.090 195 / 0.5); box-shadow: 0 0 0 3px var(--teal-glow); }
.t-msg-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border-soft); }
.t-msg-from { font-size: 13px; font-weight: 500; color: var(--text); }
.t-msg-to { font-size: 12px; color: var(--text-3); }
.t-msg-time { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-4); }
.t-msg-body { padding: 14px 16px; font-size: 13.5px; color: var(--text-2); line-height: 1.6; white-space: pre-wrap; }
.t-msg-body p { margin: 0 0 10px; }
.t-msg-body p:last-child { margin: 0; }
.t-insight { padding: 8px 14px; border-top: 1px solid var(--border-soft); background: oklch(0.22 0.025 252 / 0.5); display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.t-insight .ico { width: 16px; height: 16px; display: grid; place-items: center; color: var(--teal); }
.t-insight strong { color: var(--text-2); font-weight: 500; }

/* Thread reply toggle */
.thread-reply-toggle { display: flex; align-items: center; gap: 6px; padding: 8px 14px; border: none; border-top: 1px solid var(--border-soft); background: var(--bg-0); color: var(--text-3); font-size: 12px; width: 100%; text-align: left; transition: color 0.12s; }
.thread-reply-toggle:hover { color: var(--text-2); }
.thread-reply-content { display: none; padding: 12px 16px; font-size: 13px; line-height: 1.6; color: var(--text-2); white-space: pre-wrap; border-top: 1px solid var(--border-soft); background: var(--bg-0); }
.thread-reply-content.open { display: block; }
.thread-reply-toggle .chevron { transition: transform 0.2s; }

/* Loading dots */
.dot-loading { display: inline-flex; gap: 3px; }
.dot-loading span { width: 4px; height: 4px; border-radius: 50%; background: var(--teal); animation: dotpulse 1.2s ease-in-out infinite; }
.dot-loading span:nth-child(2) { animation-delay: 0.15s; }
.dot-loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes dotpulse { 0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

/* ══ Flask app–specific additions ══ */

#results { display: none; }
#results.visible { display: block; }
#loadingCard { display: none; }
#loadingCard.visible { display: block; }
#threadActionsBar { display: none; }
#threadActionsBar.visible { display: flex; }
#threadView { display: none; }
#threadView.visible { display: block; }

.error-box { display: none; }
.error-box.visible { display: block; color: var(--u-crit); font-size: 13px; padding: 10px 14px; background: var(--u-crit-bg); border: 1px solid oklch(0.70 0.190 25 / 0.3); border-radius: 8px; margin: 0 0 8px; }

.loading-card { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 14px; }
.skeleton-lines { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.skeleton-line, .skel { height: 12px; border-radius: 6px; background: linear-gradient(90deg, var(--bg-2) 25%, var(--bg-3) 50%, var(--bg-2) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.loading-hint { display: flex; align-items: center; gap: 10px; font-size: 12.5px; color: var(--text-4); font-family: var(--font-mono); }

.btn-spinner { width: 12px; height: 12px; border: 1.5px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

.urgency-override-btn { width: 20px; height: 20px; display: grid; place-items: center; background: transparent; border: none; color: var(--text-4); border-radius: 4px; transition: color 0.12s; padding: 0; }
.urgency-override-btn:hover { color: var(--text-2); }
#urgencyOverrideBtn { display: none; }
#urgencyOverrideBtn.visible { display: grid; }
.urgency-pills { display: none; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.urgency-pills.open { display: flex; }
.urgency-pill-btn { padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--bg-2); font-size: 12px; color: var(--text-3); font-weight: 500; transition: all 0.12s; }
.urgency-pill-btn:hover { background: var(--bg-3); color: var(--text); }
.urgency-pill-btn.selected { background: var(--teal-bg); color: var(--teal); border-color: oklch(0.55 0.090 195 / 0.5); }
.urgency-manual-label { display: none; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-4); margin-top: 2px; }
.urgency-manual-label.visible { display: block; }

.card.urgency-low    { border-color: oklch(0.70 0.020 252 / 0.5); }
.card.urgency-medium { border-color: oklch(0.82 0.130 85 / 0.4); }
.card.urgency-high   { border-color: oklch(0.74 0.155 45 / 0.5); }
.card.urgency-critical { border-color: oklch(0.70 0.190 25 / 0.5); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(10px);
  background: var(--bg-3); color: var(--text); font-size: 12.5px; font-weight: 500;
  padding: 8px 14px 8px 10px; border-radius: 8px; border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-2); opacity: 0; transition: opacity 0.18s, transform 0.18s;
  pointer-events: none; z-index: 100; white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.toast::before {
  content: '';
  width: 16px; height: 16px; flex-shrink: 0;
  border-radius: 50%; background: var(--teal-bg); border: 1px solid oklch(0.55 0.090 195 / 0.4);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 16 16' width='10' height='10' fill='none' stroke='oklch(0.80 0.135 195)' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3.5 8.2L6.5 11l6-6.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.sb-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 36px 20px 28px; }
.sb-empty-art { opacity: 0.85; }
.sb-empty-title { font-size: 13px; font-weight: 500; color: var(--text-2); letter-spacing: -0.005em; }
.sb-empty-sub { font-size: 11.5px; color: var(--text-4); line-height: 1.45; max-width: 200px; }
.sb-empty-sub strong { color: var(--text-3); font-weight: 500; }

.history-item { display: flex; flex-direction: column; gap: 4px; padding: 9px 10px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; transition: background 0.1s, border-color 0.1s; position: relative; margin-bottom: 2px; }
.history-item:hover { background: var(--bg-1); }
.history-item.active { background: var(--bg-1); border-color: var(--border); }
.history-item.active::before { content: ''; position: absolute; left: -8px; top: 14px; bottom: 14px; width: 2px; background: var(--teal); border-radius: 2px; }
.history-preview { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.history-meta { display: flex; align-items: center; gap: 6px; }
.history-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-4); }
.history-badge { font-family: var(--font-mono); font-size: 10px; font-weight: 500; padding: 1.5px 6px; border-radius: 4px; letter-spacing: 0.02em; text-transform: uppercase; }
.history-badge.low { color: var(--u-low); background: var(--u-low-bg); }
.history-badge.medium { color: var(--u-med); background: var(--u-med-bg); }
.history-badge.high { color: var(--u-high); background: var(--u-high-bg); }
.history-badge.critical { color: var(--u-crit); background: var(--u-crit-bg); }
.history-thread-icon { display: inline-flex; align-items: center; gap: 3px; font-family: var(--font-mono); font-size: 10px; color: var(--text-4); background: var(--bg-2); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border-soft); }

/* ── Sidebar search ── */
.sb-search-wrap { position: relative; margin: 0 14px 8px; }
.sb-search { width: 100%; background: var(--bg-1); border: 1px solid var(--border); border-radius: 8px; padding: 7px 28px 7px 30px; font-size: 12.5px; color: var(--text); outline: none; font-family: var(--font-sans); transition: border-color 0.12s, box-shadow 0.12s; }
.sb-search::placeholder { color: var(--text-4); }
.sb-search:hover { border-color: var(--border-strong); }
.sb-search:focus { border-color: var(--teal-dim); box-shadow: 0 0 0 3px var(--teal-glow); }
.sb-search-ico { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-4); pointer-events: none; display: grid; place-items: center; }
.sb-search-wrap:focus-within .sb-search-ico { color: var(--teal); }
.sb-search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; display: none; place-items: center; background: var(--bg-3); border: 1px solid var(--border); border-radius: 999px; color: var(--text-3); transition: all 0.12s; }
.sb-search-clear.visible { display: grid; }
.sb-search-clear:hover { background: var(--bg-2); color: var(--text); }

/* ── Sidebar history items ── */
.sb-item { display: grid; grid-template-columns: auto 1fr; gap: 10px; padding: 9px 10px; padding-right: 14px; border-radius: 8px; cursor: pointer; border: 1px solid transparent; transition: background 0.1s, border-color 0.1s; position: relative; margin-bottom: 2px; }
.sb-item:hover { background: var(--bg-1); }
.sb-item.active { background: var(--bg-1); border-color: var(--border); }
.sb-item.active::before { content: ''; position: absolute; left: -8px; top: 14px; bottom: 14px; width: 2px; background: var(--teal); border-radius: 2px; }
.sb-item.confirming { background: var(--bg-1); border-color: oklch(0.55 0.060 25 / 0.5); box-shadow: 0 0 0 3px oklch(0.55 0.060 25 / 0.12); }
.sb-avatar { width: 28px; height: 28px; border-radius: 7px; background: var(--bg-2); display: grid; place-items: center; font-size: 11px; font-weight: 600; color: var(--text-2); border: 1px solid var(--border-soft); flex-shrink: 0; align-self: start; margin-top: 1px; }
.sb-body { min-width: 0; }
.sb-row1 { display: flex; align-items: center; gap: 6px; margin-bottom: 2px; }
.sb-from { font-size: 12.5px; font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.sb-time { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-4); flex-shrink: 0; }
.sb-subj { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; font-weight: 400; }
.sb-snip { font-size: 11.5px; color: var(--text-4); line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 6px; }
.sb-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

/* ── Search highlight ── */
.sb-hl { background: var(--teal-bg); color: var(--teal); padding: 0 2px; border-radius: 3px; font-weight: 600; }

/* ── Trash button ── */
.sb-trash { position: absolute; top: 8px; right: 8px; width: 22px; height: 22px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text-3); opacity: 0; transform: translateY(-2px); transition: opacity 0.12s, transform 0.12s, color 0.12s, background 0.12s, border-color 0.12s; pointer-events: none; }
.sb-item:hover .sb-trash, .sb-item:focus-within .sb-trash { opacity: 1; transform: translateY(0); pointer-events: auto; }
.sb-trash:hover { color: var(--u-crit); background: var(--u-crit-bg); border-color: oklch(0.55 0.080 25 / 0.5); }
.sb-item.confirming .sb-trash { display: none; }

/* ── Inline delete confirm overlay ── */
.sb-confirm { position: absolute; inset: 0; display: none; align-items: center; justify-content: flex-end; gap: 8px; padding: 0 10px 0 14px; background: linear-gradient(90deg, transparent 0%, var(--bg-1) 38%); border-radius: 8px; z-index: 2; }
.sb-item.confirming .sb-confirm { display: flex; }
.sb-confirm-text { font-size: 12.5px; font-weight: 500; color: var(--text); margin-right: auto; padding-left: 4px; }
.sb-confirm-actions { display: flex; gap: 5px; }
.sb-confirm-btn { padding: 4px 10px; font-size: 11.5px; font-weight: 600; border-radius: 6px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); letter-spacing: 0.005em; transition: all 0.12s; }
.sb-confirm-btn:hover { background: var(--bg-3); color: var(--text); }
.sb-confirm-btn.yes { background: var(--u-crit); color: oklch(0.99 0 0); border-color: var(--u-crit); box-shadow: 0 1px 0 oklch(1 0 0 / 0.15) inset; }
.sb-confirm-btn.yes:hover { background: oklch(0.74 0.190 25); }

.thread-actions-bar { align-items: center; gap: 10px; padding: 16px 0 0; }

.thread-add-section { background: var(--bg-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; margin-top: 16px; }
.thread-add-header { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 10px; }
.thread-add-error { font-size: 12.5px; color: var(--u-crit); margin-top: 6px; }

.reply-regen-loading { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-4); font-family: var(--font-mono); }

.backdrop { display: none; position: fixed; inset: 0; background: oklch(0 0 0 / 0.5); z-index: 10; }
.backdrop.open { display: block; }
.mobile-menu-btn { display: none; }

/* ── Tone bars (mood card) ── */
.mood-tone-bars { display: flex; flex-direction: column; gap: 7px; margin-top: 2px; }
.tb-row { display: grid; grid-template-columns: 70px 1fr 32px; align-items: center; gap: 8px; }
.tb-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-3); white-space: nowrap; }
.tb { flex: 1; height: 4px; border-radius: 2px; background: var(--bg-2); overflow: hidden; position: relative; }
.tb-fill { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: var(--neg); transition: width 0.65s cubic-bezier(0.4, 0, 0.2, 1); }
.mood-tone-bars .tb-fill { background: var(--teal); }
.tb-pct { font-family: var(--font-mono); font-size: 10px; color: var(--text-4); text-align: right; }

/* ── Thread grid + right rail ── */
.thread-grid { display: grid; grid-template-columns: 1fr 210px; gap: 24px; align-items: start; }
.thread-rail { position: sticky; top: 0; padding-top: 0; }
.rail-section { margin-bottom: 22px; }
.rail-label { font-family: var(--font-mono); font-size: 10.5px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 8px; }
.rail-stat { font-size: 18px; font-weight: 500; letter-spacing: -0.01em; }
.rail-stat-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.rail-spark { display: flex; gap: 2px; align-items: flex-end; height: 28px; margin-top: 8px; }
.rail-spark .b { flex: 1; background: var(--bg-2); border-radius: 1px; min-width: 4px; }
.rail-spark .b.hot  { background: var(--u-high); }
.rail-spark .b.warn { background: var(--u-med); }
.rail-spark .b.cool { background: var(--teal-dim); }
.rail-people { display: flex; flex-direction: column; gap: 7px; }
.rail-person { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); }
.rail-person .av { width: 20px; height: 20px; border-radius: 50%; font-size: 9px; font-weight: 600; display: grid; place-items: center; color: white; flex-shrink: 0; }
.rail-person .role { font-family: var(--font-mono); font-size: 10px; color: var(--text-4); margin-left: auto; letter-spacing: 0.04em; }

@media (max-width: 800px) {
  .thread-grid { grid-template-columns: 1fr; }
  .thread-rail { display: none; }
}

@media (max-width: 960px) {
  .ws-inner { padding: 16px 16px 48px; }
  .col-4 { grid-column: span 6; }
}
@media (max-width: 700px) {
  .main { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -300px; top: 52px; bottom: 0; width: 280px; z-index: 20; transition: left 0.25s; }
  .sidebar.open { left: 0; }
  .mobile-menu-btn { display: grid; }
  .crumb, .user-chip { display: none; }
  .col-4 { grid-column: span 12; }
  .col-12 { grid-column: span 12; }
}

/* ══ Login page ══ */

.login-body {
  overflow: auto;
  background: var(--bg-0);
}

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px;
  box-shadow: var(--shadow-2);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 32px;
}

.login-brand-name {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.login-heading {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  color: var(--text);
}

.login-sub {
  font-size: 13px;
  color: var(--text-3);
  margin: 0 0 24px;
  line-height: 1.5;
}

.login-field { margin-bottom: 10px; }

.login-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.login-input {
  width: 100%;
  background: var(--bg-0);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color 0.12s, box-shadow 0.12s;
}

.login-input:focus {
  border-color: var(--teal-dim);
  box-shadow: 0 0 0 3px var(--teal-glow);
}

.login-input::placeholder { color: var(--text-4); }

.login-error {
  display: none;
  color: var(--u-crit);
  font-size: 12.5px;
  padding: 8px 12px;
  background: var(--u-crit-bg);
  border: 1px solid oklch(0.70 0.190 25 / 0.3);
  border-radius: 7px;
  margin-bottom: 10px;
  line-height: 1.5;
}

.login-btn {
  width: 100%;
  justify-content: center;
  padding: 9px 12px;
  font-size: 13.5px;
  margin-top: 4px;
}

.login-hint {
  font-size: 11.5px;
  color: var(--text-4);
  text-align: center;
  margin: 16px 0 0;
  line-height: 1.5;
}

/* Sent state */
.sent-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--teal-bg);
  color: var(--teal);
  display: grid;
  place-items: center;
  margin: 0 auto 18px;
  border: 1px solid oklch(0.55 0.090 195 / 0.3);
  box-shadow: 0 0 0 6px var(--teal-glow);
}

.sent-title {
  font-size: 17px;
  font-weight: 600;
  text-align: center;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.sent-sub {
  font-size: 13px;
  color: var(--text-3);
  text-align: center;
  margin: 0 0 24px;
  line-height: 1.6;
}

.login-back {
  width: 100%;
  justify-content: center;
  font-size: 13px;
}

@media (max-width: 480px) {
  .login-card { padding: 28px 20px; }
}

/* Login — privacy link */
.login-privacy-link {
  margin: 12px 0 0;
  text-align: center;
}
.login-privacy-link a {
  font-size: 12px;
  color: var(--text-4);
  text-decoration: none;
}
.login-privacy-link a:hover { color: var(--teal); }

/* sb-privacy-row removed — replaced by icon buttons in .sb-foot-actions */

/* ── Privacy page ── */
.privacy-body {
  overflow-y: auto;
  min-height: 100vh;
}

.privacy-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.privacy-header { margin-bottom: 24px; }

.privacy-title {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 6px;
}

.privacy-effective {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-4);
  margin: 0;
}

.privacy-intro {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-3);
  margin: 0;
}

.privacy-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 32px 0;
}

.privacy-section { margin: 0; }

.privacy-section h2 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
  font-family: var(--font-mono);
  margin: 0 0 14px;
}

.privacy-section p {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-2);
  margin: 0 0 10px;
}
.privacy-section p:last-child { margin-bottom: 0; }

.privacy-section ul {
  margin: 0 0 12px;
  padding-left: 0;
  list-style: none;
}

.privacy-section li {
  font-size: 14px;
  line-height: 1.75;
  color: var(--text-2);
  padding: 5px 0 5px 20px;
  position: relative;
}

.privacy-section li::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 13px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--teal-dim);
}

.privacy-section li strong { color: var(--text); font-weight: 500; }

.privacy-link {
  color: var(--teal);
  text-decoration: none;
  border-bottom: 1px solid oklch(0.55 0.090 195 / 0.35);
  transition: border-color 0.12s;
}
.privacy-link:hover { border-bottom-color: var(--teal); }

/* Privacy page nav back button */
.privacy-nav-back {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
  font-size: 13px;
  color: var(--text-3);
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  transition: all 0.12s;
}
.privacy-nav-back:hover {
  background: var(--bg-1);
  color: var(--text);
  border-color: var(--border-strong);
}

@media (max-width: 600px) {
  .privacy-wrap { padding: 32px 16px 72px; }
  .privacy-title { font-size: 22px; }
}

/* ── Excel export button ─────────────────────────────────────────────────────── */

.excel-export-wrap { margin: 0 0 12px; }

.excel-export-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 14px 18px;
  background: #217346;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  transition: background 0.14s ease, box-shadow 0.14s ease, transform 0.08s ease;
  box-shadow: 0 2px 10px rgba(33, 115, 70, 0.40), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}
.excel-export-btn:hover {
  background: #1e6840;
  box-shadow: 0 4px 18px rgba(33, 115, 70, 0.50), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
}
.excel-export-btn:active { transform: scale(0.995); background: #1a5e39; }
.excel-export-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.excel-icon-box {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.excel-export-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.excel-export-label {
  color: #fff;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1;
}
.excel-export-sub {
  color: rgba(255, 255, 255, 0.70);
  font-family: var(--font-sans);
  font-size: 11.5px;
  line-height: 1.35;
}

.excel-export-arrow { flex-shrink: 0; }

/* ── Composed badge & sidebar extras ─────────────────────────────────────── */

.u-badge.composed { background: var(--teal-bg); color: var(--teal); border-color: oklch(0.55 0.090 195 / 0.4); }
.u-badge.composed .dot { background: var(--teal); }

.sb-avatar-compose { font-size: 15px; line-height: 1; border: 1.5px solid oklch(0.55 0.090 195 / 0.4); }

.sb-tone-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--text-4);
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  letter-spacing: 0.02em;
}

.sb-pill.lvl-composed .sb-pill-dot.composed { background: var(--teal); }
.sb-pill.lvl-composed.active { background: var(--teal-bg); color: var(--teal); border-color: oklch(0.55 0.090 195 / 0.4); box-shadow: 0 0 0 3px var(--teal-glow); }

/* ── Compose ─────────────────────────────────────────────────────────────── */

.compose-panel {
  animation: fadeUp 0.18s ease;
}

.compose-recipient-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.compose-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--teal-bg);
  border: 1.5px solid var(--teal);
  color: var(--teal);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.compose-recipient-input {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  padding: 0;
}

.compose-recipient-input::placeholder { color: var(--text-4); }

.compose-textarea {
  width: 100%;
  min-height: 120px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  resize: none;
  overflow: hidden;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s ease;
}

.compose-textarea:focus { border-color: var(--teal); }
.compose-textarea::placeholder { color: var(--text-4); }

.compose-loading {
  padding: 20px 24px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Tone bar inside compose result */
.compose-result-tone-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 8px 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 10px;
}

/* Subject shimmer while waiting for first \n\n */
.compose-subject-card.subject-pending .compose-subject-text {
  min-height: 20px;
  min-width: 220px;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--teal-bg) 25%, var(--teal-glow) 50%, var(--teal-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite;
}

/* Blinking cursor at end of body while streaming */
.compose-body-text.streaming::after {
  content: '▋';
  color: var(--teal);
  animation: blink 0.75s steps(1) infinite;
  margin-left: 1px;
}

.compose-subject-card {
  background: var(--teal-bg);
  border: 1.5px solid var(--teal);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.compose-subject-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.compose-subject-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}

.compose-subject-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.compose-body-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.compose-body-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
}

.compose-body-text {
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.compose-result-actions {
  display: flex;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

/* ── Settings page (styles are self-contained in templates/settings.html) ──── */

.st-body { overflow-y: auto !important; }

/* ── CSP-safe utility & layout classes ──────────────────────────────────────
   .hidden uses no !important so that JS el.style.display = 'value' (inline)
   still overrides it when needed for explicit show values (e.g. 'flex').
   These classes appear LAST in the sheet so they win over earlier rules at
   equal specificity (e.g. .reply-regen-loading { display:flex }).          */
.hidden { display: none; }
.mt-12 { margin-top: 12px; }
#signOutBtn { font-size: 12px; letter-spacing: .01em; padding: 0 10px; width: auto; }
.thread-count-badge { font-family: var(--font-mono); font-size: 10px; font-weight: 500; padding: 0 5px; border-radius: 4px; background: var(--bg-1); color: var(--text-3); border: 1px solid var(--border); }
.tab-meta-label { font-family: var(--font-mono); font-size: 11px; color: var(--text-4); margin-top: 1px; }
.skel-w-55 { width: 55%; }
.skel-w-82 { width: 82%; }
.skel-w-66 { width: 66%; }
.skel-w-40 { width: 40%; }
.thread-email-textarea { min-height: 140px; margin-top: 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-0); }
.tone-bar--mt10 { margin-top: 10px; border-radius: 8px; border: 1px solid var(--border); }
.tone-bar--mt12 { margin-top: 12px; border-radius: 8px; border: 1px solid var(--border); }
.flex-row-end { display: flex; justify-content: flex-end; margin-top: 10px; }
.flex-row-end--mt12 { margin-top: 12px; }
.card-padded { padding: 20px 24px; }
.card-padded--mt10 { padding: 20px 24px; margin-top: 10px; }
.flex-fill { flex: 1; }
.skel--title  { height: 18px; width: 38%; margin-bottom: 12px; border-radius: 6px; }
.skel--body-1 { height: 14px; width: 100%; margin-bottom:  7px; border-radius: 4px; }
.skel--body-2 { height: 14px; width: 94%;  margin-bottom:  7px; border-radius: 4px; }
.skel--body-3 { height: 14px; width: 82%;  border-radius: 4px; }
.action-item-li   { list-style: none; display: flex; gap: 6px; align-items: flex-start; padding: 4px 0; }
.action-item-icon { color: var(--teal); flex-shrink: 0; margin-top: 3px; }
.action-items-ul  { margin: 10px 0 0; padding: 0; }
.t-msg-avatar--low      { background: var(--u-low); }
.t-msg-avatar--medium   { background: var(--u-med); }
.t-msg-avatar--high     { background: var(--u-high); }
.t-msg-avatar--critical { background: var(--u-crit); }
.t-msg-avatar--default  { background: var(--teal-dim); }
