@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

:root {
  --bg: #0d0f14;
  --surface: #161920;
  --surface-raised: #1e2230;
  --border: #2a2f3e;
  --text-primary: #f0f2f8;
  --text-secondary: #8891a8;
  --accent: #4f7fff;
  --accent-hover: #6b96ff;
  --success: #2dd4a0;
  --warning: #f5a623;
  --danger: #ff4f6b;
  --sidebar-w: 246px;
  --list-w: 380px;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text-primary);
  font-family: Inter, 'DM Sans', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

html:has(#app.is-visible),
html:has(#app.is-visible) body {
  overflow: hidden;
  height: 100vh;
}

button,
input,
textarea {
  font-family: inherit;
}

.mono {
  font-family: 'DM Mono', ui-monospace, monospace;
  font-size: 12px;
}

.hidden {
  display: none !important;
}

/* ——— Landing ——— */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: radial-gradient(ellipse 80% 50% at 50% -20%, rgba(79, 127, 255, 0.12), transparent),
    var(--bg);
}

.landing__logo {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--accent);
  margin-bottom: 12px;
}

.landing .tagline {
  color: var(--text-secondary);
  font-size: 18px;
  margin: 0 0 0;
  letter-spacing: 0.02em;
}

.landing .tagline-sub {
  font-size: 14px;
  color: #8891a8;
  margin: 4px 0 0;
  text-align: center;
}

.landing__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}

.landing .btn--ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
}

.login-lead {
  color: var(--text-secondary);
  font-size: 15px;
  max-width: 420px;
  text-align: center;
  margin: -24px 0 8px;
  line-height: 1.5;
}

/* ——— App shell ——— */
.app {
  display: none;
  min-height: 100vh;
  min-width: 1024px;
}

.app.is-visible {
  display: flex;
  flex-direction: column;
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

.app__shell {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  min-width: 0;
  flex-shrink: 0;
  min-height: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  overflow-x: visible;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  z-index: 30;
}

.sidebar__head-sticky {
  position: sticky;
  top: 0;
  z-index: 3;
  margin: -20px -14px 0;
  padding: 12px 14px 12px;
  background: #121722;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow: visible;
}

.sidebar__lang-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}

.sidebar__lang-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  padding: 0 2px;
}

.sidebar__lang-select {
  margin-top: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: #1b2231;
  color: #f1f4fc;
}

.sidebar__logo_wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px;
  margin: 0 0 8px;
  background: transparent;
  background-color: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: visible;
  z-index: 2;
}

.sidebar__logo_full {
  display: block;
  width: auto !important;
  max-width: none !important;
  height: 70px !important;
  object-fit: contain;
  background: transparent;
  margin: -50px 0 0 -30px;
  transform-origin: left center;
}

.sidebar__compose-action,
.sidebar__lang-row,
.accounts,
.sidebar-accounts,
.nav,
.sidebar__compose-action .nav__btn,
.sidebar__lang-select,
.accounts .account-btn.pill,
.nav__btn {
  width: 100%;
}

.sidebar__compose-action {
  flex-shrink: 0;
  margin: 20px 0;
}

.sidebar__compose-action .nav__btn {
  background: var(--surface-raised);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #ffffff;
  font-weight: 600;
  text-align: center;
  padding: 8px 12px;
}

.sidebar__compose-action .nav__btn:hover {
  background: rgba(74, 158, 255, 0.16);
  border-color: #4a9eff;
  color: #ffffff;
}

.accounts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.accounts__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  padding: 0 8px;
  margin-bottom: 4px;
}

.sidebar-accounts {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.account-section {
  margin-bottom: 4px;
}

.account-chevron {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 20px;
  line-height: 1;
  font-weight: 700;
  color: #c8d0e0;
  min-width: 32px;
  text-align: center;
  transition: transform 0.2s, color 0.15s;
}

.pill:hover .account-chevron,
.pill.is-active .account-chevron {
  color: #fff;
}

.account-chevron.collapsed {
  transform: rotate(-90deg);
}

.folder-tree {
  margin-left: 12px;
  border-left: 1px solid #2a2f3e;
  padding-left: 8px;
  margin-bottom: 8px;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.folder-item-sidebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: #8891a8;
  transition: background 0.15s;
}

.folder-item-sidebar:hover {
  background: #1e2230;
  color: #f0f2f8;
}

.folder-item-sidebar.active {
  background: #1e2230;
  color: #f0f2f8;
  border-left: 2px solid #4f7fff;
}

.folder-count {
  margin-left: auto;
  font-size: 10px;
  color: #4f7fff;
  font-weight: 600;
}

.folder-icon {
  font-size: 12px;
  flex-shrink: 0;
}

.pill {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.pill:hover {
  border-color: rgba(255, 255, 255, 0.18);
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.pill.is-active {
  border-color: var(--accent);
  color: var(--text-primary);
  box-shadow: inset 0 0 0 1px rgba(79, 127, 255, 0.25);
}

.pill__badge {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  background: var(--border);
  color: var(--text-primary);
}

.pill.is-active .pill__badge {
  background: var(--accent);
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.nav__btn {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.12s, color 0.12s;
  position: relative;
}

.nav__btn:hover {
  background: var(--surface-raised);
  color: var(--text-primary);
}

.nav__btn.is-active {
  background: var(--surface-raised);
  color: #ffffff;
  padding-left: 16px;
}

.nav__btn.is-active::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: #4a9eff;
}

.user-profile-bar {
  position: fixed;
  top: 12px;
  right: 16px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-profile-bar__trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 2px 4px;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}

.user-profile-bar__trigger:hover {
  background: rgba(255, 255, 255, 0.04);
}

.user-profile-bar__trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.profile-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  background: #1e2230;
  border: 1px solid #2a2f3e;
  border-radius: 10px;
  padding: 8px;
  z-index: 2000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.profile-dropdown.hidden {
  display: none !important;
}

.dropdown-icons-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.profile-dropdown .icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid #2a2f3e;
  background: #0d0f14;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  color: inherit;
  font-family: inherit;
  transition:
    background 0.15s,
    border-color 0.15s;
}

.profile-dropdown .icon-btn:hover {
  background: #2a2f3e;
  border-color: #4f7fff;
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar__user-meta {
  min-width: 0;
  text-align: left;
}

.sidebar__user-name {
  font-size: 12px;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}

.sidebar__user-plan {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-top: 2px;
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ——— List panel (middle column) ——— */
.middle-panel {
  display: flex;
  flex-direction: column;
  width: var(--list-w);
  flex-shrink: 0;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--bg);
  position: relative;
  z-index: 1;
}

.middle-panel__search {
  flex-shrink: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 8px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.middle-search-wrap {
  position: relative;
  width: 100%;
  min-width: 0;
}

.middle-search-wrap .search--middle {
  width: 100%;
  box-sizing: border-box;
  padding-right: 36px;
  min-height: 42px;
  background: #1b2231;
  border-color: rgba(255, 255, 255, 0.16);
  color: #eef2fb;
}

.middle-search-wrap .search--middle::placeholder {
  color: rgba(255, 255, 255, 0.48);
}

.middle-search-wrap .search--middle:focus {
  border-color: #4a9eff;
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.search--middle::-webkit-search-cancel-button,
.search--middle::-webkit-search-decoration {
  -webkit-appearance: none;
  appearance: none;
}

.middle-search-clear {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}

.middle-search-clear:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.middle-search-clear:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.middle-panel__list-tools {
  flex-shrink: 0;
  min-width: 0;
  width: 100%;
}

.stats-bar--middle {
  border-top: none;
}

.mailbox-toolbar-adv-trigger {
  flex: 1;
  min-width: 0;
  margin: 0;
  box-sizing: border-box;
  border: 1px solid #1e2330;
  border-radius: 6px;
  background: #13161e;
  padding: 6px 10px;
  font-size: 11px;
  color: #8b95a1;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}

.mailbox-toolbar-adv-trigger:hover {
  color: #c8d0e0;
}

.mailbox-toolbar-adv-trigger.is-active {
  border-color: #4f7fff;
  color: #fff;
  background: #4f7fff;
  font-weight: 600;
}

#pill-gmail,
#pill-outlook {
  border-radius: 8px;
  padding: 10px 12px;
}

#pill-gmail:hover,
#pill-outlook:hover {
  background: rgba(255, 255, 255, 0.06);
}

.stats-bar__row--stats-hidden {
  display: none !important;
}

.ai-search-warning:not(.hidden) {
  padding: 6px 10px;
  margin-top: 6px;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fcd34d;
  font-size: 12px;
}
.ai-cost-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-secondary);
}
.email-item.ai-match {
  outline: 1px solid var(--accent);
  background: rgba(99, 102, 241, 0.08);
}
.email-item.ai-dim {
  opacity: 0.45;
}

.search-wrap {
  padding: 0;
  border: none;
}

.search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  font-size: 13px;
}

.search:focus {
  border-color: var(--accent);
}

.search::placeholder {
  color: var(--text-secondary);
}

.context-bar {
  padding: 4px 12px;
  background: #1a1f2a;
  border-bottom: 1px solid #2a2f3e;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  font-size: 13px;
}

.context-bar__viewing {
  color: #8891a8;
}

.context-bar__view-text {
  color: #f0f2f8;
  font-weight: 600;
}

.context-bar__position {
  color: #8891a8;
}

/* Same layout as .pill; used for “Both accounts” */
.accounts .account-btn.pill {
  justify-content: center;
  text-align: center;
  width: 100%;
  background: #4a9eff;
  border-color: #4a9eff;
  color: #fff;
  border-radius: 8px;
  font-weight: 600;
}

.email-list {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a2f3e transparent;
}

.email-item {
  padding-top: 14px;
  padding-right: 16px;
  padding-bottom: 14px;
  padding-left: 16px;
  min-width: 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s;
}

.email-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.email-item.is-unread {
  border-left-color: var(--accent);
}

.email-item.is-selected {
  background: rgba(74, 158, 255, 0.15);
  border-left-color: #4a9eff;
}

.email-item__from {
  font-weight: 600;
  font-size: 13px;
  color: #ffffff;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-item__subject {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-item__preview {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-item__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  gap: 8px;
}

.email-item__meta-start {
  display: flex;
  align-items: center;
  min-width: 0;
}

.email-item__flags {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.email-item__flag {
  width: 10px;
  height: 10px;
  margin-left: 6px;
  padding: 0;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: inline-block;
  opacity: 0.5;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

.email-item__flag:hover:not(.is-active) {
  opacity: 0.75;
}

.email-item__flag--reset {
  margin-left: 4px;
  background: #f0f2f8;
  border: 1px solid #555;
  box-sizing: border-box;
}

.email-item__flag.is-active {
  opacity: 1;
}

.email-item__flag--red {
  background: #ff4f6b;
}

.email-item__flag--amber {
  background: #f5a623;
}

.email-item__flag--green {
  background: #2dd4a0;
}

.email-item--flag-red .email-item__from,
.email-item--flag-red .email-item__subject,
.email-item--flag-red .email-item__preview {
  color: #ff4f6b;
}

.email-item--flag-amber .email-item__from,
.email-item--flag-amber .email-item__subject,
.email-item--flag-amber .email-item__preview {
  color: #f5a623;
}

.email-item--flag-green .email-item__from,
.email-item--flag-green .email-item__subject,
.email-item--flag-green .email-item__preview {
  color: #2dd4a0;
}

.email-item--flag-neutral .email-item__from,
.email-item--flag-neutral .email-item__subject,
.email-item--flag-neutral .email-item__preview {
  color: #f0f2f8;
}

.email-item__time {
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
}

.email-item__prov {
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.email-item__prov--gmail {
  background: #ea4335;
  color: #fff;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
}

.email-item__prov--outlook {
  background: #0078d4;
  color: #fff;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
}

.empty-hint {
  padding: 32px 20px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 13px;
}

/* ——— Reader / compose ——— */
.panel-main {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: var(--surface);
}

.reader-toolbar {
  flex: 0 3 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 10;
}

.thread {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.thread__empty {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 28px;
}

.thread__content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.thread__reader-head {
  flex-shrink: 0;
  padding: 10px 16px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.thread__body-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 16px 16px;
}

.thread__hdr {
  margin-bottom: 10px;
}

.thread__summary-card {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-primary);
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}

.thread__summary-card.hidden {
  display: none !important;
}

.thread__summary-text {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.thread__summary-actions-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #f5a623;
  text-transform: uppercase;
  margin-top: 10px;
  margin-bottom: 4px;
}

.thread__summary-actions-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.thread__summary-actions-item {
  position: relative;
  font-size: 12px;
  color: #f0f2f8;
  padding-left: 14px;
  margin-bottom: 2px;
}

.thread__summary-actions-item::before {
  content: '•';
  position: absolute;
  left: 0;
  color: #f0f2f8;
}

.thread__summary-actions-item--none {
  color: #8891a8;
}

.thread__summary-actions-item--none::before {
  color: #8891a8;
}

.thread__summarise-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 8px;
}

.thread__summarise-row .btn-summarise {
  margin-bottom: 0;
  flex: 1 1 0;
  min-width: 0;
  min-height: 38px;
  font-weight: 500;
  border-radius: 8px;
}

.btn-summarise {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
}

.btn-summarise:hover:not(:disabled) {
  background: rgba(79, 127, 255, 0.12);
}

.btn-summarise:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

#btn-summarise {
  background: #4a9eff;
  border-color: #4a9eff;
  color: #fff;
  font-weight: 600;
}

#btn-summarise:hover:not(:disabled) {
  background: #3a8eef;
}

.thread__subject-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 8px;
}

.thread__subject {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 0;
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

.btn-tts {
  flex-shrink: 0;
  padding: 4px 8px;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  border-radius: 8px;
}

.btn-tts:hover:not(:disabled) {
  color: var(--text-primary);
  background: var(--surface-raised);
}

.btn-tts:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.thread__meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 6px 20px;
  margin-bottom: 8px;
}

.thread__row {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.thread__row--meta {
  margin-bottom: 0;
  flex: 1 1 0;
  min-width: min(100%, 200px);
}

#app button,
#app input,
#app select,
#app textarea {
  border-radius: 8px;
}

.thread__row--meta span {
  color: rgba(255, 255, 255, 0.85);
  word-break: break-word;
}

.thread__row strong {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
  margin-right: 8px;
}

.thread__body {
  font-size: 14px;
  line-height: 1.7;
  color: #d0d0d0;
  white-space: pre-wrap;
  word-break: break-word;
}

.thread__body a {
  color: #4a9eff;
}

.thread__body.thread__body--html {
  white-space: normal;
}

.thread__body mark[data-spreakr-hl] {
  color: inherit;
  padding: 0;
}

.highlight-toolbar {
  position: fixed;
  background: #1e2230;
  border: 1px solid #2a2f3e;
  border-radius: 8px;
  padding: 6px 10px;
  display: flex;
  gap: 8px;
  align-items: center;
  z-index: 2000;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
  user-select: none;
}

.highlight-toolbar.hidden {
  display: none !important;
}

.highlight-toolbar__circle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  background: transparent;
  font-size: 11px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.highlight-toolbar__clear {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0 4px;
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.highlight-toolbar__clear:hover {
  color: var(--text-primary);
}

.compose-fields {
  flex-shrink: 0;
  padding: 0 28px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field {
  display: flex;
  align-items: center;
  gap: 12px;
}

.field label {
  width: 64px;
  flex-shrink: 0;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.field input {
  flex: 1;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-primary);
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
}

.compose-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2999;
  background: rgba(0, 0, 0, 0.55);
}

.compose-modal-backdrop.hidden {
  display: none !important;
}

.compose-modal {
  position: fixed;
  top: 5vh;
  left: 50%;
  transform: translateX(-50%);
  width: 85vw;
  max-width: 1100px;
  height: 85vh;
  background: #1e2230;
  border: 1px solid #2a2f3e;
  border-radius: 12px;
  z-index: 3000;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.compose-modal.hidden {
  display: none !important;
}

.compose-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #2a2f3e;
}

.compose-title {
  font-size: 16px;
  font-weight: 600;
  color: #f0f2f8;
}

.compose-close {
  margin: 0;
  padding: 4px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #8891a8;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.compose-close:hover {
  color: #f0f2f8;
  background: rgba(255, 255, 255, 0.06);
}

.language-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 8px 20px;
  background: #161920;
  border-bottom: 1px solid #2a2f3e;
  font-size: 11px;
  flex-shrink: 0;
}

.language-bar__label {
  color: #8891a8;
  margin-right: 4px;
}

.language-bar__value {
  display: inline-block;
  color: #f0f2f8;
  font-weight: 600;
  background: #0d0f14;
  border: 1px solid #2a2f3e;
  border-radius: 4px;
  padding: 2px 8px;
}

.language-bar__sep {
  color: #2a2f3e;
  user-select: none;
}

.language-bar__select {
  background: #0d0f14;
  border: 1px solid #2a2f3e;
  color: #f0f2f8;
  border-radius: 4px;
  padding: 2px 8px;
  font-size: 11px;
  cursor: pointer;
  font-family: inherit;
}

.compose-ai-row {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  flex-shrink: 0;
  padding: 8px 20px;
  border-bottom: 1px solid #2a2f3e;
  background: #12141a;
}

.compose-ai-row__tone {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compose-ai-row__label {
  font-size: 11px;
  color: #8891a8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.compose-transcript-wrap {
  flex-shrink: 0;
  margin: 0 20px 8px;
  padding: 8px 10px;
  border: 1px solid #2a2f3e;
  border-radius: 6px;
  background: #0d0f14;
  max-height: 120px;
  overflow: auto;
}

.compose-transcript-wrap.hidden {
  display: none !important;
}

.compose-transcript-summary {
  font-size: 12px;
  color: #4f7fff;
  cursor: pointer;
  user-select: none;
}

.compose-transcript-text {
  margin: 8px 0 0;
  font-size: 12px;
  color: #c5cad6;
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  line-height: 1.45;
}

.reply-meta__field {
  margin-bottom: 10px;
}

.reply-meta__field:last-child {
  margin-bottom: 0;
}

.compose-modal__split {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.original-pane {
  width: 40%;
  flex-shrink: 0;
  border-right: 1px solid #2a2f3e;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #161920;
}

.original-pane.hidden {
  display: none !important;
}

.original-header {
  padding: 16px 20px;
  border-bottom: 1px solid #2a2f3e;
  flex-shrink: 0;
}

.original-header__label {
  font-size: 11px;
  color: #8891a8;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.original-header__subject {
  font-size: 15px;
  font-weight: 600;
  color: #f0f2f8;
  margin-bottom: 8px;
}

.original-header__meta {
  font-size: 12px;
  color: #8891a8;
}

.original-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  font-size: 13px;
  color: #8891a8;
  line-height: 1.6;
}

.reply-pane {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.reply-meta {
  flex-shrink: 0;
  padding: 12px 20px;
  border-bottom: 1px solid #2a2f3e;
}

.reply-meta.hidden {
  display: none !important;
}

.reply-meta__line {
  font-size: 12px;
  color: #8891a8;
  margin-bottom: 6px;
}

.reply-meta__line:last-child {
  margin-bottom: 0;
}

.reply-meta__value {
  color: #f0f2f8;
}

.reply-meta--new {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reply-meta--new.hidden {
  display: none !important;
}

.compose-context__label {
  color: #8891a8;
  margin-right: 6px;
}

.compose-context__field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.compose-context__field .compose-context__label {
  width: 64px;
  flex-shrink: 0;
}

.compose-context__input {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid #2a2f3e;
  background: #0d0f14;
  color: #f0f2f8;
  font-size: 13px;
}

.compose-modal__textarea {
  flex: 1;
  min-height: 120px;
  width: 100%;
  box-sizing: border-box;
  background: #0d0f14;
  border: none;
  color: #f0f2f8;
  padding: 20px;
  font-size: 14px;
  font-family: 'DM Sans', system-ui, sans-serif;
  line-height: 1.6;
  resize: none;
  outline: none;
}

.compose-modal__textarea--reply {
  min-height: 0;
}

.compose-modal__status {
  flex-shrink: 0;
  margin: 0;
  padding: 6px 20px;
  min-height: 0;
  font-size: 12px;
}

.compose-toolbar {
  flex-shrink: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid #2a2f3e;
  background: #161920;
  border-radius: 0 0 12px 12px;
}

.compose-toolbar__left,
.compose-toolbar__right {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.compose-toolbar__btn {
  margin: 0;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
}

.compose-toolbar__btn--primary {
  background: #4f7fff;
  color: #fff;
  border: none;
  padding: 8px 20px;
  font-weight: 600;
}

.compose-toolbar__btn--secondary {
  background: transparent;
  color: #f0f2f8;
  border: 1px solid #2a2f3e;
}

.compose-toolbar__btn--secondary:hover {
  border-color: #4f7fff;
  color: #4f7fff;
}

.compose-toolbar__btn--danger {
  background: transparent;
  color: #ff4f6b;
  border: 1px solid #ff4f6b;
}

.app.is-visible > .user-profile-bar {
  flex: 0 0 0;
  height: 0;
  overflow: visible;
  pointer-events: none;
}

.app.is-visible > .user-profile-bar * {
  pointer-events: auto;
}

.lang-select {
  float: right;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 12px;
}

.textarea-lg {
  width: 100%;
  min-height: 160px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  resize: vertical;
  outline: none;
  line-height: 1.5;
}

.textarea-lg:focus {
  border-color: var(--accent);
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.btn {
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  box-sizing: border-box;
}

a.btn {
  color: inherit;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn--ghost {
  background: var(--surface-raised);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn--ghost:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn--danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

.btn--danger:hover:not(:disabled) {
  background: rgba(255, 79, 107, 0.1);
}

.btn--outline-accent {
  background: transparent;
  border: 1px solid #4f7fff;
  color: #4f7fff;
  border-radius: 6px;
  padding: 6px 14px;
  cursor: pointer;
}

.btn--outline-accent:hover:not(:disabled) {
  background: rgba(79, 127, 255, 0.1);
}

.btn--mic {
  background: var(--surface-raised);
  color: var(--accent);
  border: 1px solid var(--accent);
}

.btn--mic:hover:not(:disabled) {
  background: rgba(79, 127, 255, 0.12);
}

.btn--mic.is-recording {
  animation: pulse-mic 1.2s ease-in-out infinite;
  border-color: var(--danger);
  color: var(--danger);
}

.btn--sm {
  padding: 8px 12px;
  font-size: 12px;
}

@keyframes pulse-mic {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 79, 107, 0.35);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(255, 79, 107, 0);
  }
}

.status-bar {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 10px;
  min-height: 18px;
}

.status-bar.is-error {
  color: var(--danger);
}

.status-bar.is-ok {
  color: var(--success);
}

/* Settings modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 24px;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  width: 100%;
}

.modal h3 {
  margin: 0 0 12px;
  font-size: 16px;
}

.modal p {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

.modal--wide {
  max-width: 480px;
}

.modal-muted {
  margin: 0 0 16px;
  color: var(--text-secondary);
  font-size: 13px;
}

.settings-block {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.settings-block:last-of-type {
  border-bottom: none;
}

.settings-block__title {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.settings-select {
  width: 100%;
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 12px;
}

.stats-bar__quick-title,
.sidebar__lang-label,
.accounts__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
}

.stats-bar__btn {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.55);
}

.stats-bar__btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
}

.stats-bar__btn.is-active {
  background: #4a9eff;
  border-color: #4a9eff;
  color: #fff;
  font-weight: 600;
}

#stat-unread {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 8px;
  border-radius: 12px;
  background: #4a9eff;
  color: #fff;
  font-weight: 700;
}

* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

*::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

*::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}

.settings-accounts {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
}

.settings-accounts li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin-bottom: 8px;
  font-size: 13px;
}

.settings-accounts .acc-meta {
  color: var(--text-secondary);
  font-size: 11px;
  margin-top: 4px;
}

.settings-connect {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.stats-bar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 8px 6px;
  background: #161920;
  border-bottom: 1px solid #2a2f3e;
  flex-shrink: 0;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  font-size: 11px;
  color: #8891a8;
  align-items: stretch;
}

.stats-bar__row {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}

.stats-bar__row--stats {
  color: #a8b0c4;
  user-select: none;
  cursor: default;
  line-height: 1.35;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.stats-bar__readout {
  flex-shrink: 0;
  white-space: nowrap;
}

.stats-bar__stat-num {
  display: inline-block;
  min-width: 28px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  vertical-align: baseline;
}

.stats-bar__stat-sep {
  flex-shrink: 0;
  opacity: 0.45;
  user-select: none;
}

.stats-bar__readout--flags {
  display: inline-flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.stats-bar__flag-stat {
  white-space: nowrap;
  flex-shrink: 0;
}

.stats-bar__row--actions {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  overflow: visible;
}

.stats-bar__filter-stack {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.stats-bar__date-quick--above-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
  width: 100%;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.stats-bar__quick-filter-line {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 10px;
  min-width: 0;
  width: 100%;
}

.stats-bar__quick-filter-colors-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  flex-shrink: 0;
}

.stats-bar__quick-color-dots {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
}

.stats-bar__quick-color-dots .stats-bar__btn {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
  border-radius: 999px;
  border-width: 1px;
  border-style: solid;
  font-size: 0;
  line-height: 0;
}

.stats-bar__quick-color-dots .stats-bar__btn[data-filter='red'] {
  background: #ef4444;
  border-color: #f87171;
}

.stats-bar__quick-color-dots .stats-bar__btn[data-filter='amber'] {
  background: #f59e0b;
  border-color: #fbbf24;
}

.stats-bar__quick-color-dots .stats-bar__btn[data-filter='green'] {
  background: #10b981;
  border-color: #34d399;
}

.stats-bar__quick-color-dots .stats-bar__btn.is-active {
  box-shadow: 0 0 0 2px rgba(79, 127, 255, 0.8);
}

.stats-bar__quick-filter-colors-block .stats-bar__quick-title {
  align-self: stretch;
  padding-right: 0;
  margin-right: 0;
  border-right: none;
}

.stats-bar__date-label {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b95a1;
  padding-right: 10px;
  margin-right: 2px;
  border-right: 1px solid #2a2f3e;
  user-select: none;
}

.stats-bar__date-presets-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}

.stats-bar__quick-title {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8b95a1;
  padding-right: 10px;
  margin-right: 2px;
  border-right: 1px solid #2a2f3e;
  user-select: none;
}

.stats-bar__actions-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-width: 0;
  flex: 1;
  overflow: visible;
}

.stats-bar__group {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.stats-bar__divider {
  color: #2a2f3e;
  flex-shrink: 0;
  user-select: none;
  padding: 0 4px;
  font-weight: 300;
  font-size: 11px;
  line-height: 1;
}

.stats-bar__btn {
  box-sizing: border-box;
  flex-shrink: 0;
  margin: 0;
  font-size: 11px;
  font-family: inherit;
  line-height: 1.25;
  background: transparent;
  border: 1px solid #2a2f3e;
  border-radius: 4px;
  color: #8891a8;
  padding: 2px 6px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
}

.stats-bar__btn:hover:not(:disabled) {
  border-color: #4f7fff;
  color: #c5cad8;
}

.stats-bar__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.stats-bar__btn.is-active {
  border-color: #4f7fff;
  color: #ffffff;
  background: #4f7fff;
  font-weight: 600;
}

.stats-bar__btn.is-active:hover:not(:disabled) {
  color: #ffffff;
  background: #4f7fff;
  border-color: #4f7fff;
}

.stats-bar__btn:focus-visible {
  outline: 2px solid #4f7fff;
  outline-offset: 2px;
}

.stats-bar__btn--clear:not(:disabled) {
  border-style: dashed;
  border-color: #4a5568;
  color: #c8d0e0;
}

.stats-bar__btn--clear:not(:disabled):hover {
  border-style: solid;
  border-color: #f59e0b;
  color: #fcd34d;
  background: rgba(245, 158, 11, 0.08);
}

.stats-bar.is-mailbox-loading {
  animation: stats-bar-mailbox-pulse 1.2s ease-in-out infinite;
}

@keyframes stats-bar-mailbox-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.78;
  }
}

.ai-search-panel {
  flex-shrink: 0;
  max-height: 0;
  overflow: hidden;
  transition:
    max-height 0.3s ease,
    margin 0.3s ease;
  margin: 0 12px;
}

.ai-search-panel.is-open {
  max-height: 4000px;
  margin-top: 8px;
  margin-bottom: 8px;
}

.ai-search-panel__inner {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  background: #1e2230;
  border: 1px solid #2a2f3e;
  border-radius: 8px;
  padding: 12px;
}

.ai-search-question {
  display: block;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  margin: 0;
  background: #0d0f14;
  border: 1px solid #2a2f3e;
  border-radius: 6px;
  color: #f0f2f8;
  padding: 8px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.45;
  resize: vertical;
}

.ai-search-filter-control {
  box-sizing: border-box;
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  color: #f0f2f8;
  background: #0d0f14;
  border: 1px solid #2a2f3e;
  border-radius: 6px;
}

.cost-estimate {
  font-size: 11px;
  color: #8891a8;
  margin-top: 8px;
  padding: 6px 8px;
  background: #0d0f14;
  border-radius: 4px;
}

.ai-search-run-btn {
  background: #4f7fff;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.ai-search-clear-btn {
  background: transparent;
  border: 1px solid #2a2f3e;
  color: #8891a8;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 12px;
  cursor: pointer;
}

.ai-results__empty {
  font-size: 12px;
  color: #8891a8;
}

.ai-result-card {
  margin-top: 10px;
  padding: 10px 12px;
  background: #0d0f14;
  border: 1px solid #2a2f3e;
  border-radius: 6px;
  font-size: 12px;
  color: #f0f2f8;
}

.ai-result-card__expl {
  line-height: 1.45;
  margin-bottom: 8px;
  white-space: pre-wrap;
}

.ai-result-card__open {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid #4f7fff;
  background: transparent;
  color: #4f7fff;
  cursor: pointer;
}

.adv-search-panel {
  display: none;
  position: fixed;
  left: 8px;
  top: 96px;
  z-index: 12030;
  width: 800px;
  max-width: calc(100vw - 12px);
  max-height: min(78vh, calc(100vh - 120px));
  overflow: auto;
  background: #1e1e2e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
  cursor: grab;
}

.adv-search-panel.is-open {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
}

.adv-search-panel input,
.adv-search-panel textarea,
.adv-search-panel select {
  cursor: text;
}

.adv-search-panel button,
.adv-search-panel label {
  cursor: pointer;
}

body.adv-search-dragging,
body.adv-search-dragging * {
  cursor: grabbing !important;
}

.adv-search-panel__inner {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.adv-search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  z-index: 12020;
}

.adv-search-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -4px 0 4px;
  padding: 0 0 10px;
  border: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  cursor: move;
  user-select: none;
}

.adv-search-modal-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
  color: #ffffff;
}

.adv-search-modal-close {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  border-radius: 6px;
  padding: 0 6px;
  line-height: 1.2;
  font-size: 20px;
  cursor: pointer;
}

.adv-search-modal-close:hover {
  color: #fff;
}

.adv-search-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.adv-search-span2 {
  grid-column: 1 / -1;
}

.adv-search-top-fields-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

@media (max-width: 720px) {
  .adv-search-top-fields-row {
    grid-template-columns: 1fr;
  }
}

.adv-search-attach-folder-read-row {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  overflow-x: visible;
  padding-bottom: 0;
}

.adv-search-toolbar-presets {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}

.adv-search-attach-head {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 6px 10px;
  width: auto;
  min-width: 0;
}

.adv-search-attach-label--head {
  margin: 0;
  flex-shrink: 0;
  font-size: 11px;
}

.adv-search-date-range-block {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-rows: auto;
  gap: 8px 10px;
  align-items: center;
  min-width: 0;
}

.adv-search-date-range-block__label-dates {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
}

.adv-search-date-range-block__label-between {
  grid-column: 3;
  grid-row: 1;
  align-self: center;
}

.adv-search-date-range-block .adv-search-date-preset-btns--one-line {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  align-items: center;
  min-width: 0;
  overflow-x: visible;
  padding-bottom: 0;
}

.adv-search-date-range-block .adv-search-date-between-inputs--one-line {
  grid-column: 4;
  grid-row: 1;
}

.adv-search-preset-btn--compact {
  padding: 5px 8px;
  font-size: 11px;
}

.adv-search-date-between-inputs--one-line {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.adv-search-date-between-inputs--one-line .adv-search-input {
  width: auto;
  min-width: 112px;
  max-width: 148px;
  margin-bottom: 0;
}

.adv-search-folder-presets,
.adv-search-read-presets,
.adv-search-attach-type-presets {
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  margin-bottom: 0;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  padding: 6px 8px;
  flex: 0 0 auto;
}

.adv-search-folder-presets .adv-search-date-preset-btns,
.adv-search-read-presets .adv-search-date-preset-btns,
.adv-search-attach-type-presets .adv-search-date-preset-btns {
  flex-wrap: nowrap;
}

.adv-search-date-preset-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.adv-search-preset-btn {
  box-sizing: border-box;
  margin: 0;
  font-size: 13px;
  font-family: inherit;
  line-height: 1;
  height: 28px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.55);
  padding: 0 10px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition:
    border-color 0.15s,
    color 0.15s,
    background 0.15s;
}

.adv-search-preset-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
}

.adv-search-preset-btn.is-active {
  border-color: #4a9eff;
  color: #fff;
  background: #4a9eff;
  font-weight: 600;
}

.adv-search-preset-btn:focus-visible {
  outline: none;
  border-color: #4a9eff;
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.adv-search-preset-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
}

.adv-search-attach-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #f0f2f8;
  font-size: 12px;
  cursor: pointer;
}

.adv-search-input {
  width: 100%;
  box-sizing: border-box;
  background: #252535;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  color: #e0e0e0;
  padding: 7px 11px;
  font-size: 13.5px;
  margin-bottom: 6px;
}

.adv-search-panel .adv-search-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
}

.adv-search-panel .adv-search-input:focus {
  outline: none;
  border-color: #4a9eff;
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.adv-search-grid .adv-search-input {
  margin-bottom: 0;
}

/* Native selects: taller tap target + obvious expand affordance */
.adv-search-panel select.adv-search-input {
  min-height: 34px;
  padding: 7px 34px 7px 11px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.25;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background-color: #252535;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23e8ecf4' stroke-width='2.25' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 18px 18px;
}

.adv-search-panel select.adv-search-input:hover {
  background-color: #2b2b3f;
}

.adv-search-panel select.adv-search-input:focus {
  outline: none;
  border-color: #4a9eff;
  box-shadow: 0 0 0 2px rgba(74, 158, 255, 0.2);
}

.adv-search-triple-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

/* App shell is min-width 1024px; stack only if viewport is squeezed further */
@media (max-width: 900px) {
  .adv-search-triple-row {
    grid-template-columns: 1fr;
  }
}

.adv-search-phrase-cell {
  min-width: 0;
  display: flex;
  align-items: center;
}

.adv-search-phrase-cell .adv-search-input {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.adv-search-kw-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.adv-search-kw-row .adv-search-input {
  flex: 1;
  min-width: 0;
}

.logic-toggle {
  display: flex;
  flex-shrink: 0;
  gap: 2px;
}

.logic-btn {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
}

.logic-btn.active {
  background: #4a9eff;
  color: #ffffff;
  border-color: #4a9eff;
  font-weight: 600;
}

.adv-search-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.adv-search-submit {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  background: #4a9eff;
  color: #fff;
  transition: background 0.15s ease, transform 0.15s ease;
}

.adv-search-submit:hover {
  background: #3a8eef;
  transform: scale(1.02);
}

.adv-search-reset {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  background: transparent;
  color: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.adv-search-reset:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.35);
}

.spre { color: #4F7FFF !important; -webkit-text-fill-color: #4F7FFF !important; }
.akr { color: #F0F2F8 !important; -webkit-text-fill-color: #F0F2F8 !important; }

.spreakr-debug-panel {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: 420px;
  max-width: calc(100vw - 28px);
  max-height: 80vh;
  overflow: hidden;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4);
  color: #ffffff;
  z-index: 2400;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 12px;
}

.spreakr-debug-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.spreakr-debug-panel__controls {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px 10px 0;
}

.spreakr-debug-panel__close {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: #fff;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  cursor: pointer;
}

.spreakr-debug-panel__content {
  max-height: calc(80vh - 74px);
  overflow: auto;
  padding: 8px 10px 10px;
}

.spreakr-debug-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.spreakr-debug-card__title {
  font-weight: 700;
  margin-bottom: 6px;
}

.spreakr-debug-card .k {
  color: #a7b3d6;
}

.spreakr-debug-error {
  color: #ff6b6b;
}

.spreakr-debug-panel__btn {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #252544;
  color: #fff;
  border-radius: 6px;
  padding: 5px 8px;
  cursor: pointer;
  font-size: 12px;
}

.spreakr-debug-force-reauth {
  margin-top: 8px;
}

.action-centre {
  height: 100%;
  overflow: auto;
  padding: 18px 16px 24px;
  background: #0d0f14;
}

.action-centre__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.action-centre__title {
  font-size: 24px;
  font-weight: 700;
  color: #f0f2f8;
}

.action-centre__subtitle,
.action-centre__generated {
  font-size: 12px;
  color: #8b95a1;
}

.action-centre__controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.action-centre__refresh,
.action-centre__done-btn {
  border: 1px solid #2a2f3e;
  border-radius: 8px;
  background: #13161e;
  color: #d9e1f3;
  padding: 6px 10px;
  cursor: pointer;
}

.action-centre__toggle {
  font-size: 12px;
  color: #8b95a1;
}

.action-centre__clear {
  font-size: 12px;
  color: #8b95a1;
  text-decoration: underline;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
}

.action-centre__day {
  border-left: 2px solid #d4a017;
  padding-left: 10px;
  margin: 18px 0 8px;
  transition: opacity 240ms ease;
}

.action-centre__day-title {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8b95a1;
  margin-bottom: 8px;
}

.action-centre__card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  background: #13161e;
  border: 1px solid #232838;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: filter 120ms ease, opacity 200ms ease, max-height 300ms ease, margin 300ms ease, padding 300ms ease;
  max-height: 260px;
  overflow: hidden;
}

.action-centre__card:hover {
  filter: brightness(1.06);
}

.action-centre__card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 10px 0 0 10px;
  background: #4a9eff;
}

.action-centre__card[data-urgency='urgent']::before { background: #ef4444; }
.action-centre__card[data-urgency='normal']::before { background: #4a9eff; }
.action-centre__card[data-urgency='low']::before { background: #6b7280; }

.action-centre__meta-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.action-centre__subject { font-weight: 600; color: #e8ecf4; margin-top: 3px; }
.action-centre__summary { font-style: italic; color: #f0f2f8; margin-top: 5px; }
.action-centre__sender-email { font-size: 11px; color: #8b95a1; }

.action-centre__pill {
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 700;
}
.action-centre__pill--reply_needed { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.action-centre__pill--action { background: rgba(74, 158, 255, 0.2); color: #93c5fd; }
.action-centre__pill--deadline { background: rgba(251, 146, 60, 0.2); color: #fdba74; }
.action-centre__pill--waiting { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }
.action-centre__pill--fyi { background: rgba(107, 114, 128, 0.25); color: #d1d5db; }

.action-centre__right { text-align: right; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.action-centre__account { font-size: 10px; font-weight: 700; border-radius: 999px; padding: 2px 8px; }
.action-centre__account--gmail { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.action-centre__account--outlook { background: rgba(74, 158, 255, 0.18); color: #93c5fd; }
.action-centre__time { font-size: 11px; color: #8b95a1; margin-top: 4px; }

.action-centre__card.is-completed {
  opacity: 0.4;
}
.action-centre__card.is-completed .action-centre__subject,
.action-centre__card.is-completed .action-centre__summary {
  text-decoration: line-through;
}
.action-centre__card.is-removing {
  opacity: 0;
  max-height: 0;
  margin: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

.action-centre__loading,
.action-centre__empty {
  color: #8b95a1;
  font-size: 13px;
  padding: 12px 2px;
}

.action-centre__spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid #4f7fff;
  border-top-color: transparent;
  animation: actionSpin 0.8s linear infinite;
  margin-right: 8px;
  vertical-align: -2px;
}

@keyframes actionSpin {
  to { transform: rotate(360deg); }
}

.email-item--actioned {
  border-left: 3px solid #22c55e;
}

.email-item__actioned-tag {
  margin-top: 2px;
  font-size: 10px;
  color: #9ca3af;
}
