/* ============================================================
   Cothons v2 — design system + app pages
   ============================================================ */

:root {
  --ink: #101418;
  --ink-soft: #3c454e;
  --muted: #6b7681;
  --line: #e6e9ec;
  --bg: #f7f8f9;
  --surface: #ffffff;
  --brand: #0e7a6c;
  --brand-dark: #0a5d53;
  --brand-soft: #e3f2ef;
  --accent: #f4b63f;
  --danger: #c2452d;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow-sm: 0 1px 2px rgba(16, 20, 24, 0.06), 0 1px 6px rgba(16, 20, 24, 0.05);
  --shadow-md: 0 6px 24px rgba(16, 20, 24, 0.09);
  --shadow-lg: 0 20px 60px rgba(16, 20, 24, 0.16);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

/* The hidden attribute must always win — author display rules (e.g. .button's
   inline-flex) otherwise override the UA's [hidden] { display: none } and leak
   admin-only / gated elements to everyone. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

h1, h2, h3 { line-height: 1.15; letter-spacing: -0.02em; margin: 0 0 0.4em; }
h1 { font-size: clamp(2rem, 4.5vw, 3.4rem); font-weight: 800; }
h2 { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 750; }
h3 { font-size: 1.12rem; font-weight: 650; }
p { margin: 0 0 1em; }

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- primitives ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: 600 0.95rem var(--font);
  cursor: pointer;
  text-decoration: none !important;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  white-space: nowrap;
}
.button:active { transform: translateY(1px); }
.button.primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.button.primary:hover { background: var(--brand-dark); }
.button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.button.ghost:hover { background: #fff; }
.button.light { background: #fff; color: var(--ink); border-color: var(--line); box-shadow: var(--shadow-sm); }
.button.danger { background: transparent; color: var(--danger); border-color: #ecd5cf; }
.button.danger:hover { background: #fbf1ee; }
.button.full { width: 100%; }
.button:disabled { opacity: 0.55; cursor: progress; }

.eyebrow {
  display: inline-block;
  font: 700 0.74rem var(--font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 5px 12px;
  margin-bottom: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

input, textarea, select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font: 400 0.95rem var(--font);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus {
  outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent);
  border-color: var(--brand);
}
label { font: 600 0.85rem var(--font); color: var(--ink-soft); display: grid; gap: 6px; }

.form-status { min-height: 1.3em; font-size: 0.9rem; color: var(--muted); margin: 4px 0 0; }
.form-status.error { color: var(--danger); }
.form-status.ok { color: var(--brand); }

.badge {
  display: inline-block;
  font: 700 0.7rem var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
}
.badge.live { background: #e5f4ea; color: #1c7c3c; }
.badge.draft { background: #f1f0ea; color: #8a7a36; }

/* Subscription tiers (admin → leads). One colour per plan in PLANS. */
.badge.plan-free { background: #f1f0ea; color: #6b6357; }
.badge.plan-starter { background: #e3eefb; color: #1f5fb0; }
.badge.plan-pro { background: #ece4fb; color: #6a36c9; }
.badge.plan-agency { background: #fdecd6; color: #aa6a12; }
.badge.plan-none { background: #f6f5f3; color: #a39c92; }
.badge.editorial-badge { background: var(--brand-soft); color: var(--brand); margin-left: 8px; vertical-align: middle; }
.slug-row { display: flex; align-items: stretch; }
.slug-row .slug-prefix { display: inline-flex; align-items: center; padding: 0 10px; background: var(--brand-soft); color: var(--ink-soft); border: 1px solid var(--line); border-right: 0; border-radius: 8px 0 0 8px; font-size: 0.9rem; white-space: nowrap; }
.slug-row input { border-radius: 0 8px 8px 0; flex: 1; min-width: 0; }
select:disabled { opacity: 0.65; cursor: not-allowed; background: #f6f5f3; }

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 48px);
  background: rgba(247, 248, 249, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: var(--ink);
  text-decoration: none !important;
  letter-spacing: -0.02em;
}
.brand-logo {
  height: 56px;
  width: auto;
  display: block;
}
.topbar nav { display: flex; gap: 22px; }
.topbar nav a { color: var(--ink-soft); font-weight: 550; font-size: 0.93rem; }
.topbar nav a:hover { color: var(--ink); text-decoration: none; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }
.account-chip {
  font: 600 0.83rem var(--font);
  color: var(--ink-soft);
  background: #fff;
  border: 1px solid var(--line);
  padding: 7px 14px;
  border-radius: 999px;
}
@media (max-width: 760px) { .topbar nav { display: none; } }

/* ---------- marketing: hero ---------- */

.hero {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(24px, 5vw, 72px);
  align-items: center;
  padding: clamp(48px, 8vw, 110px) clamp(18px, 4vw, 48px);
  max-width: 1240px;
  margin: 0 auto;
}
.hero-copy .lede { font-size: 1.13rem; color: var(--ink-soft); max-width: 34rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 12px; margin: 26px 0 18px; }
.hero-note { font-size: 0.85rem; color: var(--muted); }

.hero-copy .hl {
  font-style: normal;
  color: var(--brand);
  background: linear-gradient(180deg, transparent 62%, color-mix(in srgb, var(--accent) 55%, transparent) 62%);
  padding: 0 2px;
}
.hero-bullets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  list-style: none;
  margin: 0;
  padding: 0;
  color: var(--ink-soft);
  font: 600 0.88rem var(--font);
}

.hero-visual { position: relative; }
.hero-visual .screenshot,
.hero-visual .video-shell {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--line);
  background: #0c1013;
}
.hero-visual .screenshot img { aspect-ratio: 4/3; object-fit: cover; }
.hero-visual .video-shell video {
  display: block;
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
}

/* ---------- seo strip ---------- */
.seo-strip {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 48px) clamp(20px, 3vw, 36px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.seo-strip article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
  display: grid;
  gap: 2px;
}
.seo-strip strong { font-size: 0.95rem; }
.seo-strip span { color: var(--muted); font-size: 0.86rem; }
@media (max-width: 860px) { .seo-strip { grid-template-columns: 1fr; } }

/* ---------- feature cards (image features) ---------- */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.feature-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.feature-card img { aspect-ratio: 16/10; object-fit: cover; }
.feature-card .meta { padding: 20px 22px 24px; }
.feature-card .tag {
  display: inline-block;
  font: 700 0.7rem var(--font);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 999px;
  padding: 4px 11px;
  margin-bottom: 10px;
}
.feature-card h3 { font-size: 1.08rem; margin-bottom: 6px; }
.feature-card p { color: var(--muted); font-size: 0.92rem; margin: 0; }
@media (max-width: 860px) { .feature-grid { grid-template-columns: 1fr; } }
.hero-visual .float-card {
  position: absolute;
  left: -26px;
  bottom: -22px;
  background: #fff;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
  padding: 12px 16px;
  font-size: 0.85rem;
}
.hero-visual .float-card strong { color: var(--brand); }
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .hero-visual .float-card { left: 10px; }
}

/* ---------- marketing: sections ---------- */

.section {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 90px) clamp(18px, 4vw, 48px);
}
.section-heading { max-width: 620px; margin-bottom: 38px; }
.section-heading p { color: var(--muted); }

.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: step; }
.steps article {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px 22px;
  box-shadow: var(--shadow-sm);
}
.steps article::before {
  counter-increment: step;
  content: "0" counter(step);
  display: inline-grid;
  place-items: center;
  font: 800 0.8rem var(--font);
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 9px;
  padding: 6px 10px;
  margin-bottom: 14px;
}
.steps strong { display: block; margin-bottom: 6px; }
.steps span { color: var(--muted); font-size: 0.92rem; }
@media (max-width: 980px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }

.examples { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.example-card {
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.example-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.example-card img { aspect-ratio: 3/2; object-fit: cover; }
.example-card .meta { padding: 18px 20px; }
.example-card .meta p { color: var(--muted); font-size: 0.82rem; margin: 0 0 4px; }
.example-card .meta h3 { font-size: 1.02rem; margin: 0 0 8px; }
.example-card .meta span {
  font: 650 0.72rem var(--font);
  color: var(--brand);
  background: var(--brand-soft);
  padding: 3px 10px;
  border-radius: 999px;
}
@media (max-width: 860px) { .examples { grid-template-columns: 1fr; } }

.pricing { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; align-items: stretch; }
.price-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 26px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.price-card.featured { border-color: var(--brand); box-shadow: 0 12px 40px rgba(14, 122, 108, 0.18); position: relative; }
.price-card.featured::before {
  content: "Most popular";
  position: absolute;
  top: -12px;
  left: 24px;
  background: var(--brand);
  color: #fff;
  font: 700 0.68rem var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 12px;
  border-radius: 999px;
}
.price-card .price { font: 800 2.4rem var(--font); letter-spacing: -0.03em; margin: 2px 0 4px; }
.price-card .price small { font: 600 0.95rem var(--font); color: var(--muted); }
.price-card .plan-tag { margin: -4px 0 0; color: var(--muted); font-size: 0.86rem; }
.price-card ul { margin: 8px 0 18px; padding: 0 0 0 18px; color: var(--ink-soft); font-size: 0.93rem; display: grid; gap: 6px; }
.price-card ul.plan-features { list-style: none; padding-left: 0; gap: 9px; }
.plan-features li { position: relative; padding-left: 28px; line-height: 1.45; }
.plan-features li::before {
  position: absolute;
  left: 0;
  top: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}
.plan-features li.ok::before { content: "✓"; background: var(--brand-soft); color: var(--brand); }
.plan-features li.no { color: var(--muted); }
.plan-features li.no::before { content: "✕"; background: #f3f1ee; color: #b3aca2; }
.pricing-note { margin-top: 22px; text-align: center; color: var(--muted); font-size: 0.88rem; }
.price-card .button { margin-top: auto; }
.waitlist-form { display: grid; gap: 8px; margin-top: auto; }
.waitlist-form .button { margin-top: 0; }
.waitlist-form[hidden] { display: none; }
@media (max-width: 1080px) { .pricing { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .pricing { grid-template-columns: 1fr; } }

.faq-list { display: grid; gap: 12px; max-width: 760px; }
.faq-list details {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
}
.faq-list summary { font-weight: 650; cursor: pointer; }
.faq-list details p { margin: 10px 0 0; color: var(--ink-soft); }

.footer {
  border-top: 1px solid var(--line);
  padding: 28px clamp(18px, 4vw, 48px);
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.88rem;
}

/* ---------- auth pages ---------- */

.auth-page { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 40px 18px; }
.auth-panel { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-md); padding: 36px 32px; }
.auth-panel h1 { font-size: 1.6rem; }
.auth-panel > p { color: var(--muted); font-size: 0.93rem; }
.auth-panel form { display: grid; gap: 14px; margin-top: 18px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 0.8rem; margin: 18px 0 4px; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-toggle { margin-top: 18px; text-align: center; font-size: 0.92rem; color: var(--muted); }
.auth-toggle a { font-weight: 650; margin-left: 6px; }
.google-area { display: grid; gap: 10px; margin-top: 16px; justify-items: stretch; }

/* ---------- dashboard ---------- */

.dash { max-width: 1080px; margin: 0 auto; padding: clamp(28px, 5vw, 56px) clamp(18px, 4vw, 48px); }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; flex-wrap: wrap; margin-bottom: 28px; }
.dash-head p { color: var(--muted); margin: 0; }

.generator-card { padding: 30px 28px; margin-bottom: 34px; }
.generator-card form { display: grid; gap: 16px; max-width: 560px; }

.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.site-card { overflow: hidden; display: flex; flex-direction: column; }
.site-card .thumb { aspect-ratio: 5/2.6; object-fit: cover; border-bottom: 1px solid var(--line); background: #eef0f2; }
.site-card .body { padding: 18px 20px 20px; display: grid; gap: 10px; }
.site-card .title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.site-card h3 { margin: 0; font-size: 1.05rem; }
.site-card .meta { color: var(--muted); font-size: 0.83rem; }
.site-card .row { display: flex; gap: 8px; flex-wrap: wrap; }
.site-card .row .button { padding: 8px 16px; font-size: 0.85rem; }

.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }

/* ---------- editor ---------- */

.editor-layout {
  display: grid;
  grid-template-columns: 392px 1fr;
  gap: 0;
  min-height: calc(100vh - 64px);
}
.editor-side {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 24px 22px 0;
  overflow-y: auto;
  max-height: calc(100vh - 64px);
}
.side-head { margin-bottom: 18px; }
.side-head h2 { font-size: 1.12rem; margin: 0 0 4px; }
.side-head p { color: var(--muted); font-size: 0.88rem; margin: 0; }

.editor-side form { display: grid; gap: 16px; }
.editor-side fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  display: grid;
  gap: 10px;
  margin: 0;
  min-width: 0;
}
.editor-side legend {
  font: 700 0.72rem var(--font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 6px;
}

/* repeating items (services, reviews, gallery…) read as removable cards */
.repeat-row {
  position: relative;
  display: grid;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 34px 12px 12px;
}
.row-tools { position: absolute; top: 7px; right: 8px; }
.mini-btn {
  font: 650 0.68rem var(--font);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 6px;
  padding: 3px 7px;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}
.mini-btn:hover { color: var(--danger); background: #fbf1ee; }
.add-btn {
  font: 650 0.82rem var(--font);
  color: var(--brand);
  background: transparent;
  border: 1.5px dashed color-mix(in srgb, var(--brand) 38%, transparent);
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  width: 100%;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.add-btn:hover { background: var(--brand-soft); border-color: var(--brand); }
.color-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.color-row input[type="color"] { padding: 3px; height: 38px; cursor: pointer; }

/* Save stays reachable while the long form scrolls */
.save-bar {
  position: sticky;
  bottom: 0;
  margin: 0 -22px;
  padding: 14px 22px 16px;
  background: linear-gradient(180deg, transparent, var(--surface) 32%);
  display: grid;
  gap: 4px;
}

.editor-side .side-panel { margin: 2px 0 16px; padding: 16px; }
.side-panel h3 { margin: 0 0 6px; font-size: 0.98rem; }
.side-panel .hint { color: var(--muted); font-size: 0.88rem; }

.editor-main {
  padding: 0 clamp(16px, 3vw, 36px) 30px;
  overflow-y: auto;
  max-height: calc(100vh - 64px);
  background: var(--bg);
}
.editor-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 calc(-1 * clamp(16px, 3vw, 36px)) 18px;
  padding: 12px clamp(16px, 3vw, 36px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.editor-toolbar .spacer { flex: 1; }
.editor-toolbar select { width: auto; min-width: 180px; }
.editor-toolbar .link-box { display: flex; gap: 8px; align-items: center; }
.editor-toolbar .link-box input { width: clamp(180px, 24vw, 320px); font-size: 0.83rem; }

/* preview sits in a faux-browser shell */
.preview-shell {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  background: #fff;
}
.preview-chrome {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.preview-chrome span { width: 10px; height: 10px; border-radius: 50%; }
.preview-chrome span:nth-child(1) { background: #ecc8c1; }
.preview-chrome span:nth-child(2) { background: #ecdfbb; }
.preview-chrome span:nth-child(3) { background: #c5dfc9; }
.preview-chrome em { font: 600 0.74rem var(--font); font-style: normal; color: var(--muted); margin-left: 8px; }
.preview-frame { background: #fff; }
@media (max-width: 1020px) {
  .editor-layout { grid-template-columns: 1fr; }
  .editor-side, .editor-main { max-height: none; }
  .editor-main { padding-top: 0; }
}

/* ---------- admin panel ---------- */

.admin { max-width: 1180px; margin: 0 auto; padding: clamp(24px, 4vw, 48px) clamp(18px, 4vw, 48px) 80px; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card { padding: 18px 18px 16px; display: grid; gap: 4px; align-content: start; }
.stat-label { font: 700 0.7rem var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.stat-value { font: 800 1.7rem var(--font); letter-spacing: -0.02em; color: var(--ink); }
.stat-sub { font-size: 0.78rem; color: var(--muted); line-height: 1.35; }
@media (max-width: 1080px) { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 620px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

.admin-card { padding: 22px 24px; }
.admin-card h2 { font-size: 1.15rem; margin-bottom: 14px; }

.admin-cols { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; margin-bottom: 26px; }
@media (max-width: 900px) { .admin-cols { grid-template-columns: 1fr; } }

.chart { width: 100%; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg .bar { fill: var(--brand); transition: fill 0.12s ease; }
.chart-svg .bar:hover { fill: var(--brand-dark); }
.chart-svg .bar.empty { fill: var(--line); }
.chart-axis { font: 600 10px var(--font); fill: var(--muted); }
.chart-svg .mrr-line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart-svg .mrr-area { fill: var(--brand-soft); opacity: 0.7; }

.plan-rows { display: grid; gap: 14px; }
.plan-row { display: grid; gap: 6px; }
.plan-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.plan-name { font: 600 0.9rem var(--font); color: var(--ink-soft); }
.plan-mrr { font: 800 0.95rem var(--font); color: var(--ink); }
.plan-bar { height: 8px; background: var(--brand-soft); border-radius: 999px; overflow: hidden; }
.plan-bar-fill { height: 100%; background: var(--brand); border-radius: 999px; min-width: 3px; }
.muted-note { color: var(--muted); font-size: 0.9rem; margin: 0; }
.stack-form { display: grid; gap: 13px; margin-top: 14px; }
.stack-form .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.checkbox-row { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 600; color: var(--ink-soft); }
.checkbox-row input { width: auto; }
.smtp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
@media (max-width: 640px) { .smtp-grid { grid-template-columns: 1fr; } }
.test-email-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.test-email-row input { flex: 1; min-width: 220px; }
.test-email-row .form-status { flex-basis: 100%; }

.admin-tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.admin-tabs .tab {
  font: 650 0.9rem var(--font);
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
}
.admin-tabs .tab:hover { background: var(--surface); border-color: var(--brand); color: var(--ink); }
.admin-tabs .tab.is-active { background: var(--brand); color: #fff; border-color: var(--brand); }
.admin-tabs .tab:focus-visible,
.inbox-item:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 2px;
}
.primary-tabs { margin: 6px 0 22px; flex-wrap: wrap; }
.tab-panel > .admin-card + .admin-card,
.tab-panel > .admin-cols + .admin-card,
.tab-panel > .admin-card + .admin-cols { margin-top: 18px; }

/* Projection cards reuse the stat-grid look. */
.proj-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 820px) { .proj-grid { grid-template-columns: repeat(2, 1fr); } }

/* Email tab: compose | inbox */
.email-client { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .email-client { grid-template-columns: 1fr; } }
.email-compose textarea { resize: vertical; min-height: 180px; font: inherit; }
.email-inbox { min-height: 320px; }
.inbox-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; }
.inbox-item {
  display: grid;
  grid-template-columns: 1fr 1.4fr auto;
  gap: 10px;
  align-items: baseline;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.inbox-item:hover { background: var(--brand-soft); border-radius: 8px; }
.inbox-from { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-subject { color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-date { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.inbox-item.unread .inbox-from::before { content: "● "; color: var(--brand); }
.inbox-item.unread .inbox-subject { font-weight: 600; color: var(--ink); }
.message-view { margin-top: 8px; }
.message-view h3 { margin: 12px 0 4px; }
.msg-meta { color: var(--muted); font-size: 0.86rem; margin: 0 0 12px; }
.msg-body { white-space: pre-wrap; word-break: break-word; font: 0.9rem/1.5 var(--font); background: #faf9f7; border: 1px solid var(--line); border-radius: 8px; padding: 14px; max-height: 460px; overflow: auto; }
.msg-html { width: 100%; height: 460px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.msg-attachments { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 12px; font-size: 0.85rem; color: var(--muted); }
.att-chip { background: var(--brand-soft); color: var(--ink-soft); border-radius: 6px; padding: 4px 10px; }

/* Subscriptions: counts, inline actions, sortable headers, expanded sites */
.plan-counts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.data-table th.sortable { cursor: pointer; user-select: none; }
.data-table th.sortable:hover { color: var(--ink); }
.data-table th.sort-asc::after { content: " ▲"; font-size: 0.7em; color: var(--brand); }
.data-table th.sort-desc::after { content: " ▼"; font-size: 0.7em; color: var(--brand); }
.actions-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.actions-cell .filter-select { padding: 5px 8px; font-size: 0.8rem; }
.button.btn-xs { padding: 5px 12px; font-size: 0.8rem; box-shadow: none; }
.sites-row td { background: #faf9f7; }
.sites-inline { display: flex; flex-wrap: wrap; gap: 8px; }
.sites-inline .chip { font-size: 0.82rem; padding: 5px 11px; border-radius: 999px; text-decoration: none; }
.sites-inline .chip.live { background: #e5f4ea; color: #1c7c3c; }
.sites-inline .chip.draft { background: #f1f0ea; color: #8a7a36; }

.table-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.table-head h2 { margin: 0; }
.table-head .count { color: var(--muted); font-weight: 600; font-size: 0.95rem; }
.table-tools { display: flex; gap: 8px; align-items: center; }
.table-tools input { width: 220px; padding: 8px 12px; font-size: 0.88rem; }
.table-tools .filter-select { padding: 8px 12px; font-size: 0.88rem; border: 1px solid var(--border, #e0ddd6); border-radius: 8px; background: #fff; color: var(--ink); cursor: pointer; }
.button.light.mini, .button.mini { padding: 6px 14px; font-size: 0.8rem; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.data-table th {
  text-align: left;
  font: 700 0.72rem var(--font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--ink-soft); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--bg); }
.data-table .tag-cell { text-transform: capitalize; }
.data-table td:first-child { color: var(--ink); font-weight: 550; }

/* ---------- admin blog tab ---------- */

.blog-editor textarea { font: 0.88rem/1.55 ui-monospace, "SF Mono", Menlo, Consolas, monospace; resize: vertical; }
.blog-preview {
  padding: 10px 30px 30px;
  overflow-y: auto;
  font-size: 0.97rem;
  line-height: 1.7;
}
/* Wide modal variant: the post preview gets near-page width to read like the
   real article (the regular .modal stays 420px for confirms). */
.modal.modal-wide {
  width: min(920px, 96vw);
  max-height: 90vh;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-wide .preview-chrome { flex: none; }
.modal-wide .modal-close { margin-left: auto; padding: 5px 12px; font-size: 0.82rem; }
.modal-wide .blog-preview { flex: 1; }
.blog-preview img { max-width: 100%; border-radius: 8px; }
.blog-preview pre { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; }
.blog-preview blockquote { border-left: 3px solid var(--brand); margin: 0; padding: 2px 14px; color: var(--ink-soft); }
#blogKeyValue { font: 0.85rem ui-monospace, Menlo, Consolas, monospace; }

/* ---------- modal dialogs (ui.js) ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 20, 24, 0.45);
  backdrop-filter: blur(3px);
  animation: modal-fade 0.14s ease;
}
.modal {
  width: min(420px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 26px 26px 22px;
  animation: modal-pop 0.16s ease;
}
.modal h3 { margin: 0 0 8px; font-size: 1.08rem; }
.modal p {
  margin: 0 0 20px;
  color: var(--ink-soft);
  font-size: 0.93rem;
  line-height: 1.55;
  white-space: pre-line;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
body.modal-open { overflow: hidden; }
@keyframes modal-fade { from { opacity: 0; } }
@keyframes modal-pop { from { opacity: 0; transform: translateY(6px) scale(0.98); } }

/* solid destructive button (modal confirms) */
.button.solid-danger { background: var(--danger); color: #fff; border-color: transparent; }
.button.solid-danger:hover { background: #a93a25; }

/* keyboard focus, everywhere */
.button:focus-visible, .add-btn:focus-visible, .mini-btn:focus-visible, a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--brand) 55%, transparent);
  outline-offset: 2px;
}
