/* Vigthoria Mail — Premium Visual Design System */
/* Black workstation, electric-lime/cyan signal, editorial typography */

/* ===== Reset ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; line-height: 1.5; }
body { min-height: 100vh; font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

/* Prevent hidden elements and closed dialogs from intercepting interaction */
[hidden], dialog:not([open]) { display: none !important; }

/* ===== Tokens ===== */
:root {
  /* black workstation */
  --bg-workstation: #050714;
  --bg-surface: #090d1d;
  --bg-elevated: #0e1428;
  --bg-overlay: #141b34;
  --bg-hover: rgba(255,255,255,.06);
  --bg-pressed: rgba(255,255,255,.03);
  --border-subtle: rgba(255,255,255,.08);
  --border-strong: rgba(255,255,255,.14);

  /* electric-lime / cyan signal */
  --signal-lime: #9b7bff;
  --signal-lime-dim: rgba(139,92,246,.18);
  --signal-cyan: #38bdf8;
  --signal-cyan-dim: rgba(56,189,248,.14);
  --signal-amber: #ffc544;
  --signal-amber-dim: rgba(255,197,68,.14);
  --signal-red: #ff5c6a;
  --signal-red-dim: rgba(255,92,106,.14);

  /* text */
  --text-primary: #f0f0f2;
  --text-secondary: #9a9aa2;
  --text-tertiary: #63636c;
  --text-inverse: #050714;

  /* type scale */
  --fs-hero: clamp(1.75rem, 3.2vw, 2.5rem);
  --fs-h1: clamp(1.375rem, 2.4vw, 1.75rem);
  --fs-h2: clamp(1.125rem, 1.8vw, 1.375rem);
  --fs-h3: clamp(1rem, 1.4vw, 1.125rem);
  --fs-body: 0.9375rem;
  --fs-small: 0.8125rem;
  --fs-xs: 0.6875rem;

  /* spacing */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;

  /* radii */
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 20px;

  /* motion */
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-slow: 320ms;
  --ease-out: cubic-bezier(.22,1,.36,1);

  /* shadows */
  --shadow-elevated: 0 8px 24px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);
  --shadow-overlay: 0 16px 48px rgba(0,0,0,.6), 0 4px 16px rgba(0,0,0,.4);
}

/* ===== Fluid Shell ===== */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background: var(--bg-workstation);
  color: var(--text-primary);
  font-size: var(--fs-body);
}

/* ===== Header ===== */
.app-header {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
}
.app-logo {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-h2);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--signal-lime);
  text-decoration: none;
}
.app-logo svg { flex-shrink: 0; }

/* ===== Global Search ===== */
.global-search {
  flex: 1;
  max-width: 480px;
  position: relative;
}
.global-search__input {
  width: 100%;
  padding: var(--sp-2) var(--sp-3) var(--sp-2) var(--sp-10);
  background: var(--bg-workstation);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--fs-small);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.global-search__input::placeholder { color: var(--text-tertiary); }
.global-search__input:focus-visible {
  outline: none;
  border-color: var(--signal-cyan);
  box-shadow: 0 0 0 3px var(--signal-cyan-dim);
}
.global-search__icon {
  position: absolute;
  left: var(--sp-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-tertiary);
  pointer-events: none;
}

/* ===== Header Actions ===== */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  font-size: var(--fs-small);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              transform var(--duration-fast) var(--ease-out);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--signal-cyan-dim);
}
.btn:active { transform: scale(.97); }

.btn--primary {
  background: linear-gradient(135deg, var(--signal-lime), #9ce830);
  color: var(--text-inverse);
  border-color: var(--signal-lime);
  box-shadow: 0 0 0 1px rgba(180,255,62,.15);
}
.btn--primary:hover {
  background: linear-gradient(135deg, #c8ff6e, var(--signal-lime));
  border-color: #c8ff6e;
  box-shadow: 0 0 12px rgba(180,255,62,.25), 0 0 0 1px rgba(180,255,62,.3);
}
.btn--primary:active { background: linear-gradient(135deg, #a0e830, #88d420); }

.btn--secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-subtle);
}
.btn--secondary:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn--secondary:active { background: var(--bg-pressed); }

.btn--ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn--ghost:hover { background: var(--bg-hover); color: var(--text-primary); }
.btn--ghost:active { background: var(--bg-pressed); }

.btn--icon {
  width: 40px;
  height: 40px;
  padding: 0;
}

/* Mobile target size */
@media (max-width: 600px) {
  .btn { min-height: 44px; min-width: 44px; }
  .btn--icon { width: 44px; height: 44px; }
}

/* ===== Primary Nav ===== */
.app-nav {
  display: flex;
  gap: var(--sp-1);
  padding: var(--sp-2) var(--sp-5);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
}
.nav-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-4);
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: var(--fs-small);
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.nav-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-tab:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--signal-cyan-dim);
}
.nav-tab[aria-current="page"] {
  background: var(--signal-lime-dim);
  color: var(--signal-lime);
}

/* ===== Layout ===== */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ===== Sidebar ===== */
.app-sidebar {
  width: 220px;
  flex-shrink: 0;
  padding: var(--sp-4) var(--sp-3);
  border-right: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  overflow-y: auto;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  padding: var(--sp-2) var(--sp-3);
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--fs-small);
  text-align: start;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.sidebar-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-item:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--signal-cyan-dim);
}
.sidebar-item[aria-current="page"] { background: var(--signal-lime-dim); color: var(--signal-lime); }
.sidebar-badge {
  margin-inline-start: auto;
  padding: 0 var(--sp-2);
  border-radius: 999px;
  background: var(--bg-overlay);
  color: var(--text-tertiary);
  font-size: var(--fs-xs);
  font-weight: 600;
}

/* ===== Thread List ===== */
.thread-list {
  width: 380px;
  flex-shrink: 0;
  border-right: 1px solid var(--border-subtle);
  overflow-y: auto;
  background: var(--bg-surface);
}
.thread-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
  cursor: pointer;
  transition: background var(--duration-fast) var(--ease-out);
}
.thread-row:hover { background: var(--bg-hover); }
.thread-row:focus-visible {
  outline: none;
  box-shadow: inset 3px 0 0 var(--signal-cyan);
}
.thread-row[aria-selected="true"] { background: var(--signal-lime-dim); }
.thread-row--unread .thread-row__subject { color: var(--text-primary); font-weight: 700; }
.thread-row__header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.thread-row__sender {
  flex: 1;
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-row__time {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
}
.thread-row__subject {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-row__preview {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.thread-row__meta {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.thread-row__badge {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--signal-lime);
  flex-shrink: 0;
}
.thread-row__badge--priority { background: var(--signal-red); }
.thread-row__star {
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-size: var(--fs-small);
  padding: var(--sp-1);
  transition: color var(--duration-fast) var(--ease-out);
}
.thread-row__star[aria-pressed="true"] { color: var(--signal-amber); }

/* ===== Reading Pane ===== */
.reading-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.reading-pane__header {
  padding: var(--sp-6) var(--sp-8);
  border-bottom: 1px solid var(--border-subtle);
}
.reading-pane__subject {
  font-size: var(--fs-h1);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: var(--sp-3);
}
.reading-pane__sender {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-small);
  color: var(--text-secondary);
}
.reading-pane__content {
  padding: var(--sp-8);
  flex: 1;
  line-height: 1.7;
}
.reading-pane__actions {
  display: flex;
  gap: var(--sp-2);
  padding: var(--sp-4) var(--sp-8);
  border-top: 1px solid var(--border-subtle);
}

/* ===== Agenda Rail ===== */
.agenda-rail {
  width: 280px;
  flex-shrink: 0;
  border-left: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  overflow-y: auto;
}
.agenda-section {
  padding: var(--sp-4);
  border-bottom: 1px solid var(--border-subtle);
}
.agenda-section__title {
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--sp-3);
}
.agenda-event {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-2) 0;
}
.agenda-event__time {
  font-size: var(--fs-xs);
  color: var(--text-tertiary);
  white-space: nowrap;
  min-width: 48px;
}
.agenda-event__title {
  font-size: var(--fs-small);
  color: var(--text-primary);
}
.agenda-event__bar {
  width: 3px;
  border-radius: 2px;
  background: var(--signal-cyan);
  flex-shrink: 0;
  align-self: stretch;
}

/* ===== Dialogs ===== */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fade-in var(--duration-normal) var(--ease-out);
}
.dialog {
  width: min(600px, calc(100vw - var(--sp-8)));
  max-height: calc(100vh - var(--sp-12));
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-overlay);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slide-up var(--duration-slow) var(--ease-out);
}
.dialog__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
}
.dialog__title {
  font-size: var(--fs-h2);
  font-weight: 700;
}
.dialog__close {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-tertiary);
  font-size: 1.25rem;
  transition: background var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}
.dialog__close:hover { background: var(--bg-hover); color: var(--text-primary); }
.dialog__close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--signal-cyan-dim);
}
.dialog__body {
  padding: var(--sp-6);
  overflow-y: auto;
  flex: 1;
}
.dialog__footer {
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border-subtle);
}

/* ===== Form Fields ===== */
.field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-bottom: var(--sp-4);
}
.field__label {
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text-secondary);
}
.field__input,
.field__textarea {
  padding: var(--sp-2) var(--sp-3);
  background: var(--bg-workstation);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: var(--fs-small);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.field__input:focus-visible,
.field__textarea:focus-visible {
  outline: none;
  border-color: var(--signal-cyan);
  box-shadow: 0 0 0 3px var(--signal-cyan-dim);
}
.field__textarea { resize: vertical; min-height: 120px; }

/* ===== Toast ===== */
.toast-region {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 300;
  display: flex;
  flex-direction: column-reverse;
  gap: var(--sp-3);
}
.toast {
  padding: var(--sp-3) var(--sp-5);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--signal-lime);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-elevated);
  font-size: var(--fs-small);
  color: var(--text-primary);
  animation: slide-in var(--duration-normal) var(--ease-out);
}
.toast--error { border-left-color: var(--signal-red); }

/* ===== Calendar ===== */
.calendar-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-4) var(--sp-6);
  border-bottom: 1px solid var(--border-subtle);
}
.calendar-header__title {
  font-size: var(--fs-h2);
  font-weight: 700;
}
.calendar-controls {
  display: flex;
  gap: var(--sp-1);
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  flex: 1;
  overflow-y: auto;
}
.calendar-weekday {
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}
.calendar-day {
  min-height: 80px;
  padding: var(--sp-2);
  border-right: 1px solid var(--border-subtle);
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--duration-fast) var(--ease-out);
}
.calendar-day:hover { background: var(--bg-hover); }
.calendar-day:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--signal-cyan);
}
.calendar-day__number {
  font-size: var(--fs-small);
  color: var(--text-secondary);
  line-height: 1.8;
}
.calendar-day--today .calendar-day__number {
  color: var(--signal-lime);
  font-weight: 700;
}
.calendar-day--selected { background: var(--signal-lime-dim); }
.calendar-day--other { opacity: .35; }
.calendar-event {
  display: block;
  padding: 1px var(--sp-2);
  border-radius: var(--radius-sm);
  background: var(--signal-cyan-dim);
  color: var(--signal-cyan);
  font-size: var(--fs-xs);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 1px;
}
.calendar-event--all-day {
  background: var(--signal-lime-dim);
  color: var(--signal-lime);
}

/* ===== Search Results ===== */
.search-results {
  padding: var(--sp-4);
  font-size: var(--fs-small);
  color: var(--text-secondary);
}

/* ===== Empty State ===== */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--sp-4);
  padding: var(--sp-12);
  text-align: center;
  color: var(--text-tertiary);
}
.empty-state__title {
  font-size: var(--fs-h3);
  font-weight: 700;
  color: var(--text-secondary);
}

/* ===== Animations ===== */
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slide-in {
  from { opacity: 0; transform: translateX(12px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== prefers-reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Public account entry ===== */
.welcome-page { min-height: 100dvh; overflow-x: hidden; color: var(--text-primary); }
.welcome-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding-bottom: 56px; }
.welcome-nav { display: flex; align-items: center; justify-content: space-between; min-height: 88px; }
.welcome-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 850; letter-spacing: -.04em; text-decoration: none; }
.welcome-brand img { width: 42px; height: 42px; object-fit: contain; }
.welcome-hero { display: grid; grid-template-columns: minmax(0, .92fr) minmax(420px, 1.08fr); gap: clamp(34px, 7vw, 92px); align-items: center; min-height: min(690px, calc(100dvh - 160px)); }
.welcome-copy h1 { max-width: 720px; margin: 12px 0 24px; font-size: clamp(3.2rem, 7vw, 6.7rem); line-height: .9; letter-spacing: -.075em; }
.welcome-copy h1 span { background: linear-gradient(100deg, #a78bfa 8%, #818cf8 44%, #38bdf8 88%); background-clip: text; color: transparent; }
.welcome-lead { max-width: 620px; color: #a8b0c5; font-size: clamp(1rem, 1.6vw, 1.22rem); line-height: 1.7; }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 12px; margin: 30px 0 14px; }
.welcome-actions .btn { min-height: 48px; padding-inline: 22px; text-decoration: none; }
.welcome-note { color: var(--text-tertiary); font-size: var(--fs-small); }
.welcome-product { position: relative; padding: 22px; border: 1px solid rgba(167,139,250,.2); border-radius: 28px; background: linear-gradient(145deg, rgba(18,24,49,.88), rgba(7,10,24,.78)); box-shadow: 0 40px 110px rgba(2,3,15,.7), 0 0 90px rgba(91,33,182,.15), inset 0 1px 0 rgba(255,255,255,.07); backdrop-filter: blur(24px); transform: perspective(1200px) rotateY(-4deg) rotateX(2deg); animation: product-float 7s ease-in-out infinite; }
.welcome-product::before { content: ""; position: absolute; inset: -1px; z-index: -1; border-radius: inherit; filter: blur(32px); opacity: .24; background: linear-gradient(135deg, #7c3aed, transparent 45%, #0ea5e9); }
.welcome-product__bar { display: flex; align-items: center; gap: 7px; padding-bottom: 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.welcome-product__bar span { width: 7px; height: 7px; border-radius: 50%; background: #475569; }
.welcome-product__bar span:nth-child(2) { background: #8b5cf6; }
.welcome-product__bar span:nth-child(3) { background: #38bdf8; }
.welcome-product__bar strong { margin-left: auto; font-size: .75rem; color: #94a3b8; }
.welcome-message { display: grid; grid-template-columns: 42px 1fr auto; gap: 13px; align-items: start; margin-top: 16px; padding: 17px; border: 1px solid rgba(167,139,250,.17); border-radius: 16px; background: rgba(139,92,246,.09); }
.welcome-message--muted { opacity: .7; border-color: rgba(148,163,184,.1); background: rgba(255,255,255,.025); }
.welcome-avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 13px; color: white; font-weight: 800; background: linear-gradient(135deg, #7c3aed, #2563eb); }
.welcome-message p, .welcome-message span, .welcome-message time { color: #8791a9; font-size: .74rem; }
.welcome-message strong, .welcome-message span { display: block; }
.welcome-message strong { margin: 3px 0; }
.welcome-ai { display: flex; align-items: center; gap: 12px; margin-top: 22px; padding: 16px; border-radius: 18px; background: linear-gradient(135deg, rgba(124,58,237,.2), rgba(14,165,233,.1)); }
.welcome-ai div { flex: 1; }
.welcome-ai small, .welcome-ai strong { display: block; }
.welcome-ai small { color: #a78bfa; }
.welcome-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.welcome-features article { padding: 20px; border: 1px solid rgba(148,163,184,.11); border-radius: 18px; background: rgba(11,16,32,.55); }
.welcome-features article > span { color: #8b5cf6; font: 700 .7rem ui-monospace, monospace; }
.welcome-features h2 { margin: 14px 0 7px; font-size: 1rem; }
.welcome-features p { color: #8791a9; font-size: .86rem; }
@keyframes product-float { 50% { transform: perspective(1200px) rotateY(-2deg) rotateX(1deg) translateY(-9px); } }
@media (max-width: 820px) { .welcome-hero { grid-template-columns: 1fr; padding: 50px 0 70px; } .welcome-product { transform: none; animation: none; } }
@media (max-width: 560px) { .welcome-shell { width: min(100% - 24px, 1180px); } .welcome-copy h1 { font-size: clamp(3rem, 16vw, 4.4rem); } .welcome-product { padding: 14px; } .welcome-features { grid-template-columns: 1fr; } .welcome-actions { display: grid; } .welcome-actions .btn { width: 100%; } }

/* ===== Responsive: 1920px+ ===== */
@media (min-width: 1920px) {
  .thread-list { width: 420px; }
  .agenda-rail { width: 320px; }
}

/* ===== Responsive: 1440px ===== */
@media (max-width: 1440px) {
  .agenda-rail { width: 240px; }
}

/* ===== Responsive: Tablet 768px ===== */
@media (max-width: 768px) {
  .app-sidebar { width: 56px; padding: var(--sp-2); }
  .sidebar-item span:not(.sidebar-badge) { display: none; }
  .sidebar-item { justify-content: center; padding: var(--sp-2); }
  .thread-list { width: 280px; }
  .agenda-rail { display: none; }
}

/* ===== Responsive: Mobile 390px ===== */
@media (max-width: 600px) {
  .app-header {
    flex-wrap: wrap;
    gap: var(--sp-2);
    padding: var(--sp-2) var(--sp-3);
  }
  .global-search {
    order: 10;
    max-width: 100%;
    flex-basis: 100%;
  }
  .app-nav {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .app-nav::-webkit-scrollbar { display: none; }
  .app-body { flex-direction: column; }
  .app-sidebar {
    width: 100%;
    flex-direction: row;
    display: flex;
    gap: var(--sp-1);
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: var(--sp-2);
  }
  .app-sidebar::-webkit-scrollbar { display: none; }
  .sidebar-item {
    flex-shrink: 0;
    width: auto;
  }
  .sidebar-item span:not(.sidebar-badge) { display: inline; }
  .thread-list {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    max-height: 40vh;
  }
  .reading-pane { min-height: 60vh; }
  .reading-pane__header { padding: var(--sp-4); }
  .reading-pane__content { padding: var(--sp-4); }
  .reading-pane__actions { padding: var(--sp-3) var(--sp-4); }
  .calendar-day { min-height: 60px; }
  .calendar-event { font-size: 0.625rem; }
  .dialog { width: calc(100vw - var(--sp-4)); border-radius: var(--radius-md); }
  .toast-region { left: var(--sp-3); right: var(--sp-3); }
}

/* ===== Viewport-Safe Auto-Fit Grid ===== */
.grid-auto-fit {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: var(--sp-4);
}

/* ===== Screen-reader only ===== */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ===== 2026 WORKSPACE COMPOSITION ===== */

/* Body font-size clamp and shell height */
body { font-size: clamp(0.8125rem, 1.2vw, 0.9375rem); }
#app-shell { height: 100dvh; }

/* App body flex safety */
.app-body { min-width: 0; min-height: 0; }

/* Mail workspace flex container */
.mail-workspace { display: flex; flex: 1; min-width: 0; min-height: 0; }

/* App sidebar list */
.app-sidebar ul { list-style: none; display: flex; flex-direction: column; gap: var(--sp-1); padding: 0; }

/* Thread panel — premium padding, flex column */
.thread-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: var(--sp-5); }
.thread-panel h2 { font-size: var(--fs-h2); font-weight: 700; color: var(--text-primary); margin-bottom: var(--sp-4); }
.mail-search-results { font-size: var(--fs-small); color: var(--text-secondary); }

/* Thread list — viewport-safe auto-fit grid */
.thread-list { width: 100%; flex: 1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: var(--sp-4); padding: var(--sp-4); }

/* Thread row — rounded bordered gradient card with shadow, pseudo accent, hover lift/glow, entrance animation */
.thread-row {
  position: relative;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, var(--bg-elevated), var(--bg-surface));
  box-shadow: var(--shadow-elevated);
  padding: var(--sp-4);
  overflow: hidden;
  animation: card-entry var(--duration-slow) var(--ease-out) both;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}
.thread-row::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, var(--signal-lime-dim), transparent 60%);
  opacity: 0;
  transition: opacity var(--duration-fast) var(--ease-out);
  pointer-events: none;
}
.thread-row:hover { transform: translateY(-2px); box-shadow: 0 12px 32px rgba(0,0,0,.5), 0 0 0 1px var(--signal-lime-dim); border-color: var(--border-strong); }
.thread-row:hover::before { opacity: 1; }
.thread-row:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--signal-cyan-dim); }

/* :has master-detail — when reading-pane is visible, thread-panel becomes a column */
.mail-workspace:has(.reading-pane:not([hidden])) .thread-panel { flex: 0 0 auto; width: 360px; max-width: 420px; }
.mail-workspace:has(.reading-pane:not([hidden])) .thread-list { display: block; }
.mail-workspace:has(.reading-pane:not([hidden])) .reading-pane { flex: 1; min-width: 0; }

/* Agenda rail — 300px column with separated readable cards */
.agenda-rail { width: 300px; flex-shrink: 0; padding: var(--sp-5); border-left: 1px solid var(--border-subtle); }
.agenda-rail h2 { font-size: var(--fs-h3); font-weight: 700; color: var(--text-primary); margin-bottom: var(--sp-4); }
.agenda-rail ol { list-style: none; display: flex; flex-direction: column; gap: var(--sp-3); }
.agenda-rail li { padding: var(--sp-3) var(--sp-4); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-elevated); }
.agenda-rail time { display: block; font-size: var(--fs-xs); color: var(--signal-cyan); font-weight: 600; margin-bottom: var(--sp-1); }
.agenda-rail span { display: block; font-size: var(--fs-small); color: var(--text-secondary); }

/* Reading pane article and attachments */
.reading-pane article { padding: var(--sp-6); }
.reading-pane__attachments { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-4); }
.reading-pane__attachments a { display: inline-flex; align-items: center; gap: var(--sp-2); padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); font-size: var(--fs-xs); color: var(--signal-cyan); text-decoration: none; transition: background var(--duration-fast) var(--ease-out); }
.reading-pane__attachments a:hover { background: var(--signal-cyan-dim); }

/* Calendar table — preserve semantic table behavior */
.calendar-table { width: 100%; border-collapse: collapse; font-size: var(--fs-small); }
.calendar-table thead th { padding: var(--sp-2); font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--border-subtle); }
.calendar-table tbody td { padding: var(--sp-2); border: 1px solid var(--border-subtle); vertical-align: top; }
.day-agenda { display: flex; flex-direction: column; gap: var(--sp-1); }

/* Dialog — open state, backdrop, form internals */
dialog[open] { border: 1px solid var(--border-strong); border-radius: var(--radius-lg); background: var(--bg-elevated); color: var(--text-primary); padding: var(--sp-6); max-width: min(480px, calc(100vw - var(--sp-8))); box-shadow: var(--shadow-overlay); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog form { display: flex; flex-direction: column; gap: var(--sp-4); }
dialog label { display: flex; flex-direction: column; gap: var(--sp-1); font-size: var(--fs-small); font-weight: 600; color: var(--text-secondary); }
dialog input, dialog textarea, dialog select { padding: var(--sp-2) var(--sp-3); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-workstation); color: var(--text-primary); font-size: var(--fs-small); transition: border-color var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out); }
dialog input:focus-visible, dialog textarea:focus-visible, dialog select:focus-visible { outline: none; border-color: var(--signal-cyan); box-shadow: 0 0 0 3px var(--signal-cyan-dim); }
dialog button { display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2); padding: var(--sp-3) var(--sp-5); border: 1px solid transparent; border-radius: var(--radius-md); font-size: var(--fs-small); font-weight: 600; overflow: hidden; position: relative; transition: transform var(--duration-fast) var(--ease-out), box-shadow var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out); }
dialog button::before { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.18) 50%, transparent 60%); transform: translateX(-100%); transition: transform var(--duration-slow) var(--ease-out); pointer-events: none; }
dialog button:hover::before { transform: translateX(100%); }

/* Toast region */
#toast-region { position: fixed; bottom: var(--sp-4); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: var(--sp-2); z-index: 1000; }

/* Enhanced .btn — overflow hidden, luminous gradient, ::before sheen, hover translateY/glow, active press, focus-visible */
.btn { overflow: hidden; position: relative; }
.btn::before { content: ""; position: absolute; inset: 0; background: linear-gradient(105deg, transparent 40%, rgba(255,255,255,.18) 50%, transparent 60%); transform: translateX(-100%); transition: transform var(--duration-slow) var(--ease-out); pointer-events: none; }
.btn--primary { background: linear-gradient(135deg, var(--signal-lime), var(--signal-cyan)); }
.btn--primary:hover { transform: translateY(-1px); box-shadow: 0 0 20px rgba(180,255,62,.3), 0 0 0 1px rgba(180,255,62,.4); }
.btn--primary:hover::before { transform: translateX(100%); }
.btn--primary:active { transform: translateY(0) scale(.97); }
.btn--primary:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--signal-cyan-dim); }

/* Card-entry and sheen keyframes */
@keyframes card-entry { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes sheen { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ===== Responsive: 1920px+ ===== */
@media (min-width: 1920px) {
  .thread-list { width: 420px; }
  .agenda-rail { width: 320px; }
}

/* ===== Responsive: 1440px ===== */
@media (max-width: 1440px) {
  .agenda-rail { width: 240px; }
}

/* ===== Responsive: Tablet 768px ===== */
@media (max-width: 768px) {
  .app-sidebar { width: 56px; padding: var(--sp-2); }
  .sidebar-item span:not(.sidebar-badge) { display: none; }
  .sidebar-item { justify-content: center; padding: var(--sp-2); }
  .thread-list { width: 280px; }
  .agenda-rail { display: none; }
}

/* ===== Responsive: Mobile 390px ===== */
@media (max-width: 390px) {
  .app-header, .mail-workspace { flex-direction: column; }
  .app-sidebar ul { flex-direction: row; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .app-sidebar ul::-webkit-scrollbar { display: none; }
  .thread-list { grid-template-columns: 1fr; }
  .agenda-rail { display: none; }
  .calendar-table { font-size: var(--fs-xs); }
  .calendar-table tbody td { padding: var(--sp-1); }
  button, .btn, .nav-tab, .sidebar-item, input, textarea, select { min-height: 44px; }
  .btn, .nav-tab, .sidebar-item { min-width: 44px; }
}

/* ===== Rich composer ===== */
.composer-dialog.dialog[open] { width: min(880px, calc(100vw - 28px)); max-height: min(920px, calc(100dvh - 24px)); padding: 0; }
.composer-dialog form { gap: 0 !important; }
.composer-dialog .dialog__header { position: sticky; top: 0; z-index: 4; padding: 18px 20px; border-bottom: 1px solid rgba(148,163,184,.12); background: rgba(10,14,30,.92); backdrop-filter: blur(18px); }
.composer-dialog .dialog__header h2 { margin: 0; }
.composer-window-actions { display: flex; align-items: center; gap: 10px; }
.draft-status { color: #8b94aa; font-size: .72rem; }
.composer-from, .composer-address, .composer-subject { display: flex; align-items: center; gap: 12px; padding: 9px 20px; border-bottom: 1px solid rgba(148,163,184,.1); }
.composer-from > span, .composer-address label { width: 46px; flex: 0 0 auto; color: #7f8aa3; font-size: .78rem; font-weight: 650; }
.composer-from strong { flex: 1; color: #c4b5fd; font-size: .82rem; }
.composer-address input, .composer-subject input { min-width: 0; flex: 1; padding: 8px 0 !important; border: 0 !important; border-radius: 0 !important; background: transparent !important; box-shadow: none !important; }
.composer-copy-fields { display: grid; }
.composer-subject input { font-weight: 700; font-size: 1rem !important; }
.composer-dialog .assistant-strip { margin: 14px 20px; }
.format-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; padding: 8px 20px; border-block: 1px solid rgba(148,163,184,.1); background: rgba(5,7,20,.36); }
.format-toolbar button, .toolbar-color, .toolbar-select select { min-height: 34px; border: 1px solid transparent; border-radius: 8px; color: #aab2c7; background: transparent; }
.format-toolbar button { padding: 5px 8px; }
.format-toolbar button:hover, .toolbar-color:hover, .toolbar-select select:hover { color: #fff; border-color: rgba(167,139,250,.22); background: rgba(124,58,237,.11); }
.toolbar-select select { padding: 4px 26px 4px 8px; }
.toolbar-select--small select { max-width: 92px; }
.toolbar-divider { width: 1px; height: 24px; margin-inline: 4px; background: rgba(148,163,184,.14); }
.toolbar-color { position: relative; display: grid; place-items: center; width: 34px; cursor: pointer; }
.toolbar-color input { position: absolute; inset: auto 4px 3px; width: 26px !important; height: 4px; min-height: 0 !important; padding: 0 !important; border: 0 !important; opacity: .85; }
.compose-editor { min-height: 230px; padding: 22px; color: #e8ebf3; font-size: 15px; line-height: 1.65; outline: 0; overflow-wrap: anywhere; }
.compose-editor:empty::before { content: attr(data-placeholder); color: #626d86; pointer-events: none; }
.compose-editor:focus { background: linear-gradient(135deg, rgba(124,58,237,.025), transparent 35%); }
.compose-editor a { color: #7dd3fc; }
.compose-editor blockquote { margin: 8px 0; padding-left: 14px; border-left: 3px solid #8b5cf6; color: #aab2c7; }
.attachment-zone { display: flex !important; align-items: center; justify-content: space-between; gap: 14px !important; margin: 0 20px 10px; padding: 14px 16px; border: 1px dashed rgba(167,139,250,.28); border-radius: 14px; background: rgba(124,58,237,.045); transition: border-color .2s, background .2s, transform .2s; }
.attachment-zone.is-dragging { border-color: #a78bfa; background: rgba(124,58,237,.15); transform: scale(.995); }
.attachment-zone strong, .attachment-zone span { display: block; }
.attachment-zone span { color: #727d95; font-size: .72rem; }
.compose-attachment-list { display: grid; gap: 7px; margin: 0 20px 12px; padding: 0; list-style: none; }
.compose-attachment-list li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid rgba(148,163,184,.12); border-radius: 12px; background: rgba(255,255,255,.025); }
.attachment-file-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #c4b5fd; background: rgba(124,58,237,.15); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.attachment-file-meta strong, .attachment-file-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attachment-file-meta span { color: #727d95; font-size: .7rem; }
.schedule-panel { margin: 0 20px 12px; padding: 10px 13px; border: 1px solid rgba(148,163,184,.1); border-radius: 12px; }
.schedule-panel summary { cursor: pointer; color: #aab2c7; font-size: .78rem; font-weight: 700; }
.schedule-panel[open] { display: grid; grid-template-columns: auto minmax(190px, 1fr); align-items: center; gap: 9px 12px; }
.schedule-panel[open] summary { grid-column: 1 / -1; }
.schedule-panel small { grid-column: 2; color: #727d95; }
.composer-dialog .dialog__actions { position: sticky; bottom: 0; z-index: 4; padding: 14px 20px; border-top: 1px solid rgba(148,163,184,.12); background: rgba(10,14,30,.94); backdrop-filter: blur(18px); }
@media (max-width: 620px) {
  .composer-dialog.dialog[open] { width: calc(100vw - 12px); max-height: calc(100dvh - 12px); }
  .composer-dialog .dialog__header, .composer-from, .composer-address, .composer-subject, .format-toolbar { padding-inline: 13px; }
  .composer-dialog .assistant-strip, .attachment-zone, .compose-attachment-list, .schedule-panel { margin-inline: 13px; }
  .compose-editor { min-height: 190px; padding: 17px 14px; }
  .format-toolbar { flex-wrap: wrap; overflow-x: visible; align-content: center; }
  .format-toolbar > * { flex: 0 0 auto; }
  .draft-status { display: none; }
  .attachment-zone { align-items: flex-start; flex-direction: column; }
  .attachment-zone .btn { width: 100%; }
  .schedule-panel[open] { grid-template-columns: 1fr; }
  .schedule-panel small { grid-column: 1; }
}

/* Settings is an operations surface, not a narrow compose modal. */
dialog.dialog.settings-dialog[open] {
  width: min(920px, calc(100% - 32px));
  max-width: min(920px, calc(100% - 32px));
}
.settings-card .btn {
  width: 100%;
  min-width: 0;
  padding-inline: 10px;
  white-space: normal;
  text-align: center;
}
#day-events li {
  display: flex;
  align-items: baseline;
  gap: var(--sp-2);
}
@media (max-width: 720px) {
  dialog.dialog.settings-dialog[open] { width: calc(100% - 24px); max-width: calc(100% - 24px); }
}

/* ===== Bounded EOF: DOM-to-CSS selector repair ===== */
html { background: #090a0d; color: #f4f6f8; }
body { background: #090a0d; color: #f4f6f8; min-height: 100dvh; }

#app-shell {
  min-height: 100dvh;
  height: 100dvh;
  background: radial-gradient(ellipse at 50% 0%, rgba(180,255,62,.06) 0%, transparent 60%), linear-gradient(180deg, #0a0a0c 0%, #090a0d 100%);
}

.app-header {
  background: linear-gradient(180deg, rgba(17,17,20,.95) 0%, rgba(10,10,12,.9) 100%);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}
.app-header__brand {
  color: var(--signal-lime);
  letter-spacing: 0.04em;
}

.app-header__logo {
  width: 42px;
  height: 42px;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(182, 255, 46, .22));
}

.account-summary {
  color: var(--text-secondary, #a6a6ad);
  font-size: .78rem;
  max-width: 16rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#toast-region[data-kind="error"] {
  border-color: #ff5f67;
  color: #ff9aa0;
}

.settings-dialog { width: min(880px, calc(100vw - 28px)); max-height: min(860px, calc(100vh - 28px)); }
.settings-dialog form { display: grid; gap: 24px; }
.settings-dialog__header, .integration-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.settings-dialog h2, .settings-dialog h3, .settings-dialog h4, .settings-dialog p { margin: 0; }
.settings-dialog section { display: grid; gap: 12px; }
.eyebrow { color: var(--signal-lime, #b6ff2e); font-size: .72rem; text-transform: uppercase; letter-spacing: .14em; }
.settings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.settings-card, .integration-row, .storage-summary { padding: 16px; border: 1px solid var(--line, #292b31); border-radius: 14px; background: rgba(255,255,255,.025); }
.settings-card { display: grid; gap: 9px; }
.settings-card.is-current { border-color: var(--signal-lime, #b6ff2e); box-shadow: inset 0 0 0 1px rgba(182,255,46,.2); }
.integration-list { display: grid; gap: 8px; }
.integration-row strong { text-transform: capitalize; }
.integration-row p { color: var(--text-secondary, #a6a6ad); font-size: .76rem; }
.storage-summary { display: grid; gap: 10px; }
.storage-meter { display: block; width: 100%; height: 8px; border: 0; border-radius: 99px; background: #24272e; }
.storage-meter::-webkit-meter-bar { border: 0; border-radius: 99px; background: #24272e; }
.storage-meter::-webkit-meter-optimum-value { border-radius: 99px; background: linear-gradient(90deg,#b6ff2e,#52e5a8); }
.storage-meter::-moz-meter-bar { border-radius: 99px; background: linear-gradient(90deg,#b6ff2e,#52e5a8); }
@media (max-width: 720px) { .settings-grid { grid-template-columns: 1fr; } .account-summary { display: none; } }
.app-header__brand .brand-dot {
  box-shadow: 0 0 8px var(--signal-lime), 0 0 16px rgba(180,255,62,.3);
}

.global-search__field {
  background: var(--bg-workstation);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  min-height: 44px;
  padding: var(--sp-2) var(--sp-3);
}
.global-search__field:focus-visible {
  outline: none;
  border-color: var(--signal-cyan);
  box-shadow: 0 0 0 3px var(--signal-cyan-dim);
}

.app-nav { background: var(--bg-surface); }
.nav-tab { text-decoration: none; }
.nav-tab[aria-current="page"] {
  background: var(--signal-lime-dim);
  color: var(--signal-lime);
  border-radius: var(--radius-md);
}

.app-body { background: transparent; flex: 1; min-height: 0; }

.mail-workspace { width: auto; flex: 1; }

.app-sidebar { background: var(--bg-surface); }
.app-sidebar a { color: var(--text-secondary); text-decoration: none; }
.app-sidebar a:hover { color: var(--text-primary); }

.thread-panel {
  flex: 1;
  width: auto;
  min-width: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(56,239,255,.04) 0%, transparent 70%), var(--bg-surface);
}
.thread-panel h2 {
  font-size: var(--fs-h2);
  color: var(--text-primary);
}

#mail-search-results { color: var(--text-primary); font-size: var(--fs-small); }

.thread-list { width: 100%; max-width: none; }
.thread-row { height: auto; }
.thread-row__subject, .thread-row__sender, .thread-row__preview { font-size: var(--fs-small); color: var(--text-primary); }
.thread-row__star { min-width: 44px; min-height: 44px; }

.agenda-rail {
  background: rgba(17,17,20,.85);
  backdrop-filter: blur(8px);
  color: var(--text-primary);
}

@media (min-width: 1920px) {
  .thread-list { width: 100%; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
  .agenda-rail { width: 320px; }
}

@media (max-width: 1440px) {
  .thread-list { width: 100%; }
}

@media (max-width: 768px) {
  .thread-panel { width: 100%; }
  .thread-list { width: 100%; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
  .agenda-rail { display: none; }
  .app-sidebar { width: 148px; }
}

@media (max-width: 390px) {
  #app-shell { height: auto; min-height: 100dvh; }
  .app-header { width: 100%; }
  .app-header__brand { font-size: var(--fs-h3); color: var(--signal-lime); }
  .header-action, .compose-btn { width: 100%; }
  .global-search { width: 100%; order: 2; }
  .app-nav { width: 100%; }
  .app-body { display: block; min-width: 0; }
  .mail-workspace { display: flex; flex-direction: column; width: 100%; }
  .app-sidebar { width: 100%; }
  .thread-panel { width: 100%; padding: 12px; }
  .thread-list { width: 100%; max-height: none; padding: 0; grid-template-columns: 1fr; }
  .thread-row { width: 100%; }
  .thread-panel, .thread-list, .reading-pane { background: var(--bg-surface); }
}
/* ===== End bounded EOF block ===== */

/* ===== CALENDAR SEMANTIC TABLE REPAIR ===== */
.calendar-view {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--bg-workstation);
}
.calendar-view > table {
  display: table;
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.calendar-view > table thead { display: table-header-group; }
.calendar-view > table tbody.calendar-grid { display: table-row-group; }
.calendar-view > table tr { display: table-row; }
.calendar-view > table th,
.calendar-view > table td {
  display: table-cell;
  width: 14.2857%;
  vertical-align: top;
  border: 1px solid var(--border-subtle);
  padding: 4px;
}
.calendar-view > table th {
  font-size: var(--fs-xs);
  color: var(--text-secondary);
  font-weight: 600;
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
}
.calendar-day {
  min-height: 64px;
  position: relative;
  background: transparent;
}
.calendar-day:hover { background: var(--bg-hover); }
.calendar-day:focus-visible {
  outline: 2px solid var(--signal-cyan);
  outline-offset: -2px;
}
.calendar-day__number {
  display: inline-block;
  font-size: var(--fs-small);
  color: var(--text-primary);
  line-height: 1.2;
}
.calendar-day--today .calendar-day__number {
  background: var(--signal-lime);
  color: var(--text-inverse);
  border-radius: 50%;
  padding: 2px 6px;
  font-weight: 700;
}
.calendar-day--selected {
  background: var(--signal-cyan-dim);
}
.calendar-day--other .calendar-day__number {
  color: var(--text-tertiary);
}
.calendar-event {
  display: block;
  margin-top: 2px;
  padding: 2px 4px;
  font-size: var(--fs-xs);
  line-height: 1.2;
  border-radius: 4px;
  background: var(--signal-cyan-dim);
  color: var(--signal-cyan);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.calendar-event--all-day {
  background: var(--signal-lime-dim);
  color: var(--signal-lime);
}
.calendar-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
}
.calendar-header__title {
  font-size: var(--fs-h2);
  color: var(--text-primary);
  font-weight: 700;
}
.calendar-controls {
  display: flex;
  gap: var(--sp-1);
}
#day-agenda {
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
  padding: var(--sp-4);
  min-width: 240px;
  max-width: 320px;
}
#day-events {
  list-style: none;
  padding: 0;
}
#day-events li {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-small);
}
#day-events li:last-child { border-bottom: none; }
#day-events time {
  color: var(--signal-cyan);
  font-size: var(--fs-xs);
  font-weight: 600;
}
#day-events span {
  color: var(--text-primary);
}

@media (max-width: 768px) {
  .calendar-day { min-height: 48px; }
  .calendar-view > table th,
  .calendar-view > table td { padding: 2px; }
  .calendar-event { font-size: var(--fs-xs); }
}

@media (max-width: 390px) {
  .calendar-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }
  .calendar-header__title { width: 100%; font-size: var(--fs-h3); }
  .calendar-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-1);
  }
  .calendar-controls .btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }
  .compose-btn { width: 100%; }
  .calendar-view > table { font-size: 10px; }
  .calendar-view > table th,
  .calendar-view > table td { padding: 2px; }
  .calendar-day { min-height: 52px; }
  .calendar-event {
    font-size: 9px;
    padding: 1px 3px;
  }
}
/* ===== End bounded EOF block ===== */

/* ===== CALENDAR VISUAL ACCEPTANCE 2026 ===== */

/* Desktop/ultrawide: fluid row height, layered workstation surface, lower agenda band */
.calendar-view > table {
  border-collapse: collapse;
  width: 100%;
}
.calendar-view > table tbody tr {
  min-height: clamp(72px, 10vh, 110px);
}
.calendar-view > table td {
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
  vertical-align: top;
  padding: var(--sp-1);
}
.calendar-day {
  min-height: 56px;
  border-radius: var(--radius-sm);
  padding: var(--sp-1);
  transition: background var(--duration-fast) var(--ease-out);
}
.calendar-day:hover {
  background: var(--bg-hover);
}
.calendar-day:focus-visible {
  outline: 2px solid var(--signal-cyan);
  outline-offset: -2px;
}

/* Previous/Today/Next: dark premium interactive buttons */
.calendar-controls .btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-4);
  font-weight: 600;
  font-size: var(--fs-small);
  min-height: 36px;
  transition: background var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.calendar-controls .btn:hover {
  background: var(--bg-overlay);
  border-color: var(--signal-lime);
  box-shadow: 0 0 0 2px var(--signal-lime-dim);
}
.calendar-controls .btn:focus-visible {
  outline: 2px solid var(--signal-cyan);
  outline-offset: 2px;
}
.calendar-controls .btn:active {
  background: var(--bg-pressed);
  border-color: var(--signal-lime);
  transform: scale(0.97);
}

/* Keep New event as lime-to-cyan primary action */
.compose-btn {
  background: linear-gradient(135deg, var(--signal-lime), var(--signal-cyan));
  color: var(--text-inverse);
  border: none;
  font-weight: 700;
}

/* Event pills: color, depth, readable contrast, restrained hover */
.calendar-event {
  display: block;
  margin-top: 2px;
  padding: 2px 6px;
  font-size: var(--fs-xs);
  line-height: 1.3;
  border-radius: 4px;
  background: var(--signal-cyan-dim);
  color: var(--signal-cyan);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}
.calendar-event:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,.35);
}
.calendar-event--all-day {
  background: var(--signal-lime-dim);
  color: var(--signal-lime);
}

/* Lower agenda band: visually complete */
#day-agenda {
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
  padding: var(--sp-4);
  min-width: 240px;
  max-width: 320px;
  display: flex;
  flex-direction: column;
}
#day-events {
  list-style: none;
  padding: 0;
  flex: 1;
}
#day-events li {
  padding: var(--sp-2) 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: var(--fs-small);
}
#day-events li:last-child { border-bottom: none; }
#day-events time {
  color: var(--signal-cyan);
  font-size: var(--fs-xs);
  font-weight: 600;
}
#day-events span {
  color: var(--text-primary);
}

/* Tablet 768px: compact but polished */
@media (max-width: 768px) {
  .calendar-view > table tbody tr {
    min-height: clamp(56px, 8vh, 80px);
  }
  .calendar-day { min-height: 48px; }
  .calendar-view > table th,
  .calendar-view > table td { padding: 2px; }
  .calendar-event { font-size: var(--fs-xs); }
}

/* Mobile 390px: 44px controls, no horizontal clipping, readable pills */
@media (max-width: 390px) {
  .calendar-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-2);
  }
  .calendar-header__title { width: 100%; font-size: var(--fs-h3); }
  .calendar-controls {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--sp-1);
  }
  .calendar-controls .btn {
    width: 100%;
    min-width: 0;
    min-height: 44px;
  }
  .compose-btn { width: 100%; }
  .calendar-view > table { font-size: 10px; }
  .calendar-view > table th,
  .calendar-view > table td { padding: 2px; }
  .calendar-day { min-height: 52px; }
  .calendar-event {
    font-size: 9px;
    padding: 1px 3px;
  }
}

/* Reduced motion: suppress hover lift */
@media (prefers-reduced-motion: reduce) {
  .calendar-event:hover {
    transform: none;
  }
  .calendar-controls .btn:active {
    transform: none;
  }
}

/* ===== NATIVE DIALOG ACCEPTANCE 2026 ===== */
/* Override: dialog.dialog[open] — fixed centered modal with elevated backdrop */
dialog.dialog[open] {
  position: fixed;
  inset: 0;
  margin: auto;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  width: min(540px, 100% - 32px);
  max-height: calc(100% - 32px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--sp-6);
  box-shadow: var(--shadow-overlay);
  animation: dialog-enter var(--duration-slow) var(--ease-out);
  overflow: hidden;
}

dialog.dialog[open]::backdrop {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

/* Form internals — heading, spacing, inputs */
dialog.dialog[open] form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  overflow-y: auto;
}

dialog.dialog[open] h2 {
  font-size: var(--fs-h2);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: var(--sp-2);
}

dialog.dialog[open] label {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
  font-size: var(--fs-small);
  font-weight: 600;
  color: var(--text-secondary);
}

dialog.dialog[open] input,
dialog.dialog[open] textarea {
  background: var(--bg-workstation);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: var(--sp-2) var(--sp-3);
  color: var(--text-primary);
  font-size: var(--fs-body);
  transition: border-color var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

dialog.dialog[open] input:focus-visible,
dialog.dialog[open] textarea:focus-visible {
  outline: none;
  border-color: var(--signal-cyan);
  box-shadow: 0 0 0 3px var(--signal-cyan-dim);
}

dialog.dialog[open] textarea {
  min-height: 120px;
  resize: vertical;
}

/* Button row — submit primary, cancel secondary */
dialog.dialog[open] .dialog__footer {
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
  margin-top: var(--sp-4);
}

dialog.dialog[open] form > button[type=submit] {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--signal-lime), var(--signal-cyan));
  color: var(--text-inverse);
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-5);
  min-height: 44px;
  transition: transform var(--duration-fast) var(--ease-out),
              box-shadow var(--duration-fast) var(--ease-out);
}

dialog.dialog[open] form > button[type=submit]:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(180, 255, 62, 0.25);
}

dialog.dialog[open] form > button[type=submit]:active {
  transform: translateY(0);
  box-shadow: none;
}

dialog.dialog[open] form > button[type=submit]:focus-visible {
  outline: 2px solid var(--signal-lime);
  outline-offset: 2px;
}

dialog.dialog[open] form > button[type=button] {
  position: relative;
  overflow: hidden;
  background: var(--bg-workstation);
  color: var(--text-secondary);
  font-weight: 600;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--sp-2) var(--sp-5);
  min-height: 44px;
  transition: color var(--duration-fast) var(--ease-out),
              border-color var(--duration-fast) var(--ease-out);
}

dialog.dialog[open] form > button[type=button]:hover {
  color: var(--text-primary);
  border-color: var(--border-subtle);
}

dialog.dialog[open] form > button[type=button]:active {
  background: var(--bg-pressed);
}

dialog.dialog[open] form > button[type=button]:focus-visible {
  outline: 2px solid var(--signal-cyan);
  outline-offset: 2px;
}

/* Entrance animation */
@keyframes dialog-enter {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Reduced motion: suppress dialog entrance */
@media (prefers-reduced-motion: reduce) {
  dialog.dialog[open] {
    animation: none;
  }
}

/* Mobile 390px: modal fits viewport with 16px gutters, no clipping */
@media (max-width: 390px) {
  dialog.dialog[open] {
    width: calc(100% - 32px);
    max-height: calc(100% - 32px);
    margin: auto;
    border-radius: var(--radius-lg);
    padding: var(--sp-4);
  }
  dialog.dialog[open] form > button[type=submit],
  dialog.dialog[open] form > button[type=button] {
    min-height: 44px;
    flex: 1;
  }
}

/* ===== Academy-aligned product finish ===== */
body {
  background:
    radial-gradient(circle at 12% 12%, rgba(124,58,237,.16), transparent 34rem),
    radial-gradient(circle at 88% 78%, rgba(14,165,233,.09), transparent 30rem),
    var(--bg-workstation);
}

#app-shell { isolation: isolate; background: transparent; }
#app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .28;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, black, transparent 85%);
}

.app-header {
  background: rgba(7,10,24,.78);
  border-color: rgba(167,139,250,.14);
  backdrop-filter: blur(20px) saturate(130%);
  box-shadow: 0 1px 0 rgba(255,255,255,.025), 0 18px 60px rgba(2,4,15,.34);
}

.app-header__brand span:first-of-type {
  background: linear-gradient(110deg, #fff 12%, #c4b5fd 48%, #7dd3fc 90%);
  background-clip: text;
  color: transparent;
}

.app-header__brand-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #8b5cf6;
  box-shadow: 0 0 0 5px rgba(139,92,246,.12), 0 0 24px #8b5cf6;
  animation: signal-pulse 2.8s ease-in-out infinite;
}

.global-search__field {
  background: rgba(15,23,42,.58);
  border-color: rgba(148,163,184,.15);
  border-radius: 999px;
}

.app-nav { background: rgba(7,10,24,.6); backdrop-filter: blur(18px); }
.nav-tab[aria-current="page"] { background: linear-gradient(135deg, rgba(124,58,237,.24), rgba(14,165,233,.12)); box-shadow: inset 0 0 0 1px rgba(167,139,250,.14); }

.app-sidebar, .agenda-rail, .thread-panel, .reading-pane, .calendar-view {
  background: linear-gradient(145deg, rgba(14,20,40,.76), rgba(7,10,24,.66));
  backdrop-filter: blur(18px);
}

.sidebar-item, .thread-row, .agenda-rail li, .settings-card, .integration-row, .storage-summary {
  transition: transform var(--duration-normal) var(--ease-out), border-color var(--duration-normal) var(--ease-out), background var(--duration-normal) var(--ease-out), box-shadow var(--duration-normal) var(--ease-out);
}

.sidebar-item:hover, .thread-row:hover, .agenda-rail li:hover, .settings-card:hover {
  transform: translateY(-2px);
  border-color: rgba(167,139,250,.27);
  box-shadow: 0 16px 34px rgba(2,4,15,.22);
}

.btn--primary {
  position: relative;
  overflow: hidden;
  color: #fff;
  border-color: rgba(196,181,253,.38);
  background: linear-gradient(120deg, #6d28d9, #8b5cf6 45%, #0ea5e9 115%);
  box-shadow: 0 10px 26px rgba(109,40,217,.28), inset 0 1px 0 rgba(255,255,255,.24);
}
.btn--primary::after {
  content: "";
  position: absolute;
  inset: -100% -40%;
  transform: translateX(-65%) rotate(18deg);
  background: linear-gradient(90deg, transparent 42%, rgba(255,255,255,.32), transparent 58%);
  transition: transform .7s var(--ease-out);
}
.btn--primary:hover { background: linear-gradient(120deg, #7c3aed, #9b7bff 48%, #38bdf8 120%); box-shadow: 0 15px 40px rgba(109,40,217,.38), 0 0 0 1px rgba(196,181,253,.22); transform: translateY(-2px); }
.btn--primary:hover::after { transform: translateX(65%) rotate(18deg); }

.btn--ai {
  color: #ddd6fe;
  border: 1px solid rgba(167,139,250,.25);
  background: linear-gradient(135deg, rgba(124,58,237,.16), rgba(14,165,233,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.btn--ai:hover { color: #fff; border-color: rgba(196,181,253,.52); box-shadow: 0 0 26px rgba(124,58,237,.18); transform: translateY(-1px); }
.btn:disabled { cursor: wait; opacity: .52; transform: none; }

dialog.dialog[open] {
  background: linear-gradient(155deg, rgba(16,22,45,.98), rgba(7,10,24,.98));
  border-color: rgba(167,139,250,.24);
  box-shadow: 0 34px 100px rgba(1,2,10,.76), 0 0 0 1px rgba(255,255,255,.025), 0 0 100px rgba(109,40,217,.12);
}
dialog.dialog[open]::backdrop { background: rgba(2,3,12,.76); backdrop-filter: blur(12px); }
.settings-dialog.dialog[open] { width: min(960px, calc(100vw - 28px)); }
.dialog__header, .dialog__actions, .settings-dialog__actions, .section-heading, .assistant-settings__intro { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog__actions, .settings-dialog__actions { flex-wrap: wrap; padding-top: 8px; }
.dialog__actions span { color: var(--text-tertiary); font-size: var(--fs-xs); }

.assistant-strip, .assistant-settings, .ai-result {
  border: 1px solid rgba(167,139,250,.22);
  background: linear-gradient(135deg, rgba(124,58,237,.14), rgba(14,165,233,.07));
  border-radius: var(--radius-lg);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 20px 50px rgba(2,4,15,.16);
}
.assistant-strip { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; }
.assistant-strip > div, .assistant-strip nav { display: flex; align-items: center; gap: 9px; }
.assistant-strip small { display: block; color: var(--text-tertiary); }
.assistant-orb { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; color: #fff; background: linear-gradient(135deg, #7c3aed, #0ea5e9); box-shadow: 0 0 26px rgba(124,58,237,.38); }
.assistant-orb--large { width: 48px; height: 48px; flex: 0 0 auto; font-size: 1.2rem; }
.assistant-settings { padding: 20px; gap: 18px !important; }
.assistant-settings__intro > div { flex: 1; }
.ai-result { margin-top: 20px; padding: 18px; color: var(--text-secondary); white-space: pre-wrap; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid__wide { grid-column: 1 / -1; }
.settings-dialog select, .settings-dialog input, .settings-dialog textarea {
  width: 100%;
  background: rgba(5,7,20,.68);
  border: 1px solid rgba(148,163,184,.16);
  border-radius: var(--radius-md);
  padding: 11px 13px;
}
.settings-dialog input[readonly] { color: #a5b4fc; cursor: default; }
.toggle-field { flex-direction: row !important; align-items: center; align-self: end; min-height: 44px; padding: 9px 12px; border: 1px solid rgba(148,163,184,.13); border-radius: var(--radius-md); background: rgba(5,7,20,.42); }
.toggle-field input { width: 18px; height: 18px; accent-color: #8b5cf6; }
.status-chip { display: inline-flex; align-items: center; width: fit-content; padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(167,139,250,.24); color: #c4b5fd; background: rgba(124,58,237,.11); font-size: var(--fs-xs); font-weight: 700; }
.settings-card.is-current { border-color: rgba(167,139,250,.64); box-shadow: inset 0 0 0 1px rgba(139,92,246,.2), 0 18px 48px rgba(76,29,149,.14); }

body[data-density="compact"] .thread-row { padding-block: 8px; }

@keyframes signal-pulse { 50% { transform: scale(.75); opacity: .62; box-shadow: 0 0 0 9px rgba(139,92,246,.05), 0 0 16px #8b5cf6; } }

@media (max-width: 760px) {
  .form-grid, .form-grid--three { grid-template-columns: 1fr; }
  .form-grid__wide { grid-column: auto; }
  .assistant-strip, .assistant-settings__intro { align-items: flex-start; flex-direction: column; }
  .assistant-strip nav { width: 100%; }
  .assistant-strip nav .btn { flex: 1; }
  .section-heading { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 390px) {
  .settings-dialog.dialog[open] { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); padding: 14px; }
  .dialog__header, .settings-dialog__header { align-items: flex-start; }
  .reading-pane__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .assistant-strip nav { display: grid; grid-template-columns: 1fr 1fr; }
}

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

/* Final shell geometry: these rules intentionally close legacy selector gaps. */
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}
.app-header { display: grid; grid-template-columns: auto minmax(220px, 480px) minmax(0, 1fr); align-items: center; }
.app-header__brand { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.25rem; }
.app-header__brand-dot { display: inline-block; flex: 0 0 auto; }
.global-search { width: 100%; max-width: 480px; }
.header-actions { justify-self: end; }
.composer-dialog.dialog[open] { width: min(880px, calc(100vw - 28px)); max-width: min(880px, calc(100vw - 28px)); padding: 0; }
.mail-loading-state { grid-column: 1 / -1; display: flex; align-items: center; gap: 13px; min-height: 94px; padding: 20px; border: 1px solid rgba(167,139,250,.14); border-radius: var(--radius-lg); background: rgba(124,58,237,.05); }
.mail-loading-state strong, .mail-loading-state span { display: block; }
.mail-loading-state span { color: var(--text-tertiary); font-size: var(--fs-small); }
@media (max-width: 700px) {
  .app-header { grid-template-columns: auto minmax(0, 1fr); gap: 10px 12px; padding: 12px; }
  .app-header__brand { grid-column: 1; }
  .header-actions { grid-column: 2; justify-self: end; }
  .global-search { grid-column: 1 / -1; grid-row: 2; max-width: none; }
  .header-actions { display: flex; gap: 4px; }
  .header-actions .btn--ghost { padding-inline: 8px; }
}
@media (max-width: 390px) {
  .app-header { flex-direction: initial; }
  .app-header__logo { width: 36px; height: 36px; }
  .app-header__brand { font-size: 1rem; }
  .header-actions .btn--primary { padding-inline: 10px; }
  .header-actions .btn--ghost { font-size: .72rem; }
  .composer-dialog.dialog[open] { width: calc(100vw - 12px); max-width: calc(100vw - 12px); }
}
