/* ====================================================================
   Cloudflarer — premium dashboard redesign
   ponytail: vanilla CSS, no framework. Token-driven, dark sidebar,
   light workspace, mail-style rows. Reuse everywhere via variables.
   ==================================================================== */

:root {
  color-scheme: light;
  /* ink */
  --ink: #0b1220;
  --ink-soft: #1b2435;
  --muted: #6b7689;
  --muted-2: #9aa4b6;
  --line: #e6e9f0;
  --line-soft: #eef1f6;
  --panel: #ffffff;
  --panel-2: #fafbfd;
  --soft: #f5f7fb;
  /* brand */
  --accent: #f0503a;
  --accent-dark: #c43a26;
  --accent-soft: #fdece8;
  --blue: #2f6bff;
  --blue-soft: #e8efff;
  --green: #0f9d6b;
  --green-soft: #e7f7f0;
  --amber: #d98a00;
  --amber-soft: #fdf3e0;
  --red: #e5484d;
  --red-soft: #fdecec;
  /* sidebar palette */
  --sidebar-bg: #0c1322;
  --sidebar-bg-2: #0a0f1b;
  --sidebar-line: rgba(255, 255, 255, 0.06);
  --sidebar-text: #aeb8cc;
  --sidebar-text-strong: #ffffff;
  --sidebar-active: rgba(240, 80, 58, 0.14);
  --sidebar-hover: rgba(255, 255, 255, 0.05);
  /* tokens */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgb(11 18 32 / 0.04), 0 1px 1px rgb(11 18 32 / 0.06);
  --shadow-md: 0 4px 12px rgb(11 18 32 / 0.06), 0 2px 4px rgb(11 18 32 / 0.04);
  --shadow-lg: 0 18px 40px -12px rgb(11 18 32 / 0.16), 0 4px 10px rgb(11 18 32 / 0.06);
  --ring: 0 0 0 3px rgb(47 107 255 / 0.16);
  --font: "Inter", "SF Pro Display", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --font-mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background: #eef1f7;
  font-family: var(--font);
  font-feature-settings: "cv05", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.hidden { display: none !important; }

/* ---------- Buttons ---------- */
button {
  min-height: 38px;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 0 16px;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  transition: transform 0.08s ease, background 0.12s ease, box-shadow 0.12s ease;
}
button:hover { background: var(--ink-soft); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: none; box-shadow: var(--ring); }
button:disabled { cursor: not-allowed; opacity: 0.55; }
button.primary { background: var(--accent); box-shadow: 0 2px 8px rgb(240 80 58 / 0.28); }
button.primary:hover { background: var(--accent-dark); }
button.success { background: var(--green); }
button.ghost { color: var(--ink); background: var(--soft); }
button.ghost:hover { background: var(--line-soft); }
button.outline { color: var(--ink); background: #fff; border: 1px solid var(--line); }
button.outline:hover { background: var(--soft); border-color: var(--muted-2); }
.link-button, .secondary { color: var(--ink); background: var(--soft); }
.link-button:hover, .secondary:hover { background: var(--line-soft); }

/* ---------- Inputs ---------- */
textarea, input, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  transition: border 0.12s ease, box-shadow 0.12s ease;
}
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: var(--ring);
}
textarea { resize: vertical; line-height: 1.55; }
label, .field {
  display: grid;
  gap: 7px;
  color: #3a4658;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: -0.005em;
}
.field-label { display: block; }
.chip, .combo-option strong { letter-spacing: -0.01em; }

/* ---------- Auth ---------- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(300px, 520px) minmax(300px, 400px);
  align-items: center;
  justify-content: center;
  gap: 56px;
  padding: 32px;
  background: radial-gradient(circle at 18% 12%, rgb(47 107 255 / 0.10), transparent 42%),
    radial-gradient(circle at 88% 88%, rgb(240 80 58 / 0.10), transparent 42%),
    linear-gradient(180deg, #eef1f7, #e6eaf2);
}
.brand-block .mark { margin-bottom: 22px; }
.brand-block h1 { margin: 0 0 12px; font-size: 52px; line-height: 1; letter-spacing: -0.035em; }
.brand-block p { max-width: 440px; color: var(--muted); font-size: 17px; line-height: 1.55; }
.mark {
  display: inline-grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #000));
  color: #fff;
  font-weight: 850;
  font-size: 17px;
  letter-spacing: -0.02em;
  box-shadow: 0 10px 24px -6px rgb(240 80 58 / 0.48);
}
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.auth-panel { display: grid; gap: 18px; padding: 28px; }
.message { min-height: 20px; color: var(--accent-dark); font-size: 13px; }

/* ---------- App shell ---------- */
.app-shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.drawer-backdrop, .mobile-menu, .drawer-close { display: none; }
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 14px 10px 12px;
  background: linear-gradient(180deg, var(--sidebar-bg), var(--sidebar-bg-2));
  border-right: 1px solid var(--sidebar-line);
  color: var(--sidebar-text);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}
.sidebar-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sidebar-head { flex: 0 0 auto; padding: 4px 2px 0; }
.sidebar-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: grid;
  align-content: start;
  gap: 18px;
  margin-top: 14px;
  padding: 0 2px;
}
.sidebar-foot {
  flex: 0 0 auto;
  margin-top: 10px;
  padding: 10px 2px 2px;
  border-top: 1px solid var(--sidebar-line);
}
.sidebar-brand-wrap { position: relative; display: flex; align-items: center; gap: 8px; }
.workspace-switcher-trigger {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--sidebar-text-strong);
  box-shadow: none;
  text-align: left;
  transition: background 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.workspace-switcher-trigger:hover,
.workspace-switcher-trigger[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
}
.workspace-switcher-trigger[aria-expanded="true"] {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}
.workspace-meta { min-width: 0; display: grid; gap: 1px; }
.workspace-meta strong {
  font-size: 13.5px;
  letter-spacing: -0.015em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-meta span {
  font-size: 11px;
  font-weight: 550;
  color: var(--sidebar-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-caret {
  color: var(--muted-2);
  font-size: 11px;
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.2, 1), color 0.16s ease;
}
.workspace-switcher-trigger[aria-expanded="true"] .workspace-caret,
.user-pill[aria-expanded="true"] .workspace-caret { transform: rotate(180deg); color: var(--sidebar-text); }
.workspace-avatar { width: 38px; height: 38px; font-size: 13px; box-shadow: 0 8px 18px -4px rgb(240 80 58 / 0.5); transition: transform 0.2s ease; }
.workspace-switcher-trigger[aria-expanded="true"] .workspace-avatar { transform: scale(1.03); }
.workspace-panel {
  position: fixed;
  z-index: 90;
  width: min(320px, calc(100vw - 24px));
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px) scale(0.97);
  transform-origin: top left;
  transition:
    opacity 0.18s ease,
    transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1),
    visibility 0.18s ease;
}
.workspace-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}
.workspace-panel-head {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 8px 10px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.workspace-panel-avatar {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #1f4ed8);
}
.workspace-panel-head strong { display: block; font-size: 14px; letter-spacing: -0.01em; }
.workspace-panel-head span { display: block; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.workspace-panel-label {
  margin: 10px 10px 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.workspace-panel-list { display: grid; gap: 2px; max-height: 280px; overflow-y: auto; padding: 0 4px; }
.workspace-option {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  text-align: left;
}
.workspace-option:hover { background: var(--soft); }
.workspace-option.active { background: var(--blue-soft); }
.workspace-option .wo-avatar {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--green), #0a7d57);
}
.workspace-option.is-default .wo-avatar { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.workspace-option .wo-main { min-width: 0; }
.workspace-option .wo-email { display: block; font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-option .wo-domain { display: block; font-size: 11.5px; color: var(--muted); }
.workspace-option .wo-meta { font-size: 11px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.workspace-panel-foot {
  display: grid;
  gap: 2px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}
.workspace-panel-link {
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  box-shadow: none;
}
.workspace-panel-link:hover { background: var(--soft); }
.workspace-panel-link.danger { color: var(--red); }
@media (prefers-reduced-motion: reduce) {
  .workspace-switcher-trigger,
  .workspace-caret,
  .workspace-avatar,
  .workspace-panel { transition: none; }
}
.sidebar-section { display: grid; gap: 4px; }
.sidebar-label {
  padding: 0 10px 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(174, 184, 204, 0.72);
}
nav { display: grid; align-content: start; gap: 2px; }
.nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  width: 100%;
  text-align: left;
  color: var(--sidebar-text);
  background: transparent;
  border-radius: 8px;
  padding: 0 10px;
  font-weight: 550;
  font-size: 13.5px;
  letter-spacing: -0.005em;
  box-shadow: none;
}
.nav-icon {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  color: rgba(174, 184, 204, 0.88);
}
.nav:hover { background: var(--sidebar-hover); color: var(--sidebar-text-strong); }
.nav:hover .nav-icon { color: var(--sidebar-text-strong); }
.nav.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-strong);
  font-weight: 650;
}
.nav.active .nav-icon { color: #fff; }
.nav.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 18px;
  border-radius: 2px;
  background: var(--accent);
}
.nav .count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--sidebar-text);
}
.nav.active .count { background: rgba(240, 80, 58, 0.22); color: #fff; }
.sidebar-signout {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--sidebar-text);
  font-size: 13.5px;
  font-weight: 550;
  box-shadow: none;
  text-align: left;
}
.sidebar-signout:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-strong);
}
.sidebar-signout:hover .nav-icon { color: var(--sidebar-text-strong); }

/* ---------- Workspace ---------- */
.workspace { position: relative; padding: 0; overflow: auto; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 30px 18px;
  background: rgba(238, 241, 247, 0.82);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.eyebrow {
  margin-bottom: 5px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
#view-title { margin: 0; font-size: 26px; letter-spacing: -0.025em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 7px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}
.user-pill:hover { background: var(--soft); border-color: var(--muted-2); }
.user-pill[aria-expanded="true"] { box-shadow: var(--ring); border-color: var(--blue); }
.user-pill .ua {
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 750;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #1f4ed8);
}
.view { display: none; padding: 26px 30px; }
.view.active:not(.compose-3col) { display: grid; gap: 18px; }
.view.compose-3col.active {
  display: grid;
  grid-template-rows: auto 1fr;
  grid-template-columns: 248px minmax(0, 1fr) minmax(300px, 360px);
  gap: 0;
  min-height: calc(100vh - 120px);
  padding: 20px 24px 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow-md);
}
#compose-view:not(.active),
#compose-view[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
}


/* ---------- Mailbox header ---------- */
.mailbox-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  background: linear-gradient(135deg, #fff, var(--panel-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.mailbox-header .mh-avatar {
  width: 50px;
  height: 50px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 8px 20px -6px rgb(240 80 58 / 0.45);
}
.mailbox-header.is-default .mh-avatar { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.mailbox-header h2 { font-size: 19px; letter-spacing: -0.02em; }
.mailbox-header p { color: var(--muted); font-size: 13px; }
.mailbox-header .mh-stats { display: flex; gap: 22px; margin-left: auto; align-items: center; }
.mailbox-header .mh-stats .stat { text-align: right; }
.mailbox-header .mh-stats .stat strong { display: block; font-size: 22px; letter-spacing: -0.02em; line-height: 1.1; }
.mailbox-header .mh-stats .stat span { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* ---------- Overview ---------- */
.overview-view.active { gap: 20px; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }
.metric {
  min-height: 88px;
  padding: 14px 16px;
  display: grid;
  gap: 12px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.metric-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
}
.metric-icon svg { width: 16px; height: 16px; }
.metric-icon.blue { background: var(--blue-soft); color: var(--blue); }
.metric-icon.green { background: var(--green-soft); color: var(--green); }
.metric-icon.red { background: var(--accent-soft); color: var(--accent); }
.metric-icon.amber { background: var(--amber-soft); color: var(--amber); }
.metric-body { display: grid; gap: 2px; }
.metric strong { font-size: 26px; letter-spacing: -0.03em; line-height: 1; }
.metric span { color: var(--muted); font-size: 12px; font-weight: 600; }

.overview-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.action-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: grid;
  place-items: center;
}
.action-icon svg { width: 20px; height: 20px; }
.action-icon-compose { background: var(--accent-soft); color: var(--accent); }
.action-icon-sync { background: var(--amber-soft); color: var(--amber); }
.action-body { display: grid; gap: 8px; align-content: start; }
.action-body h3 { margin: 0; font-size: 16px; letter-spacing: -0.015em; }
.action-body .muted { margin: 0; }
.action-body button { justify-self: start; margin-top: 4px; }

.overview-mailboxes { padding: 20px; }
.overview-mailboxes .panel-head { margin-bottom: 14px; }
.overview-mailboxes .panel-head h3 { margin: 0; font-size: 16px; letter-spacing: -0.015em; }

/* ---------- Split / panels ---------- */
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.split .panel, .table, .file-upload, .form-stack, .form-grid { padding: 20px; }
.panel-head-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
}
.panel h3 { font-size: 16px; letter-spacing: -0.015em; margin-bottom: 6px; }
.panel .panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel .panel-head h3 { margin: 0; }
.muted { color: var(--muted); line-height: 1.5; font-size: 13.5px; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.wide { grid-column: 1 / -1; }
.form-stack { display: grid; gap: 14px; align-content: start; }
.compose-grid { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
.compose-3col .compose-toolbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 0 4px 14px;
  border-bottom: 1px solid var(--line);
  background: transparent;
}
.compose-3col .ai-sidebar {
  grid-column: 1;
  overflow-y: auto;
  padding: 16px 14px 20px;
  border-right: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--panel-2) 0%, #fff 100%);
}
.compose-3col .composer-main {
  grid-column: 2;
  overflow-y: auto;
  padding: 16px 22px 20px;
  display: grid;
  gap: 12px;
  align-content: start;
  background: #fff;
}
.compose-3col .preview-col {
  grid-column: 3;
  overflow-y: auto;
  padding: 16px 16px 20px;
  border-left: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--soft) 0%, var(--panel-2) 100%);
  display: grid;
  gap: 12px;
  align-content: start;
}
.composer-actions { display: flex; gap: 10px; justify-content: flex-end; padding-top: 4px; }

/* ---------- Combobox (customers) ---------- */
.combo { position: relative; display: grid; gap: 8px; }
.combo-trigger {
  width: 100%;
  justify-content: space-between;
  display: flex;
  align-items: center;
  min-height: 42px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13.5px;
}
.combo-trigger:hover { border-color: var(--muted-2); }
.combo-popover {
  position: absolute;
  z-index: 40;
  top: 48px;
  left: 0;
  right: 0;
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow-lg);
}
.combo-options { display: grid; gap: 2px; max-height: 240px; overflow: auto; }
.combo-option {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 8px;
  min-height: 46px;
  padding: 7px 9px;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border-radius: var(--radius-xs);
}
.combo-option:hover { background: var(--soft); }
.combo-option[aria-pressed="true"] { background: var(--blue-soft); }
.combo-option small { display: block; color: var(--muted); font-size: 12px; font-weight: 500; }
.checkmark { color: var(--blue); font-weight: 900; }
.combo-empty { margin: 0; padding: 8px; color: var(--muted); font-size: 13px; }
.combo-add { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 2px; }
.combo-add summary { cursor: pointer; font-size: 12.5px; font-weight: 650; color: var(--blue); padding: 4px 0; list-style: none; }
.combo-add summary::-webkit-details-marker { display: none; }
.combo-add-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 6px; margin: 8px 0; }
.combo-add-grid input { padding: 8px 10px; font-size: 12.5px; }

/* ---------- Compose toolbar ---------- */
.ct-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ct-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.ct-left strong { font-size: 16px; letter-spacing: -0.02em; }
.ct-back {
  min-height: 34px;
  min-width: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.ct-saved { color: var(--muted-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.ct-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.ct-action { min-height: 36px; padding: 0 14px; font-size: 13px; }
.preview-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.pt-btn {
  min-height: 34px;
  padding: 0 12px;
  background: #fff;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  border: 0;
  border-radius: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pt-btn .pt-label { display: inline; }
.pt-btn.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  box-shadow: inset 0 0 0 1px rgb(240 80 58 / 0.22);
}
.pt-btn + .pt-btn { border-left: 1px solid var(--line); }

/* ---------- AI sidebar ---------- */
.ai-heading { font-size: 13px; font-weight: 750; color: var(--ink); letter-spacing: -0.01em; margin-bottom: 10px; }
.ai-actions { display: grid; gap: 4px; margin-bottom: 14px; }
.ai-action { width: 100%; text-align: left; min-height: 36px; padding: 0 10px; font-size: 12.5px; font-weight: 600; color: var(--ink); background: transparent; border: 0; border-radius: var(--radius-xs); box-shadow: none; display: flex; align-items: center; gap: 7px; transition: background 0.1s ease; }
.ai-action:hover { background: rgba(0,0,0,0.04); }
.ai-action.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 700; }
.ai-prompt-box { margin-bottom: 14px; }
.ai-prompt-box textarea { width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; resize: vertical; min-height: 100px; background: #fff; }
.ai-prompt-box textarea:focus { border-color: var(--blue); box-shadow: var(--ring); }
.ai-prompt-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.ai-counter { font-size: 11px; color: var(--muted-2); font-weight: 600; }
.ai-suggestion { padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; font-size: 12.5px; line-height: 1.55; color: var(--ink); max-height: 300px; overflow-y: auto; margin-bottom: 14px; }
.ai-suggestion strong { display: block; margin-bottom: 4px; }
.ai-suggestion .suggestion-apply { display: block; margin-top: 8px; font-size: 12px; color: var(--blue); font-weight: 650; cursor: pointer; background: none; border: 0; padding: 0; min-height: auto; }
.ai-suggestion .suggestion-apply:hover { text-decoration: underline; }
.ai-templates { margin-top: 10px; }
.ai-templates summary { cursor: pointer; font-size: 12.5px; font-weight: 650; color: var(--muted); padding: 6px 0; list-style: none; user-select: none; }
.ai-templates summary::-webkit-details-marker { display: none; }
.ai-templates summary::before { content: "▸ "; font-size: 10px; }
.ai-templates[open] summary::before { content: "▾ "; }
.ai-template-sidebar { display: grid; gap: 4px; margin-top: 6px; max-height: 200px; overflow-y: auto; }
.ai-template-sidebar button { width: 100%; text-align: left; padding: 7px 10px; font-size: 12px; background: transparent; color: var(--ink); border: 0; border-radius: var(--radius-xs); box-shadow: none; min-height: auto; font-weight: 550; }
.ai-template-sidebar button:hover { background: rgba(0,0,0,0.04); }

/* ---------- Composer main column ---------- */
.composer-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px 14px;
  align-items: start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.composer-row:last-of-type { border-bottom: 0; padding-bottom: 0; }
.composer-row-people { padding-bottom: 10px; }
.composer-row-attach { border-bottom: 0; }
.row-label { font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 9px; letter-spacing: 0.01em; text-transform: uppercase; }
.from-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.from-group select { flex: 1 1 280px; min-width: 0; max-width: 100%; }
.verified-badge { font-size: 11px; font-weight: 750; color: var(--green); background: var(--green-soft); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.recipients-area { display: grid; gap: 6px; min-width: 0; }
.recipients-combo {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.recipients-combo:focus-within { border-color: var(--blue); box-shadow: var(--ring); }
.recipients-combo .chips { flex: 0 1 auto; gap: 5px; }
.recipients-combo input {
  flex: 1 1 140px;
  min-width: 120px;
  border: 0;
  padding: 4px 2px;
  min-height: 28px;
  background: transparent;
  box-shadow: none;
}
.recipients-combo input:focus { outline: none; box-shadow: none; }
.recipients-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 18px; }
.customer-count { font-size: 11.5px; font-weight: 650; color: var(--muted-2); }
.clear-all { font-size: 11.5px; font-weight: 650; color: var(--blue); cursor: pointer; }
.clear-all:hover { text-decoration: underline; }
.contact-list {
  display: grid;
  gap: 1px;
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 4px;
  background: var(--panel-2);
}
.contact-list:empty { display: none; }
.contact-list .contact-group-label { font-size: 10.5px; font-weight: 750; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; padding: 8px 10px 4px; user-select: none; }
.contact-list .contact-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--radius-xs); cursor: pointer; transition: background 0.1s ease; user-select: none; }
.contact-list .contact-item:hover { background: rgba(0,0,0,0.04); }
.contact-list .contact-item .ci-check { width: 18px; height: 18px; border: 2px solid var(--line); border-radius: 4px; display: grid; place-items: center; font-size: 12px; color: transparent; flex-shrink: 0; transition: border-color 0.1s ease, color 0.1s ease, background 0.1s ease; }
.contact-list .contact-item[data-selected="true"] .ci-check { border-color: var(--blue); background: var(--blue); color: #fff; }
.contact-list .contact-item .ci-name { font-size: 13px; font-weight: 600; color: var(--ink); }
.contact-list .contact-item .ci-email { font-size: 11.5px; color: var(--muted); margin-left: 6px; }
.create-contact { font-size: 12.5px; font-weight: 650; color: var(--blue); cursor: pointer; padding: 4px 0; display: block; }
.create-contact:hover { text-decoration: underline; }
.quick-add { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 6px; padding: 10px 0 0; border-top: 1px solid var(--line-soft); margin-top: 4px; }
.quick-add input { padding: 8px 10px; font-size: 12.5px; }
.quick-add button { min-height: 34px; font-size: 12px; }
.subject-input { font-size: 14px; font-weight: 600; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding-left: 0; padding-right: 0; box-shadow: none; }
.subject-input:focus { border-bottom-color: var(--accent); box-shadow: none; }
.body-section { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: #fff; }
.body-tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.body-tab { min-height: 34px; padding: 0 14px; font-size: 12.5px; font-weight: 650; color: var(--muted); background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0; box-shadow: none; }
.body-tab:hover { color: var(--ink); }
.body-tab.active { color: var(--ink); border-bottom-color: var(--accent); background: #fff; }
#body-text, #body-html { border: 0; border-radius: 0; resize: vertical; min-height: 180px; font-family: var(--font-mono); font-size: 13px; line-height: 1.55; box-shadow: none; }
#body-text:focus, #body-html:focus { box-shadow: none; }
.attach-stack { display: grid; gap: 8px; min-width: 0; }
.dropzone {
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 18px 16px;
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-sm);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  cursor: pointer;
  background: var(--panel-2);
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--ink);
}
.dz-icon { font-size: 18px; line-height: 1; opacity: 0.7; }
.dz-copy { font-weight: 550; }
.dz-hint { font-size: 11.5px; color: var(--muted-2); }
.dropzone a { color: var(--accent-dark); font-weight: 650; cursor: pointer; text-decoration: none; }
.dropzone a:hover { text-decoration: underline; }
.attachment-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.attachment-chips:empty { display: none; }
.attachment-chips .att-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
}
.attachment-chips .att-chip .att-remove { cursor: pointer; color: var(--red); font-size: 14px; background: none; border: 0; padding: 0; min-height: auto; line-height: 1; }

/* ---------- Preview + delivery card ---------- */
.preview-col-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}
.preview-col-head h4 { font-size: 13px; font-weight: 750; letter-spacing: -0.01em; }
.preview-col-hint { font-size: 11px; font-weight: 600; color: var(--muted-2); }
.preview-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, opacity 0.2s ease;
  transform-origin: top center;
}
.preview-card.preview-desktop { max-width: none; margin: 0; transform: none; }
.preview-card.preview-mobile { max-width: 320px; margin: 0 auto; transform: none; }
.preview-header { display: flex; gap: 12px; padding: 16px; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.preview-logo { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #fff; font-size: 12px; font-weight: 800; flex-shrink: 0; }
.preview-email-meta { display: grid; gap: 3px; font-size: 12.5px; line-height: 1.45; color: var(--muted); min-width: 0; }
.preview-email-meta strong { color: var(--ink); font-weight: 650; }
.preview-body { padding: 20px 16px; font-size: 13.5px; line-height: 1.6; color: var(--ink); min-height: 120px; max-height: 420px; overflow-y: auto; }
.preview-placeholder { color: var(--muted-2); font-style: italic; }
.preview-body p { margin: 0 0 10px; }
.preview-footer { padding: 14px 16px; border-top: 1px solid var(--line-soft); font-size: 11.5px; color: var(--muted-2); line-height: 1.45; }
.preview-footer a { color: var(--blue); font-weight: 600; }
.delivery-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.delivery-head { padding: 14px 16px; background: var(--green-soft); color: #0a6e49; font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.delivery-icon { font-size: 18px; }
.delivery-rows { padding: 12px 16px; display: grid; gap: 8px; }
.delivery-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); }
.delivery-row strong { color: var(--ink); }
.delivery-row .pass { color: var(--green); font-weight: 700; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; min-height: 0; }
.chip {
  min-height: 26px;
  padding: 0 9px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

/* ---------- Feedback ---------- */
.form-feedback {
  margin: 0;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-feedback::before { content: "•"; font-size: 18px; line-height: 0.5; }
.form-feedback[data-type="success"] { border-color: #b6e4cf; background: var(--green-soft); color: #0a6e49; }
.form-feedback[data-type="success"]::before { color: var(--green); }
.form-feedback[data-type="pending"] { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }
.form-feedback[data-type="pending"]::before { color: var(--blue); }
.form-feedback[data-type="error"] { border-color: #fecaca; background: #fff1f2; color: #b42318; }
.form-feedback[data-type="error"]::before { color: var(--red); }

/* ---------- Tables ---------- */
.table { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 12px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13.5px;
}
th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--panel-2);
  position: sticky;
  top: 0;
}
tbody tr { transition: background 0.1s ease; }
tbody tr:hover { background: var(--soft); }
.status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 999px; }
.status.active { color: var(--green); background: var(--green-soft); }
.status.active::before { background: var(--green); }
.status.pending { color: var(--amber); background: var(--amber-soft); }
.status.pending::before { background: var(--amber); }
.status.paused, .status.disabled { color: var(--muted); background: var(--line-soft); }
.status.paused::before, .status.disabled::before { background: var(--muted-2); }
.status.archived, .status.lead { color: var(--blue); background: var(--blue-soft); }
.status.archived::before, .status.lead::before { background: var(--blue); }
.status.sent { color: var(--green); background: var(--green-soft); }
.status.sent::before { background: var(--green); }
.status.failed { color: var(--red); background: var(--red-soft); }
.status.failed::before { background: var(--red); }
.status.draft { color: var(--muted); background: var(--line-soft); }
.status.draft::before { background: var(--muted-2); }

.row-actions { display: flex; flex-wrap: wrap; gap: 6px; min-width: 148px; }
.table-action {
  min-height: 30px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 650;
  border-radius: var(--radius-xs);
  color: var(--ink);
  background: var(--soft);
}
.table-action:hover { background: var(--line-soft); }
.table-action.primary { color: #fff; background: var(--blue); }
.table-action.primary:hover { background: #1f4ed8; }
.table-action.danger {
  color: var(--red);
  background: #fff;
  border: 1px solid #f0b4b6;
  box-shadow: none;
}
.table-action.danger:hover { background: var(--red-soft); border-color: #e8a0a3; }
.cell-name { font-weight: 650; color: var(--ink); }
.cell-muted { color: var(--muted); }
.tag-pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--line-soft);
}

/* ---------- People ---------- */
.people-view.active { gap: 16px; }
.people-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.people-search {
  flex: 1;
  min-width: 0;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.people-search-icon { color: var(--muted-2); font-size: 15px; }
.people-search input {
  width: 100%;
  min-height: 40px;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  font-size: 13.5px;
}
.people-search input:focus { box-shadow: none; }
.people-card { padding: 0; overflow: hidden; }
.people-table table { margin: 0; }
.people-table th:first-child, .people-table td:first-child { padding-left: 18px; }
.people-table th:last-child, .people-table td:last-child { padding-right: 18px; }
.people-table .row-actions { flex-wrap: nowrap; }
.people-count { margin: 0; padding: 12px 18px 14px; font-size: 12.5px; border-top: 1px solid var(--line-soft); }
.people-empty { padding: 28px 18px; }

/* ---------- Files ---------- */
.files-view.active { gap: 16px; }
.files-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.files-search {
  flex: 1;
  min-width: 0;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.files-search-icon { color: var(--muted-2); font-size: 15px; }
.files-search input {
  width: 100%;
  min-height: 40px;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  font-size: 13.5px;
}
.files-search input:focus { box-shadow: none; }
.files-card { padding: 0; overflow: hidden; }
.files-table table { margin: 0; }
.files-table th:first-child, .files-table td:first-child { padding-left: 18px; }
.files-table th:last-child, .files-table td:last-child { padding-right: 18px; }
.files-count { margin: 0; padding: 12px 18px 14px; font-size: 12.5px; border-top: 1px solid var(--line-soft); }
.files-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 48px 24px 56px;
  text-align: center;
}
.files-empty-title { margin: 0; font-size: 17px; font-weight: 650; color: var(--ink); }
.files-empty-copy { margin: 0 0 8px; max-width: 320px; }
.file-name-cell {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.file-name-cell .cell-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.file-icon--pdf { background: #fde8e8; color: #c62828; }
.file-icon--image { background: #e8f0fe; color: #1a73e8; font-size: 14px; }
.file-icon--generic { background: var(--line-soft); color: var(--muted); font-size: 14px; }
.file-dropzone-label { margin-bottom: 4px; }
.file-dropzone { min-height: 120px; display: flex; align-items: center; justify-content: center; }

/* ---------- Templates ---------- */
.templates-view.active { gap: 16px; }
.templates-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.templates-search {
  flex: 1;
  min-width: 0;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.templates-search-icon { color: var(--muted-2); font-size: 15px; }
.templates-search input {
  width: 100%;
  min-height: 40px;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  font-size: 13.5px;
}
.templates-search input:focus { box-shadow: none; }
.templates-card { padding: 0; overflow: hidden; }
.templates-table table { margin: 0; }
.templates-table th:first-child, .templates-table td:first-child { padding-left: 18px; }
.templates-table th:last-child, .templates-table td:last-child { padding-right: 18px; }
.templates-count { margin: 0; padding: 12px 18px 14px; font-size: 12.5px; border-top: 1px solid var(--line-soft); }
.templates-empty { padding: 28px 18px; }

/* ---------- Senders ---------- */
.senders-view.active { gap: 16px; }
.senders-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.senders-search {
  flex: 1;
  min-width: 0;
  max-width: 360px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.senders-search-icon { color: var(--muted-2); font-size: 15px; }
.senders-search input {
  width: 100%;
  min-height: 40px;
  border: 0;
  background: transparent;
  padding: 0;
  box-shadow: none;
  font-size: 13.5px;
}
.senders-search input:focus { box-shadow: none; }
.senders-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.senders-card { padding: 0; overflow: hidden; }
.senders-table table { margin: 0; }
.senders-table th:first-child, .senders-table td:first-child { padding-left: 18px; }
.senders-table th:last-child, .senders-table td:last-child { padding-right: 18px; }
.senders-table .row-actions { flex-wrap: nowrap; }
.senders-count { margin: 0; padding: 12px 18px 14px; font-size: 12.5px; border-top: 1px solid var(--line-soft); }
.senders-empty { padding: 28px 18px; }

/* ---------- Modal ---------- */
.app-modal {
  width: min(560px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.app-modal::backdrop { background: rgb(11 18 32 / 0.42); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px 0;
}
.modal-head h3 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }
.modal-close {
  width: 32px;
  min-width: 32px;
  min-height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  box-shadow: none;
}
.modal-close:hover { background: var(--soft); color: var(--ink); }
.modal-form { padding: 16px 20px 20px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 4px;
  padding-top: 4px;
}

/* ---------- Mail message rows ---------- */
.inbox-shell {
  min-height: calc(100vh - 158px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow-md);
}
.mail-toolbar {
  min-height: 64px;
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(240px, 1.3fr) auto;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,0.94);
}
.mail-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.mail-title strong { display: block; font-size: 17px; letter-spacing: -0.015em; }
.mail-title span:not(.mail-icon) { display: block; color: var(--muted); font-size: 12.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mail-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}
.mail-search {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
}
.mail-search span { color: var(--muted); font-size: 18px; }
.mail-search input {
  border: 0;
  box-shadow: none;
  background: transparent;
  padding: 0;
}
.mail-tools { display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.mail-pager { display: inline-flex; align-items: center; gap: 6px; }
.mail-pager .mail-tool:disabled,
.mail-pager .mail-tool[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}
.mail-count { color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.mail-tool {
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  box-shadow: none;
}
.mail-tool:hover { background: var(--soft); }
.inbox-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  min-height: 0;
}
.inbox-list-pane {
  min-width: 0;
  border-right: 1px solid var(--line);
  overflow: auto;
}
.inbox-empty-card { display: grid; place-items: center; min-height: 420px; }
.msg-list { display: grid; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #fff; }
.inbox-list-pane .msg-list { border: 0; border-radius: 0; }
.msg-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 14px;
  align-items: start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  cursor: default;
  transition: background 0.1s ease;
  width: 100%;
  color: var(--ink);
  background: #fff;
  border-left: 3px solid transparent;
  border-radius: 0;
  box-shadow: none;
  text-align: left;
}
.msg-row:last-child { border-bottom: 0; }
.msg-row:hover { background: var(--soft); }
.msg-row.selected {
  background: #fff7f4;
  border-left-color: var(--accent);
}
.msg-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 750;
  color: #fff;
  background: linear-gradient(135deg, var(--blue), #1f4ed8);
  margin-top: 2px;
}
.msg-avatar.out { background: linear-gradient(135deg, var(--green), #0a7d57); }
.msg-main { min-width: 0; }
.msg-line1 { display: flex; align-items: baseline; gap: 8px; margin-bottom: 2px; }
.msg-from { font-weight: 650; font-size: 13.5px; letter-spacing: -0.01em; }
.msg-subject { font-size: 13.5px; color: var(--ink); font-weight: 600; letter-spacing: -0.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-snippet { color: var(--muted); font-size: 12.5px; line-height: 1.45; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.msg-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.msg-time { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.msg-tag {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.msg-tag.in { color: var(--blue); background: var(--blue-soft); }
.msg-tag.out { color: var(--green); background: var(--green-soft); }
.msg-tag.failed { color: var(--red); background: var(--red-soft); }
.msg-empty { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }
.message-preview {
  min-width: 0;
  overflow: auto;
  background: #fff;
}
.preview-toolbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.preview-message { padding: 28px 30px 34px; }
.preview-message h3 {
  margin: 10px 0 20px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.preview-sender {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
}
.preview-sender strong { display: block; font-size: 13.5px; }
.preview-sender span { display: block; color: var(--muted); font-size: 12.5px; }
.preview-sender time { color: var(--muted); font-size: 12px; font-weight: 650; white-space: nowrap; }
.preview-copy {
  max-width: 720px;
  color: #202938;
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-wrap;
}

/* ---------- Sent mail split view ---------- */
.sent-shell .msg-row { cursor: pointer; }
.sent-shell .msg-row.selected {
  background: var(--blue-soft);
  border-left-color: var(--blue);
}
.sent-toolbar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto auto;
  gap: 12px 16px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
  align-items: center;
}
.sent-search-wide { min-width: 0; }
.sent-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 10px;
}
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 650;
  box-shadow: none;
}
.filter-chip:hover { background: var(--soft); border-color: var(--muted-2); }
.filter-chip.active {
  background: var(--blue-soft);
  border-color: #bfd0ff;
  color: var(--blue);
}
.filter-chip.delivered.active {
  background: var(--green-soft);
  border-color: #b8e8d4;
  color: var(--green);
}
.filter-chip.failed.active {
  background: var(--red-soft);
  border-color: #f5c4c6;
  color: var(--red);
}
.sent-select {
  min-height: 36px;
  padding: 0 30px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}
.sent-range {
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--soft);
  color: var(--muted);
  white-space: nowrap;
}
.mailbox-switcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 650;
  color: var(--muted);
}
.mailbox-switcher span { white-space: nowrap; }
.inbox-toolbar {
  grid-template-columns: minmax(200px, 1fr) auto minmax(180px, 0.8fr) auto;
}
.sent-list-pane { display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.sent-list-pane .msg-list { min-height: 0; overflow: auto; }
.sent-list-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  background: var(--panel-2);
}
.sent-preview {
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  align-content: start;
}
.sent-preview > .sent-body-card,
.sent-preview > .preview-message {
  min-height: 0;
  overflow: auto;
}
.sent-detail-head {
  padding: 24px 28px 0;
  display: grid;
  gap: 10px;
}
.sent-detail-head h3 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}
.sent-detail-status {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.sent-detail-meta {
  display: grid;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
.sent-detail-meta span {
  display: inline-block;
  min-width: 34px;
  font-weight: 600;
}
.sent-detail-meta strong { color: var(--ink); font-weight: 650; }
.sent-sent-at { color: var(--muted); font-size: 12.5px; font-weight: 600; }
.sent-error { color: var(--red); font-size: 13px; font-weight: 600; }
.sent-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.sent-badge.delivered { color: var(--green); background: var(--green-soft); }
.sent-badge.failed { color: var(--red); background: var(--red-soft); }
.sent-detail-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 8px;
  padding: 16px 28px;
  border-bottom: 1px solid var(--line-soft);
  min-height: 0;
  height: auto;
}
.sent-detail-actions > button {
  flex: 0 0 auto;
  align-self: center;
  height: auto;
  min-height: 36px;
  max-height: 36px;
  padding: 0 14px;
  white-space: nowrap;
}
.sent-detail-actions .outline {
  min-height: 36px;
  font-size: 12.5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
button.danger-outline {
  color: var(--red);
  background: #fff;
  border: 1px solid #f0c7c9;
}
button.danger-outline:hover { background: var(--red-soft); }
.sent-body-card {
  margin: 20px 28px 28px;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: auto;
}
.preview-body-html {
  font-size: 14.5px;
  line-height: 1.7;
  color: #202938;
}
.preview-body-html p { margin: 0 0 14px; }
.sent-plain-copy { margin: 0; max-width: none; }
.sent-plain-toggle { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.sent-plain-toggle button {
  background: transparent;
  color: var(--blue);
  min-height: auto;
  padding: 0;
  font-size: 12.5px;
  font-weight: 650;
  box-shadow: none;
}
.sent-plain-toggle button:hover { text-decoration: underline; background: transparent; }

/* ---------- Mailbox grid (inbox + sent split) ---------- */
.mailbox-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.mailbox-grid .panel { padding: 0; overflow: hidden; }
.mailbox-grid .panel-head { padding: 14px 16px; margin-bottom: 0; border-bottom: 1px solid var(--line); }
.mailbox-grid .panel .msg-list, .mailbox-grid .panel .table, .mailbox-grid .panel .msg-empty { border: 0; border-radius: 0; }

/* ---------- Mailboxes overview cards ---------- */
.mailbox-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.mailbox-cards--wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.mailbox-card {
  padding: 16px 18px;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  transition: transform 0.1s ease, box-shadow 0.12s ease, border-color 0.12s ease;
  cursor: pointer;
  text-align: left;
}
.mailbox-card:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); border-color: var(--muted-2); }
.mailbox-card .mc-top { display: flex; align-items: flex-start; gap: 12px; }
.mailbox-card .mc-info { min-width: 0; display: grid; gap: 2px; flex: 1; }
.mailbox-card .mc-avatar {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  font-size: 15px; font-weight: 800; color: #fff; flex: 0 0 auto;
  background: linear-gradient(135deg, var(--blue), #1f4ed8);
}
.mailbox-card.is-default .mc-avatar { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.mailbox-card .mc-domain { font-weight: 700; font-size: 14px; letter-spacing: -0.01em; color: var(--ink); }
.mailbox-card .mc-email { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mailbox-card .mc-stats-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 600;
}
.mailbox-card .mc-stats-inline strong { color: var(--ink); font-size: 13px; font-weight: 700; }
.mailbox-card .mc-pipe { color: var(--line); font-weight: 400; }
.mailbox-card .mc-star { margin-left: auto; color: var(--amber); font-size: 15px; line-height: 1; }

/* ---------- Toast ---------- */
.inbox-help {
  display: grid;
  gap: 8px;
  padding: 24px 20px;
  text-align: left;
}
.inbox-help strong { font-size: 14px; letter-spacing: -0.01em; }
.inbox-help code {
  display: inline-block;
  max-width: 100%;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--ink);
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 80;
  max-width: 420px;
  padding: 13px 16px;
  border-radius: 10px;
  color: #fff;
  background: var(--ink);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(10px);
  transition: 0.18s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast[data-type="success"] { background: #0a6e49; }
.toast[data-type="error"] { background: #b42318; }
.toast[data-type="pending"] { background: #1d4ed8; }

/* ---------- Scrollbars ---------- */
.sidebar-scroll::-webkit-scrollbar, .combo-options::-webkit-scrollbar, .table::-webkit-scrollbar { width: 8px; height: 8px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.08); border-radius: 999px; }
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.14); }
.table::-webkit-scrollbar-thumb { background: var(--line); border-radius: 999px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .overview-actions { grid-template-columns: minmax(0, 1fr); }
  .mailbox-grid { grid-template-columns: 1fr; }
  .inbox-layout { grid-template-columns: minmax(320px, 0.9fr) minmax(340px, 1.1fr); }
  .sent-toolbar { grid-template-columns: minmax(0, 1fr); }
  .sent-filters { justify-content: flex-start; }
  .inbox-toolbar { grid-template-columns: minmax(0, 1fr); }
  .view.compose-3col.active {
    grid-template-columns: 220px minmax(0, 1fr);
    min-height: 0;
    padding: 16px;
  }
  .view.compose-3col.active .preview-col {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line-soft);
    background: var(--panel-2);
  }
  .pt-btn .pt-label { display: none; }
}
@media (max-width: 900px) {
  .auth-shell, .app-shell, .split, .compose-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
  .auth-shell { gap: 24px; padding: 24px; }
  .brand-block h1 { font-size: 42px; }
  body:has(.drawer-open) { overflow: hidden; }
  .drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: block;
    border-radius: 0;
    background: rgba(9, 15, 27, 0.46);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease;
  }
  .app-shell.drawer-open .drawer-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 80;
    width: min(84vw, 320px);
    height: 100dvh;
    padding: 16px 12px 14px;
    transform: translateX(-104%);
    transition: transform 0.2s ease;
    box-shadow: 24px 0 50px rgb(0 0 0 / 0.22);
  }
  .app-shell.drawer-open .sidebar { transform: translateX(0); }
  .sidebar-scroll { margin-top: 12px; gap: 16px; }
  .drawer-close {
    display: grid;
    width: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    place-items: center;
    color: #fff;
    background: rgba(255,255,255,0.08);
    box-shadow: none;
  }
  .sidebar-section { gap: 4px; }
  .nav {
    min-height: 42px;
    padding: 0 10px;
  }
  .nav.active::before { display: none; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mailbox-cards { grid-template-columns: minmax(0, 1fr); }
  .topbar {
    position: sticky;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    padding: 16px;
  }
  .mobile-menu {
    display: grid;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0;
    place-items: center;
    color: var(--ink);
    background: #fff;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
  }
  .topbar-actions {
    grid-column: 1 / -1;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding-top: 12px;
  }
  .user-pill { max-width: 100%; }
  .user-pill span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .view { padding: 16px; }
  .inbox-shell { min-height: calc(100vh - 188px); }
  .mail-toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }
  .mail-search {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .mail-tools { justify-content: flex-end; }
  .inbox-layout { grid-template-columns: minmax(0, 1fr); }
  .inbox-list-pane { border-right: 0; }
  .message-preview { display: none; }
  .inbox-shell.is-reading .mail-toolbar,
  .inbox-shell.is-reading .sent-toolbar { display: none; }
  .inbox-shell.is-reading .inbox-list-pane { display: none; }
  .inbox-shell.is-reading .message-preview {
    display: grid;
    min-height: calc(100vh - 160px);
  }
  .inbox-shell.is-reading .sent-reading-toolbar,
  .inbox-shell.is-reading .preview-toolbar { display: flex; }
  .view.compose-3col.active {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    gap: 0;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    overflow: visible;
    min-height: 0;
  }
  .view.compose-3col.active .compose-toolbar {
    grid-column: 1;
    grid-row: 1;
    position: sticky;
    top: 0;
    z-index: 8;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    background: #fff;
  }
  .ct-left, .ct-right { width: 100%; }
  .ct-right {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .ct-action { flex: 1 1 auto; }
  .compose-3col .composer-main {
    grid-column: 1;
    grid-row: 2;
    padding: 14px;
    overflow: visible;
  }
  .compose-3col .ai-sidebar {
    grid-column: 1;
    grid-row: 3;
    border-right: 0;
    border-top: 1px solid var(--line-soft);
    padding: 14px;
    overflow: visible;
    background: var(--panel-2);
  }
  .compose-3col .preview-col {
    grid-column: 1;
    grid-row: 4;
    border-left: 0;
    border-top: 1px solid var(--line-soft);
    padding: 14px;
    overflow: visible;
  }
  .mailbox-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }
  .mailbox-header .mh-stats {
    grid-column: 1 / -1;
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }
}
@media (max-width: 640px) {
  .auth-shell { grid-template-columns: minmax(0, 1fr); padding: 18px; }
  .brand-block h1 { font-size: 36px; }
  .brand-block p { font-size: 15px; }
  .people-toolbar, .templates-toolbar, .senders-toolbar { flex-direction: column; align-items: stretch; }
  .senders-actions { width: 100%; }
  .senders-actions button { flex: 1; }
  .people-search, .templates-search { max-width: none; }
  .topbar { display: grid; }
  .topbar-actions { justify-content: stretch; }
  .topbar-actions button, .topbar-actions .user-pill { width: 100%; justify-content: center; }
  .panel-head-wrap, .panel .panel-head {
    align-items: stretch;
    flex-direction: column;
  }
  .table { padding: 0; border-radius: var(--radius-sm); }
  th, td { padding: 10px; }
  .row-actions { min-width: 0; }
  .row-actions button { flex: 1; }
  .composer-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }
  .row-label { padding-top: 0; }
  .from-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }
  .from-group select { min-width: 0; }
  .recipients-meta { align-items: flex-start; gap: 8px; }
  .recipients-combo input { min-width: 0; flex-basis: 100%; }
  .contact-list { max-height: 280px; }
  .contact-list .contact-item { align-items: flex-start; }
  .contact-list .contact-item .ci-name { display: grid; gap: 2px; min-width: 0; }
  .contact-list .contact-item .ci-email { margin-left: 0; overflow-wrap: anywhere; }
  .quick-add { grid-template-columns: minmax(0, 1fr); }
  .composer-actions, .button-row { display: grid; grid-template-columns: minmax(0, 1fr); }
  .dropzone { padding: 16px 12px; }
  .msg-row {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }
  .msg-avatar { width: 32px; height: 32px; border-radius: 8px; font-size: 12px; }
  .msg-line1 {
    display: grid;
    gap: 2px;
  }
  .msg-subject { white-space: normal; }
  .msg-meta {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .mailbox-header { padding: 14px; }
  .mailbox-header .mh-avatar { width: 42px; height: 42px; border-radius: 10px; }
  .mailbox-header h2, .mailbox-card .mc-email { overflow-wrap: anywhere; }
  .mailbox-card .mc-stats { justify-content: space-between; }
  .toast { left: 14px; right: 14px; bottom: 14px; max-width: none; }
}

/* ---------- Full message reader (Gmail-style expand) ---------- */
.sent-reading-toolbar { border-bottom: 1px solid var(--line); }
.inbox-body-card { margin: 0; padding: 0; border: 0; box-shadow: none; }
.drafts-shell .msg-row { cursor: pointer; }
@media (min-width: 901px) {
  .preview-toolbar [data-action="close-mail-reading"],
  .sent-reading-toolbar [data-action="close-mail-reading"] { display: none; }
}
.mail-reader {
  width: min(920px, calc(100vw - 24px));
  max-width: 920px;
  height: min(88vh, 900px);
  max-height: 88vh;
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  background: #fff;
  box-shadow: var(--shadow-md);
  color: var(--ink);
}
.mail-reader::backdrop {
  background: rgba(9, 15, 27, 0.48);
}
.mail-reader-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}
.mail-reader-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.mail-reader-title {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 2px;
}
.mail-reader-title strong {
  font-size: 14px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-reader-title span {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mail-reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.mail-reader-body {
  overflow: auto;
  min-height: 0;
  background: #fff;
}
.mail-reader-body .sent-detail-actions {
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 1;
  height: auto;
  min-height: 0;
}
.message-preview .preview-toolbar,
.sent-preview .preview-toolbar {
  flex: 0 0 auto;
  align-self: start;
}
.preview-body-html {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.preview-body-html img { max-width: 100%; height: auto; }

