:root {
  color-scheme: dark;
  --bg: #06131b;
  --surface: #0b1c26;
  --surface-2: #102630;
  --surface-3: #16333e;
  --line: rgba(148, 203, 201, .14);
  --line-strong: rgba(148, 203, 201, .25);
  --text: #effffc;
  --muted: #8fb2b1;
  --muted-2: #668887;
  --brand: #29dcc3;
  --brand-dark: #0fae9b;
  --brand-soft: rgba(41, 220, 195, .12);
  --blue: #56a8ff;
  --warning: #f5bd61;
  --danger: #ff7a8a;
  --success: #5ce0a3;
  --radius: 18px;
  --shadow: 0 18px 65px rgba(0, 0, 0, .28);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { overflow-x: hidden; }
button, input, textarea, select { font: inherit; }
button { color: inherit; }
a { color: var(--brand); }
[hidden] { display: none !important; }

body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .7;
  background:
    radial-gradient(circle at 75% 5%, rgba(41,220,195,.09), transparent 33%),
    radial-gradient(circle at 16% 90%, rgba(86,168,255,.07), transparent 30%),
    linear-gradient(rgba(255,255,255,.014) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.014) 1px, transparent 1px);
  background-size: auto, auto, 32px 32px, 32px 32px;
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 258px minmax(0,1fr); position: relative; }
.sidebar {
  min-height: 100vh; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  padding: 26px 18px 20px; background: rgba(6, 19, 27, .92); border-right: 1px solid var(--line); backdrop-filter: blur(22px); z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 26px; border-bottom: 1px solid var(--line); }
.brand-mark { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: #04211d; font-weight: 900; font-size: 12px; background: linear-gradient(135deg, #6fffe8, var(--brand-dark)); box-shadow: 0 8px 32px rgba(41,220,195,.22); }
.brand strong, .brand small { display: block; }
.brand strong { letter-spacing: -.02em; }
.brand small { color: var(--muted); margin-top: 2px; font-size: 12px; letter-spacing: .07em; text-transform: uppercase; }
.nav { display: grid; gap: 5px; margin: 24px 0; }
.nav-item { display: flex; gap: 12px; align-items: center; width: 100%; border: 0; background: transparent; border-radius: 12px; padding: 11px 12px; color: var(--muted); cursor: pointer; text-align: left; transition: .2s ease; }
.nav-item:hover { color: var(--text); background: rgba(255,255,255,.035); transform: translateX(2px); }
.nav-item.active { color: var(--text); background: var(--brand-soft); box-shadow: inset 3px 0 var(--brand); }
.nav-icon { width: 22px; height: 22px; display: grid; place-items: center; font-weight: 700; color: var(--brand); }
.sidebar-card { margin-top: auto; border: 1px solid var(--line); border-radius: 14px; padding: 15px; background: linear-gradient(145deg, rgba(41,220,195,.08), rgba(86,168,255,.04)); }
.sidebar-card p { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 8px 0 0; }
.live-dot { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: #bdfef3; }
.live-dot span { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--success); margin-right: 6px; box-shadow: 0 0 0 5px rgba(92,224,163,.08); }
.sidebar-footer { display: flex; align-items: center; gap: 10px; padding: 18px 7px 0; }
.sidebar-footer strong, .sidebar-footer small { display: block; max-width: 155px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer strong { font-size: 12px; }
.sidebar-footer small { color: var(--muted-2); font-size: 10px; margin-top: 3px; }
.avatar { width: 34px; height: 34px; flex: 0 0 34px; display: grid; place-items: center; border-radius: 10px; background: var(--surface-3); color: var(--brand); font-weight: 800; }

.main { min-width: 0; }
.topbar { min-height: 112px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 25px clamp(22px, 4vw, 54px); border-bottom: 1px solid var(--line); background: rgba(6,19,27,.68); backdrop-filter: blur(16px); position: sticky; top: 0; z-index: 8; }
.eyebrow { color: var(--brand); font-size: 10px; font-weight: 900; letter-spacing: .18em; margin: 0 0 5px; }
h1 { font-size: clamp(25px, 3vw, 34px); letter-spacing: -.04em; margin: 0; }
.topbar-actions { display: flex; gap: 10px; }
.mobile-menu { display: none; border: 0; background: transparent; font-size: 20px; }
.content { padding: 34px clamp(22px, 4vw, 54px) 70px; max-width: 1700px; margin: 0 auto; }

.button { border: 1px solid var(--line-strong); border-radius: 11px; min-height: 42px; padding: 9px 15px; cursor: pointer; font-weight: 750; font-size: 13px; transition: .2s ease; display: inline-flex; align-items: center; justify-content: center; gap: 7px; background: var(--surface-2); }
.button:hover { transform: translateY(-1px); border-color: rgba(41,220,195,.45); }
.button.primary { border-color: transparent; color: #03231f; background: linear-gradient(135deg, #73ffe9, var(--brand)); box-shadow: 0 10px 28px rgba(41,220,195,.16); }
.button.ghost { background: transparent; }
.button.danger { color: #ffd9de; border-color: rgba(255,122,138,.25); background: rgba(255,122,138,.08); }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 11px; border-radius: 9px; }
.button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.icon-button { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }

.hero-panel { overflow: hidden; position: relative; border: 1px solid var(--line); border-radius: 24px; padding: clamp(24px,4vw,44px); background: linear-gradient(135deg, rgba(16,42,53,.96), rgba(8,28,38,.96)); box-shadow: var(--shadow); }
.hero-panel::after { content:""; position:absolute; width:380px; height:380px; border-radius:50%; right:-120px; top:-180px; background: radial-gradient(circle, rgba(41,220,195,.2), transparent 65%); }
.hero-panel h2 { margin: 5px 0 10px; font-size: clamp(28px,4vw,48px); max-width: 780px; letter-spacing: -.055em; line-height: 1.05; }
.hero-panel p { max-width: 720px; color: var(--muted); line-height: 1.7; margin: 0; }
.hero-kicker { color: var(--brand); font-size: 11px; font-weight: 900; letter-spacing: .17em; text-transform: uppercase; }
.hero-actions { display:flex; gap:10px; margin-top:24px; flex-wrap:wrap; }

.stat-grid { display: grid; grid-template-columns: repeat(5, minmax(150px,1fr)); gap: 14px; margin: 20px 0; }
.stat-card { min-height: 125px; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(11,28,38,.82); position: relative; overflow: hidden; }
.stat-card::after { content:""; position:absolute; inset:auto -25px -40px auto; width:90px; height:90px; border-radius:50%; background: var(--brand-soft); }
.stat-card label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 800; }
.stat-card strong { display: block; font-size: 31px; letter-spacing: -.04em; margin-top: 16px; }
.stat-card small { color: var(--muted-2); }

.grid-2 { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(300px,.75fr); gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(11,28,38,.82); overflow: hidden; }
.panel-header { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.panel-header h2, .panel-header h3 { margin: 0; font-size: 16px; }
.panel-header p { color: var(--muted); margin: 3px 0 0; font-size: 12px; }
.panel-body { padding: 19px; }
.section-heading { display:flex; justify-content:space-between; align-items:end; gap:16px; margin-bottom:18px; }
.section-heading h2 { margin:0; font-size:22px; letter-spacing:-.03em; }
.section-heading p { color:var(--muted); margin:6px 0 0; font-size:13px; }
.section-actions { display:flex; gap:9px; flex-wrap:wrap; }

.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; }
th { color:var(--muted-2); text-transform:uppercase; letter-spacing:.08em; font-size:10px; text-align:left; padding:13px 14px; border-bottom:1px solid var(--line); white-space:nowrap; }
td { padding:14px; border-bottom:1px solid rgba(148,203,201,.08); font-size:13px; color:#d9efec; vertical-align:middle; }
tr:last-child td { border-bottom:0; }
tbody tr:hover { background:rgba(255,255,255,.018); }
.cell-primary { font-weight:750; color:var(--text); }
.cell-secondary { color:var(--muted); font-size:11px; margin-top:3px; }
.table-actions { display:flex; gap:6px; justify-content:flex-end; }

.badge { display:inline-flex; align-items:center; gap:6px; border-radius:999px; padding:5px 9px; font-size:10px; text-transform:uppercase; letter-spacing:.07em; font-weight:850; border:1px solid var(--line); color:var(--muted); background:rgba(255,255,255,.025); }
.badge.success, .badge.ready, .badge.sent, .badge.completed, .badge.active { color:#bfffe0; border-color:rgba(92,224,163,.22); background:rgba(92,224,163,.08); }
.badge.warning, .badge.pending, .badge.scheduled, .badge.queued { color:#ffe2aa; border-color:rgba(245,189,97,.23); background:rgba(245,189,97,.08); }
.badge.danger, .badge.failed, .badge.disabled, .badge.invalid, .badge.bounced { color:#ffd1d7; border-color:rgba(255,122,138,.23); background:rgba(255,122,138,.08); }
.badge.sending { color:#cfe8ff; border-color:rgba(86,168,255,.22); background:rgba(86,168,255,.08); }
.badge.draft, .badge.paused, .badge.unsubscribed, .badge.suppressed { color:#c3d5d4; }
.dot { width:7px; height:7px; border-radius:50%; background:currentColor; opacity:.85; }

.card-grid { display:grid; grid-template-columns:repeat(3,minmax(260px,1fr)); gap:14px; }
.entity-card { border:1px solid var(--line); border-radius:18px; background:rgba(11,28,38,.82); padding:18px; transition:.2s ease; }
.entity-card:hover { transform:translateY(-2px); border-color:rgba(41,220,195,.28); box-shadow:0 16px 45px rgba(0,0,0,.15); }
.entity-card-top { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.entity-card h3 { margin:0; font-size:16px; }
.entity-card p { color:var(--muted); line-height:1.55; min-height:40px; font-size:12px; }
.entity-card-footer { display:flex; align-items:center; justify-content:space-between; padding-top:14px; margin-top:14px; border-top:1px solid var(--line); }
.entity-card-footer strong { font-size:22px; }
.entity-card-footer small { color:var(--muted-2); display:block; }
.color-chip { width:12px; height:12px; border-radius:4px; display:inline-block; box-shadow:0 0 0 4px rgba(255,255,255,.03); }

.toolbar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.toolbar-group { display:flex; gap:9px; flex-wrap:wrap; }
.search { min-width:min(340px,100%); position:relative; }
.search input { padding-left:37px; }
.search::before { content:"⌕"; position:absolute; left:13px; top:50%; transform:translateY(-50%); color:var(--muted-2); }
input, textarea, select { width:100%; border:1px solid var(--line-strong); background:#091a23; color:var(--text); border-radius:11px; padding:11px 12px; outline:none; transition:.15s ease; }
input:focus, textarea:focus, select:focus { border-color:var(--brand); box-shadow:0 0 0 3px rgba(41,220,195,.08); }
textarea { min-height:120px; resize:vertical; line-height:1.55; }
label.field { display:grid; gap:7px; color:#c9dedd; font-size:12px; font-weight:700; }
label.field > span small { color:var(--muted-2); font-weight:500; }
.form-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; }
.form-grid .wide { grid-column:1/-1; }
.form-section { border-top:1px solid var(--line); margin-top:18px; padding-top:18px; }
.form-section h3 { font-size:13px; margin:0 0 13px; text-transform:uppercase; letter-spacing:.08em; color:var(--muted); }
.checkbox-row { display:flex; flex-wrap:wrap; gap:8px; }
.checkbox-pill { position:relative; }
.checkbox-pill input { position:absolute; opacity:0; pointer-events:none; }
.checkbox-pill span { display:block; border:1px solid var(--line); border-radius:999px; padding:7px 10px; color:var(--muted); font-size:11px; cursor:pointer; }
.checkbox-pill input:checked + span { color:#c9fff7; border-color:rgba(41,220,195,.4); background:var(--brand-soft); }

.progress { height:6px; border-radius:999px; overflow:hidden; background:rgba(255,255,255,.05); }
.progress span { display:block; height:100%; border-radius:inherit; background:linear-gradient(90deg,var(--brand-dark),var(--brand)); }
.metric-row { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; margin-top:14px; }
.metric { padding:10px; border-radius:10px; background:rgba(255,255,255,.025); }
.metric small { display:block; color:var(--muted-2); font-size:9px; text-transform:uppercase; letter-spacing:.07em; }
.metric strong { display:block; margin-top:5px; font-size:15px; }

.notice { border:1px solid rgba(245,189,97,.2); border-radius:14px; padding:14px 16px; background:rgba(245,189,97,.06); color:#f8d9a3; font-size:12px; line-height:1.55; }
.notice.info { border-color:rgba(86,168,255,.2); background:rgba(86,168,255,.06); color:#c7e4ff; }
.notice.success { border-color:rgba(92,224,163,.2); background:rgba(92,224,163,.06); color:#c4ffe1; }
.empty-state { text-align:center; padding:55px 22px; }
.empty-icon { width:54px; height:54px; border-radius:17px; display:grid; place-items:center; margin:0 auto 16px; background:var(--brand-soft); color:var(--brand); font-size:24px; }
.empty-state h3 { margin:0 0 7px; }
.empty-state p { color:var(--muted); max-width:430px; margin:0 auto 18px; line-height:1.6; }

.modal-backdrop { position:fixed; inset:0; z-index:100; display:grid; place-items:center; padding:20px; background:rgba(0,7,12,.74); backdrop-filter:blur(8px); }
.modal { width:min(720px,100%); max-height:min(90vh,930px); overflow:auto; border:1px solid var(--line-strong); border-radius:22px; background:#0a1c25; box-shadow:0 40px 120px rgba(0,0,0,.55); }
.modal.large { width:min(1100px,100%); }
.modal-header { position:sticky; top:0; z-index:2; display:flex; justify-content:space-between; align-items:center; padding:20px 22px; border-bottom:1px solid var(--line); background:rgba(10,28,37,.95); backdrop-filter:blur(14px); }
.modal-header h2 { margin:0; font-size:20px; letter-spacing:-.03em; }
.modal-header p { margin:4px 0 0; color:var(--muted); font-size:12px; }
.modal-body { padding:22px; }
.modal-footer { position:sticky; bottom:0; display:flex; justify-content:flex-end; gap:9px; padding:16px 22px; border-top:1px solid var(--line); background:rgba(10,28,37,.95); backdrop-filter:blur(14px); }
.close-modal { width:36px; height:36px; border-radius:10px; border:1px solid var(--line); background:var(--surface-2); cursor:pointer; }
.composer-layout { display:grid; grid-template-columns:minmax(0,1.1fr) minmax(300px,.9fr); gap:18px; }
.email-preview { min-height:560px; width:100%; border:1px solid var(--line); border-radius:13px; background:#fff; }
.mapping-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin-top:16px; }
.file-drop { border:1px dashed rgba(41,220,195,.4); border-radius:16px; padding:28px; text-align:center; background:rgba(41,220,195,.035); }
.file-drop input { max-width:430px; margin:13px auto 0; }
.sample-table { max-height:260px; overflow:auto; margin-top:16px; border:1px solid var(--line); border-radius:12px; }

.toast-stack { position:fixed; right:22px; bottom:22px; z-index:200; display:grid; gap:10px; width:min(390px,calc(100vw - 44px)); }
.toast { border:1px solid var(--line-strong); border-radius:13px; padding:14px 15px; background:#102b35; box-shadow:var(--shadow); animation:toast-in .25s ease; }
.toast strong { display:block; font-size:13px; }
.toast p { color:var(--muted); margin:4px 0 0; font-size:11px; line-height:1.45; }
.toast.error { border-color:rgba(255,122,138,.35); }
@keyframes toast-in { from { opacity:0; transform:translateY(10px); } }

.loading-state { min-height:45vh; display:grid; place-items:center; align-content:center; gap:12px; color:var(--muted); }
.spinner { width:30px; height:30px; border:3px solid rgba(41,220,195,.15); border-top-color:var(--brand); border-radius:50%; animation:spin .75s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }
.skeleton { border-radius:10px; min-height:18px; background:linear-gradient(90deg,rgba(255,255,255,.03),rgba(255,255,255,.07),rgba(255,255,255,.03)); background-size:200% 100%; animation:shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position:-200% 0; } }
.pagination { display:flex; justify-content:space-between; align-items:center; padding:14px 0 0; color:var(--muted); font-size:12px; }
.code-token { display:inline-block; padding:3px 6px; border:1px solid var(--line); border-radius:6px; background:#07171f; color:#a5f8ec; font-family:ui-monospace,monospace; font-size:10px; }

@media (max-width: 1180px) {
  .stat-grid { grid-template-columns:repeat(3,1fr); }
  .card-grid { grid-template-columns:repeat(2,1fr); }
  .grid-2 { grid-template-columns:1fr; }
}
@media (max-width: 820px) {
  .app-shell { grid-template-columns:1fr; }
  .sidebar { position:fixed; left:0; transform:translateX(-105%); transition:.25s ease; width:258px; box-shadow:30px 0 90px #0009; }
  .sidebar.open { transform:translateX(0); }
  .mobile-menu { display:block; }
  .topbar { min-height:92px; padding:18px 20px; }
  .topbar-actions .ghost { display:none; }
  .content { padding:24px 18px 55px; }
  .stat-grid { grid-template-columns:repeat(2,1fr); }
  .card-grid { grid-template-columns:1fr; }
  .composer-layout { grid-template-columns:1fr; }
  .email-preview { min-height:380px; }
}
@media (max-width: 540px) {
  .stat-grid { grid-template-columns:1fr; }
  .form-grid, .mapping-grid { grid-template-columns:1fr; }
  .section-heading { align-items:flex-start; flex-direction:column; }
  .topbar-actions .button { padding:9px 11px; }
  .topbar-actions .button span:last-child { display:none; }
  .metric-row { grid-template-columns:repeat(2,1fr); }
}
