:root {
  --bg: #faf7f0;
  --bg-soft: #f3eee4;
  --ink: #0a0a0a;
  --muted: #5c5c5c;
  --line: #e5dfd3;
  --card: #ffffff;
  --brand-red: #e11d48;
  --brand-yellow: #fcd34d;
  --brand-yellow-hover: #fbbf24;
  --ok: #15803d;
  --bad: #b91c1c;
  --ok-bg: #dcfce7;
  --bad-bg: #fee2e2;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(10, 10, 10, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.55;
}

a { color: inherit; }
img { max-width: 100%; }

.site-header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: rgba(250, 247, 240, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex; align-items: center; gap: 0.55rem;
  text-decoration: none; font-weight: 700; font-size: 1.15rem;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: #111; color: var(--brand-yellow);
  display: grid; place-items: center;
}
.brand-name span { color: var(--brand-red); }
.main-nav { display: none; gap: 1.1rem; }
.main-nav a { text-decoration: none; color: #333; font-weight: 500; font-size: 0.95rem; }
.main-nav a:hover { color: var(--ink); }
.header-actions { display: flex; align-items: center; gap: 0.55rem; }
@media (max-width: 600px) {
  .header-actions #who, .dashboard-home-action { display: none; }
}

.btn-primary, button[type="submit"], .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  background: var(--brand-yellow); color: var(--ink);
  border: 0; border-radius: 999px; padding: 0.75rem 1.2rem;
  font-weight: 700; text-decoration: none; cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.btn-primary:hover, button[type="submit"]:hover, .btn:hover {
  background: var(--brand-yellow-hover);
}
.btn-primary.lg, .btn-ghost.lg { padding: 0.95rem 1.35rem; font-size: 1rem; }
.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px; padding: 0.7rem 1.1rem;
  text-decoration: none; font-weight: 600; color: var(--ink);
  border: 1px solid var(--line); background: transparent;
}
.btn-ghost:hover { background: #fff; }
.btn-dark { background: #111; color: #fff; border-radius: 999px; padding: 0.75rem 1.2rem; text-decoration: none; font-weight: 700; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.25rem; }
.wrap-narrow { max-width: 480px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}
.card h1, .card h2, .card h3 { font-family: Fraunces, Georgia, serif; letter-spacing: -0.02em; }

.muted { color: var(--muted); }
.flash { background: var(--ok-bg); color: var(--ok); border: 1px solid #bbf7d0; padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1rem; }
.error { background: var(--bad-bg); color: var(--bad); border: 1px solid #fecaca; padding: .8rem 1rem; border-radius: 12px; margin-bottom: 1rem; }

label { display: block; margin: .7rem 0 .3rem; color: var(--muted); font-size: .9rem; font-weight: 500; }
input, select, textarea {
  width: 100%; padding: .8rem .9rem; border-radius: 12px;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font: inherit;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(252, 211, 77, 0.55); border-color: var(--brand-yellow);
}
button[type="submit"] { width: 100%; margin-top: 1rem; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .65rem .4rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; }
.code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--brand-red); font-size: 1.7rem; font-weight: 700; letter-spacing: .04em;
}

.grid { display: grid; gap: 1rem; }
@media (min-width: 860px) {
  .main-nav { display: flex; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
}

/* Landing */
.hero-section { padding: 2.5rem 0 1rem; }
.hero-inner { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 960px) {
  .hero-inner { grid-template-columns: 1.15fr 0.85fr; gap: 2.5rem; }
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .4rem;
  color: var(--brand-red); font-size: .78rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; margin: 0 0 1rem;
}
.hero-section h1 {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(2.4rem, 6vw, 4.2rem);
  line-height: 1.05; letter-spacing: -0.03em; margin: 0 0 1rem;
}
.hero-section h1 .accent { color: var(--brand-red); }
.hero-lead { font-size: 1.08rem; color: var(--muted); max-width: 36rem; margin: 0 0 1.4rem; }
.hero-btns { display: flex; flex-wrap: wrap; gap: .7rem; margin-bottom: 1.2rem; }
.badge-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.badge-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: .35rem .7rem; font-size: .82rem; font-weight: 600;
}

.hero-panel {
  background: #111; color: #fff; border-radius: 22px; padding: 1.3rem;
  box-shadow: 0 20px 50px rgba(0,0,0,.18);
  min-height: 280px;
}
.hero-panel .panel-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.2rem; }
.hero-panel .dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; display: inline-block; margin-right: .35rem; }
.hero-panel .stat-label { color: #a3a3a3; font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; }
.hero-panel .stat-value { font-family: Fraunces, Georgia, serif; font-size: 2.6rem; margin: .2rem 0; }
.hero-panel .pay-row {
  margin-top: 1.2rem; background: #1c1c1c; border-radius: 14px; padding: .9rem 1rem;
  display: flex; justify-content: space-between; align-items: center;
}
.hero-panel .pay-amt { color: var(--brand-yellow); font-weight: 800; }

.section { padding: 2.5rem 0; }
.section-kicker { color: var(--brand-red); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 .5rem; }
.section h2 {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  letter-spacing: -0.02em; margin: 0 0 .6rem; line-height: 1.15;
}
.section-lead { color: var(--muted); max-width: 36rem; margin: 0 0 1.5rem; }

.feature-card {
  background: #fff; border: 1px solid var(--line); border-radius: 18px;
  padding: 1.25rem; height: 100%;
}
.feature-card .tag {
  display: inline-block; font-size: .7rem; font-weight: 700; letter-spacing: .08em;
  color: var(--brand-red); margin-bottom: .55rem;
}
.feature-card h3 { font-family: Fraunces, Georgia, serif; margin: 0 0 .45rem; font-size: 1.25rem; }
.feature-card p { margin: 0; color: var(--muted); font-size: .95rem; }

.step {
  display: grid; grid-template-columns: auto 1fr; gap: .9rem;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 1rem 1.1rem;
}
.step-num {
  width: 42px; height: 42px; border-radius: 12px; background: var(--brand-yellow);
  display: grid; place-items: center; font-weight: 800;
}
.step h3 { margin: 0 0 .25rem; font-family: Fraunces, Georgia, serif; font-size: 1.15rem; }
.step p { margin: 0; color: var(--muted); font-size: .92rem; }

.cta-band {
  margin: 2rem 0 1rem; background: #111; color: #fff;
  border-radius: 22px; padding: 2rem 1.4rem; text-align: center;
}
.cta-band h2 { font-family: Fraunces, Georgia, serif; margin: 0 0 .6rem; font-size: clamp(1.7rem, 3vw, 2.3rem); }
.cta-band p { color: #bdbdbd; margin: 0 0 1.2rem; }
.site-footer {
  border-top: 1px solid var(--line); margin-top: 2rem; padding: 1.5rem 1.25rem 2.5rem;
  color: var(--muted); font-size: .9rem;
}
.site-footer .foot-inner { max-width: 1100px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; }

.auth-shell { min-height: calc(100vh - 70px); display: grid; place-items: center; padding: 1.5rem 1rem 3rem; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card h1, .auth-card h2 { font-family: Fraunces, Georgia, serif; margin: 0 0 .4rem; }
.buy-plans { display: grid; gap: .7rem; margin: 1rem 0; }
.plan-option {
  display: block; border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem;
  cursor: pointer; background: #fff;
}
.plan-option:has(input:checked) {
  border-color: var(--brand-yellow); box-shadow: 0 0 0 3px rgba(252,211,77,.35);
}
.plan-option input { width: auto; margin-right: .55rem; }
.plan-option strong { font-family: Fraunces, Georgia, serif; }
.status-center { text-align: center; padding: 2rem 1.2rem; }

/* Owner dashboard shell */
.dash {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  min-height: calc(100vh - 70px);
}
.dash-nav {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding-bottom: .5rem;
}
.dash-nav-head { padding: 1.1rem 1.2rem 0.6rem; }
.dash-links { display: flex; gap: .35rem; overflow-x: auto; padding: 0 1rem 0.8rem; }
.dash-links a {
  text-decoration: none; white-space: nowrap;
  padding: .55rem .9rem; border-radius: 999px; font-weight: 600; color: var(--muted);
  border: 1px solid transparent;
}
.dash-links a.active, .dash-links a:hover {
  background: var(--brand-yellow); color: var(--ink); border-color: transparent;
}
.dash-main { padding: 1.25rem; max-width: 980px; width: 100%; min-width: 0; margin: 0 auto; }
.dash-main h1 {
  font-family: Fraunces, Georgia, serif;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  margin: 0 0 .4rem; letter-spacing: -0.02em;
}
.dash-hero { margin-bottom: 1rem; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 1rem 1.1rem; box-shadow: var(--shadow);
}
.stat-label { color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.stat-value { font-family: Fraunces, Georgia, serif; font-size: 2rem; margin-top: .2rem; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; letter-spacing: .02em; }
.code-link { word-break: break-all; font-weight: 600; color: var(--brand-red); }
.pill {
  display: inline-block; padding: .15rem .55rem; border-radius: 999px;
  background: var(--bg-soft); border: 1px solid var(--line); font-size: .8rem; font-weight: 600;
}
@media (min-width: 960px) {
  .dash { grid-template-columns: 240px minmax(0, 1fr); }
  .dash-nav {
    border-bottom: 0; border-right: 1px solid var(--line);
    position: sticky; top: 66px; height: calc(100vh - 66px); overflow: auto;
  }
  .dash-links { flex-direction: column; padding: 0.4rem 0.85rem 1rem; }
  .dash-links a { border-radius: 12px; }
  .dash-main { padding: 1.6rem 1.8rem 3rem; max-width: none; }
}

.download-row button { width: auto; margin-top: .8rem; }
.dash-main table input {
  width: 100%;
  min-width: 0;
  padding: .55rem .65rem;
  font-size: .92rem;
}

.wrap-narrow select {
  width: 100%;
  margin: 0.35rem 0 1rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
  color: var(--ink);
}

button[type="submit"]:disabled,
.btn-primary:disabled {
  opacity: .7;
  cursor: wait;
  pointer-events: none;
}
.btn-loading {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
}
.btn-loading[hidden] { display: none !important; }
.btn-label[hidden] { display: none !important; }
.spinner {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: wn-spin .7s linear infinite;
  flex: 0 0 auto;
}
@keyframes wn-spin { to { transform: rotate(360deg); } }

.owner-contact {
  margin: 1.25rem 0 0;
  text-align: center;
  font-size: .92rem;
  color: #5c564c;
}
.owner-contact a {
  color: #0f3d5c;
  font-weight: 600;
  text-decoration: none;
}
.owner-contact a:hover { text-decoration: underline; }


/* Payments analytics */
.grid-4 { display: grid; gap: 1rem; }
@media (min-width: 900px) {
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 899px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}
.stat-card.flat { box-shadow: none; }
.stat-value.sm { font-size: 1.55rem; }
.tiny { font-size: .78rem; margin-top: .2rem; }
.row-between { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; flex-wrap: wrap; }
.filter-bar { padding: 1rem 1.1rem; }
.filter-grid { display: grid; gap: .8rem; grid-template-columns: 1fr; align-items: end; }
@media (min-width: 720px) {
  .filter-grid { grid-template-columns: 1fr 1fr auto; }
}
.filter-bar label { display: block; margin: 0 0 .35rem; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.filter-bar select { width: 100%; margin: 0; }
.filter-actions button { width: auto; min-width: 7rem; margin: 0; }
.bar-chart { display: flex; flex-direction: column; gap: .45rem; }
.bar-row { display: grid; grid-template-columns: 3.2rem 1fr 4.5rem; gap: .6rem; align-items: center; }
.bar-label { font-size: .8rem; color: var(--muted); font-family: "JetBrains Mono", ui-monospace, monospace; }
.bar-track { height: .7rem; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; background: linear-gradient(90deg, #fcd34d, #e11d48); border-radius: 999px; min-width: 2px; }
.bar-val { text-align: right; font-size: .8rem; }
.router-title-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: .35rem; }
.router-title-row h1 { margin: 0; }
.router-add-shortcut { width: auto; flex: 0 0 auto; margin: 0; }
.add-router-form-card { max-width: 680px; }
.add-router-list-card, .add-router-next-card { max-width: 100%; }
.add-router-table table { min-width: 760px; }
.router-install-link { width: auto; padding: .45rem .8rem; margin: 0; white-space: nowrap; }
.new-router-row { background: #f0fdf4; }
.setup-steps { margin: .8rem 0 0; padding-left: 1.25rem; color: var(--muted); }
.setup-steps li + li { margin-top: .55rem; }
.usage-kpis, .router-kpis { margin: 1rem 0; }
.usage-filter-grid, .router-usage-filter-grid { grid-template-columns: 1fr; }
.usage-custom-dates { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.usage-custom-dates input { width: 100%; margin: 0; }
.usage-filter-actions { display: flex; gap: .5rem; align-items: end; }
.usage-filter-actions .btn-ghost { min-width: auto; }
.usage-router-table table { min-width: 1040px; }
.usage-device-table table { min-width: 1240px; }
.client-search-bar { display: flex; align-items: end; justify-content: space-between; gap: .8rem; margin: 1rem 0; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); }
.client-search-bar > div { flex: 1 1 22rem; max-width: 32rem; }
.client-search-bar label { display: block; margin-bottom: .35rem; font-size: .8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.client-search-bar input { width: 100%; margin: 0; background: var(--card); }
.client-search-bar button { width: auto; margin: 0; }
.section-divider { display: flex; align-items: center; gap: .8rem; margin: 2rem 0 1rem; color: var(--muted); font-size: .76rem; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; }
.section-divider::after { content: ''; height: 1px; flex: 1; background: var(--line); }
.usage-pagination { display: flex; align-items: center; justify-content: center; gap: .8rem; margin-top: 1rem; }
.usage-pagination button { width: auto; }
.usage-pagination button:disabled { opacity: .45; cursor: not-allowed; }
@media (min-width: 980px) {
  .usage-filter-grid { grid-template-columns: .8fr 1fr .9fr minmax(0, 1.4fr) auto; }
  .router-usage-filter-grid { grid-template-columns: 1fr 1fr minmax(0, 1.6fr) auto; }
}
@media (max-width: 600px) {
  .usage-filter-actions { align-items: stretch; }
  .usage-filter-actions .btn, .usage-filter-actions .btn-ghost { flex: 1; }
  .usage-pagination { justify-content: space-between; }
  .client-search-bar { align-items: stretch; flex-direction: column; }
  .client-search-bar > div { flex-basis: auto; max-width: none; }
  .client-search-bar button { width: 100%; }
}
.analytics-kpis { margin: 1rem 0; }
.analytics-grid-2 { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 980px) { .analytics-grid-2 { grid-template-columns: 1.5fr 1fr; } }
.analytics-filter-grid { grid-template-columns: 1fr; }
@media (min-width: 900px) { .analytics-filter-grid { grid-template-columns: 1fr 1fr minmax(0, 1.5fr) auto; } }
.analytics-custom-dates { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
.analytics-custom-dates input { width: 100%; margin: 0; }
.payment-status-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .8rem; }
.payment-status-item { display: flex; justify-content: space-between; align-items: center; gap: .7rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--bg-soft); }
.table-wrap { width: 100%; max-width: 100%; min-width: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 680px; }
.pill-paid { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.pill-pending { background: #fef9c3; border-color: #fde68a; color: #854d0e; }
.pill-failed { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.pill-expired { background: #f3f4f6; border-color: #e5e7eb; color: #4b5563; }

.pill-trial { background: #e0f2fe; border-color: #bae6fd; color: #075985; }
.pill-active { background: #dcfce7; border-color: #bbf7d0; color: #166534; }
.pill-suspended { background: #fee2e2; border-color: #fecaca; color: #991b1b; }
.pill-available { background: #fef9c3; border-color: #fde68a; color: #854d0e; }

.copy-field { margin-top: 1rem; }
.copy-field label {
  display: block; margin: 0 0 .35rem;
  font-size: .8rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.copy-row { display: flex; gap: .5rem; align-items: stretch; }
.copy-row input {
  flex: 1; margin: 0; font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: .92rem; min-width: 0;
}
.copy-row .copy-btn {
  width: auto; margin: 0; white-space: nowrap; padding: .7rem 1rem;
}
.copy-row .copy-btn.copied {
  background: #dcfce7; border-color: #bbf7d0; color: #166534;
}

.plan-grid {
  display: grid;
  gap: .8rem;
  grid-template-columns: 1fr;
  margin-bottom: .8rem;
}
@media (min-width: 800px) {
  .plan-grid { grid-template-columns: 1.4fr 1fr 1.2fr 1fr; align-items: end; }
}
.duration-row { display: flex; gap: .4rem; align-items: center; }
.duration-row input { margin: 0; flex: 1; min-width: 0; }
.duration-row select { margin: 0; width: auto; min-width: 6.5rem; }
.plan-add-form button { width: auto; }
.plans-table td { vertical-align: top; }
.danger-btn { color: #991b1b !important; border-color: #fecaca !important; }
.danger-btn:hover { background: #fee2e2 !important; }

/* LightNet aliases so login/register keep working */
.top { max-width: 1100px; margin: 0 auto; padding: 1.1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; }
.mark { width: 34px; height: 34px; border-radius: 10px; background: #111; color: var(--brand-yellow); display: grid; place-items: center; font-weight: 800; }
.brand-text span, .brand-name span { color: var(--brand-red); }
.auth-wrap { max-width: 480px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.lead { color: var(--muted); }
.foot { margin: 1rem 0 0; color: var(--muted); font-size: .92rem; text-align: center; }
.msg { min-height: 1.2em; margin: .75rem 0 0; font-size: .9rem; }
.msg.err { color: var(--bad); }
.msg.ok { color: var(--ok); }
.hint { color: var(--muted); font-size: .82rem; line-height: 1.4; margin: .4rem 0 .8rem; }

.omada-help {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--brand-yellow);
  border-radius: 12px;
  padding: .9rem 1rem;
  margin: 0 0 1rem;
  color: var(--muted);
}
.omada-form-grid { margin-bottom: 1rem; }
.omada-form-grid textarea { min-height: 4.2rem; resize: vertical; }
.omada-ip-list { display:flex; flex-wrap:wrap; gap:.4rem; margin:.55rem 0 .75rem; min-height:1.4rem; }
.omada-ip-list .pill { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.secret-row { display:flex; gap:.5rem; align-items:center; }
.secret-row input { flex:1; }
