/* One theme colour (picked in Settings) drives the accent; every tint below is mixed from it,
   so switching theme recolours the whole app softly. Folder tiles and avatars add the other colours. */
:root {
  --accent-dark: color-mix(in srgb, var(--accent) 80%, #000);
  --accent-soft: color-mix(in srgb, var(--accent) 10%, #fff);
  --badge: color-mix(in srgb, var(--accent) 16%, #fff);
  --bg: color-mix(in srgb, var(--accent) 5%, #f6f7f9);
  --field: color-mix(in srgb, var(--accent) 6%, #eef0f4);
  --active: color-mix(in srgb, var(--accent) 8%, #fff);
  --panel: #fff;
  --line: #eceef3;
  --line-strong: #d8dce4;
  --text: #1d2433;
  --dim: #5f687a;
  --hover: #f3f5f9;
  --star: #e3a008;
  --danger: #c93a3a;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(29, 36, 51, .04), 0 2px 6px rgba(29, 36, 51, .05);
}
/* Theme colours. A swatch in Settings uses the same rule to paint its own dot. */
:root, [data-swatch=ocean] { --accent: #2f6bed; }
[data-theme=violet], [data-swatch=violet] { --accent: #6d55e0; }
[data-theme=teal], [data-swatch=teal] { --accent: #0f8f85; }
[data-theme=rose], [data-swatch=rose] { --accent: #d1457a; }
[data-theme=amber], [data-swatch=amber] { --accent: #c2700f; }
[data-theme=graphite], [data-swatch=graphite] { --accent: #44506a; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

button, input, select { font: inherit; color: inherit; }
button, select { border: 0; background: none; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dim { color: var(--dim); }
.sprite { position: absolute; overflow: hidden; }

.i {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: var(--dim);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:disabled { opacity: .35; cursor: default; background: none; }
.icon-btn.big { width: 44px; height: 44px; color: var(--text); }
.icon-btn.big .i { width: 24px; height: 24px; }

.primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.primary:hover { background: var(--accent-dark); }
.primary { white-space: nowrap; }
.primary:disabled { opacity: .6; cursor: default; }

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  --hue: var(--accent);
  background: color-mix(in srgb, var(--hue) 17%, #fff);
  color: color-mix(in srgb, var(--hue) 78%, #000);
  font-weight: 650;
  font-size: 14px;
  flex-shrink: 0;
  user-select: none;
}
.avatar.lg { width: 46px; height: 46px; font-size: 17px; }
/* Pastel avatar colours, picked per sender from their address. */
.c0 { --hue: #2f6bed; } .c1 { --hue: #1f9a6a; } .c2 { --hue: #e0742c; } .c3 { --hue: #7c5ce6; }
.c4 { --hue: #d24545; } .c5 { --hue: #0e9aae; } .c6 { --hue: #d0508f; } .c7 { --hue: #6f7a8f; }
#avatar-btn { background: var(--accent); color: #fff; } /* you: always in the theme colour */

/* Brand */
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; color: var(--text); text-decoration: none; font-size: 24px; font-weight: 700; letter-spacing: -.4px; }
.brand-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.logo { width: 38px; height: 38px; flex-shrink: 0; }
.logo-tile { fill: var(--accent); }

/* Login */
.login {
  margin: 12vh auto 0;
  width: min(380px, calc(100% - 32px));
  padding: 32px;
  background: var(--panel);
  border-radius: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.login p { margin: 0 0 8px; color: var(--dim); }
.login input:not([type=hidden]) { padding: 11px 14px; border: 1px solid var(--line-strong); border-radius: 10px; }
.login .error { color: var(--danger); margin: 0; }
.login .primary { align-self: stretch; justify-content: center; margin-top: 10px; padding: 12px; }

/* Top bar */
.top { display: flex; align-items: center; gap: 16px; height: 80px; padding: 0 28px 0 32px; flex-shrink: 0; }
.top .brand { width: 248px; flex-shrink: 0; }
#search { position: relative; flex: 1; max-width: 800px; }
#search .i { position: absolute; left: 20px; top: 50%; translate: 0 -50%; width: 22px; height: 22px; color: var(--text); pointer-events: none; }
#search input {
  width: 100%;
  padding: 15px 20px 15px 58px;
  border: 1px solid transparent;
  border-radius: 16px;
  background: var(--field);
  font-size: 16px;
}
#search input::placeholder { color: #7a8294; }
#search input:focus { outline: 0; background: #fff; border-color: var(--line-strong); box-shadow: var(--shadow); }
#settings-btn { margin-left: auto; }

.pop { position: relative; }
.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 40;
  min-width: 230px;
  padding: 6px;
  background: var(--panel);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(16, 24, 40, .16), 0 1px 3px rgba(16, 24, 40, .08);
}
.menu button, .menu .menu-move {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  text-align: left;
  white-space: nowrap;
}
.menu button:hover, .menu .menu-move:hover { background: var(--hover); }
.menu .i { color: var(--dim); }
.menu-move select { flex: 1; padding: 0; }
.menu-head { display: flex; flex-direction: column; padding: 10px 12px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.menu-head span { color: var(--dim); font-size: 14px; overflow-wrap: anywhere; }

/* Layout */
.app {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  gap: 16px;
  padding: 0 20px 20px 0;
}

/* Sidebar */
.side { padding: 4px 8px 16px 20px; overflow-y: auto; }
.compose-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  width: calc(100% - 8px);
  padding: 19px 26px;
  border-radius: 14px;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent);
}
.compose-btn:hover { background: var(--accent-dark); }
.compose-btn .i { width: 22px; height: 22px; }
.nav { list-style: none; margin: 18px 0 0; padding: 0; }
.nav button {
  display: flex;
  align-items: center;
  gap: 14px;
  width: calc(100% - 8px);
  padding: 7px 14px 7px 8px;
  margin-bottom: 3px;
  border-radius: 13px;
  font-size: 16px;
  text-align: left;
}
.nav button:hover { background: color-mix(in srgb, var(--tone) 7%, transparent); }
.nav button .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Each folder has its own soft colour; the open one fills its tile. */
.tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--tone) 13%, #fff);
  color: var(--tone);
  flex-shrink: 0;
}
.tile .i { width: 19px; height: 19px; }
.nav button[aria-current] { background: color-mix(in srgb, var(--tone) 11%, #fff); font-weight: 600; }
.nav button[aria-current] .tile { background: var(--tone); color: #fff; }
.tone-inbox { --tone: var(--accent); } .tone-starred { --tone: #d99a06; } .tone-sent { --tone: #1f9a6a; }
.tone-drafts { --tone: #e0742c; } .tone-spam { --tone: #d24545; } .tone-trash { --tone: #6f7a8f; }
.tone-bulk { --tone: #c026a3; }
.tools-nav { margin-top: 6px; }
.tone-c0 { --tone: #7c5ce6; } .tone-c1 { --tone: #0e9aae; } .tone-c2 { --tone: #d0508f; } .tone-c3 { --tone: #6f8f2a; }
.badge { padding: 1px 9px; border-radius: 999px; background: var(--badge); color: var(--accent); font-size: 13px; font-weight: 600; }
.nav .badge { background: color-mix(in srgb, var(--tone) 16%, #fff); color: color-mix(in srgb, var(--tone) 82%, #000); }
.nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 20px 8px 0 0;
  padding: 18px 4px 0 18px;
  border-top: 1px solid #e2e6ed;
  font-weight: 600;
}
.nav-head .icon-btn { color: var(--text); }
.nav-head + .nav { margin-top: 8px; }

/* Message list */
.list-pane, .read-pane, .settings {
  min-height: 0;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.list-pane { display: flex; flex-direction: column; overflow: hidden; }
.list-bar { display: flex; align-items: center; gap: 2px; min-height: 54px; padding: 6px 12px 6px 30px; border-bottom: 1px solid var(--line); }
.list-bar input[type=checkbox], .row input[type=checkbox] { width: 18px; height: 18px; margin: 0 10px 0 0; accent-color: var(--accent); }
.bulk { display: inline-flex; align-items: center; gap: 2px; }
.move-to { margin-left: 6px; padding: 6px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 14px; }
.pager { display: flex; align-items: center; gap: 2px; margin-left: auto; color: var(--dim); font-size: 13px; }
.pager #range { margin-right: 6px; }
.list { flex: 1; overflow-y: auto; }

.row {
  display: grid;
  grid-template-columns: 28px 14px minmax(0, 1fr) auto;
  grid-template-areas: "check dot who time" ". . subject star";
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
  padding: 19px 20px 17px 30px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.row:hover { background: #f8fafd; }
.row.active { background: var(--active); }
.row input[type=checkbox] { grid-area: check; }
.row .dot { grid-area: dot; width: 9px; height: 9px; border-radius: 50%; }
.row.unread .dot { background: var(--accent); }
.row .who { grid-area: who; font-size: 17px; font-weight: 700; }
.row .subject { grid-area: subject; color: var(--text); font-size: 16px; }
.row.unread .subject { font-weight: 600; }
.row .who, .row .subject { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row .time { grid-area: time; padding-left: 12px; color: var(--dim); font-size: 14px; white-space: nowrap; }
.row.unread .time { color: var(--text); font-weight: 600; }
.row .star { grid-area: star; justify-self: end; width: 30px; height: 30px; margin: -4px -6px -4px 0; color: #b9c0cb; opacity: 0; }
.row:hover .star, .row:focus-within .star, .row .star.on { opacity: 1; }
.row .star .i { width: 18px; height: 18px; }
.row .star.on { color: var(--star); }
.row .star.on .i { fill: var(--star); }
.empty { max-width: 560px; margin: 0 auto; padding: 56px 24px; text-align: center; color: var(--dim); line-height: 1.6; }
.empty p { margin: 0 0 18px; }

/* Reading pane */
.read-pane { overflow-y: auto; }
/* The preview column exists only while a message is open; otherwise the list takes the full width. */
.app.reading { grid-template-columns: 296px minmax(340px, 540px) minmax(0, 1fr); }
.app:not(.reading) .read-pane { display: none; }
.read { padding: 26px 32px 32px; }
.r-head { display: flex; align-items: center; gap: 6px; }
.r-head h1 { flex: 1; min-width: 0; margin: 0; font-size: 28px; font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.r-from { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; align-items: start; margin: 26px 0 24px; }
.r-line { overflow-wrap: anywhere; }
.r-line strong { font-size: 16px; }
.r-line .dim { font-size: 15px; }
.to-toggle { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; padding: 2px 0; color: var(--dim); font-size: 15px; }
.to-toggle span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.to-toggle .i { width: 16px; height: 16px; }
.to-toggle[aria-expanded=true] .i { rotate: 180deg; }
.details {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 14px;
  margin: 8px 0 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
}
.details dt { color: var(--dim); }
.details dd { margin: 0; overflow-wrap: anywhere; }
.r-date { padding-top: 2px; font-size: 15px; white-space: nowrap; }
.images-note {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 10px;
  background: #f5f7fb;
  color: var(--dim);
  font-size: 14px;
  text-align: left;
}
.images-note u { color: var(--accent); }
#r-body { display: block; width: 100%; height: 120px; border: 0; }

.r-files { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line); }
.r-files p { margin: 0 0 14px; font-size: 16px; }
.files { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 12px; }
.file {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--text);
  text-decoration: none;
}
.file:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.ftype {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 50px;
  border-radius: 6px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.ftype.pdf { background: #e5322d; } .ftype.img { background: #0f9d58; } .ftype.doc { background: #2b6cd8; }
.ftype.xls { background: #1d7044; } .ftype.ppt { background: #d24726; } .ftype.zip { background: #8a6d3b; }
.ftype.other { background: #667085; }
.fmeta { display: flex; flex-direction: column; min-width: 0; }
.fmeta strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.fmeta span { color: var(--dim); font-size: 14px; }
.dl {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-left: auto;
  border-radius: 10px;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}
.dl .i { width: 22px; height: 22px; stroke-width: 2.2; }

.r-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 30px; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 16px;
  font-weight: 500;
}
.pill:hover { background: var(--hover); }
.pill .i { width: 22px; height: 22px; }
.phone-only { display: none !important; }

/* Settings: section menu on the left, one section at a time, save bar always in reach */
.settings { grid-column: 2 / -1; overflow-y: auto; padding: 22px 32px 0; }
.app.settings-open .list-pane, .app.settings-open .read-pane,
.app.bulk-open .list-pane, .app.bulk-open .read-pane { display: none; }
.s-head { display: flex; align-items: center; gap: 10px; }
.s-head h1 { margin: 0; font-size: 26px; font-weight: 700; }
.note { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; max-width: 1116px; margin: 18px 0 0; padding: 12px 16px; border-radius: 12px; background: #fef7e0; }
.link-btn { padding: 0; color: var(--accent); font-weight: 600; text-decoration: underline; }

.s-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 36px; align-items: start; margin-top: 22px; }
.s-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 4px; }
.s-nav button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 11px 14px;
  border-radius: 11px;
  color: var(--dim);
  font-size: 15px;
  text-align: left;
}
.s-nav button:hover { background: var(--hover); color: var(--text); }
.s-nav button[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.s-pane { max-width: 860px; padding-bottom: 28px; }
.s-pane h2 { margin: 0; font-size: 21px; font-weight: 700; }
.s-desc { max-width: 640px; margin: 4px 0 18px; color: var(--dim); }
.s-card { padding: 18px 22px 22px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.s-card + .s-card, .s-card + .s-grid { margin-top: 16px; }
.s-card h3 { margin: 0 0 2px; font-size: 16px; }
.s-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }
.s-grid > .s-card { margin-top: 0; }
.s-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0 14px; max-width: 620px; }
.s-pair:has(.narrow) { grid-template-columns: minmax(0, 1fr) 110px; }

/* Fields: label above its input */
.settings fieldset { max-width: 780px; margin: 22px 0 0; padding: 18px 0 0; border: 0; border-top: 1px solid var(--line); }
.settings legend { padding: 0 8px 0 0; font-size: 16px; font-weight: 600; }
.settings label { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; max-width: 460px; margin: 14px 0 0; font-size: 14px; font-weight: 600; }
.s-pair label { max-width: none; }
.settings label input, .settings label select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font-size: 15px;
  font-weight: 400;
}
.settings label input:focus, .settings label select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.settings label.check { display: flex; align-items: center; gap: 10px; max-width: none; font-weight: 400; }
.settings label.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.settings .hint { max-width: 560px; margin: 10px 0 0; color: var(--dim); font-size: 13px; }

.theme-row { margin-top: 14px; }
.theme-label { display: block; margin-bottom: 8px; font-size: 14px; font-weight: 600; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.settings label.swatch {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: none;
  margin: 0;
  padding: 6px 14px 6px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
}
.settings .swatch input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.swatch span { width: 24px; height: 24px; border-radius: 50%; background: var(--accent); }
.settings label.swatch:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, #fff); font-weight: 600; }
.swatch:has(input:checked) span { box-shadow: inset 0 0 0 3px #fff, 0 0 0 1px var(--accent); }
.swatch:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }

.s-actions { display: flex; align-items: center; gap: 14px; margin-top: 28px; }
#s-status.error { color: var(--danger); }
.s-bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -32px;
  padding: 12px 32px 16px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, #fff 92%, transparent);
  backdrop-filter: blur(6px);
}
.s-bar .s-actions { margin-top: 0; }
.results { max-width: 780px; padding: 0; list-style: none; }
.results li { margin: 6px 0; padding: 10px 14px; border-radius: 10px; overflow-wrap: anywhere; }
.results .ok { background: #e6f4ea; color: #137333; }
.results .bad { background: #fce8e6; color: var(--danger); }
.s-bar .results { max-height: 30vh; margin: 0 0 10px; overflow-y: auto; }
.s-bar .results:empty { display: none; }

/* Bulk send */
.pill.small { padding: 6px 14px; font-size: 14px; gap: 6px; color: var(--text); text-decoration: none; }
.b-input {
  display: block;
  width: 100%;
  max-width: 780px;
  margin: 12px 0 0;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  font: inherit;
}
textarea.b-input { resize: vertical; min-height: 110px; }
.b-input:focus, .b-compose:focus-within { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.b-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 780px; margin-top: 12px; }
.b-row .b-input { flex: 1; min-width: 200px; margin: 0; }
.settings label.b-file { display: inline-flex; max-width: none; margin: 0; font-size: 16px; font-weight: 500; cursor: pointer; }
.b-file .i { width: 18px; height: 18px; }
.b-summary { max-width: 780px; margin-top: 12px; padding: 12px 16px; border-radius: 12px; background: #e6f4ea; color: #137333; }
.b-summary.bad { background: #fce8e6; color: var(--danger); }
.b-summary p { margin: 2px 0; overflow-wrap: anywhere; }
.b-summary p + p { font-size: 14px; }
.b-compose { max-width: 780px; margin-top: 12px; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.b-compose .tools { padding: 4px 8px; border-bottom: 1px solid var(--line); }
.b-compose .editor { min-height: 220px; max-height: 480px; }
.bulk-view .s-actions { flex-wrap: wrap; }

.campaigns { max-width: 780px; }
.campaign { margin-top: 16px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; }
.c-top { display: flex; align-items: baseline; gap: 12px; }
.c-top strong { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 16px; }
.c-state { padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--hover); color: var(--dim); }
.is-sending .c-state { background: var(--accent-soft); color: var(--accent); }
.is-paused .c-state { background: #fef3c7; color: #92400e; }
.is-done .c-state { background: #e6f4ea; color: #137333; }
.progress { height: 8px; margin: 12px 0 8px; border-radius: 999px; background: var(--hover); overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width .4s; }
.is-done .progress span { background: #1f9a6a; }
.is-paused .progress span { background: #d99a06; }
.c-meta { color: var(--dim); font-size: 14px; }
.c-info { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: #fef3c7; color: #92400e; font-size: 14px; overflow-wrap: anywhere; }
.c-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.c-actions:empty { display: none; }

.b-blocked { margin-top: 32px !important; }
.b-blocked-list { max-width: 780px; max-height: 260px; margin: 12px 0 0; padding: 0; overflow-y: auto; list-style: none; }
.b-blocked-list li { display: flex; align-items: center; gap: 12px; padding: 4px 4px 4px 12px; border-bottom: 1px solid var(--line); }
.b-blocked-list li span:first-child { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.b-blocked-list .dim { font-size: 13px; }


/* Compose window */
.compose {
  position: fixed;
  right: 28px;
  bottom: 0;
  z-index: 50;
  width: min(580px, calc(100vw - 16px));
  height: min(620px, calc(100vh - 16px));
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 12px 40px rgba(16, 24, 40, .25);
  overflow: hidden;
}
.compose header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 20px;
  background: var(--accent-soft);
  font-weight: 600;
}
.c-field { display: flex; align-items: center; gap: 10px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.c-field span { width: 32px; color: var(--dim); font-size: 14px; }
.c-field input, .c-subject { flex: 1; min-width: 0; padding: 10px 0; border: 0; outline: 0; }
.c-subject { flex: none; padding: 12px 20px; border-bottom: 1px solid var(--line); font-weight: 500; }
.editor { flex: 1; overflow-y: auto; padding: 14px 20px; outline: 0; line-height: 1.6; }
.editor blockquote { margin: 0 0 0 .8ex; padding-left: 1ex; border-left: 2px solid var(--line-strong); color: var(--dim); }
.compose footer { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); }
.compose footer .primary { padding: 10px 22px; }
.compose footer .primary .i { width: 18px; height: 18px; }
.tools { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }
.tools .icon-btn { width: 34px; height: 34px; border-radius: 8px; font-size: 15px; color: var(--text); }
.tools label.icon-btn { cursor: pointer; }
.c-note { padding: 0 20px; color: var(--dim); font-size: 13px; }
.c-note:not(:empty) { padding-bottom: 10px; }

.toast {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 60;
  max-width: min(480px, calc(100vw - 48px));
  padding: 12px 20px;
  border-radius: 10px;
  background: #202124;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .2);
}

/* Narrower screens: list and reading pane share one column */
@media (max-width: 1180px) {
  .app, .app.reading { grid-template-columns: 264px minmax(0, 1fr); }
  .top .brand { width: 216px; }
  .list-pane, .read-pane, .settings { grid-column: 2; grid-row: 1; }
  .app.reading .list-pane { display: none; }
}

/* Phones: folders slide in from the left */
@media (max-width: 760px) {
  .top { height: 64px; gap: 6px; padding: 0 10px; }
  .top .brand { width: auto; font-size: 0; }
  .logo { width: 32px; height: 32px; }
  #search input { padding: 11px 14px 11px 44px; font-size: 15px; }
  #search .i { left: 14px; width: 20px; height: 20px; }
  .avatar.lg { width: 38px; height: 38px; font-size: 15px; }
  .phone-only { display: inline-flex !important; }
  .app, .app.reading { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; }
  .list-pane, .read-pane, .settings { grid-column: 1; border-radius: 0; box-shadow: none; }
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 45;
    width: 290px;
    padding-top: 16px;
    background: var(--bg);
    translate: -105% 0;
    transition: translate .2s;
  }
  .app.nav-open .side { translate: 0 0; }
  .scrim { position: fixed; inset: 0; z-index: 44; background: rgba(16, 24, 40, .35); }
  .list-bar { padding-left: 16px; }
  .row { padding: 14px 14px 12px 16px; }
  .read { padding: 18px 16px 28px; }
  .r-head h1 { font-size: 22px; }
  .r-from { grid-template-columns: auto minmax(0, 1fr); }
  .r-date { grid-column: 2; padding: 0; font-size: 13px; }
  .settings { padding: 16px 16px 0; }
  .s-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 14px; }
  .s-nav { position: static; flex-direction: row; gap: 6px; overflow-x: auto; scrollbar-width: none; }
  .s-nav button { width: auto; padding: 8px 12px; white-space: nowrap; }
  .s-card { padding: 14px 16px 18px; }
  .s-bar { margin: 0 -16px; padding: 10px 16px 14px; }
  .compose { right: 0; width: 100vw; height: 100dvh; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

.bulk-view .hint { max-width: 780px; margin-left: 0; }

/* Uploaded logo and favicon */
.logo-img { width: auto; max-width: 190px; height: 38px; object-fit: contain; flex-shrink: 0; }
.brand-files { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; max-width: 620px; margin-top: 18px; }
.brand-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 76px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--bg);
}
.brand-preview img { max-width: 85%; max-height: 46px; object-fit: contain; }
.brand-preview .logo { width: 38px; height: 38px; }
.brand-preview.square img, .brand-preview.square .logo { width: 32px; height: 32px; }
.brand-file .b-row { margin-top: 10px; }
.settings label.b-file.small { font-size: 14px; }

/* Inbox switched off: sending only */
.app.no-inbox #system-folders, .app.no-inbox .nav-head, .app.no-inbox #user-folders,
.app.no-inbox .list-bar, .app.no-inbox #list { display: none; }
.start { padding: 56px 32px; text-align: center; }
.start h2 { margin: 0; font-size: 24px; }
.start > p { margin: 6px 0 28px; color: var(--dim); }
.start-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 240px)); justify-content: center; gap: 16px; }
.start-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 24px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}
.start-card:hover { border-color: var(--tone); box-shadow: 0 6px 18px color-mix(in srgb, var(--tone) 18%, transparent); }
.start-card .tile { width: 52px; height: 52px; margin-bottom: 6px; border-radius: 14px; }
.start-card .tile .i { width: 26px; height: 26px; }
.start-card strong { font-size: 17px; }
.start-card span:last-child { color: var(--dim); font-size: 14px; }
.results .off { background: var(--hover); color: var(--dim); }

/* Bulk send: tabs, history table, details */
.b-note p { margin: 0; }
.b-note p + p { margin-top: 4px; font-size: 14px; }
.b-note { display: block; }
.b-tabs { display: flex; gap: 4px; max-width: 980px; margin-top: 24px; border-bottom: 1px solid var(--line); }
.b-tabs button {
  margin-bottom: -1px;
  padding: 10px 16px;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  color: var(--dim);
  font-weight: 500;
}
.b-tabs button:hover { background: var(--hover); color: var(--text); }
.b-tabs button[aria-selected=true] { border-bottom-color: var(--accent); color: var(--accent); font-weight: 600; }
.b-tabs .count:not(:empty) { margin-left: 4px; padding: 0 7px; border-radius: 999px; background: var(--hover); color: var(--dim); font-size: 12px; font-weight: 600; }
[data-bpane] > form > fieldset:first-child, [data-bpane] > .b-blocked { margin-top: 8px; border-top: 0; }
.b-hist-hint { margin: 16px 0 12px !important; }
.campaigns:empty { display: none; }

.b-table { width: 100%; max-width: 980px; border-collapse: collapse; font-size: 14px; }
.b-table th { padding: 10px 12px; border-bottom: 1px solid var(--line-strong); color: var(--dim); font-size: 13px; font-weight: 600; text-align: left; white-space: nowrap; }
.b-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.b-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.b-table th:nth-child(n+3):nth-child(-n+5) { text-align: right; }
.b-table td.bad { color: var(--danger); font-weight: 600; }
.b-table.history tbody tr { cursor: pointer; }
.b-table.history tbody tr:hover { background: var(--active); }
.b-table.history .subject { font-weight: 600; }
.b-table.recipients th:nth-child(n+3):nth-child(-n+5) { text-align: left; }
.b-table.recipients .email, .b-table.recipients .reply { overflow-wrap: anywhere; }
.b-table.recipients .reply { max-width: 360px; color: var(--dim); font-size: 13px; }
.b-table.recipients .r-failed td:nth-child(2), .b-table.recipients .r-failed .reply { color: var(--danger); }
.b-table.recipients .r-sent td:nth-child(2) { color: #137333; }
.b-detail-head { margin: 8px 0 4px; }
.b-more { margin-top: 12px; }
@media (max-width: 760px) {
  .b-table.history th:nth-child(2), .b-table.history td:nth-child(2) { display: none; }
  .b-table.recipients th:nth-child(3), .b-table.recipients td:nth-child(3) { display: none; }
  .b-tabs { overflow-x: auto; }
  .b-tabs button { white-space: nowrap; }
}
.bulk-view .campaigns, #b-detail .campaign { max-width: 980px; }

/* Pictures in the editors */
.editor img { max-width: 100%; height: auto; border-radius: 4px; }
.tools label.icon-btn input { display: none; }

/* Live progress of a running bulk send */
.c-live { margin-top: 10px; }
.c-live-line { font-weight: 600; font-variant-numeric: tabular-nums; }
.c-recent { margin: 8px 0 0; padding: 0; list-style: none; font-size: 13px; }
.c-recent li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border-top: 1px dashed var(--line); }
.c-recent li span:first-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.c-recent .sent span:first-child { color: #137333; }
.c-recent .failed span:first-child { color: var(--danger); }
.bulk-pill {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 55;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: min(360px, calc(100vw - 32px));
  padding: 10px 16px 12px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .18);
  translate: -50% 0;
  text-align: left;
  font-size: 14px;
}
.bulk-pill .pill-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 600; }
.bulk-pill .progress { height: 6px; margin: 0; }

/* Preview before sending */
.preview {
  width: min(760px, calc(100vw - 24px));
  max-height: calc(100vh - 40px);
  padding: 0;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, .3);
  color: var(--text);
}
.preview::backdrop { background: rgba(16, 24, 40, .45); }
.preview[open] { display: flex; flex-direction: column; }
.preview header { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 22px; border-bottom: 1px solid var(--line); }
.preview header .dim { flex: 1; font-size: 14px; }
.p-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; margin: 0; padding: 14px 22px; border-bottom: 1px solid var(--line); font-size: 14px; }
.p-head dt { color: var(--dim); }
.p-head dd { margin: 0; overflow-wrap: anywhere; }
#p-subject { font-weight: 600; }
.p-files:not(:empty) { padding: 12px 22px 0; }
#p-body { display: block; width: 100%; height: 200px; min-height: 120px; padding: 0 22px; border: 0; flex-shrink: 0; }
.preview > iframe { overflow: hidden; }
.preview footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; margin-top: auto; padding: 14px 22px; border-top: 1px solid var(--line); background: #fff; }
.preview { overflow-y: auto; }
.preview footer { position: sticky; bottom: 0; }
.pill .i { width: 18px; height: 18px; }

/* Bulk send, redesigned: header with chips, folded tips, step cards beside a sticky summary */
.b-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 24px; max-width: 1160px; }
.b-head .s-head { align-items: flex-start; }
.b-head .s-head .icon-btn { margin-top: 2px; }
.b-sub { margin: 2px 0 0; color: var(--dim); }
.b-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 11px; border-radius: 999px; background: var(--hover); color: var(--dim); font-size: 13px; white-space: nowrap; }
.chip strong { color: var(--text); font-weight: 600; }
.chip .i { width: 14px; height: 14px; }
.b-tips { max-width: 1160px; margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.b-tips summary { padding: 11px 16px; cursor: pointer; color: var(--dim); font-size: 14px; font-weight: 600; }
.b-tips summary:hover { color: var(--text); }
.b-tips #b-note { padding: 0 16px 12px; }
.b-tips #b-note p { margin: 4px 0; color: var(--dim); font-size: 14px; }
.bulk-view .campaigns, .bulk-view .b-tabs, .bulk-view .b-table, #b-detail .campaign { max-width: 1160px; }

.b-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; max-width: 1160px; margin-top: 20px; }
.b-card { padding: 20px 22px 22px; border: 1px solid var(--line); border-radius: 16px; background: #fff; }
.b-card + .b-card { margin-top: 16px; }
.b-card h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 17px; }
.b-desc { margin: 6px 0 0; color: var(--dim); font-size: 14px; }
.step { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-size: 13px; font-weight: 700; }
.b-card .b-input, .b-card .b-compose, .b-card .b-row, .b-card .b-summary { max-width: none; }
.b-card .hint { max-width: none; margin-top: 10px; }
.b-card textarea.b-input { min-height: 130px; font-family: inherit; }

/* one button size across the page */
.bulk-view .pill, .bulk-view .primary { min-height: 40px; padding: 0 16px; gap: 8px; font-size: 15px; justify-content: center; }
.bulk-view .pill.small { min-height: 34px; padding: 0 12px; font-size: 14px; }
.bulk-view .pill .i, .bulk-view .primary .i { width: 18px; height: 18px; }
.settings .bulk-view label.b-file, .bulk-view label.b-file { min-height: 40px; font-size: 15px; font-weight: 500; }

.b-subject-row { display: flex; gap: 8px; align-items: center; margin-top: 14px; }
.b-subject-row .b-input { flex: 1; margin: 0; }
.b-field-btn { font-family: inherit; white-space: nowrap; }
.b-compose .tools { align-items: center; }
.tool-sep { width: 1px; height: 20px; margin: 0 4px; background: var(--line-strong); }
.tools-end { margin-left: auto; }
.b-fields { min-width: 260px; }
.b-fields button code { min-width: 92px; color: var(--accent); font-size: 13px; }
.menu-note { margin: 6px 4px 2px; padding: 8px 8px 2px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; white-space: normal; }
.b-attachments { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.b-attachments:empty { display: none; }
.b-summary { padding: 10px 14px; font-size: 14px; }
.b-summary p + p { font-size: 13px; }

.b-aside { position: sticky; top: 0; }
.b-sum h3 { margin-bottom: 12px; }
.b-sum dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 10px 14px; margin: 0; font-size: 14px; }
.b-sum dt { color: var(--dim); }
.b-sum dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-weight: 500; }
.b-sum dd.ok { color: #137333; font-weight: 600; }
.b-sum dd.bad { color: var(--danger); }
.b-sum dd.dim { font-weight: 400; }
.b-sum-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.b-sum-actions .primary { grid-column: 1 / -1; min-height: 46px; font-size: 16px; }
.b-sum-actions .pill { padding: 0 10px; font-size: 14px; }
#b-status { margin: 10px 0 0; font-size: 13px; }
#b-status:empty { display: none; }
.b-blocked { max-width: 760px; margin-top: 8px; }

@media (max-width: 1180px) {
  .b-grid { grid-template-columns: minmax(0, 1fr); }
  .b-aside { position: static; }
}
@media (max-width: 760px) {
  .b-card { padding: 16px; }
  .b-head { align-items: flex-start; }
  .b-subject-row .b-field-btn span { display: none; }
}
.bulk-view .tools label.icon-btn { display: inline-flex; max-width: none; margin: 0; }
.b-tabs { scrollbar-width: none; }

/* Emoji picker */
.emoji-menu { width: 304px; max-height: 330px; padding: 6px 8px 8px; overflow-y: auto; }
.emoji-group p { margin: 6px 4px 4px; color: var(--dim); font-size: 12px; font-weight: 600; }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.menu .emoji-grid button { justify-content: center; width: auto; padding: 4px 0; border-radius: 8px; font-size: 20px; line-height: 1.3; }
.emoji-btn { font-size: 17px; }
.bulk-view .pill.b-emoji-btn { padding: 0 12px; font-size: 18px; }
.compose .emoji-menu { top: auto; bottom: calc(100% + 8px); } /* the compose toolbar sits at the bottom of its window */
