:root {
  --bg: #050b18;
  --bg-elevated: #0b1530;
  --card: #0f1c3d;
  --card-border: #1c2f5c;
  --blue-500: #2e7bff;
  --blue-400: #5a9bff;
  --blue-300: #8fbcff;
  --text: #e6ecff;
  --text-dim: #9ab0e0;
  --danger: #ff5a7a;
  --success: #3ee6a8;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at top, #0a1838 0%, var(--bg) 55%, #020510 100%);
  color: var(--text);
  font-family: var(--font);
  min-height: 100%;
}

a {
  color: var(--blue-300);
  text-decoration: none;
}

a:hover {
  color: var(--blue-400);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

header.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text);
}

.brand .mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--blue-500), #0b2a66);
  box-shadow: 0 0 24px rgba(46, 123, 255, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 800;
}

nav.site-nav {
  display: flex;
  gap: 18px;
  align-items: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--blue-500), #1a4fc4);
  border: none;
  box-shadow: 0 8px 24px rgba(46, 123, 255, 0.35);
}

.btn-ghost {
  background: transparent;
}

.btn-danger {
  background: transparent;
  border-color: rgba(255, 90, 122, 0.4);
  color: var(--danger);
}

section.hero {
  padding: 80px 0 60px;
  text-align: center;
}

.hero-photo {
  position: relative;
  padding: 0;
  overflow: hidden;
}

.hero-photo-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center 15%;
}

.hero-photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(2, 5, 16, 0.55) 0%,
    rgba(2, 5, 16, 0.8) 60%,
    var(--bg) 100%
  );
}

.hero-photo-content {
  position: relative;
  z-index: 1;
  padding: 120px 24px 80px;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.1;
  margin: 0 0 18px;
  background: linear-gradient(135deg, #ffffff, var(--blue-300));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  color: var(--text-dim);
  font-size: 1.15rem;
  max-width: 620px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.badge-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 28px;
  flex-wrap: wrap;
}

.badge {
  font-size: 0.8rem;
  color: var(--text-dim);
  border: 1px solid var(--card-border);
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(46, 123, 255, 0.08);
}

section.features {
  padding: 40px 0 70px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
}

.card h3 {
  margin: 10px 0 8px;
  font-size: 1.05rem;
}

.card p {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 0;
}

.icon-dot {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: rgba(46, 123, 255, 0.15);
  color: var(--blue-300);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

section.how {
  padding: 40px 0 70px;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.step-number {
  font-size: 0.85rem;
  color: var(--blue-400);
  font-weight: 700;
  letter-spacing: 0.08em;
}

section.pricing {
  padding: 40px 0 90px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

.plan {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.plan.featured {
  border-color: var(--blue-500);
  box-shadow: 0 0 40px rgba(46, 123, 255, 0.25);
}

.plan .price {
  font-size: 2rem;
  font-weight: 800;
}

.plan .price span {
  font-size: 0.95rem;
  color: var(--text-dim);
  font-weight: 500;
}

.plan ul {
  list-style: none;
  padding: 0;
  margin: 0;
  color: var(--text-dim);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

footer.site-footer {
  border-top: 1px solid var(--card-border);
  padding: 28px 0 48px;
  color: var(--text-dim);
  font-size: 0.85rem;
  text-align: center;
}

/* Auth pages */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 32px;
}

.auth-card h1 {
  font-size: 1.4rem;
  margin: 0 0 6px;
}

.auth-card p.sub {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: 0 0 24px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.field input,
.field select {
  width: 100%;
  padding: 11px 13px;
  border-radius: 9px;
  border: 1px solid var(--card-border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.95rem;
}

.field input:focus,
.field select:focus {
  outline: 2px solid var(--blue-500);
}

.error-text {
  color: var(--danger);
  font-size: 0.85rem;
  margin-top: 10px;
  min-height: 1.2em;
}

/* App shell (dashboard/campaign) */
.app-shell {
  min-height: 100vh;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
  border-bottom: 1px solid var(--card-border);
}

main.app-main {
  padding: 32px 0 60px;
}

/* Sidebar app shell */
.app-shell-sidebar {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--card-border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar .brand {
  padding: 0 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 28px;
  flex: 1;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
}

.sidebar-link:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.sidebar-link.active {
  background: rgba(46, 123, 255, 0.15);
  color: var(--blue-300);
  font-weight: 700;
}

.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--card-border);
}

.sidebar-footer .badge {
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-content {
  flex: 1;
  min-width: 0;
  padding: 36px 40px 60px;
}

@media (max-width: 820px) {
  .app-shell-sidebar {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    padding: 14px 16px;
    gap: 16px;
  }
  .sidebar-nav {
    flex-direction: row;
    margin-top: 0;
    flex-wrap: wrap;
  }
  .sidebar-footer {
    flex-direction: row;
    margin-left: auto;
    padding-top: 0;
    border-top: none;
  }
  .app-content {
    padding: 24px 16px 48px;
  }
}

.stat-card-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.page-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.page-title-row h1 {
  font-size: 1.5rem;
  margin: 0;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.data-table th,
table.data-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
  color: var(--text-dim);
}

table.data-table th {
  color: var(--text);
  font-weight: 600;
}

.empty-state {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-dim);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 5, 16, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-backdrop.hidden {
  display: none;
}

.modal {
  width: 100%;
  max-width: 460px;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  margin-top: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.checkbox-row label {
  color: var(--text);
  font-size: 0.92rem;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-tile {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 18px;
}

.stat-tile .value {
  font-size: 1.8rem;
  font-weight: 800;
}

.stat-tile.allow .value {
  color: var(--success);
}

.stat-tile.block .value {
  color: var(--danger);
}

.stat-tile .label {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.entry-link-row {
  display: flex;
  gap: 10px;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 24px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85rem;
  overflow-x: auto;
}

.section-block {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.section-block h2 {
  margin-top: 0;
  font-size: 1.1rem;
}

.variant-row {
  display: grid;
  grid-template-columns: 1fr 1.6fr 70px auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}

.variant-row input {
  padding: 9px 10px;
  border-radius: 8px;
  border: 1px solid var(--card-border);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: 0.88rem;
  width: 100%;
}

.actions-wrapper {
  position: relative;
  display: inline-block;
}

.actions-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  min-width: 190px;
  padding: 6px;
  z-index: 40;
}

.actions-menu button {
  display: flex;
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 0.88rem;
  cursor: pointer;
}

.actions-menu button:hover {
  background: var(--bg-elevated);
}

.actions-menu button.danger {
  color: var(--danger);
}

.variant-row .remove-variant-btn {
  background: transparent;
  border: 1px solid rgba(255, 90, 122, 0.4);
  color: var(--danger);
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 0.85rem;
}

.variants-weight-total {
  font-size: 0.85rem;
  margin: 2px 0 14px;
  color: var(--text-dim);
}

.variants-weight-total.ok {
  color: var(--success);
}

.variants-weight-total.warn {
  color: var(--danger);
}
