:root {
  --bg-deep: #070b12;
  --bg-elevated: #111927;
  --bg-hover: #162033;
  --border: rgba(120, 180, 220, 0.12);
  --border-strong: rgba(80, 220, 200, 0.28);
  --text: #e8eef7;
  --text-muted: #8b9bb0;
  --accent: #2dd4bf;
  --accent-soft: rgba(45, 212, 191, 0.14);
  --accent-glow: rgba(45, 212, 191, 0.35);
  --cyan: #38bdf8;
  --danger: #fb7185;
  --success: #34d399;
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }

.app-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(45, 212, 191, 0.12), transparent 50%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(56, 189, 248, 0.1), transparent 45%),
    linear-gradient(180deg, #070b12 0%, #0a1018 100%);
}
.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 180, 220, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 180, 220, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 20%, transparent 75%);
  z-index: 0;
}
.sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  padding: 1.75rem 1.25rem;
  border-right: 1px solid var(--border);
  background: rgba(8, 12, 20, 0.72);
  backdrop-filter: blur(16px);
  z-index: 2;
}
.sidebar-brand { display: flex; gap: 0.85rem; align-items: center; margin-bottom: 2.5rem; padding: 0 0.35rem; }
.brand-mark {
  width: 2.25rem; height: 2.25rem; border-radius: 0.65rem;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  box-shadow: 0 0 24px var(--accent-glow);
}
.brand-name { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; }
.brand-sub { margin: 0.1rem 0 0; font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.sidebar-nav { display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 0.9rem; border-radius: 0.75rem;
  color: var(--text-muted); transition: 0.2s ease;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text); }
.nav-link.active { background: var(--accent-soft); color: var(--accent); }
.sidebar-footer { padding: 0.75rem 0.9rem; color: var(--text-muted); font-size: 0.75rem; border-top: 1px solid var(--border); }
.main { position: relative; z-index: 1; padding: 2rem 2.25rem 3rem; max-width: 1200px; width: 100%; animation: pageIn 0.45s ease; }
.page-header { margin-bottom: 2rem; }
.page-header h1 { margin: 0; font-family: var(--font-display); font-size: clamp(1.75rem, 2.5vw, 2.35rem); font-weight: 700; letter-spacing: -0.03em; }
.page-header p { margin: 0.5rem 0 0; color: var(--text-muted); max-width: 42rem; line-height: 1.55; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.kpi {
  padding: 1.25rem 1.35rem; border: 1px solid var(--border); border-radius: 1rem;
  background: linear-gradient(160deg, rgba(17, 25, 39, 0.9), rgba(12, 18, 28, 0.75));
}
.kpi-label { margin: 0; font-size: 0.78rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-value { margin: 0.55rem 0 0; font-family: var(--font-display); font-size: 1.85rem; font-weight: 700; }
.section { margin-top: 1.75rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-head h2 { margin: 0; font-family: var(--font-display); font-size: 1.15rem; }
.panel { border: 1px solid var(--border); border-radius: 1rem; background: rgba(12, 18, 28, 0.7); overflow: hidden; }
.panel-pad { padding: 1.35rem; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border); font-size: 0.92rem; }
.table th { color: var(--text-muted); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; background: rgba(255,255,255,0.02); }
.table tr:last-child td { border-bottom: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.65rem 1.1rem; border-radius: 0.7rem; border: 1px solid transparent;
  cursor: pointer; font-weight: 600; font-size: 0.9rem;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #14b8a6); color: #042f2e; box-shadow: 0 8px 24px rgba(45, 212, 191, 0.25); }
.btn-secondary { background: var(--bg-elevated); border-color: var(--border); color: var(--text); }
.btn-danger { background: rgba(251, 113, 133, 0.12); border-color: rgba(251, 113, 133, 0.35); color: var(--danger); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.form-grid { display: grid; gap: 1rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field label { font-size: 0.8rem; color: var(--text-muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.75rem 0.9rem; border-radius: 0.7rem;
  border: 1px solid var(--border); background: var(--bg-elevated); outline: none;
}
.field textarea { min-height: 220px; resize: vertical; line-height: 1.55; }
.field-hint { font-size: 0.75rem; color: var(--text-muted); }
.status-badge {
  display: inline-flex; align-items: center; padding: 0.2rem 0.55rem; border-radius: 999px;
  font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
}
.status-draft { background: rgba(139, 155, 176, 0.15); color: var(--text-muted); }
.status-queued, .status-sending { background: rgba(56, 189, 248, 0.15); color: var(--cyan); }
.status-sent { background: rgba(52, 211, 153, 0.15); color: var(--success); }
.status-failed { background: rgba(251, 113, 133, 0.15); color: var(--danger); }
.alert { padding: 0.85rem 1rem; border-radius: 0.75rem; border: 1px solid var(--border); margin-bottom: 1rem; font-size: 0.9rem; }
.alert-success { background: rgba(52, 211, 153, 0.1); border-color: rgba(52, 211, 153, 0.3); color: var(--success); }
.alert-error { background: rgba(251, 113, 133, 0.1); border-color: rgba(251, 113, 133, 0.3); color: var(--danger); }
.alert-info { background: rgba(56, 189, 248, 0.1); border-color: rgba(56, 189, 248, 0.25); color: var(--cyan); }
.empty-state { padding: 3rem 1.5rem; text-align: center; }
.empty-state h3 { margin: 0; font-family: var(--font-display); }
.empty-state p { margin: 0.5rem auto 1.25rem; color: var(--text-muted); max-width: 28rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.muted { color: var(--text-muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85rem; }
.stat-pills { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.stat-pill { padding: 0.25rem 0.55rem; border-radius: 0.45rem; background: rgba(255,255,255,0.04); border: 1px solid var(--border); font-size: 0.75rem; color: var(--text-muted); }
.stat-pill strong { color: var(--text); }
.upload-zone {
  border: 1px dashed var(--border-strong); border-radius: 1rem; padding: 2rem; text-align: center;
  background: rgba(45, 212, 191, 0.04);
}
.quick-links { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.quick-link {
  display: block; padding: 1.25rem 1.35rem; border-radius: 1rem;
  border: 1px solid var(--border); background: rgba(12, 18, 28, 0.7);
}
.quick-link h3 { margin: 0; font-family: var(--font-display); font-size: 1.05rem; }
.quick-link p { margin: 0.4rem 0 0; color: var(--text-muted); font-size: 0.9rem; }
.progress {
  height: 10px; border-radius: 999px; background: rgba(255,255,255,0.06);
  overflow: hidden; border: 1px solid var(--border);
}
.progress > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--cyan));
}
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 2rem;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(45, 212, 191, 0.12), transparent 50%),
    var(--bg-deep);
}
.login-card { width: min(420px, 100%); }

.landing {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  padding: 1.5rem clamp(1.25rem, 4vw, 3rem) 3rem;
  background:
    radial-gradient(ellipse 70% 45% at 15% -5%, rgba(45, 212, 191, 0.16), transparent 55%),
    radial-gradient(ellipse 55% 40% at 90% 0%, rgba(56, 189, 248, 0.12), transparent 50%),
    linear-gradient(180deg, #070b12 0%, #0a1018 100%);
}
.landing::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(120, 180, 220, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 180, 220, 0.035) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 15%, transparent 70%);
}
.landing-nav, .landing-hero, .landing-metrics, .landing-features, .landing-footer {
  position: relative;
  z-index: 1;
}
.landing-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 3.5rem;
}
.landing-brand { display: flex; gap: 0.85rem; align-items: center; }
.landing-hero {
  max-width: 760px;
  margin: 0 auto 3rem;
  text-align: center;
  animation: pageIn 0.5s ease;
}
.landing-eyebrow {
  margin: 0 0 0.75rem;
  color: var(--accent);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.landing-hero h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 6vw, 4rem);
  letter-spacing: -0.04em;
  line-height: 1.05;
}
.landing-lead {
  margin: 1rem auto 1.5rem;
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 36rem;
}
.landing-hero .actions { justify-content: center; }
.landing-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 auto 3rem;
  max-width: 1100px;
}
.landing-features {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  max-width: 1100px;
  margin: 0 auto 3rem;
}
.landing-features article {
  padding: 1.35rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: rgba(12, 18, 28, 0.7);
}
.landing-features h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
}
.landing-features p {
  margin: 0.55rem 0 0;
  color: var(--text-muted);
  line-height: 1.55;
  font-size: 0.92rem;
}
.landing-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .sidebar-nav { flex-direction: row; flex-wrap: wrap; }
  .kpi-grid, .form-row, .quick-links, .landing-metrics, .landing-features { grid-template-columns: 1fr; }
  .main { padding: 1.25rem; }
}
