/* ============================================================
   Aurora Mail — Roundcube 1.7 skin concept
   Layout: four-zone workspace — rail · folders · list · reader
   ============================================================ */

/* ---------- tokens (light) ---------- */
:root {
  --accent: #0f6cbd;
  --accent-hover: #0b5aa0;
  --accent-hover: color-mix(in srgb, var(--accent) 86%, #000);
  --accent-ink: var(--accent);
  --accent-ink: color-mix(in srgb, var(--accent) 88%, #06121f);
  --accent-soft: rgba(15, 108, 189, .10);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, transparent);
  --accent-soft-2: rgba(15, 108, 189, .18);
  --accent-soft-2: color-mix(in srgb, var(--accent) 18%, transparent);
  --on-accent: #ffffff;

  --header-bg: #093256;
  --header-bg: color-mix(in srgb, var(--accent) 36%, #06121c);
  --header-text: #ffffff;
  --header-muted: rgba(255, 255, 255, .68);
  --header-line: rgba(255, 255, 255, .15);
  --header-field: rgba(255, 255, 255, .10);
  --header-field-hover: rgba(255, 255, 255, .16);

  --bg: #dfe4eb;
  --surface: #ffffff;
  --surface-2: #f4f6f9;
  --surface-3: #eaeef3;
  --surface-4: #dfe5ed;
  --text: #172230;
  --text-2: #536173;
  --text-3: #7b8797;
  --border: #dce2ea;
  --border-strong: #c4cdd9;
  --row-hover: #f0f4f8;
  --row-selected: #e2ecf6;
  --row-selected: color-mix(in srgb, var(--accent) 9%, var(--surface));
  --row-unread: #fbfcfe;
  --row-unread: color-mix(in srgb, var(--accent) 2%, var(--surface));

  --star: #b45309;
  --star-soft: #fef3c7;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --success: #067647;
  --success-soft: #ecfdf3;
  --warning: #b54708;
  --warning-soft: #fffaeb;

  --cat-product: #2f6fed;
  --cat-decision: #0f6cbd;
  --cat-finance: #2e7d5b;
  --cat-legal: #a16207;
  --cat-people: #0f766e;
  --cat-sales: #7c3aed;
  --cat-analytics: #475569;

  --focus: rgba(15, 108, 189, .55);
  --focus: color-mix(in srgb, var(--accent) 55%, transparent);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-pop: 0 12px 32px rgba(16, 24, 40, .16), 0 4px 12px rgba(16, 24, 40, .08);
  --shadow-compose: 0 24px 64px rgba(16, 24, 40, .24), 0 8px 24px rgba(16, 24, 40, .12);
  --frame-shadow: 0 1px 3px rgba(16, 24, 40, .06), 0 18px 48px rgba(16, 24, 40, .11);
  --raised-bg: linear-gradient(180deg, #ffffff 0%, #edf1f6 100%);
  --raised-highlight: rgba(255, 255, 255, 1);
  --raised-inset-bottom: rgba(16, 24, 40, .07);
  --raised-shadow: 0 2px 4px rgba(16, 24, 40, .07), 0 8px 18px rgba(16, 24, 40, .06);
  --raised-border: var(--border);

  --font-ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Code", "Cascadia Mono", Consolas, monospace;

  --r-sm: 5px;
  --r-md: 7px;
  --r-lg: 10px;
  --r-xl: 12px;

  --topbar-h: 54px;
  --rail-w: 72px;
  --status-h: 30px;
  --tabs-h: 58px;
  --compose-dock-h: 0px;
}

/* ---------- tokens (dark) ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-ink: #a9cdf2;
    --accent-ink: color-mix(in srgb, var(--accent) 35%, #e6f0ff);
    --accent-soft: rgba(77, 163, 255, .14);
    --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
    --accent-soft-2: color-mix(in srgb, var(--accent) 28%, transparent);
    --on-accent: #ffffff;

    --header-bg: #072642;
    --header-bg: color-mix(in srgb, var(--accent) 28%, #03080d);
    --header-text: #f2f6fb;
    --header-muted: rgba(255, 255, 255, .62);
    --header-line: rgba(255, 255, 255, .12);
    --header-field: rgba(255, 255, 255, .08);
    --header-field-hover: rgba(255, 255, 255, .13);

    --bg: #070a0f;
    --surface: #12171e;
    --surface-2: #0e1319;
    --surface-3: #1a212a;
    --surface-4: #232b36;
    --text: #e7ecf3;
    --text-2: #9eabbb;
    --text-3: #74808f;
    --border: #222a34;
    --border-strong: #33404d;
    --row-hover: #1b222b;
    --row-selected: #172839;
    --row-selected: color-mix(in srgb, var(--accent) 16%, var(--surface));
    --row-unread: #141a22;
    --row-unread: color-mix(in srgb, var(--accent) 3%, var(--surface));

    --star: #fbbf24;
    --star-soft: rgba(251, 191, 36, .14);
    --danger: #ff9b91;
    --danger-soft: rgba(255, 99, 99, .12);
    --success: #6ee7b7;
    --success-soft: rgba(16, 185, 129, .12);
    --warning: #fbbf24;
    --warning-soft: rgba(251, 191, 36, .12);

    --cat-product: #7ea6ff;
    --cat-decision: #6fb3ff;
    --cat-finance: #6fcf9f;
    --cat-legal: #f0c36a;
    --cat-people: #57c7bd;
    --cat-sales: #b9a1ff;
    --cat-analytics: #a6b4c6;

    --focus: color-mix(in srgb, var(--accent) 65%, transparent);
    --shadow: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-pop: 0 16px 40px rgba(0, 0, 0, .55), 0 4px 12px rgba(0, 0, 0, .35);
    --shadow-compose: 0 28px 72px rgba(0, 0, 0, .65), 0 8px 24px rgba(0, 0, 0, .4);
    --frame-shadow: 0 2px 8px rgba(0, 0, 0, .35), 0 24px 64px rgba(0, 0, 0, .5);
    --raised-bg: linear-gradient(180deg, #1e2530 0%, #10151c 100%);
    --raised-highlight: rgba(255, 255, 255, .07);
    --raised-inset-bottom: rgba(0, 0, 0, .45);
    --raised-shadow: 0 2px 4px rgba(0, 0, 0, .4), 0 8px 18px rgba(0, 0, 0, .3);
    --raised-border: var(--border);

    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --accent-ink: #a9cdf2;
  --accent-ink: color-mix(in srgb, var(--accent) 35%, #e6f0ff);
  --accent-soft: rgba(77, 163, 255, .14);
  --accent-soft: color-mix(in srgb, var(--accent) 18%, transparent);
  --accent-soft-2: color-mix(in srgb, var(--accent) 28%, transparent);
  --on-accent: #ffffff;

  --header-bg: #072642;
  --header-bg: color-mix(in srgb, var(--accent) 28%, #03080d);
  --header-text: #f2f6fb;
  --header-muted: rgba(255, 255, 255, .62);
  --header-line: rgba(255, 255, 255, .12);
  --header-field: rgba(255, 255, 255, .08);
  --header-field-hover: rgba(255, 255, 255, .13);

  --bg: #070a0f;
  --surface: #12171e;
  --surface-2: #0e1319;
  --surface-3: #1a212a;
  --surface-4: #232b36;
  --text: #e7ecf3;
  --text-2: #9eabbb;
  --text-3: #74808f;
  --border: #222a34;
  --border-strong: #33404d;
  --row-hover: #1b222b;
  --row-selected: #172839;
  --row-selected: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --row-unread: #141a22;
  --row-unread: color-mix(in srgb, var(--accent) 3%, var(--surface));

  --star: #fbbf24;
  --star-soft: rgba(251, 191, 36, .14);
  --danger: #ff9b91;
  --danger-soft: rgba(255, 99, 99, .12);
  --success: #6ee7b7;
  --success-soft: rgba(16, 185, 129, .12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, .12);

  --cat-product: #7ea6ff;
  --cat-decision: #6fb3ff;
  --cat-finance: #6fcf9f;
  --cat-legal: #f0c36a;
  --cat-people: #57c7bd;
  --cat-sales: #b9a1ff;
  --cat-analytics: #a6b4c6;

  --focus: color-mix(in srgb, var(--accent) 65%, transparent);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-pop: 0 16px 40px rgba(0, 0, 0, .55), 0 4px 12px rgba(0, 0, 0, .35);
  --shadow-compose: 0 28px 72px rgba(0, 0, 0, .65), 0 8px 24px rgba(0, 0, 0, .4);
  --frame-shadow: 0 2px 8px rgba(0, 0, 0, .35), 0 24px 64px rgba(0, 0, 0, .5);
  --raised-bg: linear-gradient(180deg, #1e2530 0%, #10151c 100%);
  --raised-highlight: rgba(255, 255, 255, .07);
  --raised-inset-bottom: rgba(0, 0, 0, .45);
  --raised-shadow: 0 2px 4px rgba(0, 0, 0, .4), 0 8px 18px rgba(0, 0, 0, .3);
  --raised-border: var(--border);

  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  padding-block: 16px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
svg.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.topbar :focus-visible,
.compose-head :focus-visible { outline-color: rgba(255, 255, 255, .8); }
::selection { background: var(--accent-soft-2); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 8px;
  border: 3px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-track { background: transparent; }

/* ---------- avatars ---------- */
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  background: color-mix(in srgb, var(--av, #64748b) 17%, var(--surface));
  color: color-mix(in srgb, var(--av, #64748b) 68%, var(--text));
  font-weight: 600;
  letter-spacing: .01em;
  user-select: none;
}
.avatar-sm { width: 26px; height: 26px; font-size: 0.625rem; }
.avatar-md { width: 32px; height: 32px; font-size: 0.6875rem; }
.avatar-lg { width: 44px; height: 44px; font-size: 0.8125rem; }
.avatar-xl { width: 84px; height: 84px; font-size: 1.5rem; }

/* ---------- login ---------- */
.login-screen {
  position: relative;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(430px, .94fr);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--frame-shadow);
}
.login-screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 3;
  background: var(--accent);
  opacity: .9;
}
.login-brand {
  position: relative;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 34px 40px 26px;
  background: var(--header-bg);
  color: var(--header-text);
  overflow: hidden;
}
.login-brand::before {
  content: "";
  position: absolute;
  right: -190px;
  bottom: -240px;
  width: 540px;
  height: 540px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 58%, transparent) 0, transparent 68%);
  opacity: .5;
  pointer-events: none;
}
.login-brand::after {
  content: "";
  position: absolute;
  right: -90px;
  top: -150px;
  width: 390px;
  height: 390px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 45%, transparent) 0, transparent 70%);
  opacity: .28;
  pointer-events: none;
}
.login-watermark {
  position: absolute;
  right: 12px;
  bottom: 26px;
  z-index: 0;
  font-family: var(--font-display);
  font-size: 240px;
  font-weight: 700;
  line-height: .75;
  letter-spacing: -.07em;
  color: rgba(255, 255, 255, .035);
  pointer-events: none;
  user-select: none;
}
.login-brand-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}
.login-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 10px;
  border: 0;
  background: rgba(255, 255, 255, .94);
  color: var(--header-bg);
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -.03em;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.login-brand-top strong { display: block; font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.login-brand-top > div > span { display: block; margin-top: 1px; font-size: 0.6875rem; color: var(--header-muted); }
.login-brand-main {
  position: relative;
  z-index: 1;
  margin: auto 0;
  max-width: 520px;
  padding: 26px 0;
}
.login-brand-main .eyebrow { color: rgba(255, 255, 255, .62); }
.login-brand-main h1 {
  max-width: 12ch;
  margin: 8px 0 12px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -.035em;
  color: #fff;
  text-wrap: balance;
}
.login-lead {
  max-width: 42ch;
  margin: 0 0 26px;
  font-size: 0.875rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, .7);
}
.login-features { display: flex; flex-direction: column; gap: 14px; max-width: 430px; }
.login-features > div { display: flex; align-items: flex-start; gap: 11px; }
.login-feature-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .11);
  background: rgba(255, 255, 255, .08);
  color: #fff;
}
.login-feature-icon svg { width: 16px; height: 16px; }
.login-features strong { display: block; font-size: 0.75rem; font-weight: 600; }
.login-features span { display: block; margin-top: 1px; font-size: 0.6875rem; line-height: 1.45; color: rgba(255, 255, 255, .56); }
.login-brand-foot {
  position: relative;
  z-index: 1;
  flex: none;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 0.625rem;
  color: rgba(255, 255, 255, .55);
}
.login-foot-sep { width: 3px; height: 3px; border-radius: 50%; background: rgba(255, 255, 255, .3); }
.login-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px;
  background: var(--surface-2);
  overflow-y: auto;
}
.login-card {
  width: min(390px, 100%);
  padding: 28px 28px 22px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}
.login-heading h2 {
  margin: 4px 0 4px;
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -.025em;
}
.login-heading p:last-child { margin: 0 0 20px; font-size: 0.8125rem; color: var(--text-2); }
.sso-btn {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
}
.sso-btn:hover { background: var(--surface-2); }
.sso-btn svg { width: 16px; height: 16px; color: var(--success); }
.login-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
  color: var(--text-3);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.login-divider::before,
.login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.login-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.login-field label { font-size: 0.6875rem; font-weight: 600; color: var(--text-2); }
.login-field input {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.8125rem;
}
.login-field input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--accent); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 52px; }
#passwordToggle {
  position: absolute;
  right: 4px;
  top: 4px;
  height: 30px;
  padding: 0 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--accent-ink);
  font-size: 0.625rem;
  font-weight: 600;
}
#passwordToggle:hover { background: var(--accent-soft); }
.login-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 14px;
}
.login-check { display: flex; align-items: center; gap: 6px; font-size: 0.6875rem; color: var(--text-2); }
.login-check input { width: 14px; height: 14px; accent-color: var(--accent); }
.login-link {
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  font-size: 0.6875rem;
  font-weight: 600;
}
.login-link:hover { text-decoration: underline; }
.login-error,
.login-hint {
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: 0.6875rem;
  line-height: 1.45;
}
.login-error { background: var(--danger-soft); color: var(--danger); }
.login-hint { background: var(--surface-2); color: var(--text-2); }
.login-submit {
  width: 100%;
  height: 40px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.login-submit:hover { background: var(--accent-hover); }
.login-submit:disabled { cursor: wait; opacity: .7; }
.login-demo { margin: 12px 0 0; font-size: 0.625rem; line-height: 1.5; text-align: center; color: var(--text-3); }
.login-card-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 15px;
  padding-top: 13px;
  border-top: 1px solid var(--border);
  font-size: 0.5625rem;
  color: var(--text-3);
}
.login-card-foot svg { width: 12px; height: 12px; color: var(--success); }
.login-legal { font-size: 0.5625rem; color: var(--text-3); text-align: center; }
.login-screen:not([hidden]) ~ .compose-fab { display: none !important; }

@media (max-width: 900px) {
  .login-screen {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
    overflow-y: auto;
  }
  .login-brand { min-height: 190px; padding: 20px 22px; }
  .login-brand-main { margin: 0; max-width: none; padding: 18px 0 0; }
  .login-brand-main .eyebrow { display: none; }
  .login-brand-main h1 { max-width: 18ch; margin: 0 0 6px; font-size: 1.75rem; }
  .login-lead { max-width: 48ch; margin: 0; font-size: 0.75rem; }
  .login-features,
  .login-brand-foot { display: none; }
  .login-watermark { right: 0; bottom: -12px; font-size: 150px; }
  .login-panel { justify-content: flex-start; padding: 16px; overflow: visible; }
  .login-card { width: min(430px, 100%); padding: 22px 20px 18px; box-shadow: var(--shadow); }
  .login-legal { padding-bottom: 4px; }
}
@media (max-width: 420px) {
  .login-brand { min-height: 164px; padding: 16px; }
  .login-mark { width: 36px; height: 36px; border-radius: 8px; font-size: 1rem; }
  .login-brand-main { padding-top: 14px; }
  .login-brand-main h1 { font-size: 1.5rem; }
  .login-lead { font-size: 0.6875rem; }
  .login-panel { padding: 12px; }
  .login-card { padding: 20px 16px 16px; }
  .login-heading h2 { font-size: 1.5rem; }
}

/* ---------- app frame ---------- */
.app {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto auto;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: var(--frame-shadow);
}

/* ---------- top bar ---------- */
.topbar {
  position: relative;
  z-index: 20;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 10px 0 12px;
  background: var(--header-bg);
  color: var(--header-text);
  box-shadow: 0 1px 0 rgba(0, 0, 0, .12);
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  opacity: .85;
}
.brand {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 4px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, .13);
  border: 1px solid rgba(255, 255, 255, .17);
  color: #fff;
  font-family: var(--font-display);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand-mark svg { width: 18px; height: 18px; stroke-width: 2.1; }
.brand-name {
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-chip {
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--header-muted);
  border: 1px solid var(--header-line);
  border-radius: 4px;
  padding: 2px 5px;
  line-height: 1.1;
  white-space: nowrap;
}
.brand-shield {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, .5);
  flex: none;
}
.search {
  flex: 0 1 520px;
  min-width: 0;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 10px;
  border-radius: var(--r-md);
  background: var(--header-field);
  border: 1px solid var(--header-line);
  color: var(--header-text);
  transition: background .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.search:hover { background: var(--header-field-hover); }
.search:focus-within {
  background: var(--surface);
  border-color: var(--border-strong);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, .16);
  color: var(--text);
}
.search-icon { color: var(--header-muted); }
.search:focus-within .search-icon { color: var(--text-2); }
.search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  background-color: transparent;
  color: inherit;
  font-size: 0.8125rem;
}
.search input::placeholder { color: var(--header-muted); }
.search:focus-within input::placeholder { color: var(--text-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search kbd {
  font-family: var(--font-ui);
  font-size: 0.625rem;
  color: var(--header-muted);
  border: 1px solid var(--header-line);
  border-radius: 4px;
  padding: 2px 5px;
  background: transparent;
  background-color: transparent;
  white-space: nowrap;
}
.search:focus-within kbd { display: none; }
.search-back, .search-clear {
  display: none;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-2);
  flex: none;
}
.search-clear { display: none; color: var(--text-3); }
.search-clear:hover { background: var(--surface-3); color: var(--text); }
.search-clear svg { width: 15px; height: 15px; }
.top-actions {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 2px;
}
.top-btn {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--header-muted);
  flex: none;
}
.top-btn:hover { background: var(--header-field-hover); color: #fff; }
.top-btn svg { width: 19px; height: 19px; }
.mobile-search-btn { display: none; }
.top-divider {
  width: 1px;
  height: 20px;
  margin: 0 7px;
  background: var(--header-line);
}
.top-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .38);
  background: rgba(255, 255, 255, .20);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 600;
}
.top-avatar:hover { background: rgba(255, 255, 255, .30); }
.top-account {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
}
.presence-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #3fb950;
  border: 2px solid var(--header-bg);
}
.notify-btn { position: relative; }
.notify-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #f0b429;
  box-shadow: 0 0 0 2px var(--header-bg);
}
.app[data-task="settings"] .search,
.app[data-task="calendar"] .search { visibility: hidden; }

/* ---------- workspace ---------- */
.workspace {
  min-height: 0;
  min-width: 0;
  display: flex;
  overflow: hidden;
}
.main-area {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
}

/* ---------- app rail ---------- */
.rail {
  width: var(--rail-w);
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 0;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
}
.rail-btn {
  position: relative;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-2);
  flex: none;
}
.rail-btn.has-label {
  width: 54px;
  height: 54px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 7px 2px 5px;
  font-size: 0.5625rem;
  font-weight: 500;
  letter-spacing: .01em;
}
.rail-label { line-height: 1; white-space: nowrap; }
.rail-btn:hover { background: var(--surface-3); color: var(--text); }
.rail-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.rail-btn.is-active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 13px;
  bottom: 13px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.rail-btn.is-active .rail-label { font-weight: 600; }
.rail-btn svg { width: 20px; height: 20px; }
.rail-rule {
  width: 28px;
  height: 1px;
  margin: 8px 0;
  background: var(--border);
}
.rail-spacer { flex: 1 1 auto; }
.rail .theme-btn .icon-sun { display: none; }
:root[data-theme="dark"] .rail .theme-btn .icon-sun { display: block; }
:root[data-theme="dark"] .rail .theme-btn .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .rail .theme-btn .icon-sun { display: block; }
  :root:not([data-theme="light"]) .rail .theme-btn .icon-moon { display: none; }
}

/* ---------- mail view grid ---------- */
.mail-view {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 236px clamp(320px, 27vw, 400px) minmax(0, 1fr);
  grid-template-rows: 44px minmax(0, 1fr);
}

/* ---------- mail command bar ---------- */
.commandbar {
  grid-column: 1 / -1;
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  padding: 0 10px;
  background: var(--raised-bg);
  border-bottom: 1px solid var(--raised-border);
  box-shadow: inset 0 1px 0 var(--raised-highlight), inset 0 -1px 0 var(--raised-inset-bottom), var(--raised-shadow);
}
.cmd-split {
  display: flex;
  align-items: stretch;
  flex: none;
  height: 30px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .18);
  overflow: hidden;
}
.cmd-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 0.75rem;
  font-weight: 600;
}
.cmd-primary:hover { background: rgba(0, 0, 0, .10); }
.cmd-primary svg { width: 15px; height: 15px; stroke-width: 2.2; }
.cmd-chevron {
  width: 24px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-left: 1px solid rgba(255, 255, 255, .22);
  background: transparent;
  color: inherit;
}
.cmd-chevron:hover { background: rgba(0, 0, 0, .10); }
.cmd-chevron svg { width: 13px; height: 13px; }
.cmd-divider {
  width: 1px;
  height: 18px;
  margin: 0 5px;
  background: var(--border);
  flex: none;
}
.cmd-btn {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 8px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
  flex: none;
}
.cmd-btn:hover { background: var(--surface-3); color: var(--text); }
.cmd-btn svg { width: 16px; height: 16px; }
.cmd-btn.icon-only { width: 30px; padding: 0; justify-content: center; }
.cmd-btn.is-disabled { opacity: .38; pointer-events: none; }
.cmd-right { margin-left: auto; display: flex; align-items: center; gap: 2px; }
.cmd-newmenu {
  position: fixed;
  z-index: 90;
  width: 190px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
}
.cmd-newmenu button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text);
  font-size: 0.75rem;
  text-align: left;
}
.cmd-newmenu button:hover { background: var(--surface-3); }
.cmd-newmenu svg { width: 16px; height: 16px; color: var(--text-2); }

/* ---------- folder pane ---------- */
.folders {
  position: relative;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
}
.drawer-head {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 8px 0 16px;
}
.drawer-head span {
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.drawer-close {
  display: none;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
}
.drawer-close:hover { background: var(--surface-3); color: var(--text); }
.folders-top { padding: 12px 10px 0; }
.compose-btn {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.8125rem;
  font-weight: 600;
  box-shadow: var(--shadow);
  transition: background .15s ease;
}
.compose-btn:hover { background: var(--accent-hover); }
.compose-btn svg { width: 17px; height: 17px; stroke-width: 2.2; }
.drawer-compose { display: none; margin-bottom: 12px; }
.tenant {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2px 6px 12px;
  min-width: 0;
}
.tenant-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 8px;
  background: var(--accent);
  color: var(--on-accent);
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: var(--shadow);
}
.tenant-id { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tenant-id strong {
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tenant-id span {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.625rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tenant-id svg { width: 12px; height: 12px; color: var(--success); flex: none; }
.account-line {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 8px 6px 11px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.account-id { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.account-id strong {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.account-id span {
  font-size: 0.625rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 2px 10px 8px;
}
.folder-section {
  margin: 12px 8px 4px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.folder-item {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 8px;
  margin-bottom: 1px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  text-align: left;
  font-size: 0.8125rem;
}
.folder-item:hover { background: var(--surface-3); color: var(--text); }
.folder-item.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}
.folder-item svg { width: 17px; height: 17px; opacity: .9; }
.folder-name {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.folder-badge {
  min-width: 20px;
  height: 18px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.folder-badge.neutral { background: var(--surface-4); color: var(--text-2); }
.quota {
  flex: none;
  padding: 12px 18px 14px;
  border-top: 1px solid var(--border);
}
.quota-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.625rem;
  color: var(--text-3);
  margin-bottom: 6px;
}
.quota-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--surface-4);
  overflow: hidden;
}
.quota-bar span {
  display: block;
  width: 16%;
  height: 100%;
  border-radius: 2px;
  background: var(--accent);
  opacity: .75;
}

/* ---------- message list ---------- */
.list-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.list-head {
  flex: none;
  padding: 15px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.list-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.list-title-row h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.list-count {
  flex: none;
  font-size: 0.6875rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.list-actions { margin-left: auto; display: flex; gap: 1px; flex: none; }
.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }
.folder-toggle { display: none; }
.chips {
  display: flex;
  gap: 5px;
  margin-top: 11px;
}
.chip {
  height: 26px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.chip:hover { background: var(--surface-3); color: var(--text); }
.chip.is-active {
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-weight: 600;
}
.list-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.msg {
  position: relative;
  width: 100%;
  display: flex;
  gap: 11px;
  padding: 11px 14px 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  user-select: none;
}
.msg:hover { background: var(--row-hover); }
.msg.is-unread { background: var(--row-unread); }
.msg.is-selected { background: var(--row-selected); }
.msg.is-selected::before,
.msg.is-unread::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.msg.is-selected::before { width: 3px; }
.msg-avatar { margin-top: 1px; }
.msg-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.msg-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.msg-from {
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg.is-unread .msg-from { font-weight: 650; }
.msg-time {
  flex: none;
  font-size: 0.6875rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-left: 2px;
}
.msg-tag {
  display: grid;
  place-items: center;
  color: var(--text-3);
  flex: none;
}
.msg-tag svg { width: 14px; height: 14px; }
.star-btn {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  flex: none;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text-3);
  opacity: 0;
  transition: opacity .12s ease, color .12s ease;
}
.msg:hover .star-btn,
.msg:focus-within .star-btn,
.star-btn.is-starred { opacity: 1; }
.star-btn:hover { background: var(--surface-3); color: var(--star); }
.star-btn svg { width: 16px; height: 16px; }
.star-btn.is-starred {
  color: var(--star);
  opacity: 1;
}
.star-btn.is-starred svg { fill: currentColor; }
.msg-subject {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg-cat-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 2px;
  background: var(--cat);
  vertical-align: 1px;
}
.msg.is-unread .msg-subject { font-weight: 600; }
.msg-snippet {
  font-size: 0.75rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.msg.is-unread .msg-snippet { color: var(--text-2); }
.app[data-density="compact"] .msg { padding: 8px 14px 8px 16px; }
.app[data-density="compact"] .msg-snippet { display: none; }
.app[data-density="compact"] .msg-avatar { width: 30px; height: 30px; font-size: 0.625rem; }
.app[data-density="compact"] .msg-main { gap: 2px; }
.list-empty {
  padding: 44px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.list-empty-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-3);
  color: var(--text-3);
  margin-bottom: 12px;
}
.list-empty h2 {
  margin: 0 0 4px;
  font-size: 0.875rem;
  font-weight: 600;
}
.list-empty p {
  margin: 0 0 14px;
  max-width: 26ch;
  font-size: 0.75rem;
  color: var(--text-3);
  line-height: 1.55;
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.btn-secondary:hover { background: var(--surface-2); }
.btn-secondary svg { width: 15px; height: 15px; }

/* ---------- reading pane ---------- */
.reader {
  container-type: inline-size;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.reader-toolbar {
  flex: none;
  min-height: 48px;
  display: none;
  align-items: center;
  gap: 1px;
  padding: 0 10px;
  border-bottom: 1px solid var(--border);
}
.reader.is-empty .reader-toolbar { display: none; }
.tool-btn {
  height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.tool-btn:hover { background: var(--surface-3); color: var(--text); }
.tool-btn svg { width: 17px; height: 17px; }
.tool-btn.icon-only { width: 32px; padding: 0; justify-content: center; }
.tool-divider {
  width: 1px;
  height: 18px;
  margin: 0 4px;
  background: var(--border);
  flex: none;
}
.tool-spacer { flex: 1; }
.reader-back { display: none !important; }
.reader-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.reader-doc {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 26px 32px 52px;
}
.subject-card {
  margin-bottom: 18px;
  padding: 16px 18px 14px;
  border: 1px solid var(--raised-border);
  border-radius: var(--r-lg);
  background: var(--raised-bg);
  box-shadow: inset 0 1px 0 var(--raised-highlight), inset 0 -1px 0 var(--raised-inset-bottom), var(--raised-shadow);
}
.subject-card .reader-subject { margin-bottom: 0; }
.subject-card .reader-tags { margin: 11px 0 0; padding-left: 0; }
.reader-subject {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
}
.reader-subject h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.reader-subject .star-btn { opacity: 1; width: 30px; height: 30px; color: var(--text-3); }
.reader-subject .star-btn:hover { color: var(--star); }
.reader-subject .star-btn.is-starred { color: var(--star); }
.reader-subject .star-btn.is-starred svg { fill: currentColor; }
.sender-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.sender-id { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sender-name {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sender-name-row { display: flex; align-items: center; gap: 5px; min-width: 0; }
.sender-verified { width: 13px; height: 13px; color: var(--success); flex: none; }
.sender-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.6875rem;
  color: var(--text-3);
}
.sender-meta .meta-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.reader-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin: -10px 0 16px;
  padding-left: 1px;
}
.chip-cat,
.chip-class {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 21px;
  padding: 0 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
.chip-cat .cat-dot { width: 6px; height: 6px; border-radius: 2px; background: var(--cat); flex: none; }
.chip-class {
  font-size: 0.5625rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  font-weight: 700;
}
.chip-class.confidential {
  background: var(--warning-soft);
  border-color: color-mix(in srgb, var(--warning) 30%, transparent);
  color: var(--warning);
}
.chip-class.public {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 28%, transparent);
  color: var(--success);
}
.trust-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 22px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: 0.625rem;
  color: var(--text-3);
}
.trust-line svg { width: 13px; height: 13px; color: var(--success); flex: none; }
.trust-line.is-external svg { color: var(--warning); }
.trust-line.is-external .trust-strong { color: var(--warning); }
.trust-line .trust-strong { color: var(--text-2); font-weight: 600; }
.trust-line .trust-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--border-strong); }
.trust-line .trust-details {
  margin-left: auto;
  padding: 2px 4px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--accent-ink);
  font-size: 0.625rem;
  font-weight: 600;
}
.trust-line .trust-details:hover { background: var(--accent-soft); }
.external-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 0 0 20px;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--warning) 34%, transparent);
  border-radius: var(--r-md);
  background: var(--warning-soft);
  font-size: 0.75rem;
  line-height: 1.5;
  color: var(--text);
}
.external-banner > div { flex: 1; min-width: 0; }
.external-banner > svg { width: 17px; height: 17px; color: var(--warning); flex: none; margin-top: 1px; }
.external-banner strong {
  display: block;
  margin-bottom: 1px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--warning);
}
.external-banner .banner-action {
  flex: none;
  align-self: center;
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  border-radius: 4px;
  background: transparent;
  color: var(--warning);
  font-size: 0.625rem;
  font-weight: 600;
  white-space: nowrap;
}
.external-banner .banner-action:hover { background: color-mix(in srgb, var(--warning) 10%, transparent); }
.meeting-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 68ch;
  margin: 28px 0 0;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.meeting-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.meeting-icon svg { width: 18px; height: 18px; }
.meeting-main { flex: 1; min-width: 0; }
.meeting-kicker {
  display: block;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
}
.meeting-main h3 {
  margin: 2px 0 4px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.meeting-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 12px;
  font-size: 0.6875rem;
  color: var(--text-2);
}
.meeting-meta span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.meeting-meta svg { width: 12px; height: 12px; color: var(--text-3); flex: none; }
.meeting-actions { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; flex: none; }
.meeting-actions button {
  height: 26px;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.625rem;
  font-weight: 600;
  white-space: nowrap;
}
.meeting-actions button:hover { border-color: var(--accent); color: var(--accent-ink); }
.meeting-actions button.is-active { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.email-body {
  max-width: 68ch;
  font-size: 0.9375rem;
  line-height: 1.68;
  color: var(--text);
}
.email-body p { margin: 0 0 1em; }
.email-body p:last-child { margin-bottom: 0; }
.email-body ol, .email-body ul { margin: 0 0 1em; padding-left: 1.4em; }
.email-body li { margin: .35em 0; padding-left: .2em; }
.email-body a { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
.email-body .sig { margin-top: 1.6em; color: var(--text-2); }
.email-body .sig span { color: var(--text-3); font-size: .8125rem; }
.attachments {
  max-width: 68ch;
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.attach-title {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 0 0 9px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.attach-title svg { width: 13px; height: 13px; color: var(--success); }
.attach-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.attach {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 190px;
  max-width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-align: left;
}
.attach:hover { border-color: var(--border-strong); background: var(--surface-3); }
.attach-badge {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: var(--r-sm);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--surface-4);
  color: var(--text-2);
}
.attach-badge[data-type="PDF"] { background: var(--danger-soft); color: var(--danger); }
.attach-badge[data-type="XLS"] { background: var(--success-soft); color: var(--success); }
.attach-badge[data-type="DOC"] { background: var(--accent-soft); color: var(--accent-ink); }
.attach-badge[data-type="ZIP"] { background: var(--warning-soft); color: var(--warning); }
.attach-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.attach-name {
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.attach-size { font-size: 0.625rem; color: var(--text-3); }
.attach-safe { width: 14px; height: 14px; color: var(--success); margin-left: auto; flex: none; }
.attach-dl { margin-left: 4px; color: var(--text-3); width: 16px; height: 16px; flex: none; }
.reader-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px 56px;
}
.empty-mark {
  width: 104px;
  height: 104px;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  margin-bottom: 20px;
}
.empty-monogram {
  font-family: var(--font-display);
  font-size: 2.75rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
}
.empty-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  width: min(570px, 100%);
  margin: 20px 0 24px;
}
.empty-stat {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  text-align: left;
}
.empty-stat-value {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empty-stat-value.is-number { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.empty-stat-label {
  display: block;
  margin-top: 2px;
  font-size: 0.625rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.empty-protected { display: inline-flex; align-items: center; gap: 5px; color: var(--success); }
.empty-protected svg { width: 14px; height: 14px; }
.reader-empty h2 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
}
.reader-empty p {
  margin: 0 0 22px;
  max-width: 34ch;
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--text-3);
}
.empty-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
}
.empty-key {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.6875rem;
  color: var(--text-3);
}
kbd {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--text-2);
  font-family: var(--font-ui);
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1;
}

/* container refinements for the reading pane */
@container (max-width: 560px) {
  .reader-doc { padding: 22px 20px 44px; }
  .subject-card { padding: 13px 14px 12px; }
  .reader-subject h2 { font-size: 1.1875rem; }
  .tool-btn .tool-label { display: none; }
  .tool-btn { width: 32px; padding: 0; justify-content: center; }
  .meeting-card { flex-wrap: wrap; }
  .meeting-actions { width: 100%; justify-content: flex-start; }
}
@container (max-width: 440px) {
  .reader-doc { padding: 18px 16px 40px; }
  .subject-card { padding: 12px; }
  .reader-subject h2 { font-size: 1.0625rem; }
  .attach { min-width: 0; width: 100%; }
}

/* ---------- status bar ---------- */
.statusbar {
  height: var(--status-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}
.status-left { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); flex: none; }
.status-mid { white-space: nowrap; }
.status-right { margin-left: auto; display: flex; align-items: center; gap: 12px; white-space: nowrap; }
.status-quota { display: inline-flex; align-items: center; gap: 6px; }
.status-quota-bar {
  width: 54px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-4);
  overflow: hidden;
}
.status-quota-bar span { display: block; width: 16%; height: 100%; background: var(--accent); opacity: .7; }

/* ---------- mobile tabs ---------- */
.mobile-tabs { display: none; }
.compose-fab { display: none; }

/* ---------- drawer scrim ---------- */
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(8, 12, 18, .46);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}
.scrim.is-open { opacity: 1; visibility: visible; }

/* ---------- people ---------- */
.people-view {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  background: var(--surface);
}
.people-list {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
}
.people-head {
  flex: none;
  padding: 18px 16px 12px;
  border-bottom: 1px solid var(--border);
}
.people-head .eyebrow { margin-bottom: 4px; font-size: 0.5625rem; color: var(--accent-ink); }
.people-title-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.people-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.people-count { flex: none; font-size: 0.625rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.people-head p { margin: 2px 0 0; font-size: 0.75rem; color: var(--text-3); }
.dept-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 10px; }
.dept-chips .chip { height: 24px; padding: 0 8px; font-size: 0.6875rem; }
.people-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 10px 16px; }
.contact {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 10px;
  margin-bottom: 1px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  text-align: left;
}
.contact:hover { background: var(--surface-3); }
.contact.is-active { background: var(--accent-soft); }
.contact-id { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.contact-name {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-role {
  font-size: 0.6875rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-pane {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.person-toolbar { flex: none; min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-bottom: 1px solid var(--border); }
.person-back { display: none; }
.person-scroll { flex: 1; min-height: 0; overflow-y: auto; }
.person-doc { max-width: 760px; margin: 0 auto; padding: 32px 32px 56px; }
.person-hero { display: flex; align-items: flex-start; gap: 18px; flex-wrap: wrap; }
.person-hero-id { min-width: 0; flex: 1; padding-top: 6px; }
.person-hero h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.625rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.person-hero p { margin: 3px 0 0; font-size: 0.8125rem; color: var(--text-2); }
.directory-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--success);
}
.directory-badge svg { width: 12px; height: 12px; }
.person-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; width: 100%; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary svg { width: 16px; height: 16px; }
.info-card {
  margin-top: 26px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface-2);
  overflow: hidden;
}
.info-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
}
.info-row:last-child { border-bottom: 0; }
.info-label { color: var(--text-3); }
.info-value { color: var(--text); overflow-wrap: anywhere; }
.recent-block { margin-top: 30px; }
.recent-block h3 {
  margin: 0 0 10px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.recent-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  margin-bottom: 7px;
  text-align: left;
}
.recent-item:hover { background: var(--surface-2); border-color: var(--border-strong); }
.recent-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--accent-soft);
  color: var(--accent-ink);
  flex: none;
}
.recent-icon svg { width: 16px; height: 16px; }
.recent-main { min-width: 0; flex: 1; }
.recent-subject {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.recent-when { display: block; font-size: 0.625rem; color: var(--text-3); margin-top: 1px; }
.recent-arrow { color: var(--text-3); width: 16px; height: 16px; }
.people-empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.75rem;
}

/* ---------- calendar ---------- */
.calendar-view {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface);
}
.calendar-head {
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px 14px;
  border-bottom: 1px solid var(--border);
}
.calendar-title h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.calendar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cal-nav {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.cal-nav .icon-btn { width: 30px; height: 30px; border-radius: 0; }
.cal-nav .icon-btn + .icon-btn { border-left: 1px solid var(--border); }
.calendar-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  overflow: hidden;
}
.cal-month {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px 18px 18px;
  border-right: 1px solid var(--border);
}
.cal-month-head {
  flex: none;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 9px;
}
.cal-month-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.cal-month-head span { font-size: 0.6875rem; color: var(--text-3); }
.cal-weekdays {
  flex: none;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  padding: 0 0 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.cal-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.cal-cell {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 5px 6px;
  border: 0;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  overflow: hidden;
}
.cal-cell:hover { background: var(--surface-2); }
.cal-cell.is-weekend { background: var(--surface-2); }
.cal-cell.is-outside { background: var(--surface-2); color: var(--text-3); }
.cal-cell.is-selected { background: var(--accent-soft); }
.cal-daynum {
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: 50%;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
}
.cal-cell.is-today .cal-daynum { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.cal-events { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow: hidden; }
.cal-event {
  display: block;
  min-width: 0;
  padding: 2px 4px;
  border-left: 2px solid var(--ev);
  border-radius: 2px;
  background: color-mix(in srgb, var(--ev) 11%, transparent);
  color: color-mix(in srgb, var(--ev) 68%, var(--text));
  font-size: 0.625rem;
  font-weight: 500;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cal-more { padding-left: 3px; font-size: 0.5625rem; color: var(--text-3); }
.cal-agenda {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
}
.cal-agenda-head {
  flex: none;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 18px 18px 12px;
  border-bottom: 1px solid var(--border);
}
.cal-agenda-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.cal-agenda-head .eyebrow { margin-bottom: 4px; }
.cal-agenda-count {
  flex: none;
  font-size: 0.625rem;
  color: var(--text-3);
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}
.cal-agenda-list { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px 16px; }
.agenda-event {
  display: flex;
  align-items: stretch;
  gap: 9px;
  padding: 10px 11px;
  margin-bottom: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.agenda-bar { width: 3px; flex: none; border-radius: 2px; background: var(--ev); }
.agenda-time {
  width: 48px;
  flex: none;
  padding-top: 1px;
  font-size: 0.625rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  line-height: 1.45;
}
.agenda-time strong { display: block; color: var(--text-2); font-weight: 600; }
.agenda-main { flex: 1; min-width: 0; }
.agenda-title { font-size: 0.75rem; font-weight: 600; line-height: 1.35; }
.agenda-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  margin-top: 4px;
  font-size: 0.625rem;
  color: var(--text-3);
}
.agenda-meta span { display: inline-flex; align-items: center; gap: 4px; min-width: 0; }
.agenda-meta svg { width: 12px; height: 12px; flex: none; }
.cal-agenda-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.625rem;
  color: var(--text-3);
}
.cal-agenda-foot svg { width: 13px; height: 13px; color: var(--success); flex: none; }
.cal-empty {
  padding: 22px 12px;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-3);
}
.agenda-upcoming {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--border);
}
.agenda-upcoming-head {
  margin: 0 2px 6px;
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.upcoming-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  margin: 0 2px;
  padding: 7px 8px;
  border-left: 2px solid var(--ev);
  border-radius: 0 4px 4px 0;
  background: color-mix(in srgb, var(--ev) 5%, transparent);
}
.upcoming-item + .upcoming-item { margin-top: 4px; }
.upcoming-date {
  width: 58px;
  flex: none;
  padding-top: 1px;
  font-size: 0.5625rem;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
.upcoming-main { min-width: 0; flex: 1; }
.upcoming-meta {
  margin-top: 1px;
  font-size: 0.5625rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- settings ---------- */
.settings-view {
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: var(--surface);
}
.settings-scroll { height: 100%; overflow-y: auto; }
.settings-doc { max-width: 840px; margin: 0 auto; padding: 34px 30px 60px; }
.eyebrow {
  margin: 0 0 6px;
  font-size: 0.625rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-ink);
}
.settings-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.025em;
}
.settings-head > p:last-child {
  margin: 6px 0 0;
  max-width: 56ch;
  font-size: 0.8125rem;
  color: var(--text-2);
  line-height: 1.6;
}
.settings-grid { display: flex; flex-direction: column; gap: 16px; margin-top: 26px; }
.card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 16px; }
.card-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: var(--r-md);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.card-icon svg { width: 18px; height: 18px; }
.card-head h2 { margin: 1px 0 0; font-size: 0.875rem; font-weight: 600; }
.card-head p { margin: 2px 0 0; font-size: 0.75rem; color: var(--text-3); line-height: 1.45; }
.theme-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.theme-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: left;
}
.theme-card:hover { border-color: var(--border-strong); }
.theme-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  background: var(--surface);
  color: var(--text);
}
.theme-thumb {
  height: 54px;
  border-radius: 6px;
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.theme-thumb .tt-bar { height: 13px; background: #0b4f8a; flex: none; }
.theme-thumb .tt-body { flex: 1; display: flex; background: #f2f5f9; }
.theme-thumb .tt-side { width: 22%; background: #ffffff; border-right: 1px solid #dde4ed; }
.theme-thumb .tt-main { flex: 1; display: flex; flex-direction: column; gap: 4px; padding: 7px 6px; }
.theme-thumb .tt-main i { height: 4px; border-radius: 2px; background: #d9e1ea; }
.theme-thumb .tt-main i:first-child { width: 64%; background: #b7c3d2; }
.theme-thumb[data-variant="dark"] .tt-bar { background: #164a75; }
.theme-thumb[data-variant="dark"] .tt-body { background: #141920; }
.theme-thumb[data-variant="dark"] .tt-side { background: #10151b; border-color: #2a3340; }
.theme-thumb[data-variant="dark"] .tt-main i { background: #303a47; }
.theme-thumb[data-variant="dark"] .tt-main i:first-child { background: #5b6c81; }
.theme-thumb[data-variant="system"] .tt-bar {
  background: linear-gradient(90deg, #0b4f8a 0 50%, #164a75 50% 100%);
}
.theme-thumb[data-variant="system"] .tt-body {
  background: linear-gradient(90deg, #f2f5f9 0 50%, #141920 50% 100%);
}
.theme-thumb[data-variant="system"] .tt-side {
  background: linear-gradient(90deg, #ffffff 0 50%, #10151b 50% 100%);
  border-color: #ccd6e2;
}
.theme-card-label { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.theme-check {
  display: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  place-items: center;
  flex: none;
}
.theme-check svg { width: 10px; height: 10px; stroke-width: 2.6; }
.theme-card.is-active .theme-check { display: grid; }
.accent-row { display: flex; flex-wrap: wrap; gap: 8px; }
.accent-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 5px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 500;
}
.accent-option:hover { border-color: var(--border-strong); }
.accent-option.is-active {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--accent);
}
.accent-dot {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--sw);
  color: #fff;
  flex: none;
}
.accent-dot svg { width: 13px; height: 13px; stroke-width: 2.6; opacity: 0; }
.accent-option.is-active .accent-dot svg { opacity: 1; }
.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.segmented button {
  height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font-size: 0.75rem;
  font-weight: 500;
}
.segmented button:hover { color: var(--text); }
.segmented button.is-active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: var(--shadow);
}
.density-hint { margin: 9px 0 0; font-size: 0.6875rem; color: var(--text-3); }
.setting-list {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.setting-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.setting-row:last-child { border-bottom: 0; }
.setting-copy { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.setting-copy strong { font-size: 0.75rem; font-weight: 600; }
.setting-copy span { font-size: 0.6875rem; line-height: 1.45; color: var(--text-3); }
.switch {
  width: 34px;
  height: 20px;
  padding: 2px;
  display: flex;
  align-items: center;
  flex: none;
  border: 0;
  border-radius: 999px;
  background: var(--surface-4);
  transition: background .15s ease;
}
.switch span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .25);
  transition: transform .15s ease;
}
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"] span { transform: translateX(14px); }
.policy-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  height: 22px;
  padding: 0 7px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.policy-chip svg { width: 11px; height: 11px; color: var(--success); }
.about-text {
  margin: 0;
  max-width: 68ch;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: var(--text-2);
}
.static-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.static-chips span {
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-size: 0.625rem;
  font-weight: 500;
}
.about-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}
.about-note { font-size: 0.6875rem; color: var(--text-3); }

/* ---------- settings workspace ---------- */
.settings-layout { display: flex; height: 100%; min-height: 0; }
.settings-nav {
  width: 228px;
  flex: none;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
}
.settings-nav-head { flex: none; padding: 20px 18px 12px; }
.settings-nav-head .eyebrow { margin-bottom: 4px; }
.settings-nav-head h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.settings-nav-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 10px 12px;
}
.settings-nav-item {
  width: 100%;
  height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 0.8125rem;
  text-align: left;
}
.settings-nav-item:hover { background: var(--surface-3); color: var(--text); }
.settings-nav-item.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.settings-nav-item svg { width: 17px; height: 17px; flex: none; }
.settings-nav-item .nav-chevron { margin-left: auto; width: 13px; height: 13px; opacity: .45; }
.settings-nav-foot {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 0.625rem;
  color: var(--text-3);
}
.settings-nav-foot svg { width: 13px; height: 13px; color: var(--success); flex: none; }
.settings-main { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.settings-topbar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.settings-topbar .eyebrow { margin-bottom: 3px; }
.settings-topbar h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.settings-main .settings-scroll { flex: 1; min-height: 0; height: auto; overflow-y: auto; }
.settings-panels { max-width: 980px; margin: 0; padding: 22px 30px 60px; }
.settings-panel { display: none; }
.settings-panel.is-active { display: block; }
.settings-block { margin-bottom: 24px; }
.settings-block-head { margin-bottom: 10px; }
.settings-block-head h3 { margin: 0; font-size: 0.875rem; font-weight: 600; }
.settings-block-head p { margin: 2px 0 0; font-size: 0.75rem; line-height: 1.5; color: var(--text-3); }
.settings-block-body {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
}
.settings-note { margin: 9px 0 0; font-size: 0.625rem; line-height: 1.5; color: var(--text-3); }
.pref-list {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}
.pref-row {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.pref-row:last-child { border-bottom: 0; }
.pref-copy { flex: 1; min-width: 0; }
.pref-copy strong { display: block; font-size: 0.75rem; font-weight: 600; }
.pref-copy span { display: block; margin-top: 1px; font-size: 0.6875rem; line-height: 1.45; color: var(--text-3); }
.pref-select {
  flex: none;
  height: 30px;
  min-width: 110px;
  padding: 0 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
}
.account-profile {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.account-profile-copy { flex: 1; min-width: 0; }
.account-profile h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.account-profile p { margin: 2px 0 6px; font-size: 0.75rem; color: var(--text-2); }
.storage-inline { display: flex; align-items: center; gap: 6px; flex: none; font-size: 0.625rem; color: var(--text-3); }
.storage-inline > span {
  width: 70px;
  height: 4px;
  display: block;
  border-radius: 2px;
  background: var(--surface-4);
  overflow: hidden;
}
.storage-inline i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.session-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.session-row:last-child { border-bottom: 0; }
.session-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  color: var(--text-2);
}
.session-icon svg { width: 15px; height: 15px; }
.link-btn {
  flex: none;
  padding: 4px 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--accent-ink);
  font-size: 0.6875rem;
  font-weight: 600;
}
.link-btn:hover { background: var(--accent-soft); }
.settings-actions { display: flex; justify-content: flex-end; margin-top: 12px; }

/* ---------- compose ---------- */
.compose-layer {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
}
.compose-layer .compose { pointer-events: auto; }
.compose {
  position: fixed;
  right: 28px;
  bottom: calc(var(--status-h) + 28px);
  z-index: 1;
  width: min(580px, calc(100vw - 56px));
  height: min(540px, calc(100dvh - 120px));
  min-width: 380px;
  min-height: 300px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-compose);
  overflow: hidden;
  animation: compose-in .16s ease-out;
}
@keyframes compose-in {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to { opacity: 1; transform: none; }
}
.compose-head {
  flex: none;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px 0 14px;
  background: var(--header-bg);
  color: var(--header-text);
  user-select: none;
  cursor: grab;
  touch-action: none;
}
body[data-compose-pointer="drag"] { cursor: grabbing; user-select: none; }
body[data-compose-pointer="resize"] { cursor: nwse-resize; user-select: none; }
body[data-compose-pointer="drag"] .compose-head { cursor: grabbing; }
.compose-grip {
  width: 10px;
  height: 14px;
  flex: none;
  background-image: radial-gradient(var(--header-muted) 1px, transparent 1.3px);
  background-size: 4px 4px;
  opacity: .6;
}
.compose-head h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compose-head-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.compose-head-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--header-muted);
}
.compose-head-btn:hover { background: var(--header-field-hover); color: #fff; }
.compose-head-btn svg { width: 16px; height: 16px; }
.compose-expand .icon-collapse { display: none; }
.compose.is-inline .compose-expand .icon-expand { display: none; }
.compose.is-inline .compose-expand .icon-collapse { display: block; }
.compose.is-inline {
  border: 0;
  border-radius: 0;
  box-shadow: none;
  min-width: 0;
  min-height: 0;
}
.compose.is-inline .compose-grip { display: none; }
.compose.is-inline .compose-resize { display: none; }
.compose.is-inline .compose-head { cursor: default; }
.compose-body {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.compose-field {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
}
.compose-field label {
  flex: none;
  width: 50px;
  font-size: 0.75rem;
  color: var(--text-3);
}
.compose-field input {
  flex: 1;
  min-width: 0;
  height: 38px;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 0.8125rem;
}
.compose-field input::placeholder { color: var(--text-3); }
.compose-field.is-error { box-shadow: inset 0 -2px 0 var(--danger); }
.cc-toggle {
  border: 0;
  background: transparent;
  color: var(--accent-ink);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 4px 6px;
  border-radius: 4px;
  flex: none;
}
.cc-toggle:hover { background: var(--accent-soft); }
.compose-options { flex: none; border-bottom: 1px solid var(--border); }
.compose-options-toggle {
  width: 100%;
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 14px;
  border: 0;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.6875rem;
  font-weight: 600;
  text-align: left;
}
.compose-options-toggle:hover { background: var(--surface-3); color: var(--text); }
.compose-options-toggle svg { width: 14px; height: 14px; flex: none; }
.compose-options-toggle .opt-chevron { margin-left: auto; transition: transform .15s ease; }
.compose-options-toggle[aria-expanded="true"] .opt-chevron { transform: rotate(180deg); }
.compose-opt-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.compose-opt-chips span {
  padding: 2px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 0.5625rem;
  font-weight: 600;
}
.compose-options-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  padding: 11px 14px 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
}
.compose-option { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 0.625rem; color: var(--text-3); }
.compose-option select {
  width: 100%;
  height: 30px;
  min-width: 0;
  padding: 0 7px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
}
.compose-check {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 0.6875rem;
  color: var(--text-2);
}
.compose-check input { width: 14px; height: 14px; accent-color: var(--accent); flex: none; }
.compose-text {
  flex: 1;
  min-height: 140px;
  width: 100%;
  padding: 14px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  font-size: 0.875rem;
  line-height: 1.65;
}
.compose-text::placeholder { color: var(--text-3); }
.compose-files { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 12px; }
.compose-file {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 0.6875rem;
  color: var(--text-2);
  max-width: 100%;
}
.compose-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.compose-file button {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-3);
  flex: none;
}
.compose-file button:hover { background: var(--surface-4); color: var(--text); }
.compose-file svg { width: 11px; height: 11px; }
.compose-foot {
  flex: none;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.compose-note {
  flex: 1;
  min-width: 0;
  text-align: right;
  font-size: 0.625rem;
  color: var(--text-3);
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compose-actions { display: flex; gap: 2px; }
.compose.is-minimized {
  height: 44px !important;
  width: min(320px, calc(100vw - 40px)) !important;
}
.compose.is-minimized .compose-body,
.compose.is-minimized .compose-foot { display: none; }
.compose.is-minimized .compose-resize { display: none; }
.compose.is-minimized .compose-head { cursor: pointer; }
.compose-resize {
  position: absolute;
  right: 3px;
  bottom: 3px;
  z-index: 3;
  width: 16px;
  height: 16px;
  cursor: nwse-resize;
  touch-action: none;
  opacity: .55;
}
.compose-resize::before,
.compose-resize::after {
  content: "";
  position: absolute;
  border-right: 1px solid var(--text-3);
  border-bottom: 1px solid var(--text-3);
}
.compose-resize::before { right: 3px; bottom: 3px; width: 8px; height: 8px; }
.compose-resize::after { right: 6px; bottom: 6px; width: 5px; height: 5px; opacity: .6; }
.compose-resize:hover { opacity: 1; }

/* ---------- compose dock ---------- */
.compose-dock {
  flex: none;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 0 12px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  overflow: hidden;
}
.compose-dock-tabs {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
}
.compose-dock-tabs::-webkit-scrollbar { display: none; }
.compose-tab {
  min-width: 150px;
  max-width: 260px;
  height: 32px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 4px 0 9px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text-2);
  font-size: 0.6875rem;
  cursor: pointer;
  flex: none;
}
.compose-tab:hover { border-color: var(--border-strong); color: var(--text); }
.compose-tab.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-ink);
}
.compose-tab.is-minimized { box-shadow: inset 0 0 0 1px var(--border); }
.compose-tab-icon { display: grid; place-items: center; flex: none; }
.compose-tab-icon svg { width: 14px; height: 14px; }
.compose-tab-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; line-height: 1.25; }
.compose-tab-text strong {
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compose-tab-text span {
  font-size: 0.5625rem;
  color: var(--text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.compose-tab-close {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  flex: none;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-3);
}
.compose-tab-close:hover { background: var(--surface-4); color: var(--text); }
.compose-tab-close svg { width: 12px; height: 12px; }

/* ---------- dialog / toast ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(8, 12, 18, .5);
  animation: fade-in .14s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.dialog {
  width: min(460px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: dialog-in .16s ease-out;
}
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(8px) scale(.99); }
  to { opacity: 1; transform: none; }
}
.dialog-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px 20px;
}
.dialog-head h2 { margin: 0; flex: 1; font-size: 0.9375rem; font-weight: 600; }
.dialog-body { padding: 0 20px 20px; }
.shortcut-list { margin: 0; padding: 0; display: flex; flex-direction: column; }
.shortcut-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-2);
}
.shortcut-row:last-child { border-bottom: 0; }
.shortcut-keys { display: flex; gap: 4px; flex: none; }
.dialog-note { margin: 14px 0 0; font-size: 0.6875rem; color: var(--text-3); line-height: 1.5; }
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--status-h) + 30px);
  z-index: 110;
  transform: translate(-50%, 12px);
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 12px 10px 16px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: var(--text);
  color: var(--surface);
  font-size: 0.75rem;
  font-weight: 500;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}
.toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }
.toast text { }
.toast-action {
  flex: none;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 5px 10px;
}
.toast-action:hover { opacity: .9; }

/* ---------- notifications ---------- */
.notify-pop {
  position: fixed;
  top: calc(16px + var(--topbar-h) + 6px);
  right: 28px;
  z-index: 92;
  width: min(360px, calc(100vw - 36px));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  animation: dialog-in .14s ease-out;
}
.notify-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 10px 14px;
  border-bottom: 1px solid var(--border);
}
.notify-head h2 { margin: 0; flex: 1; font-size: 0.875rem; font-weight: 600; }
.notify-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  text-align: left;
}
.notify-item:hover { background: var(--surface-2); }
.notify-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: none;
  border-radius: var(--r-md);
  background: var(--surface-3);
  color: var(--text-2);
}
.notify-icon.accent { background: var(--accent-soft); color: var(--accent-ink); }
.notify-icon.security { background: var(--success-soft); color: var(--success); }
.notify-icon svg { width: 16px; height: 16px; }
.notify-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.notify-main strong { font-size: 0.75rem; font-weight: 600; line-height: 1.35; }
.notify-main span { font-size: 0.625rem; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notify-item time { flex: none; font-size: 0.5625rem; color: var(--text-3); }
.notify-foot {
  padding: 9px 14px;
  background: var(--surface-2);
  color: var(--text-3);
  font-size: 0.5625rem;
}

/* ---------- details + event dialog ---------- */
.details-dialog { width: min(520px, 100%); }
.details-grid {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.details-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
}
.details-row:last-child { border-bottom: 0; }
.details-row dt { color: var(--text-3); }
.details-row dd { margin: 0; color: var(--text); overflow-wrap: anywhere; }
.details-note { margin: 12px 0 0; font-size: 0.625rem; line-height: 1.5; color: var(--text-3); }

.event-dialog { width: min(480px, 100%); }
.form-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; min-width: 0; }
.form-field label { font-size: 0.6875rem; font-weight: 600; color: var(--text-2); }
.form-field input {
  width: 100%;
  height: 34px;
  min-width: 0;
  padding: 0 9px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 0.75rem;
}
.form-field input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--accent); }
.form-row { display: flex; gap: 8px; flex-wrap: wrap; }
.form-row .form-field { flex: 0 1 110px; margin-bottom: 12px; }
.form-row .form-field.grow { flex: 1 1 140px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* ============================================================
   responsive
   ============================================================ */
@media (max-width: 1250px) {
  .cmd-btn > span { display: none; }
  .cmd-btn { width: 32px; padding: 0; justify-content: center; }
}

@media (max-width: 1119px) {
  .mail-view { grid-template-columns: clamp(300px, 44%, 400px) minmax(0, 1fr); }
  .drawer-compose { display: flex; }
  .folders {
    position: fixed;
    top: max(16px, env(safe-area-inset-top, 0px));
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    left: max(16px, env(safe-area-inset-left, 0px));
    z-index: 60;
    width: 288px;
    transform: translateX(calc(-100% - 16px));
    transition: transform .22s ease;
    box-shadow: var(--shadow-pop);
    border: 1px solid var(--border-strong);
    border-radius: 14px;
    overflow: hidden;
    padding-top: 0;
    padding-bottom: 0;
  }
  body.drawer-open .folders { transform: none; }
  .scrim { display: block; }
  .drawer-head { display: flex; }
  .drawer-close { display: grid; }
  .folder-toggle { display: grid; }
  .people-view { grid-template-columns: 300px minmax(0, 1fr); }
  .calendar-body { grid-template-columns: minmax(0, 1fr) 300px; }
}

@media (max-width: 719px) {
  :root { --topbar-h: 52px; }
  .app { grid-template-rows: auto minmax(0, 1fr) auto auto; }
  .rail { display: none; }
  .topbar { gap: 8px; padding: 0 8px; }
  .top-help, .top-settings { display: none; }
  .brand { flex: 0 1 auto; gap: 8px; padding-left: 0; }
  .brand-name { font-size: 0.875rem; }
  .brand-chip { font-size: 0.5rem; padding: 1px 4px; }
  .brand-shield { display: none; }
  .brand-mark { width: 28px; height: 28px; border-radius: 7px; font-size: 0.75rem; }
  .search { display: none; }
  .mobile-search-btn { display: grid; }
  .top-actions { flex: 0 0 auto; margin-left: auto; }
  .top-divider { display: none; }
  .statusbar { display: none; }
  .mobile-tabs {
    height: var(--tabs-h);
    padding-bottom: 0;
    display: flex;
    background: var(--surface-2);
    border-top: 1px solid var(--border);
  }
  .mobile-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border: 0;
    background: transparent;
    color: var(--text-3);
    font-size: 0.625rem;
    font-weight: 500;
  }
  .mobile-tab svg { width: 20px; height: 20px; }
  .mobile-tab.is-active { color: var(--accent-ink); }
  .mobile-tab.is-active svg { stroke-width: 2; }

  .mail-view { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .commandbar { display: none; }
  .list-pane { border-right: 0; }
  .reader { display: none; }
  .reader-toolbar { display: flex; }
  body.reader-open .list-pane { display: none; }
  body.reader-open .reader { display: flex; }
  .reader-back { display: grid !important; }
  .reader-doc { padding: 20px 18px 44px; }
  .reader-subject h2 { font-size: 1.1875rem; }
  .compose {
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px) + var(--tabs-h) + var(--compose-dock-h, 0px)) !important;
    width: auto !important;
    height: auto !important;
    min-width: 0;
    min-height: 0;
    max-width: none;
    max-height: none;
    border-radius: 0;
    border: 0;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: 0;
  }
  .compose-expand { display: none; }
  .compose-resize { display: none; }
  .compose-grip { display: none; }
  .compose-head { cursor: default; }
  .compose-fab {
    position: fixed;
    right: 28px;
    bottom: calc(var(--tabs-h) + 32px + var(--compose-dock-h, 0px) + env(safe-area-inset-bottom, 0px));
    z-index: 30;
    width: 52px;
    height: 52px;
    place-items: center;
    border: 0;
    border-radius: 16px;
    background: var(--accent);
    color: var(--on-accent);
    box-shadow: var(--shadow-pop);
  }
  .compose-fab svg { width: 23px; height: 23px; stroke-width: 2.2; }
  .app[data-task="mail"] ~ .compose-fab { display: grid; }
  body.compose-visible .compose-fab,
  body.reader-open .compose-fab,
  body.drawer-open .compose-fab { display: none !important; }

  /* mobile search overlay */
  body.search-open .search {
    display: flex;
    position: absolute;
    left: 8px;
    right: 8px;
    top: 8px;
    bottom: 8px;
    z-index: 5;
    max-width: none;
    background: var(--surface);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-pop);
    color: var(--text);
  }
  body.search-open .search .search-back { display: grid; color: var(--text-2); }
  body.search-open .search .search-icon { color: var(--text-2); }
  body.search-open .search input::placeholder { color: var(--text-3); }
  body.search-open .search kbd { display: none; }
  .search-clear.is-shown { display: grid; }
  .app[data-task="settings"] .mobile-search-btn,
  .app[data-task="calendar"] .mobile-search-btn { display: none; }

  .list-head { padding: 12px 14px 9px; }
  .list-title-row h1 { font-size: 1.125rem; }
  .list-scroll { padding-bottom: 80px; }
  .msg { padding: 10px 12px 10px 14px; }
  .msg-avatar { width: 32px; height: 32px; }
  .star-btn { opacity: 0; }
  .msg.is-starred .star-btn, .msg .star-btn.is-starred { opacity: 1; }
  .chip { height: 28px; }

  .people-view { grid-template-columns: minmax(0, 1fr); }
  .people-list { border-right: 0; }
  .person-pane { display: none; }
  body.person-open .people-list { display: none; }
  body.person-open .person-pane { display: flex; }
  .person-back { display: grid; }
  .person-doc { padding: 22px 20px 48px; }
  .person-hero h2 { font-size: 1.375rem; }

  .calendar-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 14px;
  }
  .calendar-title h1 { font-size: 1.25rem; }
  .calendar-actions { width: 100%; justify-content: flex-end; }
  .calendar-body {
    display: block;
    overflow-y: auto;
  }
  .cal-month {
    min-height: 430px;
    padding: 10px 12px 16px;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .cal-month-head { padding-bottom: 7px; }
  .cal-grid { min-height: 372px; }
  .cal-cell { padding: 4px 4px; gap: 3px; }
  .cal-daynum { width: 19px; height: 19px; font-size: 0.625rem; }
  .cal-events { flex-direction: row; flex-wrap: wrap; gap: 3px; padding-top: 2px; }
  .cal-event {
    width: 5px;
    height: 5px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--ev);
    color: transparent;
    font-size: 0;
  }
  .cal-more { display: none; }
  .cal-agenda { min-height: 280px; }
  .cal-agenda-head { padding: 14px 16px 10px; }
  .cal-agenda-list { overflow: visible; padding: 10px 12px 16px; }

  .settings-doc { padding: 24px 20px 48px; }
  .settings-head h1 { font-size: 1.5rem; }
  .settings-layout { flex-direction: column; }
  .settings-nav {
    width: auto;
    flex: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .settings-nav-head { display: none; }
  .settings-nav-list {
    flex: none;
    flex-direction: row;
    overflow-x: auto;
    gap: 4px;
    padding: 8px 10px;
    scrollbar-width: none;
    -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
    mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 26px), transparent 100%);
  }
  .settings-nav-list::-webkit-scrollbar { display: none; }
  .settings-nav-item {
    width: auto;
    height: 32px;
    padding: 0 9px;
    white-space: nowrap;
    font-size: 0.75rem;
  }
  .settings-nav-item .nav-chevron { display: none; }
  .settings-nav-foot { display: none; }
  .settings-main { flex: 1; min-height: 0; }
  .settings-topbar { padding: 12px 16px; }
  .settings-panels { padding: 16px 16px 48px; }
  .account-profile { padding: 14px; }
  .pref-row { gap: 10px; }
  .card { padding: 16px; }
  .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .theme-card { padding: 6px; font-size: 0.6875rem; }
  .theme-thumb { height: 44px; }
  .theme-card-label { font-size: 0.625rem; }
  .accent-row { gap: 6px; }
  .accent-option { padding-right: 8px; }
  .toast { bottom: calc(var(--tabs-h) + 32px + env(safe-area-inset-bottom, 0px)); border-radius: var(--r-lg); }
  .dialog { width: 100%; }
}

@media (max-width: 420px) {
  .list-title-row h1 { font-size: 1.0625rem; }
  .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .theme-thumb { height: 38px; }
  .theme-card-label { font-size: 0.5625rem; }
  .theme-check { width: 14px; height: 14px; }
  .reader-subject h2 { font-size: 1.0625rem; }
  .empty-keys { gap: 12px; }
  .compose-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}
