/* ============================================================================
   Bulk Mailer — futuristic dark design system
   Class names are kept stable so all Django templates restyle in place.
   ========================================================================== */

:root {
  /* surfaces */
  --bg:        #0a0a0b;
  --bg-2:      #0e0e10;
  --surface:   rgba(255,255,255,0.022);
  --surface-2: rgba(255,255,255,0.04);
  --glass:     rgba(20,20,24,0.6);

  /* lines */
  --line:      rgba(255,255,255,0.08);
  --line-2:    rgba(255,255,255,0.14);

  /* text */
  --text:      #ededf0;
  --muted:     #8a8a96;
  --faint:     #5c5c66;

  /* accents */
  --b:         #5b8cff;        /* primary blue */
  --cyan:      #22d3ee;
  --violet:    #a78bfa;
  --accent-grad: linear-gradient(120deg, #22d3ee 0%, #5b8cff 45%, #a78bfa 100%);

  /* status hues */
  --ok:   #34d399;
  --warn: #fbbf24;
  --err:  #f87171;

  --radius:   14px;
  --radius-sm: 10px;
  --shadow:   0 1px 0 rgba(255,255,255,0.04) inset, 0 8px 30px rgba(0,0,0,0.45);
}

/* ---- Light theme overrides (opt-in via <html data-theme="light">) -------- */
:root[data-theme="light"] {
  --bg:        #f7f8fa;
  --bg-2:      #ffffff;
  --surface:   rgba(10,12,20,0.018);
  --surface-2: rgba(10,12,20,0.045);
  --glass:     rgba(255,255,255,0.75);

  --line:      rgba(10,12,20,0.09);
  --line-2:    rgba(10,12,20,0.16);

  --text:      #1a1c22;
  --muted:     #5b6270;
  --faint:     #9aa0ac;

  --b:         #3b6cff;
  --shadow:    0 1px 0 rgba(255,255,255,0.6) inset, 0 6px 20px rgba(20,30,60,0.08);
}
:root[data-theme="light"] code { color: #2563eb; }
:root[data-theme="light"] .stat .n {
  background: linear-gradient(180deg, #14161c, #4a505e);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
:root[data-theme="light"] .btn.primary { color: #fff; }
:root[data-theme="light"] kbd { color: var(--text); }
:root[data-theme="light"] .badge.pending  { color: #2c4fb8; }
:root[data-theme="light"] .badge.sent,
:root[data-theme="light"] .badge.completed { color: #0f8a5f; }
:root[data-theme="light"] .badge.failed,
:root[data-theme="light"] .badge.provider-gmail   { color: #c0392b; }
:root[data-theme="light"] .badge.running           { color: #b7791f; }
:root[data-theme="light"] .badge.provider-outlook  { color: #2c4fb8; }
:root[data-theme="light"] .ql-snow .ql-picker-options { background: #fff; }

* { box-sizing: border-box; -webkit-tap-highlight-color: rgba(91,140,255,0.16); }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
  min-height: 100vh;
}

/* ambient grid + glow ------------------------------------------------------ */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% -10%, #000 30%, transparent 80%);
          mask-image: radial-gradient(ellipse 90% 70% at 50% -10%, #000 30%, transparent 80%);
  pointer-events: none; z-index: 0;
}
body::after {
  content: "";
  position: fixed; top: -240px; left: 50%; transform: translateX(-50%);
  width: 900px; height: 600px;
  background: radial-gradient(circle at 50% 50%, rgba(91,140,255,0.16), transparent 60%);
  filter: blur(40px); pointer-events: none; z-index: 0;
}
:root[data-theme="light"] body::before {
  background-image:
    linear-gradient(to right, rgba(10,20,60,0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(10,20,60,0.05) 1px, transparent 1px);
}
:root[data-theme="light"] body::after {
  background: radial-gradient(circle at 50% 50%, rgba(91,140,255,0.12), transparent 60%);
}

a { color: var(--b); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--cyan); }

code {
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.86em; background: var(--surface-2); border: 1px solid var(--line);
  padding: 1px 6px; border-radius: 6px; color: var(--cyan);
}

/* ============================================================================
   App shell — sidebar + content
   ========================================================================== */
.shell { display: flex; min-height: 100vh; position: relative; z-index: 1; }

.sidebar {
  width: 248px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 6px;
  padding: 20px 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 16px; color: var(--text);
  padding: 6px 10px 16px; letter-spacing: -0.02em;
}
.sidebar .brand .logo {
  width: 30px; height: 30px; border-radius: 9px; flex-shrink: 0;
  background: var(--accent-grad); box-shadow: 0 0 20px rgba(91,140,255,0.5);
  display: grid; place-items: center; font-size: 16px;
}
.sidebar .nav-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--faint); padding: 14px 12px 6px; font-weight: 600;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; font-size: 14px;
  position: relative; transition: background .15s, color .15s;
}
.sidebar nav a .ico { width: 17px; text-align: center; opacity: .85; }
.sidebar nav a:hover { background: var(--surface-2); color: var(--text); }
.sidebar nav a.active {
  background: linear-gradient(90deg, rgba(91,140,255,0.16), rgba(91,140,255,0.04));
  color: #fff;
}
.sidebar nav a.active::before {
  content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px;
  border-radius: 3px; background: var(--accent-grad);
  box-shadow: 0 0 12px rgba(91,140,255,0.7);
}
/* Light theme: never use white text on the pale active background */
:root[data-theme="light"] .sidebar nav a.active {
  background: linear-gradient(90deg, rgba(59,108,255,0.13), rgba(59,108,255,0.03));
  color: #1d3fb0;
}
:root[data-theme="light"] .sidebar nav a:hover { color: var(--text); }
:root[data-theme="light"] .sidebar {
  background: linear-gradient(180deg, rgba(20,30,60,0.025), rgba(20,30,60,0));
}
.sidebar .spacer { flex: 1; }
.sidebar .side-foot {
  border-top: 1px solid var(--line); padding-top: 12px; margin-top: 8px;
  display: flex; flex-direction: column; gap: 8px;
}
.sidebar .who {
  display: flex; align-items: center; gap: 10px; padding: 4px 8px;
  font-size: 13px; color: var(--muted);
}
.sidebar .who .avatar {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--violet), var(--b));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px;
  text-transform: uppercase;
}
.sidebar .who .role { font-size: 11px; color: var(--faint); }
.kbd-hint {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 8px 10px; margin: 0 2px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--muted); font-size: 12px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.kbd-hint:hover { border-color: var(--line-2); background: var(--surface-2); }
kbd {
  font-family: "JetBrains Mono", monospace; font-size: 11px;
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: 5px; padding: 1px 6px; color: var(--text);
}

/* ---- Sidebar dropdown (More / profile) menu ----------------------------- */
.avatar {
  width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--violet), var(--b));
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px;
  text-transform: uppercase;
}
.menu { position: relative; margin: 0 2px; }
.menu-btn {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); cursor: pointer; font: inherit;
  transition: border-color .15s, background .15s;
}
.menu-btn:hover { border-color: var(--line-2); background: var(--surface-2); }
.menu-btn .mname { display: flex; flex-direction: column; line-height: 1.25; text-align: left; font-size: 13px; min-width: 0; }
.menu-btn .mname .uname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.menu-btn .mname .role { font-size: 11px; color: var(--faint); }
.menu-btn .chev { margin-left: auto; color: var(--muted); transition: transform .2s ease; flex-shrink: 0; }
.menu.open .menu-btn .chev { transform: rotate(180deg); }
.menu-panel {
  position: absolute; bottom: calc(100% + 10px); left: 0; right: 0;
  background: var(--glass); border: 1px solid var(--line-2); border-radius: 13px;
  padding: 6px; box-shadow: 0 22px 55px rgba(0,0,0,0.5); backdrop-filter: blur(20px);
  display: none; flex-direction: column; gap: 2px; z-index: 90;
  animation: popIn .16s cubic-bezier(.2,.8,.2,1);
}
.menu.open .menu-panel { display: flex; }
.menu-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 9px 11px; border: none; background: none; border-radius: 9px;
  color: var(--muted); font: inherit; font-size: 13.5px; text-align: left; cursor: pointer;
}
.menu-item .ico { width: 17px; text-align: center; }
.menu-item .kbd-r { margin-left: auto; }
.menu-item:hover { background: var(--surface-2); color: var(--text); }
.menu-item.is-danger { color: var(--err); }
.menu-item.is-danger:hover { background: rgba(248,113,113,0.12); }
.menu-sep { height: 1px; background: var(--line); margin: 5px 4px; }
.menu-form { margin: 0; }
.menu-form .menu-item { width: 100%; }
.menu-mobile { display: none; }   /* Campaigns/Senders inside the menu: mobile only */

.main-area { flex: 1; min-width: 0; }

/* container used by all pages */
.container { max-width: 1080px; margin: 0 auto; padding: 40px 36px 80px; position: relative; z-index: 1; }
.main-area .container { margin: 0 auto; }

/* logged-out (login) — no sidebar */
.guest { display: grid; place-items: center; min-height: 100vh; position: relative; z-index: 1; }

/* ============================================================================
   Cards / typography
   ========================================================================== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  position: relative;
  transition: border-color .2s ease, transform .2s ease;
}
.card:hover { border-color: var(--line-2); }
.card.narrow { max-width: 400px; width: 100%; margin: 0 auto; }

h1 { font-size: 24px; font-weight: 650; margin: 0 0 18px; letter-spacing: -0.025em; }
h2 {
  font-size: 14px; font-weight: 600; margin: 0 0 14px;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}
h1 .badge { vertical-align: middle; }

label { display: block; margin: 14px 0; font-size: 13px; font-weight: 600; color: var(--text); }

input, select, textarea {
  width: 100%; padding: 10px 12px; margin-top: 6px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-2); color: var(--text);
  font: inherit; font-weight: 400;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: rgba(91,140,255,0.6);
  box-shadow: 0 0 0 3px rgba(91,140,255,0.14);
  background: var(--bg-2);
}
select option { background: var(--bg-2); color: var(--text); }
/* Keep browser autofill on-theme instead of the default white/yellow fill */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
select:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg-2) inset;
          box-shadow: 0 0 0 1000px var(--bg-2) inset;
  caret-color: var(--text);
  transition: background-color 9999s ease-out 0s;
}
:root[data-theme="light"] select option { background: #fff; }

.row { display: flex; gap: 16px; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 150px; }

/* ============================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px; border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  font: inherit; font-weight: 550; font-size: 14.5px;
  transition: transform .12s ease, border-color .15s, background .15s, box-shadow .15s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--line-2); background: rgba(255,255,255,0.07); color: var(--text); }
.btn:active { transform: translateY(0); }
/* Primary = the highlighted "next" button the user should click. Made bigger and
   bolder so it's unmistakably the main action on every step. */
.btn.primary {
  background: var(--accent-grad); color: #07111f; border: none; font-weight: 700;
  padding: 12px 24px; font-size: 15.5px;
  box-shadow: 0 4px 18px rgba(91,140,255,0.4);
}
.btn.primary:hover { color: #07111f; box-shadow: 0 8px 28px rgba(91,140,255,0.6); }
.btn.danger { background: rgba(248,113,113,0.12); border-color: rgba(248,113,113,0.4); color: #fca5a5; font-size: 14.5px; }
.btn.danger:hover { background: rgba(248,113,113,0.2); color: #fecaca; }
.btn.btn-danger-ghost { background: none; border-color: transparent; color: var(--muted); padding: 6px 11px; font-size: 18px; line-height: 1; }
.btn.btn-danger-ghost:hover { color: #fca5a5; background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.3); }
/* Larger inline action links (e.g. the Delete button in list tables). */
.actions .link, td .link, .link.is-danger { font-size: 14.5px; padding: 4px 6px; }
.ico { font-size: 1.05em; }

button.link { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0; transition: color .15s; }
button.link:hover { color: var(--err); }
.inline { display: inline; }

/* ============================================================================
   Tables
   ========================================================================== */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
th {
  color: var(--faint); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.07em;
}
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--surface); }
tbody tr:last-child td { border-bottom: none; }

.muted { color: var(--muted); }

/* ============================================================================
   Alerts
   ========================================================================== */
.alert {
  padding: 11px 15px; border-radius: var(--radius-sm); margin-bottom: 16px;
  font-size: 13.5px; border: 1px solid transparent; display: flex; gap: 8px; align-items: center;
}
.alert.success { background: rgba(52,211,153,0.1); color: #6ee7b7; border-color: rgba(52,211,153,0.25); }
.alert.error   { background: rgba(248,113,113,0.1); color: #fca5a5; border-color: rgba(248,113,113,0.25); }
.alert.warning, .alert.info { background: rgba(251,191,36,0.09); color: #fcd34d; border-color: rgba(251,191,36,0.22); }

/* ============================================================================
   Badges
   ========================================================================== */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
  border: 1px solid transparent; letter-spacing: 0.01em; line-height: 1.4;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge.pending           { background: rgba(91,140,255,0.12); color: #93b4ff; border-color: rgba(91,140,255,0.28); }
.badge.sent,
.badge.completed         { background: rgba(52,211,153,0.12); color: #6ee7b7; border-color: rgba(52,211,153,0.28); }
.badge.failed            { background: rgba(248,113,113,0.12); color: #fca5a5; border-color: rgba(248,113,113,0.28); }
.badge.running           { background: rgba(251,191,36,0.12); color: #fcd34d; border-color: rgba(251,191,36,0.28); }
.badge.running::before   { animation: pulse 1.4s ease-in-out infinite; }
.badge.draft, .badge.paused { background: rgba(255,255,255,0.06); color: var(--muted); border-color: var(--line-2); }
.badge.provider-gmail    { background: rgba(248,113,113,0.1); color: #fca5a5; border-color: rgba(248,113,113,0.25); }
.badge.provider-outlook  { background: rgba(91,140,255,0.1); color: #93b4ff; border-color: rgba(91,140,255,0.25); }

@keyframes pulse { 0%,100% { opacity: 1; box-shadow: 0 0 0 0 currentColor; } 50% { opacity: .4; } }

/* ============================================================================
   Stat grid (dashboard metrics)
   ========================================================================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 14px; }
.stat {
  background: linear-gradient(160deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 16px; position: relative; overflow: hidden;
  transition: border-color .2s, transform .2s;
}
.stat::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at 100% 0%, rgba(91,140,255,0.12), transparent 60%);
}
.stat:hover { transform: translateY(-2px); border-color: var(--line-2); }
.stat .n {
  font-size: 28px; font-weight: 700; letter-spacing: -0.03em;
  background: linear-gradient(180deg, #fff, #b9bcc7); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent;
}
.stat .l { color: var(--muted); font-size: 12px; margin-top: 2px; text-transform: uppercase; letter-spacing: 0.05em; }

/* ============================================================================
   Layout helpers
   ========================================================================== */
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0; }
.toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.toolbar > div:first-child { flex: 1; }
.toolbar > div:first-child h1 { margin: 8px 0 0 0; }
.help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }

/* ============================================================================
   Quill editor (dark)
   ========================================================================== */
.ql-toolbar.ql-snow, .ql-container.ql-snow { border-color: var(--line) !important; }
.ql-toolbar.ql-snow { background: var(--surface-2); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.ql-container.ql-snow { border-radius: 0 0 var(--radius-sm) var(--radius-sm); background: var(--bg-2); }
.ql-editor { min-height: 220px; color: var(--text); }
.ql-editor.ql-blank::before { color: var(--faint); }
.ql-snow .ql-stroke { stroke: var(--muted); }
.ql-snow .ql-fill { fill: var(--muted); }
.ql-snow .ql-picker { color: var(--muted); }
.ql-snow .ql-picker-options { background: #16161a; border-color: var(--line) !important; }
.ql-snow.ql-toolbar button:hover .ql-stroke { stroke: var(--cyan); }
.ql-snow.ql-toolbar button.ql-active .ql-stroke { stroke: var(--cyan); }

/* ============================================================================
   Composer mode tabs
   ========================================================================== */
.compose-tabs { display: flex; gap: 4px; margin: 8px 0; }
.compose-tab {
  padding: 8px 15px; border: 1px solid var(--line); background: var(--surface);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0; cursor: pointer; font-size: 13.5px;
  color: var(--muted); border-bottom: none; transition: color .15s, background .15s;
}
.compose-tab.active { background: var(--surface-2); color: var(--text); font-weight: 600; box-shadow: 0 -2px 0 var(--b) inset; }
.html-source { min-height: 240px; font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }

/* ============================================================================
   Command palette (⌘K)
   ========================================================================== */
.cmdk-overlay {
  position: fixed; inset: 0; z-index: 100; display: none;
  background: rgba(5,5,7,0.6); backdrop-filter: blur(6px);
  align-items: flex-start; justify-content: center; padding-top: 14vh;
  animation: fadeIn .15s ease;
}
.cmdk-overlay.open { display: flex; }
.cmdk {
  width: min(560px, 92vw);
  background: var(--glass); border: 1px solid var(--line-2);
  border-radius: 16px; overflow: hidden; box-shadow: 0 30px 80px rgba(0,0,0,0.65);
  backdrop-filter: blur(20px); animation: popIn .18s cubic-bezier(.2,.8,.2,1);
}
.cmdk-search { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.cmdk-search input { border: none; background: none; margin: 0; padding: 0; font-size: 16px; box-shadow: none; }
.cmdk-search input:focus { box-shadow: none; }
.cmdk-search .ico { color: var(--muted); }
.cmdk-list { max-height: 320px; overflow-y: auto; padding: 8px; }
.cmdk-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--muted);
}
.cmdk-item .ico { width: 18px; text-align: center; }
.cmdk-item.active { background: var(--surface-2); color: var(--text); }
.cmdk-item .arrow { margin-left: auto; opacity: 0; }
.cmdk-item.active .arrow { opacity: .6; }
.cmdk-empty { padding: 24px; text-align: center; color: var(--faint); font-size: 13px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

/* ============================================================================
   Page enter animation
   ========================================================================== */
.container > * { animation: rise .4s cubic-bezier(.2,.7,.2,1) backwards; }
.container > *:nth-child(2) { animation-delay: .04s; }
.container > *:nth-child(3) { animation-delay: .08s; }
.container > *:nth-child(4) { animation-delay: .12s; }
.container > *:nth-child(5) { animation-delay: .16s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

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

/* ============================================================================
   Responsive — tablet / mobile top bar
   ========================================================================== */
@media (max-width: 820px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; top: 0; z-index: 50;
    flex-direction: row; align-items: center; gap: 8px; padding: 9px 14px;
    border-right: none; border-bottom: 1px solid var(--line);
    flex-wrap: nowrap; backdrop-filter: blur(14px);
  }
  .sidebar .brand { padding: 0 4px 0 0; font-size: 15px; white-space: nowrap; }
  .sidebar .nav-label { display: none; }
  /* small screens: ALL nav lives in the dropdown */
  .sidebar .primary-nav { display: none; }
  .sidebar .spacer { flex: 1 0 4px; }
  .menu { margin: 0; }
  .menu-btn { width: auto; }
  .menu-btn .mname { display: none; }     /* compact: avatar + chevron only */
  .menu-panel {
    bottom: auto; top: calc(100% + 10px); left: auto; right: 0;
    width: min(248px, 80vw);
  }
  .menu-mobile { display: flex; }         /* reveal Campaigns/Senders in the menu */
  .container { padding: 24px 16px 60px; }
  .toolbar { gap: 12px; }
  /* tables scroll horizontally instead of overflowing the card */
  .card table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
}

@media (max-width: 560px) {
  h1 { font-size: 20px; }
  .card { padding: 18px 16px; }
  .container { padding: 20px 12px 56px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat .n { font-size: 24px; }
  .actions { width: 100%; }
  .actions .btn { flex: 1 1 auto; justify-content: center; }
  .row { gap: 10px; }
  .row > label { min-width: 100%; }
  .cmdk-overlay { padding-top: 9vh; }
}

/* ============================================================================
   Prachandam — brand mark, landing page, premium polish & motion
   ========================================================================== */

/* Logomark: wrapper sets the box; the SVG fills it. Soft ambient glow + a gentle
   float so it feels alive without being distracting. */
.brand-logo { display: inline-flex; width: 30px; height: 30px; flex-shrink: 0; }
.brand-mark { width: 100%; height: 100%; display: block;
  filter: drop-shadow(0 3px 10px rgba(91,140,255,0.45)); }

.sidebar .brand .brand-logo .brand-mark { animation: markFloat 6s ease-in-out infinite; }
@keyframes markFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }

/* Login brand row */
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.login-brand .brand-word { font-weight: 700; font-size: 19px; letter-spacing: -0.03em;
  background: linear-gradient(120deg, var(--text), var(--muted));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }

/* Larger primary button variant (landing CTA) */
.btn.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: 12px; }

/* ---- Landing page ---- */
.landing {
  min-height: calc(100vh - 40px);
  display: grid; place-items: center; text-align: center;
  padding: 40px 20px; position: relative;
}
.landing-inner {
  max-width: 560px; display: flex; flex-direction: column; align-items: center;
}
.landing-inner > * { opacity: 0; animation: rise .7s cubic-bezier(.2,.7,.2,1) forwards; }
.landing-badge  { animation-delay: .02s; }
.landing-logo   { animation-delay: .10s; }
.landing-title  { animation-delay: .18s; }
.landing-tagline{ animation-delay: .26s; }
.landing-cta    { animation-delay: .34s; }
.landing-note   { animation-delay: .42s; }

.landing-badge {
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600;
  color: var(--muted); padding: 6px 14px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--surface); margin-bottom: 30px;
}
.landing-logo { width: 88px; height: 88px; margin-bottom: 26px; }
.landing-logo .brand-mark { animation: markFloat 6s ease-in-out infinite;
  filter: drop-shadow(0 10px 34px rgba(91,140,255,0.55)); }
.landing-title {
  font-size: 60px; font-weight: 700; letter-spacing: -0.04em; margin: 0 0 14px;
  line-height: 1;
  background: linear-gradient(120deg, var(--text) 30%, var(--b) 75%, var(--violet));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.landing-tagline { font-size: 18px; color: var(--muted); margin: 0 0 34px; line-height: 1.5; max-width: 460px; }
.landing-cta { margin-bottom: 26px; }
.landing-note { font-size: 13px; color: var(--faint); margin: 0; }

@media (max-width: 560px) {
  .landing-title { font-size: 42px; }
  .landing-tagline { font-size: 16px; }
  .landing-logo { width: 72px; height: 72px; }
}

/* ---- Progress bar shimmer (campaign dashboard) — reads as "live sending" ---- */
.progress-track > div { position: relative; overflow: hidden; transition: width .6s cubic-bezier(.4,0,.2,1); }
.progress-track > div::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.45), transparent);
  transform: translateX(-100%); animation: shimmer 1.6s ease-in-out infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ---- Setup wizard stepper (draft campaigns) ---- */
.stepper {
  list-style: none; margin: 6px 0 24px; padding: 16px 18px;
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.stepper .step { flex: 0 0 auto; }
.stepper .step a { display: flex; align-items: center; gap: 11px; text-decoration: none; padding: 4px 6px; border-radius: 10px; }
.stepper .step-num {
  width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; border: 2px solid var(--line-2);
  color: var(--muted); background: var(--surface-2);
}
.stepper .step-label { font-size: 15px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.stepper .step-line { flex: 1 1 24px; min-width: 20px; height: 2px; background: var(--line-2); border-radius: 2px; }
/* current step — the one the user is on */
.stepper .step.active .step-num { background: var(--b); border-color: var(--b); color: #fff; box-shadow: 0 0 0 4px rgba(91,140,255,0.18); }
.stepper .step.active .step-label { color: var(--text); }
/* completed steps */
.stepper .step.done .step-num { background: var(--ok); border-color: var(--ok); color: #06281c; }
.stepper .step.done .step-label { color: var(--text); }
.stepper .step a:hover .step-label { color: var(--text); }
@media (max-width: 600px) {
  .stepper .step-label { display: none; }   /* keep just the numbered circles on small screens */
  .stepper { justify-content: space-between; }
}

/* ---- Campaign tab navigation ---- */
.campaign-tabs {
  display: flex; gap: 4px; margin: 4px 0 18px; padding-bottom: 2px;
  border-bottom: 1px solid var(--line); overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.campaign-tabs a {
  padding: 9px 15px; border-radius: 9px 9px 0 0; white-space: nowrap;
  color: var(--muted); text-decoration: none; font-weight: 550; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, background .15s;
}
.campaign-tabs a:hover { color: var(--text); background: var(--surface); }
.campaign-tabs a.active { color: var(--text); border-bottom-color: var(--b); }

/* ---- Segmented toggle (Console / Table) ---- */
.seg { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line);
  border-radius: 10px; background: var(--surface); }
.seg-btn {
  padding: 6px 14px; border: none; background: transparent; color: var(--muted);
  font: inherit; font-size: 13px; font-weight: 550; border-radius: 7px; cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--surface-2); color: var(--text); box-shadow: var(--shadow); }

/* ---- Send console (terminal) — authentic dark look in both themes ---- */
.term { border-radius: 12px; overflow: hidden; border: 1px solid #1e2430;
  box-shadow: 0 18px 50px rgba(0,0,0,0.5); background: #0b0e15; }
.term-bar { display: flex; align-items: center; gap: 10px; padding: 9px 14px;
  background: #11151f; border-bottom: 1px solid #1e2430; }
.term-dots { display: inline-flex; gap: 6px; }
.term-dots i { width: 11px; height: 11px; border-radius: 50%; display: block; }
.term-dots i:nth-child(1) { background: #ff5f57; }
.term-dots i:nth-child(2) { background: #febc2e; }
.term-dots i:nth-child(3) { background: #28c840; }
.term-title { color: #8b93a7; font-size: 12.5px; font-weight: 600; letter-spacing: 0.02em;
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; }
.term-live { color: #34d399; margin-left: 6px; animation: pulseDot 1.4s ease-in-out infinite; }
@keyframes pulseDot { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.term-refresh { margin-left: auto; color: #8b93a7; text-decoration: none; font-size: 15px;
  line-height: 1; padding: 2px 6px; border-radius: 6px; }
.term-refresh:hover { color: #fff; background: rgba(255,255,255,0.08); }
.term-body { max-height: 380px; overflow-y: auto; padding: 14px 16px;
  font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.85; color: #cdd3e0; }
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line + .term-line { margin-top: 1px; }
.t-time { color: #59617a; }
.t-ok   { color: #3ddc84; font-weight: 600; }
.t-err  { color: #ff6b6b; font-weight: 600; }
.t-to   { color: #e8ecf5; }
.t-dim  { color: #6b7488; }
.t-done { color: #3ddc84; font-weight: 600; }
.term-cursor { display: inline-block; width: 8px; height: 14px; margin-left: 6px;
  background: #3ddc84; vertical-align: text-bottom; animation: blink 1.1s steps(1) infinite; }
@keyframes blink { 0%,50% { opacity: 1; } 50.01%,100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .term-cursor, .term-live { animation: none; } }

/* Unsaved-changes cue: the save button of a dirty guarded form gets an amber ring. */
.js-guard.is-dirty .btn.primary {
  box-shadow: 0 0 0 2px var(--warn), 0 4px 18px rgba(251,191,36,0.35);
}
.js-guard.is-dirty .btn.primary::after { content: " • unsaved"; opacity: .8; font-weight: 500; }
@media (prefers-reduced-motion: reduce) {
  .brand-mark, .landing-inner > *, .progress-track > div::after { animation: none !important; }
  .landing-inner > * { opacity: 1; }
}
