/* ============================================================
   SMTP Mailer — visual design system (v2, premium refresh)
   Same class names as before; only the look changed.
   ============================================================ */
:root {
  --bg: #f4f5f9;
  --bg-tint: radial-gradient(1200px 600px at 100% -10%, #eef1fb 0%, rgba(238,241,251,0) 60%),
             radial-gradient(900px 500px at -10% 0%, #f0fbf6 0%, rgba(240,251,246,0) 55%);
  --surface: #ffffff;
  --surface-2: #f4f6fa;
  --surface-3: #eceff5;
  --border: #e5e8ef;
  --border-strong: #d5dae4;
  --text: #131722;
  --text-soft: #3d4453;
  --muted: #6b7383;
  --accent: #4f46e5;
  --accent-2: #6366f1;
  --accent-strong: #4338ca;
  --accent-soft: #eef0fe;
  --accent-ring: rgba(99, 102, 241, 0.25);
  --green: #12824a;
  --green-soft: #e2f6ec;
  --amber: #9a5b00;
  --amber-soft: #fdf0d8;
  --red: #c4262e;
  --red-soft: #fde7e7;
  --sidebar-1: #171b2b;
  --sidebar-2: #10131f;
  --sidebar-text: #a7afc3;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(20, 28, 46, 0.06), 0 1px 1px rgba(20, 28, 46, 0.04);
  --shadow-md: 0 2px 4px rgba(20, 28, 46, 0.05), 0 8px 24px -8px rgba(20, 28, 46, 0.12);
  --shadow-lg: 0 24px 60px -12px rgba(20, 28, 46, 0.28);
  --ring: 0 0 0 4px var(--accent-ring);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0e15;
    --bg-tint: radial-gradient(1200px 600px at 100% -10%, #16203b 0%, rgba(22,32,59,0) 60%),
               radial-gradient(900px 500px at -10% 0%, #10231c 0%, rgba(16,35,28,0) 55%);
    --surface: #151a24;
    --surface-2: #1b212d;
    --surface-3: #222937;
    --border: #262d3b;
    --border-strong: #333c4d;
    --text: #eef1f6;
    --text-soft: #c3cad6;
    --muted: #8b93a5;
    --accent: #7c85ff;
    --accent-2: #8b8cff;
    --accent-strong: #9aa0ff;
    --accent-soft: #1e2542;
    --accent-ring: rgba(124, 133, 255, 0.28);
    --green: #45c07a;
    --green-soft: #123324;
    --amber: #ecb454;
    --amber-soft: #33280f;
    --red: #f3767d;
    --red-soft: #3a1b1e;
    --sidebar-1: #0d1019;
    --sidebar-2: #070911;
    --sidebar-text: #98a0b4;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
    --shadow-md: 0 8px 24px -10px rgba(0,0,0,0.6);
    --shadow-lg: 0 24px 60px -12px rgba(0,0,0,0.7);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  background-image: var(--bg-tint);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.006em;
}
a { color: var(--accent); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--accent-strong); text-decoration: none; }
h1 { font-size: 23px; margin: 0; letter-spacing: -0.02em; font-weight: 680; }
h2 { font-size: 15px; margin: 0 0 12px; letter-spacing: -0.01em; font-weight: 650; }
code, textarea.code { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.error-text { color: var(--red); }
::selection { background: var(--accent-ring); }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: padding-box; }

/* Layout */
.layout { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  background: linear-gradient(180deg, var(--sidebar-1), var(--sidebar-2));
  color: var(--sidebar-text);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 3px;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid rgba(255,255,255,0.05);
}
.brand { color: #fff; font-weight: 750; font-size: 16.5px; padding: 6px 10px 20px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 8px; }
.nav a {
  display: flex; align-items: center; gap: 9px; color: var(--sidebar-text);
  padding: 9px 12px; border-radius: 9px; font-weight: 500; font-size: 13.5px;
  position: relative; transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, 0.10); color: #fff; font-weight: 600; }
.nav a.active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 18px; border-radius: 0 3px 3px 0; background: linear-gradient(var(--accent-2), var(--accent));
}
.sidebar .spacer { flex: 1; }
.sidebar .user { padding: 12px 12px 2px; font-size: 12.5px; border-top: 1px solid rgba(255,255,255,0.07); margin-top: 6px; }
.sidebar .user > div:first-child { color: #eef; font-weight: 600; margin-bottom: 4px; }
.sidebar .user button { display: block; margin-top: 5px; }
.main { padding: 28px 40px 64px; min-width: 0; width: 100%; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 4px; }
  .brand { padding: 0 10px; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav a.active::before { display: none; }
  .sidebar .spacer { display: none; }
  .sidebar .user { padding: 4px 10px; border-top: 0; margin-top: 0; }
  .main { padding: 20px 16px 48px; }
}

/* Cards & grids */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm); min-width: 0;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.2s;
}
.card + .card { margin-top: 18px; }
.grid { display: grid; gap: 18px; }
.grid .card + .card { margin-top: 0; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-stats { grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); margin-bottom: 18px; }

/* Stat tiles */
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s;
}
.stat:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stat::after {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent-2), var(--accent)); opacity: 0.8;
}
.stat .label { color: var(--muted); font-size: 12px; font-weight: 550; text-transform: uppercase; letter-spacing: 0.03em; }
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 14px; color: var(--muted); font-weight: 500; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.empty { text-align: center; padding: 32px 12px; color: var(--muted); }
.stack > * + * { margin-top: 12px; }

/* Buttons */
button, .btn {
  font: inherit; font-weight: 550; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-soft); padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; line-height: 1.2;
  box-shadow: var(--shadow-sm); transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.05s, filter 0.15s;
}
button:hover, .btn:hover { background: var(--surface-2); border-color: var(--muted); text-decoration: none; }
button:active, .btn:active { transform: translateY(0.5px); }
button:disabled { opacity: 0.5; cursor: default; box-shadow: none; transform: none; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-color: var(--accent-strong);
  color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,0.35), 0 6px 16px -6px rgba(79,70,229,0.5);
}
.btn-primary:hover { filter: brightness(1.07); border-color: var(--accent-strong); background: linear-gradient(180deg, var(--accent-2), var(--accent)); }
.btn-danger { color: var(--red); border-color: var(--border-strong); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn-sm { padding: 4px 10px; font-size: 12.5px; border-radius: 7px; }
.btn-link { border: 0; background: none; color: var(--accent); padding: 0; box-shadow: none; font-weight: 550; }
.btn-link:hover { background: none; color: var(--accent-strong); text-decoration: underline; }
.sidebar .btn-link { color: var(--sidebar-text); }
.sidebar .btn-link:hover { color: #fff; }

/* Forms */
label.field { display: block; }
label.field > span { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text-soft); }
label.field .hint { display: block; color: var(--muted); font-size: 12px; margin-top: 4px; font-weight: 400; }
input, select, textarea {
  font: inherit; color: var(--text); background: var(--surface); border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 8px 11px; width: 100%; transition: border-color 0.15s, box-shadow 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.75; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
input[type="checkbox"], input[type="radio"] { width: auto; margin: 0; accent-color: var(--accent); width: 16px; height: 16px; }
textarea { resize: vertical; }
textarea.code { min-height: 420px; line-height: 1.5; tab-size: 2; white-space: pre; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 2px 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.section-title { font-weight: 680; font-size: 14px; margin: 24px 0 12px; padding-top: 18px; border-top: 1px solid var(--border); letter-spacing: -0.01em; }
.section-title:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar input[type="search"] { max-width: 280px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.chip:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; box-shadow: var(--shadow-sm); }
.segmented button { border: 0; border-radius: 0; box-shadow: none; }
.segmented button + button { border-left: 1px solid var(--border); }
.segmented button.active { background: var(--accent-soft); color: var(--accent); font-weight: 650; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.03em; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }
td.actions button + button { margin-left: 5px; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; gap: 8px; }

/* Badges & progress */
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--muted); white-space: nowrap; border: 1px solid transparent; letter-spacing: 0.01em; }
.badge.green { background: var(--green-soft); color: var(--green); }
.badge.amber { background: var(--amber-soft); color: var(--amber); }
.badge.red { background: var(--red-soft); color: var(--red); }
.badge.blue { background: var(--accent-soft); color: var(--accent); }
.progress { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; min-width: 80px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 99px; transition: width 0.4s ease; }
.progress.green > div { background: linear-gradient(90deg, #26c281, var(--green)); }
.progress-label { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; gap: 8px; }

.notice { padding: 12px 15px; border-radius: var(--radius-sm); background: var(--amber-soft); color: var(--amber); margin-bottom: 12px; border: 1px solid color-mix(in srgb, var(--amber) 22%, transparent); font-size: 13px; }
.notice.info { background: var(--accent-soft); color: var(--accent-strong); border-color: color-mix(in srgb, var(--accent) 22%, transparent); }
.notice.error { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 22%, transparent); }
.status-line { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.dot.live { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 3px var(--green-soft); } 50% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--green) 12%, transparent); } }

/* Chart */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 10px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; }
.bars .bar div { width: 100%; max-width: 30px; background: linear-gradient(180deg, var(--accent-2), var(--accent)); border-radius: 5px 5px 0 0; min-height: 2px; transition: filter 0.15s; }
.bars .bar:hover div { filter: brightness(1.12); }
.bars .bar.zero div { background: var(--border-strong); }
.bars .bar span { font-size: 10.5px; color: var(--muted); margin-top: 5px; white-space: nowrap; }

/* Activity */
.activity { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; }
.activity li { padding: 9px 0; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: auto 1fr; gap: 10px; font-size: 13px; }
.activity li:last-child { border-bottom: 0; }
.activity time { color: var(--muted); font-size: 12px; white-space: nowrap; }
.activity .error { color: var(--red); }
.activity .warning { color: var(--amber); }

/* Accounts */
.account-card .meta { color: var(--muted); font-size: 12.5px; margin: 2px 0 12px; overflow-wrap: anywhere; }
.account-card .buttons { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }

/* Editor & preview */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } }
.preview-frame { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; display: block; margin: 0 auto; transition: max-width 0.2s; box-shadow: var(--shadow-sm); }
.preview-subject { font-size: 13px; margin-bottom: 10px; overflow-wrap: anywhere; }
pre.text-preview { white-space: pre-wrap; background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px; margin: 0; max-height: 640px; overflow: auto; font-size: 12.5px; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(12, 15, 24, 0.55); backdrop-filter: blur(3px); display: flex; align-items: flex-start; justify-content: center; padding: 7vh 16px; z-index: 50; overflow-y: auto; animation: fade 0.15s ease; }
.modal { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; width: 100%; max-width: 620px; padding: 24px; box-shadow: var(--shadow-lg); animation: pop 0.18s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.modal h2 { font-size: 17px; margin-bottom: 16px; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }

/* Toasts */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: calc(100vw - 36px); }
.toast { background: #10131c; color: #f3f5fa; padding: 12px 16px; border-radius: 11px; box-shadow: var(--shadow-lg); max-width: 420px; font-size: 13px; font-weight: 500; border: 1px solid rgba(255,255,255,0.08); animation: slidein 0.22s cubic-bezier(0.2,0.9,0.3,1.2); }
.toast.error { background: var(--red); color: #fff; border-color: transparent; }
@keyframes slidein { from { opacity: 0; transform: translateX(16px); } to { opacity: 1; transform: none; } }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: 100%; max-width: 380px; padding: 32px; box-shadow: var(--shadow-md); }
.login h1 { margin-bottom: 6px; }

/* Warmup schedule editor */
.schedule { display: grid; gap: 6px; }
.schedule-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.schedule-row .sched-week { min-width: 84px; font-weight: 550; }
.schedule-row .sched-num { width: 76px; padding: 6px 8px; text-align: center; }
input[type="time"] { max-width: 160px; }

/* Import & bulk actions */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); padding: 40px 16px; text-align: center; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.dropzone:hover, .dropzone:focus, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); outline: none; }
th.highlight, td.highlight { background: var(--accent-soft); }
.bulk-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px; border-radius: var(--radius-sm); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent); }
.modal .grid-stats { margin: 14px 0 0; }

/* Lists */
.list-name-box { padding: 16px; margin: 0 0 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.list-name-box input { background: var(--surface); font-size: 15px; }
a.badge:hover { text-decoration: none; filter: brightness(0.96); }
.toolbar select { width: auto; }

/* Email check */
.check-summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--border); }
.check-pills, .check-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.check-pill { border-radius: 99px; padding: 4px 12px; font-size: 12.5px; background: var(--surface-2); border: 1px solid var(--border); }
.check-pill.green b { color: var(--green); }
.check-pill.amber b { color: var(--amber); }
.check-pill.red b { color: var(--red); }
.check-pill.active { border-color: var(--accent); background: var(--accent-soft); }
.check-panel { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 12px 14px; margin-bottom: 14px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.check-panel.green { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 20%, transparent); }
.check-panel.amber { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 20%, transparent); }
.check-panel.red { background: var(--red-soft); border-color: color-mix(in srgb, var(--red) 20%, transparent); }

/* Account DNS health */
.dns-block { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.dns-lines { display: flex; gap: 16px; flex-wrap: wrap; }
.dns-line { display: inline-flex; align-items: baseline; gap: 5px; cursor: help; }
.dns-line .dns-mark { font-weight: 700; }
.dns-line.green .dns-mark { color: var(--green); }
.dns-line.amber .dns-mark { color: var(--amber); }
.dns-line.red .dns-mark { color: var(--red); }

/* Lists page */
.list-rows { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 0; border-bottom: 1px solid var(--border); }
.list-rows .list-row:last-child { border-bottom: 0; }
.list-row-all, .list-row-unlisted { border-bottom: 1px solid var(--border); }
.list-row-unlisted:last-child { border-bottom: 0; }
.list-row-main { min-width: 0; }
.list-row-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* Pacing panel */
.pace-panel { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--surface-2); font-size: 12.5px; line-height: 1.7; }
.pace-panel > div { color: var(--text); }

/* Template editor upgrades */
.starter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 12px 14px; margin-bottom: 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); background: var(--surface-2); }
.subj-nav { display: flex; align-items: center; margin-bottom: 8px; }
.health-list { display: flex; flex-direction: column; gap: 8px; }
.health-row { display: grid; grid-template-columns: 20px 1fr; gap: 8px; align-items: start; font-size: 13px; line-height: 1.45; }
.health-icon { font-weight: 700; text-align: center; }
.health-row.green .health-icon { color: var(--green); }
.health-row.amber .health-icon { color: var(--amber); }
.health-row.red .health-icon { color: var(--red); }
.health-summary { display: flex; gap: 6px; }

/* Sending days */
.day-row { display: flex; gap: 6px; flex-wrap: wrap; }
.day-check { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border: 1.5px solid var(--border-strong); border-radius: var(--radius-sm); font-size: 13px; cursor: pointer; transition: background 0.15s, border-color 0.15s; }
.day-check:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); font-weight: 650; }

/* Details/summary polish (settings, lead finder) */
details.card > summary { cursor: pointer; font-weight: 600; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::before { content: "▸"; display: inline-block; margin-right: 8px; color: var(--muted); transition: transform 0.15s; }
details.card[open] > summary::before { transform: rotate(90deg); }

/* ============================================================
   Nav unread badge
   ============================================================ */
.nav-badge {
  margin-left: auto; display: inline-flex; align-items: center; justify-content: center;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: linear-gradient(var(--accent-2), var(--accent)); color: #fff;
  font-size: 11px; font-weight: 700; line-height: 1; box-shadow: 0 1px 4px rgba(79, 70, 229, 0.55);
}

/* ============================================================
   Inbox — professional two-pane mail client
   ============================================================ */
.mail {
  display: grid; grid-template-columns: minmax(300px, 372px) 1fr;
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  background: var(--surface); box-shadow: var(--shadow-md); min-height: 60vh;
}
.mail-list { border-right: 1px solid var(--border); overflow-y: auto; max-height: 74vh; background: var(--surface); }
.mail-list-empty { display: grid; place-items: center; height: 100%; min-height: 300px; color: var(--muted); text-align: center; padding: 30px; }
.mail-item {
  display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.12s; position: relative;
}
.mail-item:hover { background: var(--surface-2); }
.mail-item.active { background: var(--accent-soft); }
.mail-item.active::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: linear-gradient(var(--accent-2), var(--accent)); }
.mail-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; color: #fff; font-weight: 650; font-size: 15px; letter-spacing: -0.01em;
}
.mail-item-main { min-width: 0; flex: 1; }
.mail-row1 { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.mail-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.mail-time { color: var(--muted); font-size: 11.5px; white-space: nowrap; flex-shrink: 0; }
.mail-subject { font-size: 13.5px; margin: 2px 0 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-soft); }
.mail-snippet { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mail-item.unread .mail-name { font-weight: 750; }
.mail-item.unread .mail-subject { font-weight: 650; color: var(--text); }
.mail-item.unread .mail-avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); }

.mail-read { display: flex; flex-direction: column; min-width: 0; max-height: 74vh; }
.mail-read-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); }
.mail-read-subject { font-size: 18px; font-weight: 680; letter-spacing: -0.02em; margin: 0 0 10px; }
.mail-read-meta { display: flex; align-items: center; gap: 12px; }
.mail-read-meta .mail-avatar { width: 44px; height: 44px; font-size: 16px; }
.mail-read-body { padding: 22px 24px; overflow-y: auto; flex: 1; font-size: 14px; line-height: 1.65; white-space: pre-wrap; word-break: break-word; color: var(--text-soft); }
.mail-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 24px 4px; }
.mail-reply { border-top: 1px solid var(--border); padding: 14px 20px; background: var(--surface-2); }
.mail-reply textarea { background: var(--surface); }
.mail-empty { display: grid; place-items: center; color: var(--muted); text-align: center; padding: 40px; height: 100%; }
.mail-empty .big { font-size: 34px; opacity: 0.5; margin-bottom: 10px; }
.mail-back { display: none; }

@media (max-width: 900px) {
  .mail { grid-template-columns: 1fr; min-height: auto; }
  .mail-list { max-height: none; border-right: 0; }
  .mail-read { display: none; max-height: none; }
  .mail.reading .mail-list { display: none; }
  .mail.reading .mail-read { display: flex; }
  .mail-back { display: inline-flex; }
}

/* Conversation thread (chat) in the reading pane */
.mail-thread { padding: 20px 24px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 14px; }
.chat-msg { max-width: 82%; display: flex; flex-direction: column; }
.chat-msg.in { align-self: flex-start; align-items: flex-start; }
.chat-msg.out { align-self: flex-end; align-items: flex-end; }
.chat-bubble { padding: 11px 15px; border-radius: 16px; white-space: pre-wrap; word-break: break-word; font-size: 13.5px; line-height: 1.6; box-shadow: var(--shadow-sm); }
.chat-msg.in .chat-bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; color: var(--text); }
.chat-msg.out .chat-bubble { background: linear-gradient(180deg, var(--accent-2), var(--accent)); color: #fff; border-bottom-right-radius: 5px; }
.chat-msg.auto .chat-bubble { opacity: 0.9; font-style: italic; }
.chat-meta { font-size: 11px; color: var(--muted); margin: 4px 8px 0; }
/* Rendered HTML inside a sent bubble: keep links/lists readable on the coloured background */
.chat-msg.out .chat-bubble { white-space: normal; }
.chat-msg.out .chat-bubble a { color: #fff; text-decoration: underline; }
.chat-msg.out .chat-bubble p, .chat-msg.out .chat-bubble div { margin: 0 0 6px; }
.chat-msg.out .chat-bubble ul, .chat-msg.out .chat-bubble ol { margin: 4px 0 4px 20px; }
.chat-msg.out .chat-bubble blockquote { border-left: 3px solid rgba(255,255,255,0.5); margin: 4px 0; padding-left: 10px; }

/* Rich-text editor (Inbox compose + reply) — a lightweight Gmail-style toolbar */
.rich-editor { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.rich-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 3px; padding: 6px 8px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); }
.rich-toolbar .rt-btn { min-width: 30px; height: 30px; padding: 0 7px; border: 1px solid transparent;
  background: transparent; border-radius: 6px; cursor: pointer; font-size: 14px; line-height: 1;
  color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.rich-toolbar .rt-btn:hover { background: var(--surface); border-color: var(--border); }
.rich-toolbar .rt-sel { height: 30px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  color: var(--text); font-size: 12.5px; padding: 0 4px; cursor: pointer; }
.rich-toolbar .rt-color-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 6px; cursor: pointer; overflow: hidden; }
.rich-toolbar .rt-color-wrap:hover { background: var(--surface); }
.rich-toolbar .rt-a { font-weight: 800; font-size: 14px; pointer-events: none; }
.rich-toolbar .rt-hl { font-size: 14px; color: #d9b400; pointer-events: none; }
.rich-toolbar .rt-color { position: absolute; left: 0; top: 18px; width: 30px; height: 16px; border: 0;
  padding: 0; background: transparent; cursor: pointer; }
.rich-area { min-height: 150px; max-height: 340px; overflow-y: auto; padding: 12px 14px; outline: none;
  font-family: Arial, Helvetica, sans-serif; font-size: 14px; line-height: 1.55; color: var(--text); }
.rich-area:empty::before { content: attr(data-placeholder); color: var(--muted); }
.rich-area a { color: var(--accent); }
.rich-area blockquote { border-left: 3px solid var(--border); margin: 4px 0; padding-left: 10px; color: var(--muted); }
.mail-reply .rich-editor { background: var(--surface); }

/* Locked preview (following Settings): visible but greyed out and non-interactive */
.pref-locked { opacity: 0.5; pointer-events: none; transition: opacity 0.15s; }
