:root {
  --bg: #070d19;
  --surface: #0f172a;
  --surface-2: #162137;
  --border: #1e293b;
  --text: #f1f5f9;
  --muted: #94a3b8;
  --primary: #0284c7;
  --primary-2: #004f90;
  --gold: #fab818;
  --green: #10b981;
  --red: #ef4444;
  --radius: 14px;
}

body.light-mode {
  --bg: #f1f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a { color: #38bdf8; }

.brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.08rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: linear-gradient(135deg, #fab818, #38bdf8);
  box-shadow: 0 0 12px rgba(250,184,24,0.65);
}
.brand-accent { color: #38bdf8; }

.landing-screen { min-height: 100vh; display: flex; flex-direction: column; }
.landing-nav {
  max-width: 1200px; width: 100%; margin: 0 auto; padding: 1.15rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.landing-nav-links { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.landing-nav-links a { color: var(--muted); text-decoration: none; font-weight: 600; font-size: 0.88rem; }
.landing-nav-links a:hover { color: var(--text); }

.landing-hero {
  max-width: 1200px; width: 100%; margin: 1.25rem auto 2.5rem; padding: 0 1.25rem;
  display: grid; grid-template-columns: 1.15fr 0.85fr; gap: 2rem; align-items: start;
}
@media (max-width: 920px) { .landing-hero { grid-template-columns: 1fr; } }

.free-badge {
  display: inline-block;
  background: rgba(250, 184, 24, 0.14);
  border: 1px solid rgba(250, 184, 24, 0.45);
  color: #fde68a;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  margin-bottom: 1rem;
}
.landing-hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.9rem, 3.6vw, 2.85rem);
  line-height: 1.13;
  font-weight: 900;
  letter-spacing: -0.03em;
}
.landing-hero h1 span {
  background: linear-gradient(135deg, #38bdf8, #fab818);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-lead { color: var(--muted); font-size: 1rem; margin: 0 0 1.4rem; }
.hero-cta-row { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.trust-strip { display: flex; gap: 1rem; flex-wrap: wrap; font-size: 0.8rem; color: #a7f3d0; font-weight: 600; }

.auth-card, .panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem;
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.25);
}
.card-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin-bottom: 1rem; }
.card-tab {
  padding: 0.55rem 0.7rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 0.82rem; cursor: pointer;
}
.card-tab.active {
  background: linear-gradient(135deg, var(--primary-2), var(--primary));
  color: #fff; border-color: transparent;
}
.auth-card h2 { margin: 0 0 0.35rem; font-size: 1.2rem; font-weight: 800; }
.auth-sub { margin: 0 0 1rem; color: var(--muted); font-size: 0.82rem; }

.field { display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.75rem; }
.field span { font-size: 0.76rem; font-weight: 700; color: var(--muted); }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.6rem 0.78rem; border-radius: 10px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
  font-size: 0.88rem; font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: #38bdf8;
}
.field-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
@media (max-width: 560px) { .field-2col { grid-template-columns: 1fr; } }

.btn-primary, .btn-secondary, .btn-ghost-dark, .btn-gold-sm, .btn-danger-soft, .btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border-radius: 10px; font-weight: 800; cursor: pointer; text-decoration: none;
  border: 1px solid transparent; transition: transform 0.12s ease, opacity 0.12s ease;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, #004f90, #0284c7); color: #fff;
  padding: 0.68rem 1.15rem; font-size: 0.88rem;
}
.btn-secondary {
  background: var(--surface-2); color: var(--text); border-color: var(--border);
  padding: 0.65rem 1.05rem; font-size: 0.86rem;
}
.btn-ghost-dark, .btn-ghost {
  background: transparent; color: var(--text); border-color: var(--border);
  padding: 0.5rem 0.85rem; font-size: 0.82rem;
}
.btn-gold-sm {
  background: linear-gradient(135deg, #f59e0b, #fab818); color: #09090b;
  padding: 0.48rem 0.88rem; font-size: 0.82rem;
}
.btn-danger-soft {
  background: rgba(239, 68, 68, 0.15); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35);
  padding: 0.48rem 0.85rem; font-size: 0.82rem;
}
.btn-full { width: 100%; }
.btn-sm { padding: 0.38rem 0.72rem; font-size: 0.78rem; }

.alert-error {
  background: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5; padding: 0.6rem 0.8rem; border-radius: 10px; font-size: 0.82rem; margin-bottom: 0.75rem;
}
.save-feedback {
  background: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7; padding: 0.6rem 0.8rem; border-radius: 10px; font-size: 0.82rem; font-weight: 700;
}

.landing-section { max-width: 1200px; width: 100%; margin: 0 auto 2.5rem; padding: 0 1.25rem; }
.section-head { text-align: center; margin-bottom: 1.5rem; }
.section-head h2 { margin: 0 0 0.4rem; font-size: 1.7rem; font-weight: 900; }
.section-head p { margin: 0; color: var(--muted); }

.steps-grid, .pricing-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.15rem;
}
.step-card, .price-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.4rem;
}
.step-num {
  display: inline-flex; width: 30px; height: 30px; align-items: center; justify-content: center;
  border-radius: 999px; background: rgba(56, 189, 248, 0.18); color: #38bdf8; font-weight: 900; margin-bottom: 0.6rem;
}
.price-card-featured { border-color: rgba(250, 184, 24, 0.65); box-shadow: 0 0 32px rgba(250, 184, 24, 0.12); }
.price-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 800; padding: 0.25rem 0.65rem;
  border-radius: 999px; background: rgba(56, 189, 248, 0.15); color: #7dd3fc; margin-bottom: 0.7rem;
}
.price-badge-gold { background: rgba(250, 184, 24, 0.2); color: #fde68a; }
.price-amount { font-size: 2rem; font-weight: 900; margin: 0.4rem 0; }
.price-amount small { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.price-list { list-style: none; padding: 0; margin: 1rem 0 1.25rem; display: grid; gap: 0.45rem; font-size: 0.86rem; color: var(--muted); }

.landing-footer {
  margin-top: auto; border-top: 1px solid var(--border); padding: 1.25rem;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap;
  max-width: 1200px; width: 100%; margin-inline: auto; font-size: 0.82rem; color: var(--muted);
}
.admin-subtle-link { color: var(--muted); text-decoration: none; font-size: 0.76rem; }

/* APP SHELL */
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.25rem; display: flex; justify-content: space-between; align-items: center;
  gap: 0.75rem; flex-wrap: wrap; position: sticky; top: 0; z-index: 50;
}
.topbar-left, .topbar-controls { display: flex; align-items: center; gap: 0.65rem; flex-wrap: wrap; }
.tenant-meta { display: flex; flex-direction: column; }
.tenant-meta strong { font-size: 0.9rem; }
.muted { color: var(--muted); font-size: 0.76rem; }

.container { max-width: 1320px; margin: 1.25rem auto; padding: 0 1.25rem; display: grid; gap: 1.2rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0.9rem; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.15rem;
}
.kpi-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-bottom: 0.35rem; }
.kpi-label { font-size: 0.76rem; font-weight: 700; color: var(--muted); }
.kpi-tag { font-size: 0.68rem; font-weight: 800; padding: 0.15rem 0.5rem; border-radius: 999px; background: rgba(56,189,248,0.16); color: #7dd3fc; }
.kpi-value { font-size: 1.7rem; font-weight: 900; }
.kpi-sub { font-size: 0.74rem; color: var(--muted); margin-top: 0.2rem; }

.demo-banner {
  background: linear-gradient(135deg, rgba(2,132,199,0.2), rgba(250,184,24,0.16));
  border-bottom: 1px solid rgba(250,184,24,0.4);
  padding: 0.65rem 1.25rem; display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  font-size: 0.84rem;
}
.demo-banner-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.app-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.app-tab {
  background: var(--surface); color: var(--muted); border: 1px solid var(--border);
  padding: 0.58rem 1rem; border-radius: 11px; font-weight: 700; font-size: 0.86rem; cursor: pointer;
}
.app-tab.active {
  background: linear-gradient(135deg, #004f90, #0284c7); color: #fff; border-color: transparent;
}

.studio-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 1.15rem; align-items: start; }
@media (max-width: 980px) { .studio-grid { grid-template-columns: 1fr; } }

.template-pills { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 1rem; }
.template-pill {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  padding: 0.42rem 0.75rem; border-radius: 999px; font-size: 0.78rem; font-weight: 700; cursor: pointer;
}
.template-pill:hover { border-color: #38bdf8; }

.preview-frame {
  width: 100%; height: 620px; border: 1px solid var(--border); border-radius: 12px; background: #f1f5f9;
}

.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.data-table th, .data-table td { padding: 0.68rem 0.75rem; border-bottom: 1px solid var(--border); text-align: left; }
.data-table th { color: var(--muted); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.4px; }

.pill { display: inline-block; padding: 0.18rem 0.55rem; border-radius: 999px; font-size: 0.72rem; font-weight: 800; }
.pill-ok { background: rgba(16,185,129,0.18); color: #6ee7b7; }
.pill-warn { background: rgba(245,158,11,0.18); color: #fde68a; }
.pill-err { background: rgba(239,68,68,0.18); color: #fca5a5; }
.pill-info { background: rgba(56,189,248,0.18); color: #7dd3fc; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(2, 6, 23, 0.78);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem;
}
.modal-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  max-width: 520px; width: 100%; padding: 1.4rem; max-height: 92vh; overflow-y: auto;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.75rem; }
.modal-head h3 { margin: 0; font-size: 1.12rem; }
.checkout-plan-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; margin: 0.9rem 0; }
.plan-pick-btn {
  display: flex; flex-direction: column; gap: 0.2rem; padding: 0.75rem; border-radius: 12px;
  background: var(--surface-2); border: 1.5px solid var(--border); color: var(--text); cursor: pointer; text-align: left;
}
.plan-pick-btn.active { border-color: #fab818; background: rgba(250,184,24,0.12); }
.plan-pick-btn span { font-size: 0.78rem; color: var(--muted); }
.icon-btn {
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: 0.35rem 0.6rem; cursor: pointer; font-weight: 700;
}
