:root {
  color-scheme: light;
  --ink: #0d1117;
  --ink-soft: #1e293b;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --canvas: #f1f5f9;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --field: #ffffff;
  --rail: #0f172a;
  --rail-soft: #1e293b;
  --nav: #f4f6f9;
  --accent: #e94f4f;
  --accent-dark: #cf3c3c;
  --blue: #2563eb;
  --blue-soft: #eff6ff;
  --green: #16a34a;
  --green-soft: #f0fdf4;
  --amber: #d97706;
  --amber-soft: #fffbeb;
  --red-soft: #fff1f2;
  --official: #0f172a;
  --official-soft: #1e293b;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-sm: 0 2px 6px rgba(15, 23, 42, 0.08);
  --shadow-md: 0 8px 20px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 16px 40px rgba(15, 23, 42, 0.14);
  --shadow-xl: 0 28px 64px rgba(15, 23, 42, 0.20);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
}

a,
button,
input,
textarea,
.message-row,
.status-tile,
.compose-panel,
.auth-panel,
.visual-mail-card {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    color 160ms ease,
    opacity 160ms ease,
    transform 160ms ease;
}

button:active,
.message-row:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.message-row:focus-visible {
  outline: 2.5px solid rgba(37, 99, 235, 0.5);
  outline-offset: 2px;
  border-radius: 4px;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
}

/* ── Loading ── */
.loading-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-content: center;
  gap: 28px;
  padding: 28px;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
}

.loading-brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.loading-brand img {
  width: 78px;
  height: 44px;
  object-fit: contain;
  filter: brightness(1.2);
}

.loading-brand strong,
.loading-brand span {
  display: block;
}

.loading-brand strong {
  font-size: 26px;
  font-weight: 850;
  letter-spacing: 0;
  color: #fff;
}

.loading-brand span {
  color: rgba(255,255,255,0.55);
  overflow-wrap: anywhere;
  font-size: 13px;
  margin-top: 3px;
}

.loading-line {
  width: 280px;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
  position: relative;
}

.loading-line::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  animation: load-slide 1.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

@keyframes load-slide {
  0% { transform: translateX(-130%); }
  100% { transform: translateX(280%); }
}

/* ── Auth ── */
.auth-view {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(320px, 560px) minmax(320px, 420px);
  align-items: center;
  justify-content: center;
  gap: 60px;
  padding: 48px;
  background:
    linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.auth-view:not(.hidden),
.mail-view:not(.hidden) {
  animation: view-enter 240ms ease both;
}

@keyframes view-enter {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.auth-intro {
  display: grid;
  gap: 28px;
}

.auth-brand,
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  width: 70px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
  box-shadow: var(--shadow-sm);
  flex: 0 0 auto;
}

.brand-mark img {
  width: 88%;
  height: 78%;
  object-fit: contain;
  filter: brightness(1.3);
}

.brand-mark.small {
  width: 44px;
  height: 30px;
}

.brand-name {
  min-width: 0;
  font-weight: 850;
  font-size: 24px;
  letter-spacing: 0;
  line-height: 1.05;
  color: #fff;
}

.brand-domain {
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  overflow-wrap: anywhere;
  margin-top: 2px;
}

.auth-visual {
  display: grid;
  gap: 8px;
  width: min(100%, 520px);
  padding: 18px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  box-shadow: 0 20px 48px rgba(0,0,0,0.32);
  backdrop-filter: blur(8px);
}

.visual-topline,
.visual-mail-card,
.visual-metrics {
  display: grid;
  align-items: center;
}

.visual-topline {
  grid-template-columns: 1fr auto;
  min-height: 38px;
  padding: 0 6px;
  color: rgba(255,255,255,0.5);
}

.visual-topline strong {
  color: #60a5fa;
  font-size: 24px;
  font-weight: 850;
}

.visual-mail-card {
  grid-template-columns: 38px 1fr 64px;
  gap: 12px;
  min-height: 70px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
}

.visual-mail-card.active {
  border-left: 3px solid #2563eb;
  background: rgba(37,99,235,0.1);
}

.visual-mail-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.visual-avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: rgba(255,255,255,0.15);
  font-weight: 850;
  font-size: 15px;
}

.visual-avatar.blue {
  background: #2563eb;
}

.visual-lines {
  display: grid;
  gap: 9px;
}

.visual-lines span {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
}

.visual-lines span:last-child {
  width: 72%;
}

.visual-pill {
  display: grid;
  place-items: center;
  min-height: 28px;
  border-radius: 999px;
  color: #f87171;
  background: rgba(239,68,68,0.15);
  font-size: 12px;
  font-weight: 850;
  border: 1px solid rgba(239,68,68,0.2);
}

.visual-pill.gold {
  color: #fbbf24;
  background: rgba(251,191,36,0.12);
  border-color: rgba(251,191,36,0.2);
}

.visual-metrics {
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.visual-metrics div {
  min-height: 64px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.04);
}

.visual-metrics strong,
.visual-metrics span {
  overflow-wrap: anywhere;
}

.visual-metrics strong {
  color: #fff;
  font-size: 18px;
  font-weight: 850;
}

.visual-metrics span {
  color: rgba(255,255,255,0.45);
  font-size: 11px;
}

.auth-panel {
  display: grid;
  gap: 18px;
  width: min(100%, 420px);
  padding: 30px;
  border: 1px solid rgba(255,255,255,0.12);
  border-top: 3px solid #2563eb;
  border-radius: 12px;
  background: rgba(255,255,255,0.97);
  box-shadow: 0 24px 60px rgba(0,0,0,0.36);
}

.auth-panel:hover {
  box-shadow: 0 28px 72px rgba(0,0,0,0.42);
}

.auth-panel h1,
.title-block h1,
.compose-header h2,
.empty-reader h2,
.message-reader h1 {
  margin: 0;
  letter-spacing: 0;
}

.auth-panel h1 {
  font-size: 28px;
  font-weight: 850;
  color: var(--ink);
  line-height: 1.1;
}

.auth-panel p,
.title-block p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input,
textarea,
select {
  width: 100%;
  border: 1.5px solid var(--line);
  border-radius: 7px;
  background: var(--field);
  color: var(--ink);
  outline: none;
  padding: 10px 13px;
  font-weight: 500;
}

textarea {
  resize: vertical;
  line-height: 1.52;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.auth-panel button[type="submit"],
.compose-primary,
.compose-actions button {
  min-height: 42px;
  border-radius: 7px;
  background: #2563eb;
  color: #fff;
  font-weight: 850;
  letter-spacing: 0.01em;
}

.auth-panel button[type="submit"]:hover,
.compose-primary:hover,
.compose-actions button:hover {
  background: #1d4ed8;
  box-shadow: 0 6px 18px rgba(37,99,235,0.32);
}

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.button-icon svg,
.folder-icon svg,
.suite-icon svg,
.icon-button svg,
.right-rail svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.folder-icon svg {
  width: 16px;
  height: 16px;
}

.suite-icon svg,
.icon-button svg,
.right-rail svg {
  width: 18px;
  height: 18px;
}

.link-button,
.ghost-button {
  color: var(--blue);
  background: transparent;
  font-weight: 800;
}

.form-message {
  min-height: 19px;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.form-message.error {
  color: var(--accent-dark);
}

.form-message.success {
  color: var(--green);
}

/* ── Mail layout ── */
.mail-view {
  height: 100vh;
  height: 100dvh;
  min-height: 100vh;
  min-height: 100dvh;
  min-width: 0;
  display: grid;
  grid-template-columns: 64px 292px minmax(0, 1fr);
  background: var(--canvas);
}

/* ── Suite rail ── */
.suite-rail {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 58px repeat(4, 68px) 1fr auto;
  gap: 6px;
  padding: 9px 7px;
  border-right: 1px solid rgba(0,0,0,0.3);
  background: linear-gradient(180deg, #0a1120 0%, #0f172a 40%, #111827 100%);
}

.suite-logo {
  display: grid;
  place-items: center;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
}

.suite-logo img {
  width: 36px;
  height: 28px;
  object-fit: contain;
  filter: brightness(1.15);
}

.suite-button {
  min-width: 0;
  min-height: 62px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: rgba(255, 255, 255, 0.5);
  background: transparent;
  position: relative;
}

.suite-button:hover {
  color: rgba(255,255,255,0.9);
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.07);
}

.suite-button.active {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.09);
}

.suite-button.active::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 0 999px 999px 0;
  background: #2563eb;
  box-shadow: 0 0 8px rgba(37,99,235,0.7);
}

/* Badge on suite-button */
.suite-button[data-badge]:not([data-badge=""])::after {
  content: attr(data-badge);
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 850;
  line-height: 17px;
  text-align: center;
  border: 1.5px solid #0f172a;
}

.suite-icon {
  width: 30px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: rgba(255,255,255,0.8);
  background: rgba(255, 255, 255, 0.09);
  font-size: 11px;
  font-weight: 850;
}

.suite-button.active .suite-icon {
  background: rgba(37,99,235,0.35);
  color: #93c5fd;
}

.suite-copy {
  min-width: 0;
  display: grid;
  justify-items: center;
  gap: 1px;
  line-height: 1.05;
}

.suite-copy strong,
.suite-copy small {
  min-width: 0;
  max-width: 54px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: 0;
}

.suite-copy strong {
  color: inherit;
  font-size: 10px;
  font-weight: 850;
}

.suite-copy small {
  color: rgba(255, 255, 255, 0.36);
  font-size: 9px;
  font-weight: 700;
}

.suite-button.active .suite-copy small,
.suite-button:hover .suite-copy small {
  color: rgba(255, 255, 255, 0.6);
}

.suite-status {
  min-width: 0;
  display: grid;
  justify-items: center;
  align-content: center;
  padding: 10px 0 5px;
}

.suite-status span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.2);
}

/* ── Sidebar ── */
.sidebar {
  min-width: 0;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(0, 1fr) auto auto auto;
  gap: 10px;
  padding: 13px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0, #f8fafc 90px, var(--nav) 240px);
}

.sidebar-brand {
  min-height: 72px;
  align-items: start;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, #fff 0%, #f0f6ff 100%);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.9);
}

.sidebar-kicker {
  margin-bottom: 5px;
  color: #2563eb;
  font-size: 9.5px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-brand .brand-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--official);
  font-size: 18px;
}

.sidebar-brand .brand-domain {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11.5px;
  color: var(--muted);
}

.security-strip {
  min-width: 0;
  min-height: 46px;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border: 1px solid rgba(22, 163, 74, 0.18);
  border-radius: 8px;
  background: linear-gradient(135deg, #f0fdf4, #dcfce7);
}

.security-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.security-strip strong,
.security-strip span {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.security-strip strong {
  color: #14532d;
  font-size: 11.5px;
  font-weight: 850;
}

.security-strip span {
  color: var(--green);
  font-size: 10.5px;
  font-weight: 800;
  text-transform: capitalize;
}

.compose-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff;
  font-weight: 850;
  font-size: 13.5px;
  border: 1px solid rgba(37,99,235,0.3);
  box-shadow: 0 4px 14px rgba(37,99,235,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.compose-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(37,99,235,0.4), inset 0 1px 0 rgba(255,255,255,0.15);
  background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

.sidebar-section {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 4px 0;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-section strong {
  min-width: 26px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 10.5px;
}

.folder-list,
.sidebar-extras {
  display: grid;
  align-content: start;
  gap: 2px;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.folder-button {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}

.folder-copy,
.folder-label,
.folder-button small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.folder-copy {
  display: grid;
  gap: 1px;
}

.folder-label {
  color: inherit;
}

.folder-button small {
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
}

.folder-button.active {
  color: var(--ink);
  border-color: var(--line);
  background: #fff;
  box-shadow:
    inset 3px 0 0 #2563eb,
    var(--shadow-xs);
  padding-left: 10px;
}

.folder-button:hover {
  border-color: var(--line);
  background: rgba(255,255,255,0.7);
  color: var(--ink-soft);
  transform: translateX(2px);
}

.folder-button.static {
  color: var(--muted);
}

.folder-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  background: var(--line);
  font-size: 10px;
  font-weight: 900;
  flex: 0 0 auto;
}

.folder-button.active .folder-icon {
  color: #fff;
  background: #2563eb;
}

.folder-count {
  min-width: 24px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 10.5px;
  border: 1px solid var(--line);
  font-weight: 850;
}

.folder-button.active .folder-count {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: rgba(37,99,235,0.18);
}

.mailbox-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.mailbox-summary div,
.insight-card {
  min-width: 0;
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 62px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mailbox-summary div {
  background: linear-gradient(180deg, #fff, #f8fafc);
  box-shadow: var(--shadow-xs);
}

.mailbox-summary span,
.insight-card span,
.delivery-panel span,
.sync-status,
.eyebrow,
.list-toolbar span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.mailbox-summary strong,
.insight-card strong,
.delivery-panel strong {
  color: var(--official);
  font-size: 20px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.mailbox-health {
  display: grid;
  gap: 6px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.mailbox-health div {
  min-width: 0;
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.mailbox-health div > span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--green);
}

.mailbox-health strong,
.mailbox-health em {
  min-width: 0;
  display: block;
  grid-column: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mailbox-health strong {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
}

.mailbox-health em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 650;
}

.sidebar-footer {
  display: grid;
  gap: 8px;
}

.sidebar-footer .ghost-button {
  justify-content: flex-start;
  min-height: 40px;
  color: var(--official);
}

.signout-button {
  border-color: rgba(207, 60, 60, 0.18);
  color: var(--accent-dark);
  background: #fff;
}

.signout-button:hover {
  border-color: rgba(207, 60, 60, 0.32);
  background: var(--red-soft);
  color: var(--accent-dark);
}

.signout-button .button-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  color: var(--accent-dark);
  background: var(--red-soft);
}

.ghost-button {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font-weight: 760;
}

.ghost-button:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  color: var(--ink);
}

.ghost-button.danger {
  color: var(--accent-dark);
}

/* ── Workspace ── */
.workspace {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 58px auto minmax(0, 1fr);
  background: var(--panel);
}

.app-header {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff, #fafbfd);
  position: relative;
}

.title-block {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.eyebrow {
  display: block;
  text-transform: none;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-block h1 {
  min-width: 0;
  max-width: 100%;
  font-size: 20px;
  line-height: 1.06;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.title-block p {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.search-box {
  position: relative;
}

.search-box span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.search-box input {
  min-height: 36px;
  border-radius: 7px;
  padding-left: 38px;
  border-color: var(--line-strong);
  background:
    linear-gradient(90deg, transparent 33px, #fff 33px),
    radial-gradient(circle at 17px 50%, transparent 0 5px, var(--faint) 5px 6px, transparent 6px),
    #fff;
}

.search-box input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.sync-status {
  min-width: 92px;
  text-align: right;
}

.sync-status.syncing {
  color: var(--blue);
}

.sync-status.syncing::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-left: 6px;
  border-radius: 999px;
  background: currentColor;
  animation: pulse-dot 860ms ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.25; transform: scale(0.82); }
  50%       { opacity: 1;    transform: scale(1); }
}

.icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font-weight: 850;
  font-size: 14px;
}

.icon-button:hover,
.icon-button.active {
  border-color: rgba(37, 99, 235, 0.38);
  color: var(--blue);
  background: var(--blue-soft);
}

/* ── Dashboard strip ── */
.dashboard-strip {
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) minmax(210px, 1.3fr) minmax(130px, 1fr);
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.status-tile {
  min-width: 0;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 8px;
  align-items: end;
  min-height: 64px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.status-tile::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 10px 10px 0 0;
}

.status-tile:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}

.status-tile span,
.status-tile small {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-tile strong {
  min-width: 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 850;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-tile small {
  grid-column: 1 / -1;
  font-weight: 650;
}

.status-tile.wide strong {
  font-size: 14px;
}

/* ── Suite grid (mail list + reader) ── */
.suite-grid {
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(460px, 1fr) 48px;
  background: #fff;
}

.message-list-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: 46px 1fr;
  border-right: 1px solid var(--line);
  background: #fff;
}

.list-toolbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.list-toolbar div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.list-toolbar strong {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
}

.filter-chips {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
}

.filter-chips button,
.segmented-control button,
.card-actions button {
  min-height: 26px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  font-weight: 850;
}

.filter-chips button:hover,
.filter-chips button.active,
.segmented-control button:hover,
.segmented-control button.active,
.card-actions button:hover {
  color: var(--blue);
  border-color: rgba(37, 99, 235, 0.34);
  background: var(--blue-soft);
}

.message-list {
  min-height: 0;
  overflow: auto;
}

.list-empty {
  min-height: 220px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--faint);
  text-align: center;
  padding: 24px;
}

.list-empty {
  animation: view-enter 180ms ease both;
}

.list-empty strong {
  color: var(--muted);
  font-size: 15px;
  font-weight: 850;
}

.list-empty span {
  font-size: 13px;
  color: var(--faint);
}

/* ── Message rows ── */
.message-row {
  width: 100%;
  min-width: 0;
  min-height: 64px;
  display: grid;
  grid-template-columns: 30px 36px minmax(0, 1fr);
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  text-align: left;
  position: relative;
}

.message-row::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: transparent;
  transition: background 160ms ease;
}

.message-row:hover,
.message-row.active {
  background: #f5f9ff;
}

.message-row:hover {
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.08);
}

.message-row.active::before {
  background: var(--blue);
}

.message-row.unread {
  background: #fafcff;
}

.message-row.unread::before {
  background: #2563eb;
  opacity: 0.4;
}

.message-row.unread .message-subject,
.message-row.unread .message-sender {
  color: var(--ink);
  font-weight: 850;
}

.message-row.active.unread::before {
  opacity: 1;
}

/* Avatar in message rows */
.message-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  align-self: center;
  color: #fff;
  font-size: 13px;
  font-weight: 850;
  flex: 0 0 auto;
  letter-spacing: 0;
  user-select: none;
}

.message-star {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  align-self: start;
  border-radius: 6px;
  color: var(--faint);
  background: transparent;
  font-size: 17px;
}

.message-star:hover,
.message-star.active {
  color: var(--amber);
  background: var(--amber-soft);
  transform: scale(1.06);
}

.message-content {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.message-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.message-sender,
.message-subject,
.message-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.message-sender {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}

.message-subject {
  font-size: 13px;
  color: var(--muted);
}

.message-date,
.message-preview {
  color: var(--faint);
  font-size: 12px;
}

.message-subject-line {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.message-subject-line .message-subject {
  flex: 1;
  min-width: 0;
}

.status-chip {
  display: inline-grid;
  place-items: center;
  min-width: 54px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 10px;
  font-weight: 850;
  flex: 0 0 auto;
  text-transform: capitalize;
}

.status-chip.failed {
  color: var(--accent-dark);
  background: var(--red-soft);
}

.status-chip.delivered {
  color: var(--green);
  background: var(--green-soft);
}

.status-chip.subtle {
  color: var(--muted);
  background: #f1f5f9;
}

.status-chip.high {
  color: var(--accent-dark);
  background: var(--red-soft);
}

.status-chip.low {
  color: var(--green);
  background: var(--green-soft);
}

.important-dot {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-dark);
  background: var(--red-soft);
  font-size: 11px;
  font-weight: 950;
  flex: 0 0 auto;
}

/* ── Reader ── */
.reader-panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: #fff;
}

.empty-reader {
  min-height: 100%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 14px;
  padding: 40px 28px;
  text-align: center;
  color: var(--faint);
}

.empty-mark {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 13px;
  font-weight: 850;
  border: 1px solid rgba(37, 99, 235, 0.14);
  box-shadow: var(--shadow-sm);
}

.empty-reader h2 {
  font-size: 18px;
  color: var(--muted);
  font-weight: 850;
}

.message-reader {
  padding: 20px 28px 32px;
}

.reader-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 0 14px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}
.reader-actions::-webkit-scrollbar { display: none; }

.reader-btn-group {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.reader-btn-group + .reader-btn-group {
  margin-left: 2px;
  padding-left: 10px;
  position: relative;
}

.reader-btn-group + .reader-btn-group::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15%;
  bottom: 15%;
  width: 1px;
  background: var(--line-strong);
  border-radius: 999px;
}

.reader-btn-group--star {
  margin-left: auto;
  padding-left: 10px;
}

.reader-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 100ms ease, border-color 100ms ease, color 100ms ease, box-shadow 100ms ease, transform 90ms ease;
}

.reader-btn svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.reader-btn:hover {
  background: var(--canvas);
  border-color: var(--line-strong);
  color: var(--ink-soft);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(0,0,0,0.07);
}

.reader-btn:active {
  transform: scale(0.95) translateY(0);
  box-shadow: none;
  transition-duration: 50ms;
}

.reader-btn-primary {
  color: var(--blue);
  background: rgba(37, 99, 235, 0.07);
  border-color: rgba(37, 99, 235, 0.2);
}

.reader-btn-primary:hover {
  color: var(--blue);
  background: rgba(37, 99, 235, 0.13);
  border-color: rgba(37, 99, 235, 0.45);
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.16);
}

.reader-btn-danger {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.reader-btn-danger:hover {
  color: var(--accent-dark);
  background: rgba(207, 60, 60, 0.07);
  border-color: rgba(207, 60, 60, 0.22);
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(207, 60, 60, 0.1);
}

.reader-btn-group--star .icon-button {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  font-size: 15px;
  transition: background 100ms ease, color 100ms ease, border-color 100ms ease, transform 90ms ease;
}

.reader-btn-group--star #reader-star-button:hover,
.reader-btn-group--star #reader-star-button.active {
  background: var(--amber-soft);
  border-color: rgba(217, 119, 6, 0.35);
  color: var(--amber);
  transform: scale(1.12);
}

.reader-btn-group--star #reader-important-button:hover,
.reader-btn-group--star #reader-important-button.active {
  background: var(--red-soft);
  border-color: rgba(207, 60, 60, 0.3);
  color: var(--accent-dark);
  transform: scale(1.12);
}

.message-reader h1 {
  margin-bottom: 16px;
  font-size: 22px;
  font-weight: 850;
  line-height: 1.25;
  overflow-wrap: anywhere;
  color: var(--ink);
}

.reader-meta,
.reader-recipients {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  color: var(--muted);
  font-size: 13px;
}

.reader-details,
.reader-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.reader-details span,
.attachment-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 760;
}

.attachment-pill:hover {
  color: var(--blue);
  border-color: rgba(37, 99, 235, 0.34);
  background: var(--blue-soft);
}

.attachment-pill small {
  color: inherit;
  opacity: 0.74;
}

.reader-body {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
  color: var(--ink-soft);
}

/* ── Right rail ── */
.insights-panel {
  display: none;
}

.right-rail {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 10px 5px;
  border-left: 1px solid var(--line);
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
}

.right-rail button {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 850;
  box-shadow: var(--shadow-xs);
}

.right-rail button span {
  width: 26px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--panel-soft);
}

.right-rail button:hover {
  color: var(--official);
  border-color: var(--line-strong);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.right-rail button.active {
  color: #fff;
  background: var(--official-soft);
  border-color: rgba(15, 23, 42, 0.4);
}

.right-rail button.active span {
  background: rgba(255, 255, 255, 0.14);
}

/* ── Module panels ── */
.module-panel {
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: linear-gradient(180deg, #f8fafc, #f1f5f9);
}

.module-panel:not(.hidden) {
  animation: view-enter 200ms ease both;
}

.module-shell {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.module-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 88px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid #2563eb;
  border-radius: 10px;
  background: linear-gradient(135deg, #fff 0%, #f0f6ff 100%);
  box-shadow: var(--shadow-sm);
}

.module-heading h2,
.module-heading p,
.admin-columns h3 {
  margin: 0;
  letter-spacing: 0;
}

.module-heading h2 {
  color: var(--ink);
  font-size: 22px;
  font-weight: 850;
}

.module-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.module-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.module-metric {
  min-width: 0;
  min-height: 90px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.module-metric::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #2563eb, #7c3aed);
  border-radius: 10px 10px 0 0;
}

.module-metric span,
.module-metric small {
  min-width: 0;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 780;
}

.module-metric strong {
  min-width: 0;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 28px;
  font-weight: 850;
  line-height: 1;
}

.module-metric small {
  font-size: 11px;
  font-weight: 650;
}

.module-toolbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow-xs);
}

.toolbar-actions {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
}

.soft-badge,
.mini-tags span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-soft);
  font-size: 11px;
  font-weight: 800;
}

.mini-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.mini-tags span {
  min-height: 22px;
  padding: 0 7px;
  color: var(--blue);
  background: var(--blue-soft);
}

.module-search {
  width: min(100%, 360px);
}

.module-search span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.module-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow-xs);
}

.module-form.compact {
  grid-template-columns: 1fr;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.module-form.expanded {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: end;
}

.module-form.expanded textarea,
.module-form.expanded .check-row {
  grid-column: span 2;
}

.module-form.expanded button[type="submit"] {
  align-self: end;
}

.check-row {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 800;
}

.check-row input {
  width: 17px;
  min-height: 17px;
  padding: 0;
}

input[type="color"] {
  min-height: 38px;
  padding: 4px;
}

.module-form button {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 7px;
  color: #fff;
  background: #2563eb;
  font-weight: 850;
}

.module-form button:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,0.3);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.module-card,
.timeline-item,
.data-list div,
.admin-stats div,
.attachment-row {
  transition:
    background-color 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.module-card {
  min-width: 0;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-xs);
}

.module-card:hover,
.timeline-item:hover,
.data-list div:hover,
.attachment-row:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.avatar-token,
.attachment-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: #2563eb;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.attachment-icon {
  background: var(--canvas);
  color: var(--muted);
  border: 1px solid var(--line);
}

.module-card strong,
.module-card span,
.module-card small,
.timeline-item strong,
.timeline-item small,
.data-list strong,
.data-list span,
.attachment-row strong,
.attachment-row small {
  min-width: 0;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.module-card span,
.module-card small,
.timeline-item span,
.timeline-item small,
.data-list span,
.attachment-row small,
.attachment-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

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

.card-actions button {
  min-height: 26px;
  padding: 0 8px;
}

.timeline-list,
.data-list {
  display: grid;
  gap: 8px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow-xs);
}

.calendar-month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.calendar-day {
  min-height: 108px;
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.calendar-day.today {
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: inset 0 0 0 1px rgba(37, 99, 235, 0.12);
}

.calendar-day strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.calendar-day span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 6px;
  border-left: 3px solid var(--blue);
  border-radius: 5px;
  background: var(--panel-soft);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 760;
}

.calendar-week {
  display: grid;
  grid-template-columns: repeat(7, minmax(130px, 1fr));
  gap: 8px;
  overflow-x: auto;
}

.calendar-week section {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.calendar-week h3 {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.admin-stats div {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: var(--shadow-xs);
  position: relative;
  overflow: hidden;
}

.admin-stats div::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  bottom: 0;
  background: linear-gradient(180deg, #2563eb, #7c3aed);
  border-radius: 9px 0 0 9px;
}

.admin-stats span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.admin-stats strong {
  font-size: 26px;
  font-weight: 850;
  color: var(--ink);
}

.admin-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-columns section {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-xs);
}

.admin-columns h3 {
  font-size: 14px;
  font-weight: 850;
  color: var(--ink);
  margin: 0;
  letter-spacing: 0;
}

.data-list div {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.data-list div:hover {
  background: #fff;
}

.module-empty {
  padding: 36px 28px;
  border: 1.5px dashed var(--line-strong);
  border-radius: 10px;
  color: var(--faint);
  background: #fff;
  text-align: center;
  font-size: 14px;
}

.module-empty.compact {
  min-height: 54px;
  display: grid;
  place-items: center;
  padding: 10px;
  font-size: 12px;
}

.attachment-row {
  min-width: 0;
  min-height: 62px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}

/* ── Compose ── */
.compose-modal {
  position: fixed;
  inset: 0;
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(10, 17, 32, 0.5);
  backdrop-filter: blur(12px);
  z-index: 20;
}

.compose-modal:not(.hidden) {
  animation: composer-backdrop-enter 200ms ease both;
}

@keyframes composer-backdrop-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.compose-panel {
  width: min(760px, 100%);
  max-height: min(760px, calc(100vh - 56px));
  max-height: min(760px, calc(100dvh - 56px));
  display: grid;
  gap: 11px;
  padding: 0 18px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-xl);
  overflow: auto;
  animation: composer-panel-enter 240ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes composer-panel-enter {
  from { opacity: 0; transform: translateY(18px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.compose-header {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0 -18px 4px;
  padding: 0 14px 0 18px;
  border-radius: 12px 12px 0 0;
  background: var(--rail);
  color: #fff;
}

.compose-header h2 {
  font-size: 14px;
  font-weight: 850;
}

.compose-header .icon-button {
  width: 30px;
  height: 30px;
  border-color: rgba(255, 255, 255, 0.14);
  background: transparent;
  color: rgba(255,255,255,0.8);
}

.compose-header .icon-button:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.22);
  color: #fff;
}

.compose-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(120px, 160px);
  gap: 10px;
}

.compose-tools {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}

.compose-tools .ghost-button {
  min-height: 38px;
}

.compose-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.compose-actions button {
  min-width: 110px;
}

/* ── Toast ── */
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 16px;
  border: 1px solid rgba(15,23,42,0.12);
  border-radius: 9px;
  background: #0f172a;
  color: rgba(255,255,255,0.92);
  box-shadow: var(--shadow-xl);
  z-index: 30;
  font-weight: 800;
  font-size: 13.5px;
}

.toast:not(.hidden) {
  animation: toast-enter 200ms ease both;
}

@keyframes toast-enter {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ── */
@media (max-width: 1240px) {
  .suite-grid {
    grid-template-columns: minmax(340px, 410px) minmax(420px, 1fr) 46px;
  }

  .dashboard-strip {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 1440px) {
  .mail-view {
    grid-template-columns: 66px 304px minmax(0, 1fr);
  }

  .suite-grid {
    grid-template-columns: minmax(390px, 470px) minmax(560px, 1fr) 50px;
  }

  .message-reader {
    padding: 26px 36px 38px;
  }
}

@media (max-width: 1040px) {
  .mail-view {
    grid-template-columns: 64px 264px minmax(0, 1fr);
  }

  .app-header {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 58px;
    align-items: stretch;
    gap: 10px;
  }

  .header-actions {
    justify-content: space-between;
  }

  .suite-grid {
    grid-template-columns: minmax(320px, 380px) minmax(360px, 1fr);
  }

  .right-rail {
    display: none;
  }

  .dashboard-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-form.expanded textarea,
  .module-form.expanded .check-row {
    grid-column: 1 / -1;
  }

  .module-form button {
    grid-column: 1 / -1;
  }

  .admin-stats,
  .admin-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 960px) {
  .auth-view {
    grid-template-columns: minmax(0, 430px);
    background: linear-gradient(135deg, #0f172a, #1e293b);
  }

  .auth-intro {
    justify-items: start;
  }

  .auth-visual {
    display: none;
  }
}

@media (max-width: 860px) {
  .auth-view {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .auth-visual {
    display: none;
  }

  .mail-view {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: 1fr;
  }

  .suite-rail {
    position: sticky;
    top: 0;
    z-index: 8;
    grid-template-columns: 44px repeat(4, minmax(70px, 1fr)) 44px;
    grid-template-rows: none;
    padding: 7px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .suite-logo {
    border-bottom: 0;
  }

  .suite-button {
    min-height: 48px;
  }

  .suite-button.active::before {
    left: 10px;
    right: 10px;
    top: auto;
    bottom: -7px;
    width: auto;
    height: 3px;
  }

  .suite-copy small,
  .suite-status strong {
    display: none;
  }

  .suite-status {
    align-content: center;
    padding: 0;
  }

  .sidebar {
    position: sticky;
    top: 62px;
    z-index: 7;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    gap: 10px;
    padding: 12px;
  }

  .sidebar-brand {
    min-width: 0;
    min-height: 62px;
  }

  .sidebar-brand .brand-domain {
    max-width: calc(100vw - 188px);
  }

  .app-header {
    grid-template-columns: minmax(0, 1fr);
  }

  .title-block {
    min-height: 0;
  }

  .compose-primary {
    min-width: 126px;
  }

  .security-strip,
  .sidebar-extras,
  .mailbox-summary,
  .mailbox-health,
  .sidebar-footer {
    display: none;
  }

  .sidebar-section {
    grid-column: 1 / -1;
  }

  .folder-list {
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    overflow: visible;
  }

  .folder-count,
  .folder-button small {
    display: none;
  }

  .suite-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .message-list-panel,
  .reader-panel {
    border-right: 0;
  }

  .message-list {
    max-height: 50vh;
    max-height: 50dvh;
  }

  .calendar-month {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .module-shell {
    padding: 12px;
  }
}

@media (max-width: 640px) {
  .loading-view,
  .auth-view {
    padding: 20px;
  }

  .auth-panel {
    padding: 24px;
  }

  .brand-name {
    font-size: 20px;
  }

  .sidebar {
    top: 62px;
    grid-template-columns: 1fr;
  }

  .sidebar-brand .brand-domain {
    max-width: calc(100vw - 92px);
  }

  .sidebar-brand {
    min-height: 56px;
  }

  .compose-primary {
    width: 100%;
  }

  .folder-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-header {
    padding: 12px;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .sync-status {
    width: 100%;
    min-width: 0;
    text-align: left;
  }

  .dashboard-strip {
    grid-template-columns: 1fr;
    padding: 10px 12px;
  }

  .module-form,
  .module-metrics,
  .admin-stats,
  .admin-columns {
    grid-template-columns: 1fr;
  }

  .module-toolbar,
  .compose-row,
  .compose-tools {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    justify-content: flex-start;
  }

  .module-form.expanded textarea,
  .module-form.expanded .check-row {
    grid-column: 1;
  }

  .calendar-month {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-heading {
    padding: 14px;
  }

  .title-block h1 {
    font-size: 22px;
  }

  .message-reader {
    padding: 18px 14px 26px;
  }

  .message-reader h1 {
    font-size: 20px;
  }

  .reader-actions {
    justify-content: flex-start;
  }

  .compose-modal {
    inset: 0;
    width: 100%;
    padding: 14px;
  }

  .compose-panel {
    max-height: calc(100vh - 28px);
    max-height: calc(100dvh - 28px);
  }
}

@media (max-width: 480px) {
  .loading-brand,
  .auth-brand {
    align-items: flex-start;
  }

  .loading-brand img {
    width: 64px;
    height: 38px;
  }

  .auth-view {
    padding: 16px;
    align-content: center;
  }

  .auth-panel {
    padding: 20px;
  }

  .auth-panel h1 {
    font-size: 24px;
  }

  .mail-view {
    display: block;
  }

  .suite-rail {
    grid-template-columns: 42px repeat(4, 62px) 38px;
  }

  .suite-button {
    min-height: 46px;
  }

  .suite-copy strong {
    font-size: 9px;
  }

  .sidebar {
    position: static;
  }

  .sidebar-brand .brand-domain {
    max-width: calc(100vw - 86px);
  }

  .sidebar-brand {
    padding: 10px;
  }

  .folder-list {
    grid-template-columns: 1fr 1fr;
  }

  .folder-button {
    min-height: 44px;
    grid-template-columns: 30px minmax(0, 1fr);
  }

  .folder-icon {
    width: 26px;
    height: 26px;
  }

  .workspace {
    display: block;
  }

  .app-header {
    display: grid;
    gap: 11px;
  }

  .search-box input {
    min-height: 40px;
  }

  .dashboard-strip {
    gap: 8px;
  }

  .status-tile {
    min-height: 56px;
  }

  .list-toolbar {
    min-height: 44px;
    align-items: flex-start;
    padding: 9px 10px;
  }

  .timeline-item,
  .attachment-row {
    grid-template-columns: 1fr;
  }

  .list-toolbar div {
    display: grid;
    gap: 2px;
  }

  .filter-chips {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .filter-chips button {
    width: 100%;
  }

  .message-row {
    min-height: 68px;
    grid-template-columns: 26px 30px minmax(0, 1fr);
    padding: 10px 10px;
  }

  .message-avatar {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }

  .message-row-top {
    align-items: flex-start;
  }

  .message-date {
    flex: 0 0 auto;
  }

  .status-chip {
    display: none;
  }

  .reader-btn {
    height: 28px;
    padding: 0 8px;
    font-size: 11.5px;
    gap: 4px;
  }

  .reader-btn svg {
    width: 12px;
    height: 12px;
  }

  .reader-btn-group + .reader-btn-group {
    padding-left: 8px;
  }

  .compose-modal {
    inset: 0;
    width: 100%;
    padding: 0;
  }

  .compose-panel {
    width: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-bottom: 0;
  }

  .compose-header {
    border-radius: 0;
  }
}

@media (max-width: 360px) {
  .auth-view,
  .loading-view {
    padding: 12px;
  }

  .brand-mark {
    width: 58px;
    height: 40px;
  }

  .brand-mark.small {
    width: 40px;
    height: 28px;
  }

  .brand-name {
    font-size: 17px;
  }

  .suite-copy,
  .suite-status {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  .suite-rail {
    grid-template-columns: 42px repeat(4, 44px);
  }

  .suite-icon {
    width: 28px;
    height: 28px;
  }

  .folder-list {
    grid-template-columns: 1fr;
  }

  .message-reader h1 {
    font-size: 19px;
  }
}

@media (max-height: 620px) and (min-width: 861px) {
  .dashboard-strip {
    display: none;
  }

  .workspace {
    grid-template-rows: 54px minmax(0, 1fr);
  }
}

@media (hover: none) and (pointer: coarse) {
  .compose-primary,
  .ghost-button,
  .icon-button,
  .folder-button,
  .suite-button,
  .right-rail button {
    min-height: 44px;
  }

  .icon-button,
  .right-rail button {
    min-width: 44px;
  }

  input,
  textarea,
  select {
    min-height: 42px;
  }
}

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

/* ─── Load more ──────────────────────────────────────────────── */

.load-more-button {
  display: block;
  width: calc(100% - 24px);
  margin: 10px 12px 12px;
  min-height: 36px;
  border: 1px dashed var(--line-strong);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.load-more-button:hover:not(:disabled) {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.load-more-button:disabled {
  opacity: 0.55;
  cursor: default;
}

/* ─── Settings button in sidebar footer ──────────────────────── */

.settings-button {
  justify-content: flex-start;
  min-height: 40px;
  color: var(--ink-soft);
  background: #fff;
  border-color: var(--line);
}

.settings-button:hover {
  border-color: var(--line-strong);
  color: var(--official);
}

.settings-button .button-icon {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--canvas);
}

.settings-button .button-icon svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Keyboard shortcuts overlay ─────────────────────────────── */

.kbd-help-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(6px);
  animation: kbd-overlay-enter 160ms ease both;
}

@keyframes kbd-overlay-enter {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.kbd-help-panel {
  width: min(480px, 100%);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: kbd-panel-enter 200ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes kbd-panel-enter {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.kbd-help-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-soft);
}

.kbd-help-header strong {
  font-size: 15px;
  color: var(--official);
}

.kbd-help-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0;
  padding: 8px 0;
  max-height: 70vh;
  overflow-y: auto;
}

.kbd-help-grid kbd {
  display: block;
  padding: 9px 16px 9px 20px;
  border-bottom: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  color: var(--official);
  background: var(--panel-soft);
  white-space: nowrap;
}

.kbd-help-grid span {
  display: block;
  padding: 9px 20px 9px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-soft);
}

/* ─── Dark mode theme ─────────────────────────────────────────── */

[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f1f5f9;
  --ink-soft: #cbd5e1;
  --muted: #94a3b8;
  --faint: #64748b;
  --line: #1e293b;
  --line-strong: #334155;
  --canvas: #0a0f1a;
  --panel: #0f172a;
  --panel-soft: #111827;
  --field: #1e293b;
  --rail: #020617;
  --rail-soft: #0f172a;
  --nav: #111827;
  --official: #e2e8f0;
  --official-soft: #cbd5e1;
  --blue-soft: #1e3a5f;
  --green-soft: #0a2e1a;
  --amber-soft: #2e1f00;
  --red-soft: #2e0f12;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-xl: 0 28px 64px rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] body {
  background: var(--canvas);
  color: var(--ink);
}

[data-theme="dark"] .loading-view,
[data-theme="dark"] .auth-view {
  background: var(--canvas);
}

[data-theme="dark"] .auth-panel,
[data-theme="dark"] .compose-panel,
[data-theme="dark"] .kbd-help-panel {
  background: var(--panel);
  border-color: var(--line-strong);
  color: var(--ink);
}

[data-theme="dark"] input,
[data-theme="dark"] textarea,
[data-theme="dark"] select {
  background: var(--field);
  color: var(--ink);
  border-color: var(--line-strong);
}

[data-theme="dark"] input::placeholder,
[data-theme="dark"] textarea::placeholder {
  color: var(--faint);
}

[data-theme="dark"] .message-row:hover {
  background: var(--panel-soft);
}

[data-theme="dark"] .message-row.active {
  background: var(--blue-soft);
  border-left-color: var(--blue);
}

[data-theme="dark"] .ghost-button {
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

[data-theme="dark"] .ghost-button:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

[data-theme="dark"] .reader-btn {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

[data-theme="dark"] .reader-btn:hover {
  background: var(--panel-soft);
  border-color: var(--line-strong);
  color: var(--ink-soft);
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

[data-theme="dark"] .reader-btn-primary {
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(96, 165, 250, 0.22);
}

[data-theme="dark"] .reader-btn-primary:hover {
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.2);
  border-color: rgba(96, 165, 250, 0.5);
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.22);
}

[data-theme="dark"] .reader-btn-danger {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

[data-theme="dark"] .reader-btn-danger:hover {
  color: #f87171;
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.25);
  box-shadow: none;
}

[data-theme="dark"] .reader-btn-group + .reader-btn-group::before {
  background: var(--line-strong);
}

[data-theme="dark"] .reader-btn-group--star .icon-button {
  border-color: var(--line);
  color: var(--muted);
}

[data-theme="dark"] .settings-button {
  background: var(--panel);
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

[data-theme="dark"] .settings-button .button-icon {
  background: var(--panel-soft);
}

[data-theme="dark"] .folder-button.active {
  background: var(--blue-soft);
  color: var(--blue);
}

[data-theme="dark"] .sidebar {
  background: var(--panel);
  border-color: var(--line);
}

[data-theme="dark"] .suite-rail {
  background: var(--rail);
}

[data-theme="dark"] .app-header {
  background: var(--panel);
  border-bottom-color: var(--line);
}

[data-theme="dark"] .module-panel {
  background: var(--canvas);
}

[data-theme="dark"] .module-metric {
  background: var(--panel);
  border-color: var(--line);
}

[data-theme="dark"] .module-card {
  background: var(--panel);
  border-color: var(--line);
}

[data-theme="dark"] .compose-header {
  background: var(--panel-soft);
  border-color: var(--line);
}

[data-theme="dark"] .load-more-button {
  background: var(--panel-soft);
  border-color: var(--line-strong);
  color: var(--muted);
}

[data-theme="dark"] .status-tile {
  background: var(--panel);
  border-color: var(--line);
}

[data-theme="dark"] .reader-panel,
[data-theme="dark"] .message-reader {
  background: var(--panel);
}

[data-theme="dark"] .reader-meta,
[data-theme="dark"] .reader-recipients,
[data-theme="dark"] .reader-details {
  color: var(--muted);
  border-color: var(--line);
}

/* ─── Theme toggle button ─────────────────────────────────────── */

.theme-toggle {
  position: relative;
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
.theme-toggle .icon-moon { display: none; }
.theme-toggle .icon-sun { display: block; }

/* ─── Bulk action toolbar ─────────────────────────────────────── */

.bulk-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--blue-soft);
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.bulk-toolbar button {
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: var(--panel);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.bulk-toolbar button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.bulk-select-all {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

#bulk-count {
  flex: 1;
  color: var(--blue);
  font-weight: 600;
}

/* ─── Bulk checkbox in message rows ──────────────────────────── */

.message-row {
  position: relative;
}

.message-bulk-check {
  position: absolute;
  left: 0;
  top: 0;
  width: 36px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 2;
}

.message-row:hover .message-bulk-check,
.message-row.bulk-selected .message-bulk-check {
  opacity: 1;
}

.message-bulk-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
  cursor: pointer;
}

.message-row.bulk-selected {
  background: var(--blue-soft);
}

[data-theme="dark"] .message-row.bulk-selected {
  background: var(--blue-soft);
}

/* ─── Label chips ─────────────────────────────────────────────── */

.label-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  white-space: nowrap;
}

.label-chip button {
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: rgba(255,255,255,0.7);
  font-size: 13px;
  line-height: 1;
}

.label-chip button:hover {
  color: #fff;
}

.reader-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 10px 0 4px;
}

.reader-labels:empty {
  display: none;
}

.add-label-button {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  cursor: pointer;
}

.add-label-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.label-picker {
  position: relative;
  display: inline-block;
}

.label-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 30;
  min-width: 160px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

.label-dropdown button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 12px;
  background: none;
  border: 0;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  color: var(--ink-soft);
}

.label-dropdown button:hover {
  background: var(--panel-soft);
  color: var(--ink);
}

.label-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ─── Rich text toolbar ───────────────────────────────────────── */

.rich-text-toolbar {
  display: flex;
  gap: 2px;
  padding: 4px 6px;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 7px 7px 0 0;
  background: var(--panel-soft);
}

.rich-text-toolbar button[data-rte] {
  min-width: 28px;
  min-height: 26px;
  padding: 0 5px;
  border: 1px solid transparent;
  border-radius: 4px;
  background: none;
  color: var(--ink-soft);
  font-size: 13px;
  cursor: pointer;
}

.rich-text-toolbar button[data-rte]:hover {
  border-color: var(--line-strong);
  background: var(--panel);
  color: var(--ink);
}

.compose-body {
  min-height: 160px;
  max-height: 340px;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 0 0 7px 7px;
  background: var(--field);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  outline: none;
  cursor: text;
  transition: border-color 160ms ease;
}

.compose-body:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 2.5px rgba(37, 99, 235, 0.18);
}

.compose-body:empty:before {
  content: attr(data-placeholder);
  color: var(--faint);
  pointer-events: none;
}

[data-theme="dark"] .rich-text-toolbar {
  background: var(--panel-soft);
  border-color: var(--line-strong);
}

[data-theme="dark"] .compose-body {
  background: var(--field);
  color: var(--ink);
  border-color: var(--line-strong);
}

/* ─── Thread context in reader ────────────────────────────────── */

.reader-thread {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.reader-thread:empty {
  display: none;
}

.thread-header {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.thread-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 5px;
  cursor: pointer;
  background: var(--panel-soft);
  transition: background 120ms ease, border-color 120ms ease;
  font-size: 13px;
}

.thread-item:hover {
  background: var(--blue-soft);
  border-color: var(--blue);
}

.thread-item strong {
  flex: 1;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.thread-item small {
  color: var(--faint);
  flex-shrink: 0;
}

/* ─── HTML email iframe ───────────────────────────────────────── */

.reader-body-html {
  width: 100%;
  min-height: 200px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

/* ─── Undo send toast ─────────────────────────────────────────── */

.undo-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--rail);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: undo-toast-enter 180ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes undo-toast-enter {
  from { opacity: 0; transform: translateX(-50%) translateY(16px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.undo-toast button {
  padding: 3px 12px;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 5px;
  background: none;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.undo-toast button:hover {
  background: rgba(255,255,255,0.15);
  border-color: rgba(255,255,255,0.5);
}

/* ─── Suite rail badge fix for dark mode ─────────────────────── */

.suite-button[data-badge]:not([data-badge=""])::after {
  position: absolute;
  top: 4px;
  right: 4px;
  content: attr(data-badge);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
  pointer-events: none;
}

/* ─── TOTP / Session settings UI ─────────────────────────────── */

.totp-secret {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  letter-spacing: 0.1em;
  padding: 8px 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  color: var(--ink-soft);
  word-break: break-all;
}

.session-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  font-size: 13px;
}

.session-item > div {
  flex: 1;
  min-width: 0;
}

.session-item strong {
  display: block;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-item small {
  color: var(--muted);
}

.session-revoke {
  padding: 3px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: none;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
}

.session-revoke:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ─── Notification permission button ─────────────────────────── */

#notif-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--panel-soft);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#notif-button:hover {
  border-color: var(--blue);
  color: var(--blue);
}

[data-theme="dark"] .bulk-toolbar {
  background: var(--blue-soft);
  border-color: var(--line);
}

[data-theme="dark"] .bulk-toolbar button {
  background: var(--panel);
  border-color: var(--line-strong);
  color: var(--ink-soft);
}

[data-theme="dark"] .thread-item {
  background: var(--panel-soft);
  border-color: var(--line);
}

[data-theme="dark"] .thread-item:hover {
  background: var(--blue-soft);
}

[data-theme="dark"] .session-item {
  background: var(--panel-soft);
  border-color: var(--line);
}

[data-theme="dark"] .totp-secret {
  background: var(--panel-soft);
  border-color: var(--line-strong);
}

.kbd-help-grid kbd:last-of-type,
.kbd-help-grid span:last-of-type {
  border-bottom: 0;
}
