/* Mailwright
   Palette: cool paper and postal blue. Signal colours are reserved for delivery
   state, never decoration. One radius (3px) on controls, square panels.
   Type: Plex Sans for the interface, Plex Serif for the letter preview (the
   preview is a letter, so it should read like one), Plex Mono only where the
   content really is data: merge tokens, addresses, ids. */

:root {
  --paper: #edf0f3;
  --card: #ffffff;
  --ink: #15202a;
  --ink-soft: #566475;
  --ink-faint: #8794a2;
  --rule: #d7dde3;
  --rule-soft: #e6eaee;
  --accent: #2b4acb;
  --accent-dark: #1f39a8;
  --accent-wash: #eef1fd;
  --sent: #157f5c;
  --queued: #a7761b;
  --failed: #b3392c;
  --focus: #a9b8f0;
  --rail: 232px;
  --sans: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "IBM Plex Serif", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* dashboard shell + status palette */
  --nav-bg: #12172b;
  --nav-bg-soft: #1b2140;
  --nav-ink: #aab0c8;
  --nav-ink-dim: #6c7292;
  --nav-active-bg: #2b4acb;
  --nav-active-ink: #ffffff;
  --shadow-card: 0 1px 2px rgba(20, 24, 44, .04), 0 8px 24px -12px rgba(20, 24, 44, .08);
  --up: #16a34a;
  --up-wash: #eafaf0;
  --down: #dc2626;
  --down-wash: #fdedec;
  --purple: #7c5cfc;
  --purple-wash: #f1edfe;
  --blue: #2b4acb;
  --blue-wash: #eaeefd;
  --amber: #d98a1c;
  --amber-wash: #fdf1de;
  --green: #16a172;
  --green-wash: #e7f8f1;
  --pink: #e0507e;
  --pink-wash: #fdedf2;
  --slate: #6b7280;
  --slate-wash: #eef0f2;
  --r-lg: 16px;
  --r-md: 12px;
  --r-sm: 9px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: #eef1f7;
  color: var(--ink);
  font: 15px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}

.icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: 0 0 auto; line-height: 0; }
.icon svg { display: block; width: 100%; height: 100%; }

a { color: var(--accent); }
h1, h2, h3 { font-weight: 600; letter-spacing: -0.014em; margin: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.0625rem; }
h3 { font-size: .9375rem; }
p { margin: 0 0 .9rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 2px; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- shell ---------- */

.app { display: grid; grid-template-columns: var(--rail) 1fr; min-height: 100vh; }

.rail {
  background: var(--nav-bg);
  color: var(--nav-ink);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 22px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: var(--r-sm); flex: 0 0 auto;
  background: linear-gradient(155deg, #4a5cf7, var(--accent));
  display: grid; place-items: center; color: #fff;
}
.brand-mark .icon { width: 18px; height: 18px; }
.brand b { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.02em; color: #fff; }

.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--r-sm); color: var(--nav-ink);
  text-decoration: none; font-size: .9rem; font-weight: 500;
}
.rail nav a .icon { width: 18px; height: 18px; flex: 0 0 auto; color: var(--nav-ink-dim); }
.rail nav a:hover { background: var(--nav-bg-soft); color: #fff; }
.rail nav a:hover .icon { color: #fff; }
.rail nav a.on { background: var(--nav-active-bg); color: var(--nav-active-ink); box-shadow: 0 6px 16px -6px rgba(43, 74, 203, .7); }
.rail nav a.on .icon { color: #fff; }

.rail-foot { margin-top: auto; padding-top: 14px; }

.quota { padding: 12px 4px 16px; margin-bottom: 2px; border-top: 1px solid rgba(255,255,255,.08); }
.quota-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.quota-label { font-size: .75rem; color: var(--nav-ink); }
.quota-top b { flex: 0 0 auto; font-family: var(--mono); font-size: .75rem; font-weight: 500; color: #fff; }
.meter { flex: 1 1 auto; height: 5px; border-radius: 3px; background: rgba(255,255,255,.12); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #7c5cfc, var(--accent)); }
.meter i[data-full="true"] { background: var(--failed); }

.who { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 14px 4px 10px; border-top: 1px solid rgba(255,255,255,.08); }
.who img, .who-avatar { width: 32px; height: 32px; border-radius: 50%; flex: 0 0 auto; }
.who-avatar { display: grid; place-items: center; background: #4b5468; color: #dfe3ee; }
.who-avatar .icon { width: 18px; height: 18px; }
.who > div:not(.who-avatar) { min-width: 0; flex: 1 1 auto; }
.who strong { display: block; font-size: .8125rem; font-weight: 600; color: #fff; }
.who small { display: block; color: var(--nav-ink-dim); font-size: .75rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-signout { flex: 0 0 100%; display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 6px 4px; border-radius: var(--r-sm); color: var(--nav-ink-dim); background: transparent; border: 0; font-size: .8125rem; font-weight: 500; }
.who-signout .icon { width: 15px; height: 15px; }
.who-signout:hover { background: var(--nav-bg-soft); color: #fff; }
.who-signout span:not(.icon) { display: inline; }

main { min-width: 0; position: relative; }
.page { padding: 30px 36px 72px; max-width: 1240px; margin-inline: auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head p { color: var(--ink-soft); margin: 6px 0 0; max-width: 58ch; }
.page-head-actions { display: flex; align-items: center; gap: 10px; }

.search-box { position: relative; }
.search-box .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: #5c6a88; pointer-events: none; }

.btn-primary {
  border-radius: 10px; padding: 0 18px; height: 38px; gap: 9px;
  font-size: 15px; font-weight: 500;
  background: linear-gradient(180deg, #3f5cdb, var(--accent-dark));
  box-shadow: 0 6px 16px -6px rgba(43, 74, 203, .55);
}
.btn-primary .icon { width: 18px; height: 18px; }

/* ---------- controls ---------- */

button, .btn {
  font: 500 .9375rem/1 var(--sans);
  padding: 10px 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  background: var(--accent); color: #fff; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; gap: 7px;
}
button:hover, .btn:hover { background: var(--accent-dark); }
button:disabled { background: var(--rule); color: var(--ink-faint); cursor: not-allowed; }

.btn-quiet, button.quiet {
  background: var(--card); color: var(--ink); border-color: var(--rule);
}
.btn-quiet:hover, button.quiet:hover { background: var(--paper); border-color: var(--ink-faint); }
button.ghost { background: transparent; color: var(--ink-soft); padding: 6px 8px; }
button.ghost:hover { background: var(--paper); color: var(--ink); }
button.danger { background: var(--card); color: var(--failed); border-color: var(--rule); }
button.danger:hover { background: #fdf2f0; border-color: var(--failed); }
button.small, .btn.small { padding: 6px 11px; font-size: .8125rem; }

input[type="text"], input[type="email"], input[type="number"], input[type="datetime-local"], input[type="search"], select, textarea {
  font: 15px/1.5 var(--sans); color: var(--ink); background: var(--card);
  border: 1px solid var(--rule); border-radius: var(--r-sm); padding: 9px 11px; width: 100%;
}
/* Must follow the generic input rule above: equal specificity, so source order
   decides, and the icon gutter + reference shape have to win over padding: 9px 11px. */
.search-box input {
  width: 240px; height: 38px; padding: 0 12px 0 40px; font-size: 14px; border-radius: 10px;
  border: 1px solid #dfe5f0; background: #f8faff; box-shadow: 0 1px 2px rgba(20, 35, 70, .03);
}
.search-box input::placeholder { color: #64718b; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
label { display: block; font-size: .8125rem; color: var(--ink-soft); margin-bottom: 5px; }
.field { margin-bottom: 16px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.list-select-wrap { position: relative; flex: 1; display: flex; align-items: center; }
.list-select-wrap select { appearance: none; padding-left: 38px; padding-right: 30px; }
.list-select-wrap .list-select-icon {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border-radius: 6px; background: var(--green-wash);
  display: grid; place-items: center; pointer-events: none;
}
.list-select-wrap > .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--ink-faint); pointer-events: none; }

.select-wrap { position: relative; display: flex; align-items: center; }
.select-wrap select { appearance: none; padding-right: 30px; }
.select-wrap > .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--ink-faint); pointer-events: none; }

.switch { display: flex; align-items: center; gap: 9px; font-size: .9375rem; color: var(--ink); margin-bottom: 10px; }
.switch input { width: auto; accent-color: var(--accent); }

.switch-toggle input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; position: relative;
  width: 38px; height: 22px; border-radius: 999px; background: var(--rule);
  flex: 0 0 auto; cursor: pointer; margin: 0; transition: background .15s ease;
}
.switch-toggle input[type="checkbox"]::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(20,24,44,.28); transition: transform .15s ease;
}
.switch-toggle input[type="checkbox"]:checked { background: var(--accent); }
.switch-toggle input[type="checkbox"]:checked::after { transform: translateX(16px); }

.day-check { display: inline-flex; align-items: center; gap: 6px; font-size: .875rem; color: var(--ink); }
.day-check input { margin: 0; }

/* ---------- panels ---------- */

.panel { background: var(--card); border: 1px solid var(--rule); }
.panel + .panel { margin-top: 14px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--rule-soft); }
.panel-body { padding: 18px; }

.empty { border: 1px dashed var(--rule); background: var(--card); padding: 28px 32px; text-align: center; }
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--ink-soft); max-width: 46ch; margin: 0 auto 18px; }
.empty-steps { list-style: none; counter-reset: step; display: inline-flex; flex-direction: column; gap: 8px; text-align: left; margin: 0 auto 18px; max-width: 46ch; }
.empty-steps li { counter-increment: step; position: relative; padding-left: 30px; color: var(--ink-soft); font-size: .875rem; line-height: 1.5; }
.empty-steps li::before { content: counter(step); position: absolute; left: 0; top: 1px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent-wash); color: var(--accent-dark); font-size: .75rem; font-weight: 700; display: grid; place-items: center; }
.empty-steps b { color: var(--ink); font-weight: 600; }

table { width: 100%; border-collapse: collapse; font-size: .875rem; }
th { text-align: left; font-weight: 500; color: var(--ink-soft); font-size: .8125rem; padding: 10px 14px; border-bottom: 1px solid var(--rule); }
td { padding: 11px 14px; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
.mono, .email { font-family: var(--mono); font-size: .8125rem; }

/* ---------- status ---------- */

.tag { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--ink-soft); }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); }
.tag[data-s="sent"]::before, .tag[data-s="completed"]::before { background: var(--sent); }
.tag[data-s="pending"]::before, .tag[data-s="sending"]::before, .tag[data-s="scheduled"]::before { background: var(--queued); }
.tag[data-s="failed"]::before, .tag[data-s="cancelled"]::before { background: var(--failed); }
.tag[data-s="opened"]::before { background: var(--blue); }
.tag[data-s="replied"]::before { background: var(--purple); }
.tag[data-s="sending"]::before { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); border-top: 1px solid var(--rule-soft); }
.stat { padding: 16px 18px; border-right: 1px solid var(--rule-soft); }
.stat:last-child { border-right: 0; }
.stat b { display: block; font: 500 1.5rem/1.1 var(--mono); letter-spacing: -0.02em; }
.stat span { font-size: .8125rem; color: var(--ink-soft); }
.stat[data-tone="sent"] b { color: var(--sent); }
.stat[data-tone="failed"] b { color: var(--failed); }
.stat[data-tone="queued"] b { color: var(--queued); }

/* ---------- stat cards ---------- */

.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat-card {
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-card);
  padding: 0 16px; display: flex; align-items: center; gap: 14px; height: 72px;
}
.stat-card-icon { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; }
.stat-card-icon .icon { width: 22px; height: 22px; }
.stat-card-icon[data-tone="blue"] { background: var(--blue-wash); color: var(--blue); }
.stat-card-icon[data-tone="purple"] { background: var(--purple-wash); color: var(--purple); }
.stat-card-icon[data-tone="green"] { background: var(--green-wash); color: var(--green); }
.stat-card-icon[data-tone="amber"] { background: var(--amber-wash); color: var(--amber); }
.stat-card-text { flex: 1 1 auto; min-width: 0; }
.stat-trend { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 3px; font-size: .75rem; font-weight: 600; padding: 3px 7px; border-radius: 999px; }
.stat-trend .icon { width: 11px; height: 11px; }
.stat-trend[data-dir="up"] { color: var(--up); background: var(--up-wash); }
.stat-trend[data-dir="down"] { color: var(--down); background: var(--down-wash); }
.stat-card-num { font: 700 22px/28px var(--sans); letter-spacing: -0.02em; }
.stat-card-label { margin-top: -1px; font-size: 13px; line-height: 18px; color: var(--ink-soft); }

/* ---------- filter bar ---------- */

.filter-bar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; position: sticky; top: 0; z-index: 6; background: var(--paper); padding: 10px 0; }
.filter-pills { display: inline-flex; gap: 8px; flex-wrap: wrap; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid var(--rule-soft); background: var(--card); color: var(--ink-soft);
  font-size: .8125rem; font-weight: 500; padding: 7px 14px; border-radius: 999px;
  box-shadow: 0 1px 2px rgba(20,24,44,.03);
}
.filter-pill .icon { width: 14px; height: 14px; }
.filter-pill:hover { background: var(--paper); color: var(--ink); }
.filter-pill.on { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 6px 16px -6px rgba(43, 74, 203, .55); }
.sort-control { display: flex; align-items: center; gap: 8px; font-size: .8125rem; color: var(--ink-soft); }
.sort-control select {
  width: auto; padding: 8px 32px 8px 14px; border-radius: 999px; font-size: .8125rem;
  font-weight: 600; color: var(--ink); background: var(--card); border: 1px solid var(--rule-soft); appearance: none;
}
.sort-wrap { position: relative; }
.sort-wrap .icon { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--ink-faint); pointer-events: none; }

/* ---------- contact lists ---------- */

.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: .8125rem; color: var(--ink-faint); margin-bottom: 14px; }

.icon-chip { display: grid; place-items: center; border-radius: var(--r-sm); flex: 0 0 auto; width: 34px; height: 34px; }
.icon-chip .icon { width: 17px; height: 17px; }
.icon-chip.lg { width: 42px; height: 42px; }
.icon-chip.lg .icon { width: 21px; height: 21px; }
.icon-chip[data-tone="blue"] { background: var(--blue-wash); color: var(--blue); }
.icon-chip[data-tone="purple"] { background: var(--purple-wash); color: var(--purple); }
.icon-chip[data-tone="green"] { background: var(--green-wash); color: var(--green); }
.icon-chip[data-tone="amber"] { background: var(--amber-wash); color: var(--amber); }
.icon-chip.circle { border-radius: 50%; }

.checkbox-cell { width: 40px; }
input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; }

.row-name { display: flex; align-items: center; gap: 11px; }
.row-columns { color: var(--ink-faint); font-size: .75rem; margin-top: 3px; }
.row-sub { color: var(--ink-faint); font-size: .75rem; margin-top: 2px; }
.source-cell { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-soft); }
.source-cell .icon { width: 15px; height: 15px; color: var(--ink-faint); }

.icon-only { padding: 7px; }
.icon.sort-indicator { width: 12px; height: 12px; margin-left: 3px; color: var(--ink-faint); vertical-align: -1px; }

.row-menu-wrap { position: relative; text-align: right; }
.row-menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20; text-align: left;
  background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm);
  box-shadow: var(--shadow-card); min-width: 150px; overflow: hidden;
}
.row-menu button { display: block; width: 100%; background: transparent; color: var(--ink); border: 0; border-radius: 0; padding: 9px 13px; font-size: .8125rem; font-weight: 400; }
.row-menu button:hover { background: var(--paper); }
.row-menu button.danger-text { color: var(--failed); }

.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 2px 0; font-size: .8125rem; color: var(--ink-soft); }
.pager { display: flex; align-items: center; gap: 6px; }
.pager button { background: var(--card); border: 1px solid var(--rule); color: var(--ink-soft); }
.pager button:hover:not(:disabled) { background: var(--paper); color: var(--ink); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager-page { display: grid; place-items: center; min-width: 28px; height: 28px; border-radius: var(--r-sm); background: var(--accent-wash); color: var(--accent-dark); font-weight: 600; font-size: .8125rem; }

.help-banner { display: flex; align-items: center; gap: 16px; background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-card); padding: 18px 22px; margin-top: 20px; }
.help-banner-body { flex: 1 1 auto; min-width: 0; }
.help-banner-body h3 { margin-bottom: 3px; }
.help-banner-body p { margin: 0; color: var(--ink-soft); font-size: .875rem; }
.help-banner .btn .icon { width: 13px; height: 13px; }

@media (max-width: 640px) {
  .help-banner { flex-wrap: wrap; }
  .table-foot { flex-wrap: wrap; }
}


/* ---------- campaign list ---------- */

.clist { display: flex; flex-direction: column; gap: 12px; }
.ccard {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-card);
  padding: 12px 16px; text-decoration: none; color: inherit;
  border: 1px solid var(--rule-soft); cursor: pointer;
  transition: box-shadow .15s ease, border-color .15s ease, background .15s ease;
}
.ccard:hover { box-shadow: 0 1px 2px rgba(20,24,44,.05), 0 14px 28px -12px rgba(20,24,44,.16); border-color: var(--accent); background: #fbfcff; }
.ccard-icon { width: 36px; height: 36px; border-radius: var(--r-sm); display: grid; place-items: center; flex: 0 0 auto; }
.ccard-icon .icon { width: 19px; height: 19px; }
.ccard-icon[data-tone="slate"] { background: var(--slate-wash); color: var(--slate); }
.ccard-icon[data-tone="amber"] { background: var(--amber-wash); color: var(--amber); }
.ccard-icon[data-tone="green"] { background: var(--green-wash); color: var(--green); }
.ccard-icon[data-tone="pink"] { background: var(--pink-wash); color: var(--pink); }
.ccard-icon[data-tone="purple"] { background: var(--purple-wash); color: var(--purple); }
.ccard-icon[data-tone="blue"] { background: var(--blue-wash); color: var(--blue); }
.ccard-icon[data-tone="red"] { background: var(--down-wash); color: var(--down); }

.ccard-body { flex: 1 1 auto; min-width: 0; }
.ccard-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ccard-top strong { font-weight: 600; font-size: .9375rem; }
.ccard-sub { color: var(--ink-soft); font-size: .8125rem; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ccard-meta { color: var(--ink-faint); font-size: .78125rem; margin-top: 5px; display: flex; align-items: center; gap: 6px; }

.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: .75rem; font-weight: 600; padding: 3px 9px 3px 7px; border-radius: 999px; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill[data-s="scheduled"] { color: var(--amber); background: var(--amber-wash); }
.status-pill[data-s="draft"] { color: var(--slate); background: var(--slate-wash); }
.status-pill[data-s="sending"] { color: var(--blue); background: var(--blue-wash); }
.status-pill[data-s="sending"]::before { animation: pulse 1.6s ease-in-out infinite; }
.status-pill[data-s="completed"] { color: var(--green); background: var(--green-wash); }
.status-pill[data-s="paused"] { color: var(--purple); background: var(--purple-wash); }
.status-pill[data-s="cancelled"] { color: var(--down); background: var(--down-wash); }

.ccard-progress { height: 5px; border-radius: 3px; background: #dfe3f5; margin-top: 11px; display: flex; overflow: hidden; max-width: 420px; }
.ccard-progress i { display: block; height: 100%; }
.ccard-progress i[data-k="sent"] { background: var(--green); }
.ccard-progress i[data-k="failed"] { background: var(--down); }
.ccard-progress-meta { display: flex; gap: 14px; font-size: .75rem; color: var(--ink-soft); margin-top: 6px; }
.ccard-progress-meta b.fail { color: var(--down); font-weight: 600; }

.ccard-metrics { display: flex; align-items: flex-start; gap: 26px; flex: 0 0 auto; padding-top: 1px; }
.metric { text-align: right; min-width: 54px; }
.metric span { display: block; font-size: .75rem; color: var(--ink-faint); margin-bottom: 3px; }
.metric b { font-size: .9375rem; font-weight: 600; }

.ccard-menu { border: 0; background: transparent; color: var(--ink-faint); padding: 6px; border-radius: var(--r-sm); flex: 0 0 auto; }
.ccard-menu .icon { width: 17px; height: 17px; }
.ccard-menu:hover { background: var(--paper); color: var(--ink); }

@media (max-width: 980px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .ccard { flex-wrap: wrap; }
  .ccard-metrics { width: 100%; justify-content: flex-start; gap: 22px; padding-left: 56px; }
}

/* ---------- campaign report ---------- */

.crumbs { display: flex; align-items: center; gap: 6px; font-size: .8125rem; color: var(--ink-faint); margin-bottom: 16px; }
.crumbs a { color: var(--ink-faint); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs .icon { width: 13px; height: 13px; }
.crumbs span:last-child { color: var(--ink); font-weight: 600; }

.report-head { align-items: center; }
.report-head-main { display: flex; align-items: flex-start; gap: 16px; }
.report-icon.ccard-icon { width: 54px; height: 54px; border-radius: var(--r-md); }
.report-icon.ccard-icon .icon { width: 24px; height: 24px; }
.report-sub { display: flex; align-items: center; gap: 8px; color: var(--ink-soft); font-size: .9375rem; margin-top: 7px; }
.report-sub .dot { color: var(--ink-faint); }
.report-meta { color: var(--ink-faint); font-size: .8125rem; margin-top: 6px; }

.report-stack > * + * { margin-top: 16px; }

button.danger.soft { background: var(--down-wash); border-color: #f4c6c1; color: var(--down); }
button.danger.soft:hover { background: #fadbd6; border-color: var(--down); }

.iconbtn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; background: var(--card); border: 1px solid var(--rule); color: var(--ink-soft); border-radius: 3px; }
.iconbtn:hover { background: var(--paper); color: var(--ink); }
.iconbtn:disabled { opacity: .4; cursor: not-allowed; background: var(--card); color: var(--ink-soft); }
.iconbtn .icon { width: 16px; height: 16px; }

.rowmenu { background: transparent; border: 0; color: var(--ink-faint); padding: 6px; border-radius: 4px; display: inline-flex; }
.rowmenu:hover { background: var(--paper); color: var(--ink); }
.rowmenu .icon { width: 16px; height: 16px; }

.more-menu { position: fixed; background: var(--card); border: 1px solid var(--rule); border-radius: var(--r-sm); box-shadow: 0 14px 34px -12px rgba(20, 24, 44, .28); padding: 6px; min-width: 200px; z-index: 35; }
.more-menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; background: transparent; color: var(--ink); border: 0; padding: 9px 10px; border-radius: 4px; font-size: .875rem; font-weight: 500; }
.more-menu button:hover { background: var(--paper); }
.more-menu button .icon { width: 15px; height: 15px; color: var(--ink-faint); }
.filters-menu-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; font-size: .875rem; color: var(--ink); border-radius: 4px; cursor: pointer; }
.filters-menu-row:hover { background: var(--paper); }
.filters-menu-row input { width: auto; accent-color: var(--accent); }

.fbanner { display: flex; align-items: flex-start; gap: 12px; background: var(--blue-wash); border-radius: var(--r-lg); padding: 14px 16px 14px 18px; }
.fbanner-icon { color: var(--blue); flex: 0 0 auto; margin-top: 2px; }
.fbanner-icon .icon { width: 19px; height: 19px; }
.fbanner-body { flex: 1 1 auto; min-width: 0; }
.fbanner-body strong { display: block; color: var(--accent-dark); font-size: .9375rem; font-weight: 600; }
.fbanner-body p { margin: 2px 0 0; font-size: .8125rem; color: #4c5da3; }
.fbanner-action { flex: 0 0 auto; background: #fff; color: var(--accent-dark); border: 1px solid #fff; font-size: .8125rem; padding: 8px 14px; }
.fbanner-action:hover { box-shadow: 0 1px 2px rgba(20, 24, 44, .1); }
.fbanner-close { flex: 0 0 auto; background: transparent; border: 0; color: #6b7bc4; padding: 6px; border-radius: 4px; }
.fbanner-close:hover { background: rgba(255, 255, 255, .55); color: var(--accent-dark); }
.fbanner-close .icon { width: 14px; height: 14px; }

.rpanel { background: var(--card); border-radius: var(--r-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.rpanel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 20px; flex-wrap: wrap; }

.rstats { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; padding: 4px 20px 22px; }
.rstat { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.rstat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; }
.rstat-icon .icon { width: 17px; height: 17px; }
.rstat-icon[data-tone="blue"] { background: var(--blue-wash); color: var(--blue); }
.rstat-icon[data-tone="purple"] { background: var(--purple-wash); color: var(--purple); }
.rstat-icon[data-tone="green"] { background: var(--green-wash); color: var(--green); }
.rstat-icon[data-tone="amber"] { background: var(--amber-wash); color: var(--amber); }
.rstat-icon[data-tone="red"] { background: var(--down-wash); color: var(--down); }
.rstat-icon[data-tone="slate"] { background: var(--slate-wash); color: var(--slate); }
.rstat-num { font: 600 1.5rem/1.1 var(--sans); letter-spacing: -0.02em; }
.rstat-label { display: flex; align-items: center; gap: 4px; font-size: .75rem; color: var(--ink-soft); }
.rstat-label .icon { width: 12px; height: 12px; color: var(--ink-faint); }
.rstat-pct { font-size: .75rem; font-weight: 600; color: var(--ink-faint); }
.rstat-pct[data-tone="blue"] { color: var(--blue); }
.rstat-pct[data-tone="purple"] { color: var(--purple); }
.rstat-pct[data-tone="green"] { color: var(--green); }
.rstat-pct[data-tone="amber"] { color: var(--amber); }
.rstat-pct[data-tone="red"] { color: var(--down); }
.rstat-pct[data-tone="slate"] { color: var(--slate); }

.hourly-legend { display: flex; align-items: center; gap: 16px; font-size: .8125rem; color: var(--ink-soft); flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-item i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.legend-item i[data-c="open"] { background: var(--blue); }
.legend-item i[data-c="click"] { background: #b7c6f5; }
.hourly-summary { color: var(--ink-faint); }

.hourly-wrap { display: flex; gap: 20px; padding: 4px 20px 20px; }
.hourly-main { flex: 1 1 auto; min-width: 0; display: flex; gap: 10px; align-items: flex-start; }
.hourly-yaxis { display: flex; flex-direction: column; justify-content: space-between; height: 160px; font-size: .6875rem; color: var(--ink-faint); text-align: right; }
.hourly-area { flex: 1; position: relative; height: 160px; }
.hourly-gridline { position: absolute; left: 0; right: 0; height: 1px; background: var(--rule-soft); }
.hourly-cols { position: absolute; inset: 0; display: flex; align-items: flex-end; }
.hourly-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 2px; }
.hourly-bar { width: 7px; border-radius: 2px 2px 0 0; }
.hourly-bar[data-c="open"] { background: var(--blue); }
.hourly-bar[data-c="click"] { background: #b7c6f5; }
.hourly-xaxis { display: flex; margin-top: 8px; }
.hourly-xaxis span { flex: 1; text-align: center; font-size: .6875rem; color: var(--ink-faint); }

.hourly-empty { width: 220px; flex: 0 0 auto; background: var(--paper); border-radius: var(--r-md); padding: 22px 18px; text-align: center; align-self: center; }
.hourly-empty-icon { width: 38px; height: 38px; border-radius: var(--r-sm); background: var(--card); display: grid; place-items: center; margin: 0 auto 12px; box-shadow: var(--shadow-card); color: var(--ink-faint); }
.hourly-empty-icon .icon { width: 18px; height: 18px; }
.hourly-empty h3 { font-size: .875rem; margin-bottom: 5px; }
.hourly-empty p { font-size: .75rem; color: var(--ink-soft); margin: 0; }

.rtabs { display: flex; gap: 4px; padding: 0 20px 14px; flex-wrap: wrap; }
.rtab { background: transparent; border: 0; border-bottom: 2px solid transparent; color: var(--ink-soft); font-size: .8125rem; font-weight: 500; padding: 6px 4px; border-radius: 0; display: inline-flex; align-items: center; gap: 7px; }
.rtab:hover { color: var(--ink); background: transparent; }
.rtab-count { background: var(--paper); color: var(--ink-soft); font-size: .6875rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.rtab.on { color: var(--accent); border-bottom-color: var(--accent); }
.rtab.on .rtab-count { background: var(--blue-wash); color: var(--accent); }

.rtable-wrap { overflow-x: auto; border-top: 1px solid var(--rule-soft); }
table.rtable { width: 100%; }
table.rtable th, table.rtable td { white-space: nowrap; }
table.rtable td.email { white-space: normal; }
.rchk { width: 40px; }
.rchk input, table.rtable input[type="checkbox"] { width: auto; accent-color: var(--accent); }
.rstatus { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 500; color: var(--ink); text-transform: capitalize; }
.rstatus::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); flex: 0 0 auto; }
.rstatus[data-s="sent"]::before { background: var(--green); }
.rstatus[data-s="pending"]::before, .rstatus[data-s="sending"]::before { background: var(--amber); }
.rstatus[data-s="failed"]::before, .rstatus[data-s="bounced"]::before { background: var(--down); }
.rstatus[data-s="skipped"]::before { background: var(--slate); }
.rstatus[data-s="unsubscribed"]::before { background: var(--purple); }
.countpill { display: inline-flex; min-width: 20px; justify-content: center; background: var(--blue-wash); color: var(--accent-dark); font-family: var(--mono); font-size: .75rem; font-weight: 600; padding: 2px 6px; border-radius: 4px; }
.dash { color: var(--ink-faint); }
tr.sel { background: var(--accent-wash); }
.rmenu { text-align: right; }

.rfoot { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 20px; flex-wrap: wrap; font-size: .8125rem; color: var(--ink-soft); }
.rpage { display: flex; align-items: center; gap: 8px; }
.rpage select { width: auto; padding: 7px 30px 7px 12px; font-size: .8125rem; border-radius: var(--r-sm); }
.rpage .iconbtn { width: 30px; height: 30px; }
.rpage-num { font-weight: 600; color: var(--ink); min-width: 16px; text-align: center; }
.rsel-count { font-size: .8125rem; font-weight: 600; color: var(--accent-dark); }

.search-box.small input { width: 210px; padding: 8px 11px 8px 34px; font-size: .875rem; }
.search-box.small .icon { width: 15px; height: 15px; }

.followup-row { padding: 12px 0; border-bottom: 1px solid var(--rule-soft); }
.followup-row:last-child { border-bottom: 0; }
.followup-when { display: flex; align-items: center; gap: 10px; font-size: .8125rem; color: var(--ink-soft); margin-bottom: 4px; }
.followup-when b { color: var(--ink); font-weight: 600; }
.followup-subject { font-size: .9375rem; }

@media (max-width: 1080px) {
  .rstats { grid-template-columns: repeat(3, 1fr); }
  .hourly-wrap { flex-direction: column; }
  .hourly-empty { width: auto; }
}
@media (max-width: 640px) {
  .rstats { grid-template-columns: repeat(2, 1fr); }
  .report-head-main { flex-wrap: wrap; }
  .rpanel-head { align-items: flex-start; }
}

/* ---------- composer ---------- */

.build { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 480px); gap: 20px; align-items: start; }

.toolbar { display: flex; gap: 2px; padding: 7px 10px; border-bottom: 1px solid var(--rule-soft); flex-wrap: wrap; align-items: center; }
.toolbar button { background: transparent; color: var(--ink); padding: 6px 9px; font-size: .875rem; border-radius: var(--r-sm); display: flex; align-items: center; }
.toolbar button:hover { background: var(--paper); color: var(--ink); }
.toolbar button[data-cmd="bold"] { font-weight: 700; }
.toolbar button[data-cmd="italic"] { font-style: italic; }
.toolbar button[data-cmd="underline"] { text-decoration: underline; }
.toolbar button .icon { width: 17px; height: 17px; }
.toolbar .sep { width: 1px; height: 18px; background: var(--rule); margin: 0 6px; }

.editor {
  min-height: 150px; padding: 16px 18px; outline: none;
  font: 15px/1.7 var(--sans); color: var(--ink);
}
.editor:focus { box-shadow: inset 0 0 0 2px var(--accent-wash); }
.editor p { margin: 0 0 1em; }
.editor a { color: var(--accent); }

/* A merge token is data, so it is set in mono and outlined rather than filled —
   it should read as a slot to be filled, not as a button. */
.token {
  font-family: var(--mono); font-size: .8125em; color: var(--accent-dark);
  background: var(--accent-wash); border: 1px solid #ccd6f7;
  border-radius: 2px; padding: 1px 4px; white-space: nowrap;
}

.fields { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 18px; border-top: 1px solid var(--rule-soft); background: #fbfcfd; }
.fields > span { font-size: .8125rem; color: var(--ink-soft); align-self: center; margin-right: 4px; }

/* ---------- preview ---------- */

.preview { position: sticky; top: 20px; }
.preview-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--rule-soft); }
.preview-nav select { width: auto; flex: 1; font-family: var(--mono); font-size: .8125rem; padding: 6px 8px; }
.letter { padding: 24px 26px; font: 15.5px/1.72 var(--serif); color: #1b2732; max-height: 62vh; overflow: auto; }
.letter-subject { font: 600 1rem/1.4 var(--sans); margin-bottom: 4px; }
.letter-meta { font-family: var(--mono); font-size: .75rem; color: var(--ink-faint); padding-bottom: 14px; margin-bottom: 18px; border-bottom: 1px solid var(--rule-soft); }
.letter a { color: var(--accent); }
.letter img { max-width: 100%; }

.notice { display: flex; gap: 10px; padding: 11px 16px; font-size: .8125rem; border-bottom: 1px solid var(--rule-soft); }
.notice[data-tone="warn"] { background: #fdf8ee; color: #6d4c0e; }
.notice[data-tone="bad"] { background: #fdf2f0; color: #7e2a20; }
.notice[data-tone="good"] { background: #f0f8f4; color: #10583f; }
.notice[data-tone="info"] { background: #eef4fd; color: #1d3f7a; }
.notice code { font-family: var(--mono); }

/* ---------- misc ---------- */

.bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bar-spacer { flex: 1; }
.filters { display: flex; gap: 2px; }
.filters button { background: transparent; border: 1px solid transparent; color: var(--ink-soft); font-size: .8125rem; padding: 5px 10px; }
.filters button.on { background: var(--accent-wash); color: var(--accent-dark); }

.hours { display: flex; align-items: flex-end; gap: 3px; height: 92px; padding: 18px; }
.hours div { flex: 1; min-width: 3px; background: var(--accent); opacity: .8; }
.hours div[data-k="click"] { background: var(--sent); }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 3px;
  font-size: .875rem; z-index: 40; max-width: 90vw;
}
.toast[data-tone="bad"] { background: var(--failed); }

.modal-veil { position: fixed; inset: 0; background: rgba(21, 32, 42, .42); display: grid; place-items: center; padding: 20px; z-index: 30; }
.modal { background: var(--card); border: 1px solid var(--rule); width: 100%; max-width: 540px; max-height: 88vh; overflow: auto; }

.signin { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.signin-card { background: var(--card); border: 1px solid var(--rule); max-width: 460px; width: 100%; padding: 40px 38px; }
.signin-card h1 { font-size: 1.6rem; margin-bottom: 10px; }
.signin-card p { color: var(--ink-soft); }
.signin-card ul { list-style: none; padding: 0; margin: 22px 0; color: var(--ink-soft); font-size: .875rem; }
.signin-card li { padding: 7px 0 7px 20px; position: relative; border-top: 1px solid var(--rule-soft); }
.signin-card li::before { content: ""; position: absolute; left: 4px; top: 15px; width: 5px; height: 5px; background: var(--accent); }

.skeleton { background: linear-gradient(90deg, var(--rule-soft), #f3f5f7, var(--rule-soft)); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; height: 13px; border-radius: 2px; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1080px) {
  .build { grid-template-columns: 1fr; }
  .preview { position: static; }
}
@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 10px; }
  .rail nav { flex-direction: row; flex-wrap: wrap; flex: 1; }
  .rail nav a span:not(.icon) { display: none; }
  .rail-foot, .quota { display: none; }
  .page { padding: 22px 16px 60px; }
  .stat b { font-size: 1.25rem; }
  .stat-cards { grid-template-columns: 1fr 1fr; }
  .page-head-actions { flex-wrap: wrap; flex: 1 1 100%; }
  .search-box { flex: 1 1 100%; }
  .search-box input { width: 100%; }
}

/* Narrow phones: a two-up stat card squeezes the number and trend badge into
   each other and its min-content width overflows the viewport, so give each
   card the full row and let the metrics sit flush. Must come after the 780px
   block above, which otherwise re-forces two columns. */
@media (max-width: 480px) {
  .stat-cards { grid-template-columns: 1fr; }
  .ccard-metrics { padding-left: 0; gap: 18px; }
}

/* ---------- sequences, attachments, integrations ---------- */

/* A follow-up is a block on a timeline, so it carries a rule down its left edge
   rather than sitting in its own card like an unrelated thing. */
.step { border-bottom: 1px solid var(--rule-soft); border-left: 2px solid var(--accent-wash); }
.step:last-child { border-bottom: 0; }
.step-when { display: flex; align-items: center; gap: 8px; padding: 11px 16px; font-size: .875rem; color: var(--ink-soft); background: #fbfcfd; }
.step-when input[type="number"] { width: 68px; padding: 5px 7px; font-family: var(--mono); font-size: .8125rem; }
.step-when select { width: auto; flex: 0 1 auto; padding: 5px 7px; font-size: .8125rem; }
.step .editor { min-height: 96px; padding: 14px 16px; font-size: .9375rem; }
.step-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 16px 12px; font-size: .8125rem; color: var(--ink-faint); }

.pill {
  display: inline-block; margin-left: 6px; padding: 1px 7px;
  background: var(--accent-wash); color: var(--accent-dark);
  border-radius: 10px; font-size: .6875rem; font-family: var(--mono);
}

.grant { display: flex; align-items: flex-start; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--rule-soft); }
.grant:last-child { border-bottom: 0; }
.grant-body { flex: 1 1 auto; max-width: 58ch; }
.grant-body strong { display: block; }
.grant-body p { margin: 4px 0 0; color: var(--ink-soft); font-size: .875rem; }
.grant > .btn, .grant > .tag { flex: 0 0 auto; margin-top: 2px; }

/* ---------- integrations redesign ---------- */

.panel { border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.panel-head-lg { padding: 16px 20px; align-items: flex-start; }
.panel-head-left { display: flex; align-items: flex-start; gap: 13px; }
.panel-head-text h2 { margin-bottom: 2px; }
.panel-head-sub { display: inline-block; margin-top: 2px; }
.panel-head-right { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }

.panel-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; }
.panel-icon .icon { width: 19px; height: 19px; }
.panel-icon[data-tone="slate"] { background: var(--slate-wash); color: var(--slate); }
.panel-icon[data-tone="amber"] { background: var(--amber-wash); color: var(--amber); }
.panel-icon[data-tone="green"] { background: var(--green-wash); color: var(--green); }
.panel-icon[data-tone="pink"] { background: var(--pink-wash); color: var(--pink); }
.panel-icon[data-tone="purple"] { background: var(--purple-wash); color: var(--purple); }
.panel-icon[data-tone="blue"] { background: var(--blue-wash); color: var(--blue); }
.panel-icon[data-tone="red"] { background: var(--down-wash); color: var(--down); }

/* Phones: panel heads stack (title above actions) and wide tables scroll inside
   the card instead of stretching the whole page past the viewport. */
@media (max-width: 640px) {
  .panel { overflow-x: auto; }
  .panel-head { flex-wrap: wrap; }
  .panel-head-left { min-width: 0; flex: 1 1 auto; }
  .panel-head-text { min-width: 0; }
  .panel-head-right { flex: 1 1 100%; justify-content: flex-start; }
  .grant { flex-wrap: wrap; }
  .grant-body { flex: 1 1 200px; min-width: 0; }
}

.grant-icon { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; flex: 0 0 auto; margin-top: 1px; }
.grant-icon .icon { width: 17px; height: 17px; }
.grant-icon[data-tone="blue"] { background: var(--blue-wash); color: var(--blue); }
.grant-icon[data-tone="green"] { background: var(--green-wash); color: var(--green); }

.badge-reco {
  display: inline-block; font-size: .6875rem; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; background: var(--green-wash); color: var(--green);
}

.note-chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: .78125rem; color: var(--ink-soft);
  background: var(--paper); border: 1px solid var(--rule-soft); border-radius: 999px; padding: 7px 13px 7px 11px; max-width: 260px;
}
.note-chip .icon { width: 14px; height: 14px; color: var(--ink-faint); flex: 0 0 auto; }

.count-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: .78125rem; font-weight: 600;
  padding: 5px 11px; border-radius: 999px;
}
.count-badge .icon { width: 14px; height: 14px; }
.count-badge[data-tone="red"] { background: var(--down-wash); color: var(--down); }
.count-badge[data-tone="green"] { background: var(--green-wash); color: var(--green); }

.confirm-box {
  display: flex; align-items: center; gap: 13px; background: var(--green-wash);
  border-radius: var(--r-md); padding: 13px 16px;
}
.confirm-box-icon {
  width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; flex: 0 0 auto;
}
.confirm-box-icon .icon { width: 15px; height: 15px; }
.confirm-box-text { flex: 1 1 auto; }
.confirm-box-text strong { display: block; font-size: .9rem; }
.confirm-box-text span { display: block; color: var(--ink-soft); font-size: .8125rem; margin-top: 2px; }
.confirm-box .btn { flex: 0 0 auto; }

.status-box {
  display: flex; align-items: center; gap: 10px; background: var(--green-wash);
  border-radius: var(--r-md); padding: 10px 14px; text-align: left;
}
.status-box-icon {
  width: 24px; height: 24px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; flex: 0 0 auto;
}
.status-box-icon .icon { width: 13px; height: 13px; }
.status-box-text strong { display: block; font-size: .8125rem; }
.status-box-text span { display: block; color: var(--ink-soft); font-size: .75rem; margin-top: 1px; max-width: 26ch; }

.results-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 22px; align-items: start; }
.sheet-preview { border: 1px solid var(--rule-soft); border-radius: var(--r-md); overflow: hidden; background: #fbfcfd; }
.sheet-preview-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; font-size: .8125rem; font-weight: 600; border-bottom: 1px solid var(--rule-soft); color: var(--ink-soft); }
.sheet-preview-head .icon { width: 15px; height: 15px; color: var(--green); }
.sheet-preview table { font-size: .78125rem; }
.sheet-preview th, .sheet-preview td { padding: 7px 10px; }
@media (max-width: 900px) { .results-grid { grid-template-columns: 1fr; } }

.provider-strip { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule-soft); flex-wrap: wrap; }
.provider-strip-chips { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.provider-chip-wrap { display: inline-flex; align-items: center; gap: 9px; font-size: .8125rem; font-weight: 500; color: var(--ink); }
.provider-chip { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 auto; }
.provider-chip .icon { width: 16px; height: 16px; display: block; }
.provider-chip[data-tone="sendgrid"] { background: #e8f1fe; }
.provider-chip[data-tone="mailgun"] { background: #fbeaea; }
.provider-chip[data-tone="postmark"] { background: #fff3c4; }
.provider-chip[data-tone="ses"] { background: #fdeee0; }
.provider-chip[data-tone="smtp"] { background: var(--slate-wash); }

.doc-link { display: inline-flex; align-items: center; gap: 5px; font-size: .8125rem; font-weight: 500; color: var(--accent); text-decoration: none; margin-top: 10px; }
.doc-link .icon { width: 13px; height: 13px; }
.doc-link:hover { text-decoration: underline; }

.help-link { display: inline-flex; align-items: center; gap: 6px; font-size: .8125rem; font-weight: 500; color: var(--ink-soft); text-decoration: none; }
.help-link .icon { width: 15px; height: 15px; color: var(--ink-faint); }
.help-link:hover { color: var(--ink); }

.btn-outline-accent {
  background: #fff; color: var(--accent); border: 1px solid #c9d5f8;
}
.btn-outline-accent:hover { background: var(--accent-wash); border-color: var(--accent); }

/* ---------- upgrade banner ---------- */

.upgrade-banner {
  display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 11px 12px;
  border-radius: var(--r-md); background: rgba(233, 176, 61, .1); border: 1px solid rgba(233, 176, 61, .35);
  text-decoration: none;
}
.upgrade-banner:hover { background: rgba(233, 176, 61, .16); }
.upgrade-banner-icon {
  width: 30px; height: 30px; border-radius: var(--r-sm); flex: 0 0 auto;
  background: linear-gradient(155deg, #f3c15c, #d98a1c); display: grid; place-items: center; color: #fff;
}
.upgrade-banner-icon .icon { width: 16px; height: 16px; }
.upgrade-banner-text { flex: 1 1 auto; min-width: 0; }
.upgrade-banner-text strong { display: block; font-size: .8125rem; color: #fff; }
.upgrade-banner-text small { display: block; font-size: .71875rem; color: var(--nav-ink-dim); }
.upgrade-banner-arrow { color: var(--nav-ink-dim); flex: 0 0 auto; }
.upgrade-banner-arrow .icon { width: 15px; height: 15px; }

/* ---------- settings redesign ---------- */

.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; align-items: start; }
.settings-main .panel + .panel { margin-top: 14px; }
.settings-rail .panel + .panel { margin-top: 14px; }

.panel-head-note { font-size: .8125rem; color: var(--ink-soft); flex: 0 0 auto; }

.status-flag {
  display: inline-flex; align-items: center; gap: 7px; font-size: .8125rem; font-weight: 600;
  padding: 6px 12px; border-radius: 999px;
}
.status-flag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.status-flag[data-tone="green"] { background: var(--green-wash); color: var(--green); }
.status-flag[data-tone="red"] { background: var(--down-wash); color: var(--down); }

.rail-stat { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--rule-soft); }
.rail-stat:first-of-type { border-top: 1px solid var(--rule-soft); margin-top: 14px; }
.rail-meter { height: 4px; border-radius: 3px; background: var(--rule-soft); overflow: hidden; margin: -2px 0 2px 46px; }
.rail-meter i { display: block; height: 100%; border-radius: 3px; background: var(--accent); }
.rail-stat-icon { width: 34px; height: 34px; border-radius: var(--r-sm); display: grid; place-items: center; flex: 0 0 auto; }
.rail-stat-icon .icon { width: 16px; height: 16px; }
.rail-stat-icon[data-tone="blue"] { background: var(--blue-wash); color: var(--blue); }
.rail-stat-icon[data-tone="green"] { background: var(--green-wash); color: var(--green); }
.rail-stat-text { flex: 1 1 auto; min-width: 0; }
.rail-stat-text strong { display: block; font-size: .875rem; }
.rail-stat-text span { display: block; font-size: .75rem; color: var(--ink-soft); margin-top: 1px; }
.rail-stat-pct { font-size: .75rem; color: var(--ink-faint); flex: 0 0 auto; white-space: nowrap; }

.panel-tint-amber { background: var(--amber-wash); border: 1px solid #f0dca6; }
.panel-tint-amber .panel-head { border-bottom-color: #f0dca6; }

.tips-list { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.tips-list li { position: relative; padding-left: 16px; font-size: .8125rem; color: var(--ink-soft); }
.tips-list li::before { content: ""; position: absolute; left: 0; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--amber); }
.tips-list-check li { display: flex; align-items: center; gap: 8px; padding-left: 0; }
.tips-list-check li::before { content: none; }
.tips-list-check li .icon { width: 15px; height: 15px; flex: 0 0 auto; color: #16a172; }

.saved-banner {
  display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--rule-soft);
  border-radius: var(--r-md); padding: 9px 10px 9px 14px; box-shadow: var(--shadow-card); flex: 0 0 auto;
}
.saved-banner-text strong { display: block; font-size: .8125rem; }
.saved-banner-text span { display: block; font-size: .75rem; color: var(--ink-soft); margin-top: 1px; }
.saved-banner-close { background: transparent; border: 0; color: var(--ink-faint); padding: 4px; border-radius: var(--r-sm); }
.saved-banner-close .icon { width: 15px; height: 15px; display: block; }
.saved-banner-close:hover { background: var(--paper); color: var(--ink); }
.page-head { flex-wrap: wrap; gap: 14px; }

input[type="file"] {
  font: .875rem var(--sans); color: var(--ink-soft);
  padding: 10px; border: 1px dashed var(--rule); border-radius: 3px; width: 100%; background: #fbfcfd;
}
input[type="file"]:hover { border-color: var(--accent); }

/* ---------- compose page header ---------- */

.compose-page .breadcrumb { margin-bottom: 10px; }

.compose-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: flex-start; gap: 18px; margin-bottom: 24px; flex-wrap: wrap;
}
.compose-title-col p { color: var(--ink-soft); margin: 4px 0 0; }
.compose-title-row { display: flex; align-items: center; gap: 2px; }
.compose-title-row .title-input {
  font: 600 1.5rem/1.2 var(--sans); border-color: transparent; padding: 4px 6px;
  margin-left: -6px; background: transparent; letter-spacing: -0.014em; width: auto; min-width: 220px;
}
.compose-title-row .icon-only { color: var(--ink-faint); }
.compose-title-row .icon-only .icon { width: 15px; height: 15px; }

.steps { display: flex; align-items: center; gap: 8px; justify-self: center; padding-top: 8px; flex-wrap: wrap; }
.step-pill { display: flex; align-items: center; gap: 8px; font-size: .8125rem; font-weight: 500; color: var(--ink-faint); white-space: nowrap; }
.step-num {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--paper); color: var(--ink-faint); font-size: .75rem; font-weight: 600; flex: 0 0 auto;
}
.step-pill.done { color: var(--ink-soft); }
.step-pill.done .step-num { background: var(--rule-soft); color: var(--ink-soft); }
.step-pill.active { color: var(--ink); }
.step-pill.active .step-num { background: var(--accent); color: #fff; }
.step-line { width: 30px; height: 1px; background: var(--rule); flex: 0 0 auto; }

.compose-actions { display: flex; align-items: center; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 6px; }
.compose-actions .icon-only { padding: 8px; }

@media (max-width: 1080px) {
  .compose-head { grid-template-columns: minmax(0, 1fr); }
  .steps, .compose-actions { justify-content: flex-start; justify-self: start; }
}
@media (max-width: 640px) {
  .step-line { display: none; }
  .compose-title-row .title-input { min-width: 0; flex: 1 1 auto; }
}

/* ---------- compose panels ---------- */

.compose-body-label { padding-bottom: 0; }
.compose-body-label label { margin-bottom: 0; }

.field-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.field-label-row label { margin-bottom: 0; }
.req { color: var(--failed); }
.char-count { font-size: .75rem; color: var(--ink-faint); }

.fields-hint-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 10px 18px 0; font-size: .78125rem; color: var(--ink-faint);
}
.fields-hint code { font-family: var(--mono); }
.fields-preview { color: var(--ink-soft); }
.fields-preview em { font-style: normal; color: var(--ink); }

.adv-details { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule-soft); }
.adv-row { display: flex; align-items: center; gap: 8px; font-size: .875rem; cursor: pointer; list-style: none; }
.adv-row::-webkit-details-marker { display: none; }
.adv-row-icon { color: var(--ink-faint); display: flex; transition: transform .15s ease; }
.adv-details[open] .adv-row-icon { transform: rotate(90deg); }
.adv-row-sub { color: var(--ink-faint); font-size: .8125rem; margin-left: auto; }
.adv-body { color: var(--ink-soft); font-size: .8125rem; margin: 10px 0 0; }

/* ---------- dropzone ---------- */

.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  border: 1px dashed var(--rule); border-radius: var(--r-md); padding: 26px 18px; text-align: center;
  cursor: pointer; background: #fbfcfd;
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-wash); }
.dropzone-icon { color: var(--ink-faint); }
.dropzone-icon .icon { width: 22px; height: 22px; }
.dropzone-text { font-size: .875rem; color: var(--ink-soft); }
.dropzone-link { color: var(--accent); text-decoration: underline; font-weight: 500; }
.dropzone-hint { font-size: .75rem; color: var(--ink-faint); margin: 8px 0 0; }
input.file-input-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.empty-inline { display: flex; align-items: center; gap: 14px; border: 1px dashed var(--rule); border-radius: var(--r-md); padding: 16px 18px; background: #fbfcfd; }
.empty-inline-text { flex: 1 1 auto; min-width: 0; }
.empty-inline-text strong { display: block; font-size: .875rem; }
.empty-inline-text span { display: block; color: var(--ink-soft); font-size: .8125rem; margin-top: 2px; }
.empty-inline button { flex: 0 0 auto; }

/* ---------- preview panel ---------- */

.pager { display: flex; align-items: center; gap: 2px; font-size: .8125rem; color: var(--ink-soft); flex: 0 0 auto; }
.pager .icon-only { padding: 5px; }

.preview-pick-row select { font-family: var(--mono); font-size: .8125rem; }

.letter-card { margin: 14px 18px 18px; border: 1px solid var(--rule-soft); border-radius: var(--r-md); overflow: hidden; }
.letter-fields { padding: 13px 18px; border-bottom: 1px solid var(--rule-soft); background: #fbfcfd; display: flex; flex-direction: column; gap: 4px; font-size: .8125rem; }
.letter-field { display: flex; gap: 8px; }
.letter-field span:first-child { color: var(--ink-faint); width: 56px; flex: 0 0 auto; }
.letter-field strong { font-weight: 600; color: var(--ink); }
.letter-card .letter { padding: 20px 22px; max-height: 50vh; }

.notice .icon { width: 15px; height: 15px; flex: 0 0 auto; }

/* ---------- send buttons + contact box ---------- */

.preview > * + * { margin-top: 18px; }
.send-now-btn, .schedule-btn { width: 100%; justify-content: center; font-size: 1rem; padding: 12px 16px; border-radius: var(--r-md); }
.send-now-btn.btn-primary { border-radius: var(--r-md); }
.send-now-btn .icon, .schedule-btn .icon { width: 16px; height: 16px; }
.preview > .schedule-btn { margin-top: 10px; }

.status-box[data-tone="neutral"] { background: var(--paper); }

/* ================================================================
   SETTINGS — REFERENCE MATCH PASS
   UI-only overrides. No layout logic, state, or interaction changes.
   ================================================================ */

:root {
  --paper: #eef2f8;
  --card: #ffffff;
  --ink: #15203a;
  --ink-soft: #61718a;
  --ink-faint: #67748a;
  --rule: #dbe3ee;
  --rule-soft: #e9eef5;
  --accent: #2f55d9;
  --accent-dark: #2344b8;
  --accent-wash: #edf2ff;
  --nav-bg: #11172c;
  --nav-bg-soft: #1c2545;
  --nav-ink: #aab5cf;
  --nav-ink-dim: #687494;
  --nav-active-bg: #2f55d9;
  --r-lg: 14px;
  --r-md: 11px;
  --r-sm: 8px;
  --shadow-card: 0 1px 2px rgba(19,31,58,.035), 0 8px 24px rgba(35,54,92,.055);
}

.rail { padding: 16px 11px; gap: 4px; }
.brand { padding: 4px 6px 21px; gap: 9px; }
.brand-mark { width: 32px; height: 32px; border-radius: 8px; }
.brand b { font-size: 16px; }
.rail nav a { padding: 9px 10px; gap: 10px; font-size: 13px; border-radius: 8px; }
.rail nav a .icon { width: 16px; height: 16px; }
.rail-foot { padding-top: 12px; }
.quota { padding: 11px 11px 12px; border-radius: 10px; }
.quota-top { margin-bottom: 7px; }
.quota-label { font-size: 11px; }
.who { padding: 9px 3px 3px; }
.who strong { font-size: 12px; }
.who small { font-size: 11px; }
.who img, .who-avatar { width: 30px; height: 30px; }
.upgrade-banner { border-radius: 9px; }

.page { padding: 20px 22px 54px; max-width: 1180px; }
.page-head { margin-bottom: 20px; gap: 12px; }
.page-head h1 { font-size: 26px; font-weight: 700; line-height: 32px; letter-spacing: -.02em; }
.page-head p { font-size: 14px; line-height: 20px; margin-top: 5px; color: #61718a; }

/* Compose page reference match needs more room than the shared .page cap
   (left column ~783px + right ~467px in the reference) — scoped so Settings
   and other pages keep the narrower shared width above. */
.compose-page { max-width: 1320px; padding: 30px 32px 72px; }

.settings-grid { grid-template-columns: minmax(0, 1fr) 258px; gap: 17px; }
.settings-main .panel + .panel,
.settings-rail .panel + .panel { margin-top: 14px; }

.settings-main .panel,
.settings-rail .panel {
  border: 1px solid #dbe3ee;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(20,32,58,.025), 0 7px 20px rgba(40,61,100,.045);
  overflow: hidden;
}

.settings-main .panel-head,
.settings-rail .panel-head {
  min-height: 48px;
  padding: 11px 14px;
  border-bottom: 1px solid #e8edf4;
  background: rgba(255,255,255,.96);
}

.settings-main .panel-head-left { gap: 10px; }
.settings-main .panel-icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
}
.settings-main .panel-icon .icon { width: 15px; height: 15px; }
.settings-main .panel-head-text h2,
.settings-rail .panel-head h2 {
  font-size: 14px;
  line-height: 1.25;
  letter-spacing: -.01em;
}
.settings-main .panel-head-sub { font-size: 11px; }
.panel-head-note { font-size: 10px; color: #7d8ca2; }

.settings-main .panel-body { padding: 13px 14px 14px; }
.settings-main .panel-body > p:first-child { font-size: 11.5px !important; line-height: 1.45; margin: -2px 0 12px !important; }
.settings-main .field { margin-bottom: 12px; }
.settings-main label { font-size: 10.5px; margin-bottom: 4px; color: #718199; }
.settings-main .row { gap: 10px; }

.settings-main input[type="text"],
.settings-main input[type="email"],
.settings-main input[type="number"],
.settings-main select,
.settings-main textarea {
  font-size: 13px;
  line-height: 1.4;
  padding: 8px 9px;
  border-radius: 6px;
  border-color: #d6dfeb;
  background: #fff;
  box-shadow: inset 0 1px 1px rgba(20,35,60,.018);
}
.settings-main textarea { min-height: 76px; }
.settings-main input:hover,
.settings-main select:hover,
.settings-main textarea:hover { border-color: #c5d0df; }
.settings-main input:focus,
.settings-main select:focus,
.settings-main textarea:focus { border-color: #5573df; box-shadow: 0 0 0 3px rgba(47,85,217,.10); }

.settings-main .panel-body > p[style*="font-size"] {
  font-size: 10.5px !important;
  line-height: 1.45;
  margin: -2px 0 10px !important;
}
.settings-main .panel-body > p[style*="font-size"] a { white-space: nowrap; }
.settings-main .panel-body > button:not(.ghost) {
  min-height: 32px;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 11.5px;
  box-shadow: 0 4px 10px -5px rgba(47,85,217,.6);
  display: flex;
  width: fit-content;
  margin-left: auto;
}

.settings-main .switch {
  font-size: 11.5px;
  gap: 7px;
  margin-bottom: 11px;
}
.settings-main .switch input { width: 13px; height: 13px; }
.settings-main .switch-toggle input[type="checkbox"] { width: 34px; height: 19px; }
.settings-main .switch-toggle input[type="checkbox"]::after { width: 15px; height: 15px; }
.settings-main .switch-toggle input[type="checkbox"]:checked::after { transform: translateX(15px); }
.settings-main .day-check { font-size: 11.5px; gap: 5px; }
.settings-main .day-check input { width: 13px; height: 13px; }
.settings-main .bar { gap: 10px; }

.settings-main button.danger {
  background: var(--down);
  color: #fff;
  border-color: var(--down);
}
.settings-main button.danger:hover { background: #c81e1e; border-color: #c81e1e; }

.settings-main .notice {
  font-size: 10.5px;
  line-height: 1.45;
  padding: 9px 11px;
  border-radius: 7px !important;
  margin-bottom: 11px !important;
}

.settings-main .status-flag {
  font-size: 10.5px;
  padding: 5px 9px;
  gap: 6px;
}
.settings-main .status-flag::before { width: 6px; height: 6px; }

.settings-rail .panel-body { padding: 13px 14px 14px; }
.settings-rail .panel-body > p { font-size: 10.5px !important; line-height: 1.45; margin: 0 0 10px !important; }
.settings-rail .status-flag { font-size: 10.5px; padding: 5px 9px; margin-bottom: 10px !important; }
.settings-rail .panel-icon { width: 24px; height: 24px; border-radius: 7px; }
.settings-rail .panel-icon .icon { width: 13px; height: 13px; }
.settings-rail .panel-head-left { gap: 8px; }
.settings-rail .rail-meter { margin-left: 40px; }
.settings-rail .rail-stat { padding: 9px 0; gap: 9px; }
.settings-rail .rail-stat:first-of-type { margin-top: 10px; }
.settings-rail .rail-stat-icon { width: 28px; height: 28px; border-radius: 8px; }
.settings-rail .rail-stat-icon .icon { width: 14px; height: 14px; }
.settings-rail .rail-stat-text strong { font-size: 11.5px; }
.settings-rail .rail-stat-text span,
.settings-rail .rail-stat-pct { font-size: 9.5px; }

.settings-rail .panel-tint-amber { border-radius: 12px; }
.settings-rail .tips-list { gap: 7px; margin-bottom: 9px; }
.settings-rail .tips-list li { font-size: 10.5px; padding-left: 13px; }
.settings-rail .tips-list li::before { width: 4px; height: 4px; top: 7px; }
.settings-rail .doc-link { font-size: 10.5px; margin-top: 6px; }
.settings-rail .doc-link .icon { width: 11px; height: 11px; }

.saved-banner {
  border: 1px solid #c9efd9;
  background: #ecfbf2;
  border-radius: 9px;
  padding: 8px 9px 8px 11px;
  box-shadow: 0 4px 14px rgba(25,120,73,.06);
}
.saved-banner-text strong { font-size: 11.5px; }
.saved-banner-text span { font-size: 10px; }
.saved-banner-close { color: #72927f; }

/* Reference-style icon treatment */
.settings-main .panel-icon[data-tone="blue"] { background: #edf2ff; color: #3159db; }
.settings-main .panel-icon[data-tone="purple"] { background: #f2efff; color: #7a5ce8; }
.settings-main .panel-icon[data-tone="amber"] { background: #fff4df; color: #d58b1a; }
.settings-main .panel-icon[data-tone="pink"] { background: #ffeff4; color: #e45b86; }
.settings-main .panel-icon[data-tone="green"] { background: #eaf8f2; color: #16a172; }
.settings-main .panel-icon[data-tone="slate"] { background: #f2f4f8; color: #5b6a82; }

@media (max-width: 980px) {
  .settings-grid { grid-template-columns: 1fr; }
  .settings-rail { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
  .settings-rail .panel + .panel { margin-top: 0; }
}

@media (max-width: 780px) {
  .app { grid-template-columns: 1fr; }
  .rail { position: relative; width: 100%; height: auto; min-height: 0; padding: 10px 12px; gap: 10px; }
  .brand { padding-bottom: 10px; }
  .rail nav { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); }
  .rail nav a { justify-content: center; padding: 8px 4px; }
  .rail nav a span:not(.icon) { display: none; }
  .rail-foot { display: none; }
  .page { padding: 18px 12px 36px; }
  .settings-rail { display: block; }
  .settings-rail .panel + .panel { margin-top: 12px; }
  .settings-main .row { flex-direction: column; gap: 0; }
}


/* ================================================================
   CONTACT LISTS — REFERENCE MATCH PASS (1536 × 1024 screenshot)
   The SIDEBAR/shell block below is shared by every page so the rail,
   nav icons and type stay consistent across the whole app. Only the
   contacts-specific content (stat cards, table, filters, help banner)
   is still scoped to .app[data-page="contacts"].
   ================================================================ */

.app[data-page="contacts"] {
  --c-ink: #0e1633;
  --c-ink-2: #3a4664;
  --c-muted: #62708c;
  --c-border: #dbe2ee;
  --c-line: #e9eef6;
  --c-blue: #2b5cf0;
  --c-blue-fill: linear-gradient(180deg, #3a6cf7 0%, #2352e6 100%);
  --c-shadow: 0 1px 2px rgba(20, 35, 70, .03), 0 10px 30px rgba(45, 65, 110, .06);
}

/* ---------- SIDEBAR ---------- */
@media (min-width: 781px) {
  .app { grid-template-columns: 264px minmax(0, 1fr); }

  .app .rail {
    padding: 25px 16px 61px 15px;
    gap: 0;
    background: linear-gradient(180deg, #0b1330 0%, #0a1024 100%);
  }
  .app .brand { padding: 0 0 30px 10px; gap: 12px; }
  .app .brand-mark {
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(160deg, #4a78ff 0%, #2450e2 100%);
  }
  .app .brand-mark .icon { width: 22px; height: 22px; }
  /* solid white envelope with a blue flap line, like the reference */
  .app .brand-mark svg path:first-child { fill: #fff; stroke: #fff; }
  .app .brand-mark svg path:last-child { stroke: #2a55e6; stroke-width: 1.9; }
  .app .brand b { font-size: 21px; font-weight: 600; letter-spacing: -.02em; }

  .app .rail nav { gap: 7px; }
  .app .rail nav a {
    height: 50px; padding: 0 16px; gap: 15px; border-radius: 12px;
    font-size: 16px; font-weight: 500; color: #c6cfe6;
  }
  .app .rail nav a .icon { width: 27px; height: 27px; color: #a9b5d2; }
  .app .rail nav a .icon svg { stroke-width: 1.95; }
  .app .rail nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
  .app .rail nav a:hover .icon { color: #fff; }
  .app .rail nav a.on {
    background: linear-gradient(100deg, #1a3cc2 0%, #2350dc 100%);
    color: #fff; box-shadow: 0 6px 16px -10px rgba(37, 84, 240, .5);
  }
  .app .rail nav a.on .icon { color: #fff; }

  .app .rail-foot { padding-top: 0; }

  .app .quota {
    padding: 14px 13px 16px; margin: 0 0 30px; border-radius: 12px; background: #111a36; border-top: 0;
  }
  .app .quota-label { font-size: 14px; line-height: 20px; color: #b4bed6; }
  .app .quota-top { margin-bottom: 10px; }
  .app .quota-top b { font-family: var(--sans); font-size: 14px; font-weight: 600; color: #fff; }
  .app .meter { height: 9px; border-radius: 5px; background: rgba(255, 255, 255, .16); }
  .app .meter i { border-radius: 5px; background: linear-gradient(90deg, #8b5cf6 0%, #6a5cf3 100%); }

  .app .who { flex-wrap: wrap; align-items: center; gap: 0 14px; padding: 0 0 0 10px; }
  .app .who img,
  .app .who-avatar { width: 38px; height: 38px; }
  .app .who-avatar { background: #626c9c; }
  .app .who-avatar .icon { width: 20px; height: 20px; }
  .app .who strong { font-size: 16px; font-weight: 600; line-height: 25px; }
  .app .who small { font-size: 15px; line-height: 25px; color: #b4bed6; }

  .app .who-signout {
    order: 3; flex: 0 0 auto; width: calc(100% + 10px); height: 50px; margin: 17px 0 0 -10px;
    display: flex; align-items: center; justify-content: flex-start; gap: 20px;
    padding: 0 0 0 18px; border-radius: 12px;
    font: 400 16px/1 var(--sans); color: #c3ccdf; background: transparent;
  }
  .app .who-signout .icon { width: 24px; height: 24px; }
  .app .who-signout .icon svg { stroke-width: 2.1; }
  .app .who-signout span:not(.icon) { display: inline; }
  .app .who-signout:hover { background: rgba(255, 255, 255, .05); color: #fff; }

  /* the reference sidebar has no upgrade card */
  .app .upgrade-banner { display: none; }
}
@media (min-width: 781px) and (max-width: 1100px) {
  .app { grid-template-columns: 220px minmax(0, 1fr); }
}
/* who-signout text is visible by default now (see base .who-signout rule above) */

/* ---------- PAGE ---------- */
.app main {
  background: linear-gradient(180deg, #f3f6fd 0%, #f9fafe 45%, #fefeff 100%);
}
.app[data-page="contacts"] .page { max-width: 1240px; padding: 24px 28px 60px; }

.app[data-page="contacts"] .breadcrumb {
  gap: 10px; margin: 0 0 16px; font-size: 15px; line-height: 22px; color: #6d7b98;
}
.app[data-page="contacts"] .breadcrumb .icon { width: 14px; height: 14px; color: #7f8ca8; }
.app[data-page="contacts"] .breadcrumb strong { font-weight: 400; color: #1d2745; }

.app[data-page="contacts"] .page-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 20px; row-gap: 0;
  align-items: center; margin-bottom: 20px;
}
/* lift h1 + intro out of their wrapper so the actions can sit on the title row */
.app[data-page="contacts"] .page-head > div:first-child { display: contents; }
.app[data-page="contacts"] .page-head h1 {
  grid-column: 1; grid-row: 1; min-height: 32px; display: flex; align-items: flex-start;
  font-size: 26px; font-weight: 700; line-height: 32px; letter-spacing: -.02em; color: var(--c-ink);
}
.app[data-page="contacts"] .page-head p {
  grid-column: 1 / -1; grid-row: 2; max-width: none; margin: 5px 0 0;
  font-size: 14px; line-height: 20px; color: var(--c-muted);
}
.app[data-page="contacts"] .page-head-actions { grid-column: 2; grid-row: 1; gap: 16px; }

.app[data-page="contacts"] .search-box { width: 240px; }
.app[data-page="contacts"] .search-box input[type="search"] {
  width: 100%; height: 38px; padding: 0 12px 0 40px; font-size: 14px; border-radius: 10px;
  border: 1px solid #dfe5f0; background: #f8faff; box-shadow: 0 1px 2px rgba(20, 35, 70, .03);
}
.app[data-page="contacts"] .search-box input::placeholder { color: #64718b; }
.app[data-page="contacts"] .search-box input:focus { border-color: var(--c-blue); box-shadow: 0 0 0 3px rgba(43, 92, 240, .12); outline: none; }
.app[data-page="contacts"] .search-box .icon { left: 14px; width: 18px; height: 18px; color: #5c6a88; }

.app[data-page="contacts"] .btn-primary {
  height: 38px; min-width: 170px; padding: 0 18px; gap: 9px; justify-content: center; border-radius: 10px; border: 0;
  font-size: 15px; font-weight: 500; letter-spacing: -.005em;
  background: var(--c-blue-fill); box-shadow: 0 8px 18px -8px rgba(37, 84, 240, .7);
}
.app[data-page="contacts"] .btn-primary:hover { background: linear-gradient(180deg, #2f62f3 0%, #1e4bdb 100%); }
.app[data-page="contacts"] .btn-primary .icon { width: 18px; height: 18px; }
.app[data-page="contacts"] .btn-primary .icon svg { stroke-width: 2; }

/* ---------- STAT CARDS ---------- */
.app[data-page="contacts"] .stat-cards { grid-template-columns: 388fr 388fr 379fr; gap: 14px; margin-bottom: 20px; }
.app[data-page="contacts"] .lstat {
  display: flex; align-items: center; gap: 14px; height: 72px; padding: 0 16px;
  background: #fff; border-radius: 12px; box-shadow: var(--c-shadow);
}
.app[data-page="contacts"] .lstat-icon {
  width: 40px; height: 40px; border-radius: 50%; flex: 0 0 auto; display: grid; place-items: center;
}
.app[data-page="contacts"] .lstat-icon .icon { width: 22px; height: 22px; }
.app[data-page="contacts"] .lstat-icon .icon svg { stroke-width: 2; }
.app[data-page="contacts"] .lstat-icon[data-tone="blue"] { background: #e8eefe; color: #2b5cf0; }
.app[data-page="contacts"] .lstat-icon[data-tone="purple"] { background: #ece8fd; color: #5b3df0; }
.app[data-page="contacts"] .lstat-icon[data-tone="amber"] { background: #fff0df; color: #f59320; }
.app[data-page="contacts"] .lstat-body { min-width: 0; }
.app[data-page="contacts"] .lstat-num { font-size: 22px; font-weight: 700; line-height: 28px; letter-spacing: -.02em; color: var(--c-ink); }
.app[data-page="contacts"] .lstat-label { margin-top: -1px; font-size: 13px; line-height: 18px; color: var(--c-muted); }
.app[data-page="contacts"] .lstat-trend { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.app[data-page="contacts"] .lstat-trend small { font-size: 12px; line-height: 14px; color: #64718b; white-space: nowrap; }
.app[data-page="contacts"] .lstat-trend .stat-trend {
  height: 26px; padding: 0 10px; gap: 5px; border-radius: 13px; font-size: 13px; font-weight: 600;
}
.app[data-page="contacts"] .lstat-trend .stat-trend[data-dir="up"] { background: #e2f6e9; color: #16a34a; }
.app[data-page="contacts"] .lstat-trend .stat-trend .icon { width: 14px; height: 14px; }
.app[data-page="contacts"] .lstat-trend .stat-trend .icon svg { stroke-width: 2.6; }

/* ---------- FILTER ROW ---------- */
.app[data-page="contacts"] .filter-bar { gap: 16px; margin-bottom: 25px; }
.app[data-page="contacts"] .filter-pills { gap: 16px; padding: 0; background: none; box-shadow: none; border-radius: 0; }
.app[data-page="contacts"] .filter-pill {
  display: inline-flex; align-items: center; gap: 9px; height: 45px; padding: 0 14px 0 15px;
  font-size: 14.5px; font-weight: 400; letter-spacing: -.005em; color: #33405e;
  background: #fff; border: 1px solid #d9e1ee; border-radius: 10px;
}
.app[data-page="contacts"] .filter-pill .icon { width: 21px; height: 21px; color: #34415f; }
.app[data-page="contacts"] .filter-pill .icon svg { stroke-width: 2.1; }
.app[data-page="contacts"] .filter-pill:hover { background: #f6f8fd; color: var(--c-ink); }
.app[data-page="contacts"] .filter-pill.on,
.app[data-page="contacts"] .filter-pill.on:hover {
  color: #fff; background: var(--c-blue-fill); border-color: #2352e6;
  box-shadow: 0 8px 16px -8px rgba(37, 84, 240, .65);
}
.app[data-page="contacts"] .filter-pill.on { padding: 0 14px 0 15px; font-size: 14.1px; }
.app[data-page="contacts"] .filter-pill.on .icon { width: 20px; height: 20px; color: #fff; }

.app[data-page="contacts"] .sort-control { gap: 16px; font-size: 15px; color: #5f6c88; }
.app[data-page="contacts"] .sort-control select {
  width: 192px; height: 44px; padding: 0 44px 0 18px; font-size: 15px; font-weight: 500; color: var(--c-ink);
  border: 1px solid #d9e1ee; border-radius: 10px; background: #fff; cursor: pointer;
}
.app[data-page="contacts"] .sort-wrap .icon { right: 16px; width: 18px; height: 18px; color: #1b2545; }
.app[data-page="contacts"] .sort-wrap .icon svg { stroke-width: 2.4; }

/* ---------- TABLE CARD ---------- */
.app[data-page="contacts"] .list-table {
  border: 0; border-radius: 14px; background: #fff; box-shadow: var(--c-shadow);
}
.app[data-page="contacts"] .list-table th:first-child { border-top-left-radius: 14px; }
.app[data-page="contacts"] .list-table th:last-child { border-top-right-radius: 14px; }
.app[data-page="contacts"] .table-foot { border-radius: 0 0 14px 14px; }

.app[data-page="contacts"] .list-table table { table-layout: fixed; font-size: 14px; }

.app[data-page="contacts"] .list-table th {
  vertical-align: middle; height: 42px; padding: 0; font-size: 13px; font-weight: 600; color: var(--c-ink-2);
  border-bottom: 1px solid var(--c-line); background: #fff; white-space: nowrap;
}
.app[data-page="contacts"] .list-table td {
  height: 64px; padding: 0; border-bottom: 1px solid #edf1f7; color: #111a35; font-size: 14px;
}
.app[data-page="contacts"] .list-table tbody tr:last-child td { border-bottom: 1px solid #edf1f7; }
.app[data-page="contacts"] .list-table tbody tr:hover { background: #fafbfe; }

.app[data-page="contacts"] .list-table .checkbox-cell { width: 56px; padding-left: 16px; }
.app[data-page="contacts"] .list-table .col-contacts { width: 90px; text-align: right; padding-right: 10px; }
.app[data-page="contacts"] .list-table .cell-count { text-align: right; padding-right: 10px; font-variant-numeric: tabular-nums; }
.app[data-page="contacts"] .list-table .col-source { width: 160px; }
.app[data-page="contacts"] .list-table .col-imported { width: 170px; }
.app[data-page="contacts"] .list-table .col-actions { width: 64px; padding-right: 16px; text-align: center; }
.app[data-page="contacts"] .list-table .icon.sort-indicator {
  width: 17px; height: 17px; margin-left: 8px; color: var(--c-ink-2); vertical-align: -3px;
}
.app[data-page="contacts"] .list-table .icon.sort-indicator svg { stroke-width: 2.2; }

/* checkbox: white square, slate outline, blue when ticked */
.app[data-page="contacts"] input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; display: grid; place-content: center;
  width: 18px; height: 18px; margin: 0; border: 1.8px solid #66738f; border-radius: 4.5px; background: #fff; cursor: pointer;
}
.app[data-page="contacts"] input[type="checkbox"]:hover { border-color: var(--c-blue); }
.app[data-page="contacts"] input[type="checkbox"]:checked { background: var(--c-blue); border-color: var(--c-blue); }
.app[data-page="contacts"] input[type="checkbox"]:checked::after {
  content: ""; width: 9px; height: 5px; margin-top: -2px;
  border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg);
}

.app[data-page="contacts"] .row-name { gap: 14px; }
.app[data-page="contacts"] .row-name .icon-chip.sm { width: 36px; height: 36px; border-radius: 9px; }
.app[data-page="contacts"] .row-name .icon-chip.sm .icon { width: 20px; height: 20px; }
.app[data-page="contacts"] .row-name .icon-chip.sm .icon svg { stroke-width: 1.85; }
.app[data-page="contacts"] .icon-chip[data-tone="green"] { background: #dff6e8; color: #16a56a; }
.app[data-page="contacts"] .icon-chip[data-tone="purple"] { background: #e9e6fd; color: #5b3df0; }
.app[data-page="contacts"] .row-name-text { min-width: 0; }
.app[data-page="contacts"] .row-name strong {
  display: block; font-size: 14.5px; font-weight: 600; line-height: 20px; letter-spacing: -.005em; color: #0f1834;
}
.app[data-page="contacts"] .row-columns {
  margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; overflow: hidden; max-height: 22px;
}
.field-chip {
  font: 500 11px/18px var(--sans); color: #46536f; background: #eef2f9; border: 1px solid #dfe5f0;
  border-radius: 5px; padding: 0 6px; cursor: copy; white-space: nowrap;
}
.field-chip:hover { background: var(--accent-wash); border-color: var(--accent); color: var(--accent-dark); }
.app[data-page="contacts"] .row-columns .sep { font-size: 11px; line-height: 18px; color: #64718b; }
.app[data-page="contacts"] .cell-count { font-weight: 600; }
.app[data-page="contacts"] .source-cell { gap: 8px; font-size: 13px; color: #46536f; }
.app[data-page="contacts"] .source-cell .icon { width: 20px; height: 20px; margin: 0 -2px 0 -4px; color: #64718b; }
.app[data-page="contacts"] .source-cell .icon svg { stroke-width: 1.6; }
.app[data-page="contacts"] .source-cell[data-src="sheets"] .icon { color: #1ea362; }
.app[data-page="contacts"] .cell-date { font-size: 13.5px; font-weight: 400; line-height: 18px; }
.app[data-page="contacts"] .row-sub { margin-top: 1px; font-size: 12px; line-height: 16px; color: #64718b; }

.app[data-page="contacts"] .list-table td.row-menu-wrap { padding-right: 16px; text-align: center; }
.app[data-page="contacts"] .row-menu-wrap .icon-only { padding: 6px; color: #1a2340; border-radius: 8px; }
.app[data-page="contacts"] .row-menu-wrap .icon-only .icon { width: 18px; height: 18px; }
.app[data-page="contacts"] .row-menu-wrap .icon-only:hover { background: #eff3fa; }
.app[data-page="contacts"] .row-menu-wrap .row-menu { right: 12px; top: calc(100% - 14px); border-color: #dbe2ee; border-radius: 10px; box-shadow: 0 12px 28px -10px rgba(20, 35, 70, .28); }

/* footer lives inside the card */
.app[data-page="contacts"] .table-foot {
  height: 77px; padding: 0 26px; font-size: 16.7px; color: #5f6c88; background: #fff;
}
.app[data-page="contacts"] .table-foot .pager { gap: 13px; font-size: inherit; }
.app[data-page="contacts"] .table-foot .pager button {
  width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 10px;
  background: #fff; border: 1px solid #dde4ef; color: #9aa7be;
}
.app[data-page="contacts"] .table-foot .pager button:hover:not(:disabled) { background: #f6f8fd; color: var(--c-ink); }
.app[data-page="contacts"] .table-foot .pager button:disabled { opacity: 1; background: #fff; color: #b3bdd0; }
.app[data-page="contacts"] .table-foot .pager button .icon { width: 18px; height: 18px; }
.app[data-page="contacts"] .pager-page {
  width: 44px; height: 44px; min-width: 44px; border-radius: 10px; font-size: 17px; font-weight: 700;
  background: #e8eefe; color: #1d47d9; border: 1px solid #cfdaf8;
}

/* ---------- HELP BANNER ---------- */
.app[data-page="contacts"] .help-banner {
  height: 106px; margin-top: 50px; padding: 0 26px 0 20px; gap: 36px;
  background: linear-gradient(90deg, #e9effd 0%, #eff3fe 100%); border: 0;
  border-radius: 14px; box-shadow: none;
}
.app[data-page="contacts"] .help-banner .icon-chip.lg {
  width: 66px; height: 66px; border-radius: 50%; color: #1f47d9;
  background: rgba(255, 255, 255, .72); border: 1px solid rgba(255, 255, 255, .95);
  box-shadow: 0 3px 12px rgba(40, 70, 150, .10);
}
.app[data-page="contacts"] .help-banner .icon-chip.lg .icon { width: 36px; height: 36px; }
.app[data-page="contacts"] .help-banner .icon-chip.lg .icon svg { stroke-width: 1.8; }
.app[data-page="contacts"] .help-banner-body h3 { margin-bottom: 4px; font-size: 19px; line-height: 26px; font-weight: 600; letter-spacing: -.01em; color: var(--c-ink); }
.app[data-page="contacts"] .help-banner-body p { font-size: 16.4px; line-height: 24px; color: #5f6c88; }
.app[data-page="contacts"] .help-banner .btn {
  height: 44px; padding: 0 16px; gap: 11px; font-size: 14.5px; font-weight: 600;
  color: #1d47d9; background: #fff; border: 1px solid #e0e7f4; border-radius: 10px;
}
.app[data-page="contacts"] .help-banner .btn:hover { background: #f8faff; border-color: #cfdaf8; }
.app[data-page="contacts"] .help-banner .btn .icon { width: 20px; height: 20px; }

/* ---------- RESPONSIVE ---------- */
.app[data-page="contacts"] .lstat-label { white-space: nowrap; }
.app[data-page="contacts"] .help-banner .btn { white-space: nowrap; }
.app .who > div:not(.who-avatar) { flex: 1 1 0; min-width: 0; }
.app .who-avatar, .app .who img { flex: 0 0 auto; }
.app .who strong,
.app .who small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.app .quota-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (min-width: 781px) and (max-width: 1100px) {
  .app .quota-label,
  .app .quota-top b { font-size: 13px; }
  .app .rail nav a { padding: 0 14px; gap: 12px; }
}

/* under ~1180px of window: cards stack their trend under the number, table columns tighten */
@media (max-width: 1180px) {
  .app[data-page="contacts"] .lstat { flex-wrap: wrap; height: auto; gap: 10px 12px; padding: 12px; }
  .app[data-page="contacts"] .lstat-icon { width: 36px; height: 36px; }
  .app[data-page="contacts"] .lstat-icon .icon { width: 20px; height: 20px; }
  .app[data-page="contacts"] .lstat-trend { flex: 1 0 100%; margin-left: 0; flex-direction: row; align-items: center; gap: 10px; }
  .app[data-page="contacts"] .lstat-trend .stat-trend { height: 28px; padding: 0 10px; font-size: 13.5px; }

  .app[data-page="contacts"] .list-table .checkbox-cell { width: 60px; padding-left: 16px; }
  .app[data-page="contacts"] .list-table .col-contacts { width: 90px; }
  .app[data-page="contacts"] .list-table .col-source { width: 150px; }
  .app[data-page="contacts"] .list-table .col-imported { width: 140px; }
  .app[data-page="contacts"] .list-table .col-actions { width: 64px; padding-right: 12px; }
  .app[data-page="contacts"] .list-table td.row-menu-wrap { padding-right: 12px; }
  .app[data-page="contacts"] .row-name { gap: 14px; }
  .app[data-page="contacts"] .row-name .icon-chip.sm { width: 44px; height: 44px; }
  .app[data-page="contacts"] .row-name .icon-chip.sm .icon { width: 28px; height: 28px; }
  .app[data-page="contacts"] .source-cell { gap: 6px; }
}

@media (max-width: 1000px) {
  .app[data-page="contacts"] .stat-cards { grid-template-columns: 1fr; gap: 14px; }
  .app[data-page="contacts"] .lstat { flex-wrap: nowrap; height: 64px; padding: 0 12px; }
  .app[data-page="contacts"] .lstat-trend { flex: 0 0 auto; margin-left: auto; flex-direction: column; align-items: flex-end; gap: 6px; }
  .app[data-page="contacts"] .list-table { overflow: hidden; }
  .app[data-page="contacts"] .table-scroll { overflow-x: auto; }
  .app[data-page="contacts"] .list-table table { min-width: 704px; }
}
@media (max-width: 900px) {
  .app[data-page="contacts"] .page-head { grid-template-columns: 1fr; }
  .app[data-page="contacts"] .page-head-actions { grid-column: 1; grid-row: 3; margin-top: 18px; }
  .app[data-page="contacts"] .search-box { flex: 1 1 auto; width: auto; }
}
@media (max-width: 640px) {
  .app[data-page="contacts"] .page { padding: 20px 16px 48px; }
  .app[data-page="contacts"] .page-head h1 { font-size: 22px; min-height: 0; }
  .app[data-page="contacts"] .help-banner { height: auto; flex-wrap: wrap; padding: 18px; gap: 16px; }
  .app[data-page="contacts"] .help-banner-body { flex: 1 1 200px; }
  .app[data-page="contacts"] .filter-bar { flex-direction: column; align-items: flex-start; }
  .app[data-page="contacts"] .filter-pills { flex-wrap: wrap; gap: 10px; }
}

/* Shared responsive fallbacks for the unified reference components above.
   Placed last so they win over the theme-pass desktop sizes on narrow screens. */
@media (min-width: 481px) and (max-width: 1100px) {
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 780px) {
  .stat-cards { gap: 12px; }
  .stat-card { gap: 12px; padding: 0 12px; height: 64px; }
  .stat-card-icon { width: 36px; height: 36px; }
  .stat-card-icon .icon { width: 20px; height: 20px; }
  .stat-card-num { font-size: 20px; line-height: 24px; }
  .stat-card-label { font-size: 12px; line-height: 16px; }
  .search-box input { height: 44px; }
  .app[data-page="contacts"] .search-box input[type="search"] { height: 44px; }
  .btn-primary { height: 44px; }
}
@media (max-width: 640px) {
  .page-head h1 { font-size: 22px; line-height: 1.25; min-height: 0; }
  .page-head p { font-size: 13px; line-height: 18px; }
}

/* Unsubscribes table: scannable address, muted reason, right-aligned date */
.supp-table { font-size: 14px; }
.supp-table th { font-size: 13px; font-weight: 600; }
.supp-table .col-reason { width: 150px; }
.supp-table .col-added { width: 160px; text-align: right; }
.supp-table td.col-added { font-variant-numeric: tabular-nums; white-space: nowrap; }
.supp-table .col-action { width: 84px; text-align: right; }
.supp-table .supp-soft { color: var(--ink-soft); }
.supp-table td { height: 56px; }
@media (max-width: 640px) {
  .supp-table .col-reason { display: none; }
  .supp-table .col-added { width: 120px; }
}

/* Settings & integrations UX */
.settings-main input[type="number"] { max-width: 140px; }
.settings-main .panel[data-dirty] { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }

.save-bar {
  position: sticky; bottom: 12px; z-index: 7;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 14px; padding: 10px 14px;
  background: var(--card); border: 1px solid var(--accent); border-radius: 12px;
  box-shadow: 0 6px 18px rgba(15, 24, 52, .12);
}
.save-bar[hidden] { display: none; }
.save-bar-text { font-size: 13px; font-weight: 600; color: var(--accent-dark); }

.help-acc > summary { list-style: none; cursor: pointer; }
.help-acc > summary::-webkit-details-marker { display: none; }
.help-acc .help-acc-title { font-size: .9375rem; font-weight: 600; color: var(--ink); }
.help-acc .help-acc-chev { color: var(--ink-faint); transition: transform .15s; display: inline-flex; }
.help-acc .help-acc-chev .icon { width: 16px; height: 16px; }
.help-acc[open] .help-acc-chev { transform: rotate(180deg); }
.help-acc > summary:hover { background: var(--paper); }

.connected-as { display: flex; align-items: center; gap: 7px; margin: 0 0 12px; font-size: .8125rem; color: var(--ink-soft); }
.connected-as .icon { width: 15px; height: 15px; color: var(--green); }
.connected-as strong { color: var(--ink); font-weight: 600; }
.grant { min-height: 62px; }

button.danger-quiet { background: transparent; border-color: transparent; color: var(--failed); }
button.danger-quiet:hover { background: #fdf2f0; border-color: var(--failed); }

/* Accessibility & feedback */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.editor:focus-visible { outline-offset: -2px; }

.fields .field-chip { cursor: pointer; font-size: 12px; line-height: 22px; padding: 0 8px; }
.char-count[data-warn="1"] { color: var(--down); font-weight: 600; }

@media (max-width: 780px) {
  .icon-only { min-width: 44px; min-height: 44px; }
  .fields .field-chip { line-height: 30px; }
}
