/* =====================================================================
   Bulk Mailer app shell.
   Palette and type are lifted straight from the marketing site so the
   product does not feel like a different company once you log in.
   ===================================================================== */

:root {
  --bg:        #05070b;
  --panel:     #0b1018;
  --panel-2:   #101822;
  --panel-3:   #16202c;
  --text:      #f8fbff;
  --muted:     #99a6b6;
  --faint:     #6b7889;
  --line:      rgba(255,255,255,.09);
  --line-soft: rgba(255,255,255,.05);

  --cyan:   #00e5a9;
  --teal:   #00a9c1;
  --blue:   #0065dd;
  --green:  #67f7c5;
  --amber:  #ffb547;
  --red:    #ff6b6b;

  --gradient: linear-gradient(to right, #00e5a9, #00d1b1, #00a9c1, #0065dd);
  --ease: cubic-bezier(.2,.8,.2,1);

  --radius:    14px;
  --radius-sm: 10px;
  --sidebar:   248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 12% -8%, rgba(0,229,169,.10), transparent 32%),
    radial-gradient(circle at 92% 12%, rgba(0,101,221,.12), transparent 30%),
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4, .display {
  font-family: "Space Grotesk", "DM Sans", sans-serif;
  letter-spacing: -.02em;
  line-height: 1.15;
}

h1 { font-size: 30px; font-weight: 700; }
h2 { font-size: 21px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------------------------------------------------------------- */
/* Shell                                                             */
/* ---------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: rgba(8,12,18,.82);
  backdrop-filter: blur(14px);
  border-right: 1px solid var(--line);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 17px;
  padding: 4px 8px 20px;
}

.brandmark {
  width: 32px; height: 32px;
  border-radius: 10px;
  display: grid; place-items: center;
  background: var(--gradient);
  color: #04120e;
  font-weight: 900;
  font-size: 15px;
  flex: 0 0 32px;
}

.nav-group {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--faint);
  padding: 18px 10px 7px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  transition: background .18s var(--ease), color .18s var(--ease);
}
.nav-link:hover { background: rgba(255,255,255,.045); color: var(--text); }

.nav-link.is-active {
  background: linear-gradient(90deg, rgba(0,229,169,.14), rgba(0,101,221,.10));
  color: var(--text);
  box-shadow: inset 2px 0 0 var(--cyan);
}

.nav-link .ico { width: 17px; text-align: center; opacity: .85; font-size: 14px; }
.nav-link .pip {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(255,107,107,.16);
  color: var(--red);
  font-weight: 700;
}

.sidebar-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line-soft); }

.whoami {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: var(--radius-sm);
}
.whoami:hover { background: rgba(255,255,255,.04); }
.avatar {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--panel-3);
  border: 1px solid var(--line);
  font-size: 12px; font-weight: 700;
  flex: 0 0 30px;
}
.whoami-meta { min-width: 0; }
.whoami-meta b { display: block; font-size: 13px; font-weight: 600; }
.whoami-meta span { display: block; font-size: 11.5px; color: var(--faint); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  position: sticky; top: 0; z-index: 20;
  background: rgba(5,7,11,.86);
  backdrop-filter: blur(14px);
}
.topbar h1 { font-size: 19px; font-weight: 600; }
.topbar .spacer { flex: 1; }

.page { padding: 26px; max-width: 1280px; width: 100%; }
.page-lead { color: var(--muted); font-size: 14.5px; margin: -4px 0 22px; max-width: 70ch; }

.menu-btn { display: none; }

/* ---------------------------------------------------------------- */
/* Cards, panels                                                     */
/* ---------------------------------------------------------------- */

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.028), rgba(255,255,255,.008));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card + .card { margin-top: 18px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  margin: -20px -20px 18px; padding: 15px 20px;
  border-bottom: 1px solid var(--line-soft);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .spacer { flex: 1; }
.card-flush { padding: 0; overflow: hidden; }
.card-flush .card-head { margin: 0; }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.grid-sidebar { grid-template-columns: minmax(0,1fr) 340px; align-items: start; }

/* Stat tiles. The number is the only loud element on the page. */
.stat { position: relative; overflow: hidden; }
.stat .label {
  font-size: 12px; color: var(--muted); font-weight: 500;
  display: flex; align-items: center; gap: 7px;
}
.stat .value {
  font-family: "Space Grotesk", sans-serif;
  font-size: 32px; font-weight: 700; letter-spacing: -.035em;
  margin-top: 7px; line-height: 1;
}
.stat .sub { font-size: 12.5px; color: var(--faint); margin-top: 7px; }
.stat::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px;
  background: var(--gradient); opacity: .5;
}
.stat.is-plain::after { display: none; }

/* ---------------------------------------------------------------- */
/* Meters                                                            */
/* ---------------------------------------------------------------- */

.meter {
  height: 7px; border-radius: 999px;
  background: rgba(255,255,255,.07);
  overflow: hidden; margin-top: 10px;
}
.meter > span {
  display: block; height: 100%; border-radius: 999px;
  background: var(--gradient);
  transition: width .5s var(--ease);
}
.meter.is-warning > span { background: linear-gradient(90deg,#ffb547,#ff8c42); }
.meter.is-danger  > span { background: linear-gradient(90deg,#ff6b6b,#e5484d); }

/* ---------------------------------------------------------------- */
/* Buttons                                                           */
/* ---------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 17px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font: inherit; font-size: 13.5px; font-weight: 600;
  cursor: pointer;
  transition: transform .2s var(--ease), background .2s, border-color .2s, opacity .2s;
  white-space: nowrap;
}
.btn:hover { background: rgba(255,255,255,.075); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }

.btn-primary {
  background: var(--gradient);
  border-color: transparent;
  color: #041410;
  font-weight: 700;
}
.btn-primary:hover { box-shadow: 0 10px 28px rgba(0,180,170,.24); background: var(--gradient); }

.btn-ghost { background: transparent; }
.btn-danger { border-color: rgba(255,107,107,.32); color: var(--red); background: rgba(255,107,107,.07); }
.btn-danger:hover { background: rgba(255,107,107,.13); }
.btn-sm { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 9px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- */
/* Forms                                                             */
/* ---------------------------------------------------------------- */

.field { margin-bottom: 15px; }
.field > label {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: 6px; color: var(--text);
}
.field .hint { font-size: 12.5px; color: var(--faint); margin-top: 6px; line-height: 1.5; }
.field .hint code {
  background: rgba(255,255,255,.07); padding: 1px 5px; border-radius: 4px;
  font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

input[type=text], input[type=email], input[type=password], input[type=number],
input[type=url], input[type=search], select, textarea {
  width: 100%;
  padding: 10px 13px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit; font-size: 14px;
  transition: border-color .18s, box-shadow .18s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(0,229,169,.5);
  box-shadow: 0 0 0 3px rgba(0,229,169,.12);
}
input::placeholder, textarea::placeholder { color: #55616f; }
textarea { resize: vertical; min-height: 110px; line-height: 1.6; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2399a6b6' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 34px;
}
input[readonly] { opacity: .65; }

.mono {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}

.checkbox, .radio {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer; margin-bottom: 8px;
  transition: border-color .18s, background .18s;
}
.checkbox:hover, .radio:hover { background: rgba(255,255,255,.035); }
.checkbox input, .radio input { margin-top: 3px; accent-color: #00d1b1; flex: 0 0 auto; }
.checkbox.is-on, .radio.is-on { border-color: rgba(0,229,169,.42); background: rgba(0,229,169,.06); }
.checkbox b, .radio b { display: block; font-size: 13.5px; }
.checkbox span, .radio span { display: block; font-size: 12.5px; color: var(--faint); }

.field-row { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.field-row-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }

/* ---------------------------------------------------------------- */
/* Tables                                                            */
/* ---------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }

table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
  text-align: left;
  font-size: 11.5px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  color: var(--faint);
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: rgba(255,255,255,.015);
}
table.data td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
table.data tbody tr:hover td { background: rgba(255,255,255,.022); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data td .sub { display: block; font-size: 12px; color: var(--faint); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .actions { text-align: right; white-space: nowrap; }

/* ---------------------------------------------------------------- */
/* Badges and alerts                                                 */
/* ---------------------------------------------------------------- */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.05);
  color: var(--muted);
  white-space: nowrap;
}
.badge::before {
  content: ""; width: 5px; height: 5px; border-radius: 50%;
  background: currentColor; flex: 0 0 5px;
}
.badge-success { color: var(--cyan);  background: rgba(0,229,169,.10); border-color: rgba(0,229,169,.26); }
.badge-info    { color: #6cb6ff;      background: rgba(0,101,221,.12); border-color: rgba(0,101,221,.3); }
.badge-warning { color: var(--amber); background: rgba(255,181,71,.10); border-color: rgba(255,181,71,.26); }
.badge-danger  { color: var(--red);   background: rgba(255,107,107,.10); border-color: rgba(255,107,107,.26); }
.badge-plain::before { display: none; }

.alert {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  font-size: 13.5px;
  margin-bottom: 16px;
  line-height: 1.55;
}
.alert b { display: block; margin-bottom: 2px; }
.alert-success { border-color: rgba(0,229,169,.3);  background: rgba(0,229,169,.07); }
.alert-danger  { border-color: rgba(255,107,107,.3); background: rgba(255,107,107,.07); }
.alert-warning { border-color: rgba(255,181,71,.3);  background: rgba(255,181,71,.07); }
.alert-info    { border-color: rgba(0,101,221,.32);  background: rgba(0,101,221,.08); }
.alert .ico { font-size: 15px; line-height: 1.4; flex: 0 0 auto; }
.alert a { color: var(--cyan); text-decoration: underline; }

.flash-stack { position: fixed; top: 16px; right: 16px; z-index: 100; width: min(380px, calc(100vw - 32px)); }
.flash-stack .alert { box-shadow: 0 16px 40px rgba(0,0,0,.5); background: var(--panel-2); }

/* ---------------------------------------------------------------- */
/* Empty states                                                      */
/* ---------------------------------------------------------------- */

.empty { text-align: center; padding: 52px 24px; }
.empty .ico { font-size: 30px; opacity: .3; }
.empty h3 { margin: 14px 0 6px; }
.empty p { color: var(--muted); font-size: 14px; max-width: 42ch; margin: 0 auto 18px; }

/* ---------------------------------------------------------------- */
/* Auth pages                                                        */
/* ---------------------------------------------------------------- */

.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 34px 18px; }
.auth-box { width: 100%; max-width: 430px; }
.auth-box .brand { justify-content: center; padding-bottom: 24px; }
.auth-box .card { padding: 26px; }
.auth-title { text-align: center; margin-bottom: 6px; }
.auth-lead { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 22px; }
.auth-alt { text-align: center; margin-top: 18px; font-size: 13.5px; color: var(--muted); }
.auth-alt a { color: var(--cyan); font-weight: 600; }

/* ---------------------------------------------------------------- */
/* Misc                                                              */
/* ---------------------------------------------------------------- */

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; gap: 12px; align-items: center; }
.flex-between { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.divider { height: 1px; background: var(--line-soft); margin: 18px 0; }

.kv { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; font-size: 13.5px; }
.kv dt { color: var(--faint); }
.kv dd { margin: 0; }

.copyable {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 9px 12px;
}
.copyable code { flex: 1; overflow-x: auto; white-space: nowrap; font-size: 12.5px; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pagination a, .pagination span {
  padding: 6px 12px; border-radius: 8px; font-size: 13px;
  border: 1px solid var(--line); color: var(--muted);
}
.pagination .is-current { background: rgba(0,229,169,.12); color: var(--cyan); border-color: rgba(0,229,169,.3); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a {
  padding: 10px 15px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--text); }
.tabs a.is-active { color: var(--text); border-bottom-color: var(--cyan); }

/* Sparkline-style bar chart, drawn with plain divs. */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; margin-top: 8px; }
.bars .bar { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; height: 100%; gap: 2px; min-width: 0; }
.bars .bar i {
  display: block; border-radius: 3px 3px 0 0;
  background: linear-gradient(180deg, var(--cyan), rgba(0,169,193,.35));
  min-height: 2px;
}
.bars .bar i.b2 { background: linear-gradient(180deg, var(--blue), rgba(0,101,221,.3)); }
.bars .bar em { font-size: 9.5px; color: var(--faint); text-align: center; font-style: normal; }

.legend { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; }

/* Live campaign progress */
.progress-shell { text-align: center; padding: 8px 0 4px; }
.progress-shell .pct {
  font-family: "Space Grotesk", sans-serif; font-size: 42px;
  font-weight: 700; letter-spacing: -.04em;
}
.log-feed {
  max-height: 260px; overflow-y: auto;
  font-family: ui-monospace, Menlo, monospace; font-size: 12px;
  background: #070b11; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 12px;
}
.log-feed div { padding: 2px 0; color: var(--muted); }
.log-feed .ok   { color: var(--cyan); }
.log-feed .bad  { color: var(--red); }
.log-feed .skip { color: var(--amber); }

/* Editor preview pane */
.preview-frame {
  width: 100%; height: 520px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff;
}

.tag-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px;
  background: rgba(0,101,221,.14); border: 1px solid rgba(0,101,221,.28);
  color: #8ac4ff; margin: 2px 3px 2px 0;
}

.merge-btn {
  font-family: ui-monospace, Menlo, monospace; font-size: 11.5px;
  padding: 4px 9px; border-radius: 7px; cursor: pointer;
  background: rgba(255,255,255,.05); border: 1px solid var(--line); color: var(--muted);
  transition: background .15s, color .15s;
}
.merge-btn:hover { background: rgba(0,229,169,.12); color: var(--cyan); border-color: rgba(0,229,169,.3); }

/* ---------------------------------------------------------------- */
/* Responsive                                                        */
/* ---------------------------------------------------------------- */

@media (max-width: 1080px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .grid-sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 60;
    transform: translateX(-100%);
    transition: transform .25s var(--ease);
    box-shadow: 0 0 60px rgba(0,0,0,.6);
  }
  .sidebar.is-open { transform: translateX(0); }
  .menu-btn { display: inline-flex; }
  .page { padding: 18px 15px; }
  .topbar { padding: 0 15px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dt { margin-top: 10px; }
  .scrim {
    position: fixed; inset: 0; background: rgba(0,0,0,.55);
    z-index: 50; display: none;
  }
  .scrim.is-open { display: block; }
}

@media print {
  .sidebar, .topbar, .btn-row, .flash-stack { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border-color: #ccc; background: #fff; }
}
