/* VibeCMS Dashboard — Direction B (Site Health) */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:wght@500;600;700;800&family=Hanken+Grotesk:wght@400;500;600;700&display=swap');

:root {
  /* ---- Brand ---- */
  --brand:        #6C47FF;
  --brand-600:    #5a39e0;
  --brand-700:    #4a2dc4;
  --brand-tint:   #f3f0ff;
  --brand-tint-2: #e9e3ff;
  --brand-ink:    #3a1f9e;
  --ai-grad:      linear-gradient(115deg, #8b5cff 0%, #6C47FF 55%, #b14bff 130%);

  /* ---- Warm-cool neutral ink scale ---- */
  --ink-900: #16131f;
  --ink-800: #232032;
  --ink-700: #3a3650;
  --ink-600: #545069;
  --ink-500: #6b6880;
  --ink-400: #908da6;
  --ink-300: #c6c3d6;
  --ink-200: #e4e2ef;
  --ink-150: #ecebf3;
  --ink-100: #f3f2f8;
  --ink-50:  #faf9fc;
  --canvas:  #f5f4fa;
  --white:   #ffffff;

  /* ---- Status ---- */
  --live:      #15a35a;
  --live-bg:   #e6f6ed;
  --live-ring: #b6e6c8;
  --hold:      #cf7a12;
  --hold-bg:   #fbf0dd;
  --hold-ring: #f1d6a6;
  --rest:      #6b7186;
  --rest-bg:   #eef0f4;
  --rest-ring: #d9dde6;
  --danger-color: #d6455d;
  --danger-bg:    #fdecef;

  /* ---- Dark sidebar surfaces ---- */
  --d-bg:    #15131e;
  --d-surf:  #1d1a2a;
  --d-surf2: #252134;
  --d-line:  #322d44;
  --d-text:  #ece9f6;
  --d-mut:   #9c97b4;

  /* ---- Radii / shadow ---- */
  --r-xs: 7px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  --sh-sm: 0 1px 2px rgba(22,19,31,.05), 0 1px 1px rgba(22,19,31,.04);
  --sh-md: 0 4px 16px -6px rgba(22,19,31,.12), 0 1px 3px rgba(22,19,31,.06);
  --sh-lg: 0 18px 48px -18px rgba(40,28,90,.26), 0 4px 12px -6px rgba(22,19,31,.08);
  --sh-pop: 0 20px 50px -16px rgba(30,18,70,.34);

  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-ui:      'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;

  /* ---- Legacy aliases — every existing component keeps working ---- */
  --bg:        var(--canvas);
  --surface:   var(--white);
  --border:    var(--ink-200);
  --text:      var(--ink-900);
  --muted:     var(--ink-500);
  --primary:   var(--brand);
  --primary-h: var(--brand-600);
  --primary-l: var(--brand-tint);
  --success:   var(--live);
  --danger:    var(--danger-color);
  --shadow:    var(--sh-md);
  --radius:    var(--r-md);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 14px/1.5 var(--font-ui), -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-h); }

/* ── Login screen ──────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 20% 0%, rgba(99,102,241,.08), transparent 50%),
    radial-gradient(circle at 80% 100%, rgba(99,102,241,.06), transparent 50%),
    var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 40px;
  width: 100%;
  max-width: 380px;
}

.login-card .logo {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}
.login-card .logo img {
  height: 36px;
  width: auto;
  max-width: 100%;
  display: block;
}

.login-card h1 {
  font-size: 22px;
  margin: 16px 0 6px;
  letter-spacing: -.01em;
}
.login-card .subtitle {
  color: var(--muted);
  margin: 0 0 28px;
}

/* ── Form ──────────────────────────────────────────────────────────────── */

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 6px;
}
input[type="text"],
input[type="password"],
input[type="url"],
input[type="email"] {
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 10px 16px;
  border-radius: 8px;
  transition: background .15s, transform .08s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: #fff; width: 100%; padding: 11px; }
.btn-primary:hover:not(:disabled) { background: var(--primary-h); }

/* Warm-amber CTA — used for "Upgrade to unlock" on read-only site
   cards. Distinct from .btn-primary so the user can see at a glance
   that this is the recovery path, not a regular action. */
.btn-warm {
  background: #f59e0b;
  color: #fff;
  border: 0;
  padding: 9px 16px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s, transform .1s;
}
.btn-warm:hover:not(:disabled) { background: #d97706; }
.btn-warm:active { transform: scale(.97); }

.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--primary-l); }

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: var(--muted); }

.btn-danger { background: transparent; color: var(--danger); }
.btn-danger:hover { background: rgba(239, 68, 68, .08); }

/* ── Toast / errors ────────────────────────────────────────────────────── */

.error-message {
  background: rgba(239,68,68,.08);
  color: var(--danger);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  margin-top: 12px;
  display: none;
}
.error-message.visible { display: block; }

/* ── App shell ─────────────────────────────────────────────────────────── */

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
}

.sidebar .logo {
  display: flex;
  align-items: center;
  padding: 0 8px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.sidebar .logo img {
  /* Single-file SVG carries the wordmark; let the height drive it
     and keep aspect ratio. 28 px lines up with the old dot-+-text
     visual weight without overflowing the 220-px sidebar. */
  height: 28px;
  width: auto;
  max-width: 100%;
  display: block;
}

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  cursor: pointer;
  transition: background .14s, color .14s, transform .14s;
  user-select: none;
  font-size: 14px;
}
.nav-item .nav-icon {
  width: 18px;
  height: 18px;
  flex: none;
  opacity: .7;
  transition: opacity .14s;
}
.nav-item:hover {
  background: var(--primary-l);
  color: var(--text);
}
.nav-item:hover .nav-icon { opacity: 1; }
.nav-item.active {
  background: var(--primary-l);
  color: var(--primary);
  font-weight: 600;
}
.nav-item.active .nav-icon { opacity: 1; color: var(--primary); }
.nav-item.disabled {
  color: #cbd5e1;
  cursor: not-allowed;
}
.nav-item.disabled .nav-icon { opacity: .5; }
.nav-item.disabled:hover { background: transparent; color: #cbd5e1; transform: none; }
.nav-item.disabled:hover .nav-icon { opacity: .5; }
.nav-item .badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.sidebar-footer {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}
.user-info {
  font-size: 12px;
  color: var(--muted);
  padding: 0 8px 8px;
}
.user-info strong { color: var(--text); display: block; font-size: 13px; }

/* Sidebar upsell — warm gradient pill, eye-catching but compact.
   Sits between the FREE badge and Log out. Hidden on Agency. */
.btn-upgrade {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  margin: 4px 0 8px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
  color: #fff;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: .02em;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(245,158,11,.25);
  transition: transform .14s, box-shadow .14s, filter .14s;
}
.btn-upgrade:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(245,158,11,.35);
  filter: brightness(1.04);
}
.btn-upgrade:active { transform: translateY(0); }
.btn-upgrade .upgrade-icon {
  font-size: 14px;
  line-height: 1;
  font-weight: 700;
}

/* ── Main content ──────────────────────────────────────────────────────── */

.main { padding: 32px 40px; max-width: 1100px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h1 {
  font-size: 24px;
  margin: 0 0 4px;
  letter-spacing: -.01em;
}
.page-header .subtitle { color: var(--muted); margin: 0; }

/* Cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  transition: border-color .15s;
}
.card:hover { border-color: #cbd5e1; }

.card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.site-info { flex: 1; min-width: 0; }
.site-info h3 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
}
.site-info .url {
  color: var(--muted);
  font-size: 13px;
  word-break: break-all;
}
.site-info .meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.card-actions { display: flex; gap: 8px; flex-shrink: 0; }

.snippet {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.snippet-help {
  margin: 0;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.snippet-help strong { color: var(--text); }
.snippet-help code {
  background: var(--surface);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
.snippet-help em { color: var(--primary); font-style: normal; }
.snippet > code {
  display: flex;
  align-items: center;
  width: 100%;
  background: var(--surface);
  padding: 8px 10px;
  border-radius: 6px;
  font-family: "SF Mono", Menlo, Consolas, monospace;
}
.snippet > code + button { align-self: flex-start; }
/* HTML's `hidden` attribute must win over the .snippet display: flex above. */
.snippet[hidden] { display: none !important; }
/* Subtle chevron next to Embed label */
.btn .chev {
  display: inline-block;
  font-size: 10px;
  margin-left: 4px;
  opacity: .7;
  transform: translateY(-1px);
}
.snippet code {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.snippet button {
  padding: 4px 10px;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
}
.snippet button:hover { color: var(--primary); border-color: var(--primary); }
.snippet button.copied { color: var(--success); border-color: var(--success); }

/* ── API & Integrations panel ───────────────────────────────────── */
.api-panel {
  margin-top: 10px; padding: 16px; border-top: 1px solid var(--border);
  display: grid; gap: 16px;
}
.api-sec .api-lbl {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 7px;
}
.api-row { display: flex; gap: 8px; align-items: center; }
.api-key, .api-url {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: ui-monospace, monospace; font-size: 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 10px; color: var(--text);
}
.api-hook-input {
  flex: 1; padding: 7px 10px; border: 1px solid var(--border);
  border-radius: 6px; font-size: 13px; background: var(--surface); color: var(--text);
}
.api-hooks { margin-top: 10px; display: grid; gap: 6px; }
.api-hook {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px;
}
.api-hook-url {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; font-family: ui-monospace, monospace; color: var(--text);
}
.api-empty { font-size: 12px; color: var(--muted); font-style: italic; }
.api-code {
  margin: 0 0 8px; padding: 10px 12px; border-radius: 8px;
  background: #0f172a; color: #e2e8f0; font-size: 12px;
  font-family: ui-monospace, monospace; overflow-x: auto; white-space: pre;
}

/* ── TOS consent modal ──────────────────────────────────────────── */
#tos-modal .modal-back {
  position: fixed; inset: 0; z-index: 2147483647;
  background: rgba(15,23,42,.55);
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}
#tos-modal .modal-card {
  background: #fff; border-radius: 14px;
  width: min(440px, 92vw); padding: 28px 30px;
  box-shadow: 0 30px 80px rgba(15,23,42,.35);
}
#tos-modal h3 { font-size: 20px; margin: 0 0 6px; letter-spacing: -.01em; }
#tos-modal .modal-sub { margin: 0 0 14px; color: var(--muted); font-size: 14px; }
#tos-modal .tos-links {
  list-style: none; padding: 0; margin: 0 0 18px;
  display: flex; flex-direction: column; gap: 6px;
}
#tos-modal .tos-links a {
  color: var(--primary); text-decoration: none; font-weight: 500;
  display: inline-flex; align-items: center; gap: 4px;
}
#tos-modal .tos-links a:hover { text-decoration: underline; }
#tos-modal .tos-check {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px; color: var(--text); line-height: 1.45;
  padding: 12px; background: var(--bg); border-radius: 8px;
  margin-bottom: 18px; cursor: pointer;
}
#tos-modal .tos-check input { margin-top: 2px; flex: none; }
#tos-modal .modal-actions { display: flex; justify-content: flex-end; }

/* ── Over-quota banner ───────────────────────────────────────────── */
.quota-banner {
  display: flex; align-items: center; gap: 18px;
  background: #fef3c7; border: 1px solid #fbbf24;
  color: #92400e;
  padding: 14px 18px; border-radius: 10px;
  margin: 0 0 18px 0;
  font-size: 14px; line-height: 1.5;
}
.quota-banner strong { color: #78350f; }
.quota-banner .btn { flex: none; }

/* Empty state */

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty h2 { margin: 0 0 8px; color: var(--text); font-weight: 600; }
.empty p { margin: 0 0 20px; }

/* Modal */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .4);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal-backdrop.visible { display: flex; }

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 24px 48px rgba(15,23,42,.2);
}
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.modal .subtitle { margin: 0 0 20px; color: var(--muted); }
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Wide modal (submissions, future inboxes) */

.modal.modal-wide {
  max-width: 720px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
}
.modal-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.modal-header-row h2 { margin: 0 0 4px; }
.modal-header-row .subtitle { margin: 0; }

#submissions-list {
  overflow-y: auto;
  flex: 1;
  margin: 0 -8px;
  padding: 0 8px;
}

.submission {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--surface);
  transition: border-color .15s;
}
.submission.unread { border-color: var(--primary); background: var(--primary-l); }
.submission-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.submission-time {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
}
.submission-time .dot-unread {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary);
  display: inline-block;
}
.submission-actions { display: flex; gap: 6px; }
.submission-actions button {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
}
.submission-actions button:hover { color: var(--text); border-color: var(--muted); }
.submission-actions .danger:hover { color: var(--danger); border-color: var(--danger); }

.submission-fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  font-size: 13px;
}
.submission-fields dt {
  color: var(--muted);
  font-weight: 500;
}
.submission-fields dd {
  margin: 0;
  word-break: break-word;
  color: var(--text);
}

.submission-source {
  margin-top: 10px;
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}
.submission-source a { color: var(--muted); }

/* Inbox button on site card */
.site-info .badge-pill {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  font-weight: 700;
  background: var(--primary);
  color: #fff;
  padding: 2px 7px;
  border-radius: 10px;
  vertical-align: middle;
}
.site-info .archive-badge {
  background: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Archived sites are visually muted */
.card.archived {
  opacity: .75;
  background: var(--bg);
}
.card.archived:hover { opacity: 1; }

/* ── Plan badge in sidebar ──────────────────────────────────────────── */

.plan-badge {
  display: inline-block;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  border-radius: 999px;
  text-transform: uppercase;
  margin-top: 4px;
}
.plan-badge--free     { background: #eef2ff; color: var(--primary-deep); }
.plan-badge--personal { background: #ecfdf5; color: #047857; }
.plan-badge--smartai  { background: #fef3c7; color: #b45309; }
.plan-badge--agency   { background: #fce7f3; color: #be185d; }

/* ── Billing / Pricing page ─────────────────────────────────────────── */

.billing-interval-switch {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 10px;
  padding: 4px;
  gap: 2px;
}
.billing-switch-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 8px 16px;
  border-radius: 7px;
  font: 600 13px/1 inherit;
  color: #64748b;
  cursor: pointer;
  transition: background .15s, color .15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.billing-switch-btn.is-active {
  background: #fff;
  color: #0f172a;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
.billing-switch-btn .save-pill {
  background: #ecfdf5;
  color: #047857;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}

.billing-current {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 13px;
  color: #475569;
  line-height: 1.5;
}
.billing-current strong { color: #0f172a; }
.billing-current:empty { display: none; }

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

/* À-la-carte modules on the Billing page */
.promo-redeem {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: #faf5ff; border: 1px solid #e9d5ff; border-radius: 12px;
  padding: 12px 16px; margin-bottom: 18px;
}
.promo-redeem .promo-label { font-size: 13.5px; font-weight: 600; color: #6b21a8; }
.promo-redeem input {
  flex: 1; min-width: 140px; max-width: 240px;
  border: 1px solid #d8b4fe; border-radius: 9px; padding: 8px 11px;
  font-size: 13px; text-transform: uppercase;
}
.promo-redeem input:focus { outline: none; border-color: #a855f7; }
.promo-redeem .btn { width: auto; padding: 8px 18px; }

/* ── How VibeCMS works — guide page ─────────────────────────────────── */
.hw { display: flex; flex-direction: column; gap: 16px; max-width: 860px; }
.hw-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 22px 24px; }
.hw-card h2 { margin: 0 0 10px; font-size: 18px; font-weight: 700; color: #1e293b; }
.hw-card h4 { margin: 0 0 3px; font-size: 14px; font-weight: 700; color: #334155; }
.hw-card > p { margin: 0 0 4px; font-size: 14px; line-height: 1.6; color: #475569; }
.hw-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; line-height: 1.55; color: #475569; }
.hw-list { margin: 6px 0 0; padding-left: 20px; display: flex; flex-direction: column; gap: 7px; font-size: 14px; line-height: 1.55; color: #475569; }
.hw-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 6px; }
@media (max-width: 640px) { .hw-2col { grid-template-columns: 1fr; } }
.hw-2col > div b { color: #1e293b; }
.hw-2col > div p { margin: 3px 0 0; font-size: 13px; line-height: 1.5; color: #64748b; }
.hw-snippet { margin-top: 12px; background: #0f172a; color: #a5f3d0; border-radius: 10px; padding: 12px 14px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; overflow-x: auto; white-space: nowrap; }
.hw-note { margin-top: 12px !important; font-size: 12.5px !important; color: #64748b !important; background: #f8fafc; border-radius: 10px; padding: 10px 13px; }
.hw kbd { background: #f1f5f9; border: 1px solid #cbd5e1; border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; font-family: inherit; font-size: 12.5px; color: #334155; white-space: nowrap; }
.hw code { background: #f1f5f9; border-radius: 5px; padding: 1px 5px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; color: #7c3aed; }
.hw-snippet code { background: none; color: inherit; padding: 0; }

.hw-acc { background: linear-gradient(180deg, #faf5ff, #fff); border: 1px solid #e9d5ff; border-radius: 14px; overflow: hidden; }
.hw-acc[open] { background: #fff; }
.hw-acc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 18px 22px; font-size: 17px; font-weight: 700; color: #4c1d95; }
.hw-acc > summary::-webkit-details-marker { display: none; }
.hw-acc-ico { font-size: 20px; }
.hw-acc-title { flex: 1; }
.hw-acc-chev { color: #a855f7; transition: transform .2s; font-size: 14px; }
.hw-acc[open] .hw-acc-chev { transform: rotate(180deg); }
.hw-acc-body { padding: 0 22px 22px; }
.hw-acc-body h4 { margin: 16px 0 6px; font-size: 14px; font-weight: 700; color: #334155; }
.hw-acc-body > p { margin: 0 0 4px; font-size: 14px; line-height: 1.6; color: #475569; }
.hw-mods { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 8px; }
@media (max-width: 640px) { .hw-mods { grid-template-columns: 1fr; } }
.hw-mod { border: 1px solid #e9d5ff; border-radius: 12px; padding: 13px 15px; background: #fdfcff; }
.hw-mod-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
.hw-mod-h b { font-size: 14px; color: #1e293b; }
.hw-mod-h span { font-size: 12px; font-weight: 700; color: #7c3aed; }
.hw-mod p { margin: 0; font-size: 12.5px; line-height: 1.5; color: #64748b; }

.modules-billing { margin-top: 36px; }
.modules-billing-title { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.modules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.module-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.module-card.is-owned { border-color: #10b981; background: #f0fdf9; }
.module-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.module-card-name { font-weight: 700; font-size: 15px; }
.module-card-price { font-weight: 800; color: #4f46e5; }
.module-card-owned { font-weight: 700; color: #10b981; font-size: 13px; }
.module-card-desc { margin: 0; font-size: 13px; color: #64748b; line-height: 1.5; flex: 1; }
.module-card .btn { margin-top: 6px; align-self: flex-start; }
.module-card-foot { margin-top: 8px; font-size: 12.5px; font-weight: 600; color: #10b981; }
.modules-empty {
  grid-column: 1 / -1; font-size: 13.5px; color: #64748b; line-height: 1.55;
  background: #f8fafc; border: 1px dashed #d8dee7; border-radius: 12px; padding: 20px;
}

/* The blocks below set an explicit `display`, which would otherwise beat the
   [hidden] UA rule and keep them (e.g. the history modal) visible. Re-assert
   hidden with higher specificity so the attribute still hides them. */
.spend-summary[hidden],
.credits-billing[hidden],
.packs-panel[hidden],
.cb-history-modal[hidden] { display: none !important; }

/* ── Spending summary tiles ─────────────────────────────────────────── */
.spend-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin: 4px 0 24px;
}
.spend-tile {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 4px;
}
.spend-tile-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; }
.spend-tile-value { font-size: 24px; font-weight: 800; color: #1e293b; }
.spend-tile-sub { font-size: 12.5px; color: #64748b; }

/* ── AI credits card (one shared balance) ──────────────────────────── */
.credits-billing {
  display: grid; grid-template-columns: 1.1fr 1fr;
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  overflow: hidden; margin-bottom: 16px;
}
@media (max-width: 720px) { .credits-billing { grid-template-columns: 1fr; } }
.credits-billing-main { padding: 22px 22px 20px; }
.credits-billing-usage { padding: 22px; background: #f8fafc; border-left: 1px solid #eef2f7; }
@media (max-width: 720px) { .credits-billing-usage { border-left: 0; border-top: 1px solid #eef2f7; } }
.credits-billing-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.credits-billing-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; }
.credits-billing-balance { font-size: 15px; color: #64748b; margin-top: 2px; }
.credits-billing-balance b { font-size: 30px; font-weight: 800; color: #4f46e5; }
.credits-billing-meter { height: 8px; border-radius: 999px; background: #eef2f7; overflow: hidden; margin: 16px 0 10px; }
.credits-billing-meter > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg,#8b5cff,#6C47FF); transition: width .25s; }
.credits-billing-hint { margin: 0; font-size: 12.5px; color: #64748b; }
.credits-billing-note { margin: 8px 0 0; font-size: 12px; color: #94a3b8; }
.credits-usage-head { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 700; color: #475569; margin-bottom: 12px; }
.credits-history-link { background: none; border: 0; padding: 0; color: #4f46e5; font-weight: 600; font-size: 12.5px; cursor: pointer; }
.credits-history-link:hover { text-decoration: underline; }
.credits-usage-list { display: flex; flex-direction: column; gap: 9px; }
.credits-usage-row { display: grid; grid-template-columns: 1fr 70px auto; align-items: center; gap: 10px; font-size: 13px; }
.credits-usage-name { color: #334155; font-weight: 600; }
.credits-usage-bar { height: 6px; border-radius: 999px; background: #e9edf3; overflow: hidden; }
.credits-usage-bar > i { display: block; height: 100%; border-radius: 999px; background: #a78bfa; }
.credits-usage-val { font-weight: 700; color: #475569; text-align: right; min-width: 28px; }
.credits-usage-empty { font-size: 13px; color: #94a3b8; }
.credits-usage-total { display: flex; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px dashed #dbe2ea; font-size: 12.5px; font-weight: 700; color: #334155; }

/* ── Top-up packs panel ────────────────────────────────────────────── */
.packs-panel { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 18px 20px 20px; margin-bottom: 24px; }
.packs-panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.packs-panel-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.packs-panel-close { background: none; border: 0; font-size: 16px; color: #94a3b8; cursor: pointer; line-height: 1; }
.packs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.pack-card { position: relative; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px 14px 14px; text-align: center; display: flex; flex-direction: column; gap: 3px; }
.pack-card.is-popular { border-color: #6C47FF; box-shadow: 0 0 0 1px #6C47FF inset; }
.pack-card-badge { position: absolute; top: -9px; left: 50%; transform: translateX(-50%); background: var(--ai-grad,#6C47FF); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pack-card-credits { font-size: 24px; font-weight: 800; color: #1e293b; }
.pack-card-credits-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #94a3b8; }
.pack-card-price { font-size: 18px; font-weight: 800; color: #4f46e5; margin-top: 4px; }
.pack-card-per { font-size: 11.5px; color: #94a3b8; }
.pack-card-save { font-size: 11.5px; font-weight: 700; color: #10b981; }
.pack-card .btn { margin-top: 8px; }

.billing-section-title { margin: 28px 0 8px; font-size: 18px; font-weight: 700; }

/* ── Credit history modal ──────────────────────────────────────────── */
.cb-history-modal { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.cb-history-backdrop { position: absolute; inset: 0; background: rgba(15,23,42,.45); }
.cb-history-dialog { position: relative; background: #fff; border-radius: 14px; width: min(520px, 92vw); max-height: 80vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.cb-history-dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid #eef2f7; }
.cb-history-dialog-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.cb-history-body { overflow-y: auto; padding: 8px 20px 18px; }
.cb-history-row { display: grid; grid-template-columns: 78px 1fr auto 54px; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f5f9; font-size: 13px; }
.cb-history-date { color: #94a3b8; font-size: 12px; }
.cb-history-label { color: #334155; font-weight: 600; }
.cb-history-amt { font-weight: 800; text-align: right; }
.cb-history-amt.is-credit { color: #10b981; }
.cb-history-amt.is-debit { color: #ef4444; }
.cb-history-bal { color: #94a3b8; text-align: right; font-size: 12px; }
.pricing-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.pricing-card.is-current {
  border-color: #0D9B6A;
  background: #f0fdf4;
}
.pricing-card.is-recommended {
  border-color: #6366f1;
  box-shadow: 0 8px 24px rgba(99, 102, 241, .15);
}
.pricing-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.pricing-card-label {
  font: 700 16px/1.2 inherit;
  color: #0f172a;
}
.pricing-card-tag {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  background: #eef2ff;
  color: #4338ca;
}
.pricing-card.is-current .pricing-card-tag { background: #d1fae5; color: #047857; }
.pricing-card-price {
  display: flex;
  align-items: baseline;
  gap: 4px;
  line-height: 1;
}
.pricing-card-price .amount { font: 700 32px/1 inherit; color: #0f172a; }
.pricing-card-price .per    { font-size: 13px; color: #64748b; }
.pricing-card-annual-hint {
  font-size: 11px;
  color: #6366f1;
  margin: -8px 0 0;
}
.pricing-card-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pricing-card-features li {
  position: relative;
  padding-left: 22px;
  font-size: 13px;
  color: #334155;
  line-height: 1.45;
}
.pricing-card-features li::before {
  content: "✓";
  position: absolute;
  left: 0;
  top: 0;
  color: #0D9B6A;
  font-weight: 700;
}
.pricing-card .btn {
  margin-top: auto;
  width: 100%;
}
.pricing-card .btn[disabled] {
  background: #e2e8f0;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

.billing-fineprint {
  margin-top: 22px;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.6;
}

.billing-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 16px;
}
.billing-error:empty { display: none; }

/* ── Per-card widgets: block usage + analytics stub ──────────────────── */

.usage-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 12px;
}
.usage-label { color: var(--muted); }
.usage-num   { font-weight: 600; }
.usage-num.usage-ok     { color: #047857; }
.usage-num.usage-warn   { color: #b45309; }
.usage-num.usage-danger { color: #b91c1c; }
.usage-bar {
  display: inline-block;
  width: 90px;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
  vertical-align: middle;
}
.usage-bar-fill {
  display: block;
  height: 100%;
  transition: width .2s ease;
}
.usage-bar-fill.usage-ok     { background: #0D9B6A; }
.usage-bar-fill.usage-warn   { background: #f59e0b; }
.usage-bar-fill.usage-danger { background: #ef4444; }

.analytics-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  flex-wrap: wrap;
}
.analytics-pill {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  color: #475569;
  white-space: nowrap;
}
.analytics-stub {
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #94a3b8;
  border: 1px dashed #cbd5e1;
  padding: 1px 6px;
  border-radius: 999px;
}

/* ── Read-only site card ───────────────────────────────────────────── */

.readonly-badge {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
  font-weight: 600;
}
.card.locked {
  border-left: 4px solid #f59e0b;
}
/* Small "?" affordance next to the read-only badge — opens a popover
   with the "visitors are fine, only editing is paused" explanation.
   Replaces the old always-visible amber banner under the card. */
.readonly-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 2px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  font: 600 11px/1 ui-sans-serif, system-ui, sans-serif;
  cursor: pointer;
  transition: color .12s, border-color .12s, background .12s;
  vertical-align: middle;
}
.readonly-info:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-l);
}

/* Popover anchored under the "?" button. Positioned with inline
   left/top by JS so it never falls off-screen. */
#readonly-popover {
  position: absolute;
  z-index: 999;
  padding: 14px 16px 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .12), 0 2px 6px rgba(15, 23, 42, .06);
  font: 13px/1.5 inherit;
  color: var(--text);
  animation: rp-pop .14s ease-out;
}
#readonly-popover::before {
  /* Little arrow pointing up at the "?" button. Same fill as the
     popover; border is faked with a second pseudo-element below. */
  content: "";
  position: absolute;
  top: -6px;
  left: 16px;
  width: 10px;
  height: 10px;
  background: #fff;
  border-left: 1px solid var(--border);
  border-top:  1px solid var(--border);
  transform: rotate(45deg);
}
#readonly-popover h4 {
  margin: 0 0 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
#readonly-popover p {
  margin: 0 0 4px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text);
}
#readonly-popover p.muted { color: var(--muted); font-size: 12px; }
#readonly-popover .rp-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: 0;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
#readonly-popover .rp-close:hover { color: var(--text); background: var(--bg); }
@keyframes rp-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Downgrade picker modal ────────────────────────────────────────── */

.modal-wide .dg-list {
  max-height: 360px;
  overflow-y: auto;
  margin: 16px 0;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
}
.dg-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #f1f5f9;
  cursor: pointer;
  transition: background .12s;
}
.dg-row:last-child { border-bottom: 0; }
.dg-row:hover { background: #f8fafc; }
.dg-row input { margin: 0; cursor: pointer; }
.dg-name {
  font-weight: 600;
  color: #0f172a;
}
.dg-url {
  color: #64748b;
  font-size: 12px;
  margin-left: auto;
  font-family: ui-monospace, "DM Mono", monospace;
}

/* ── Client logins panel on each site card ────────────────────────────── */

.client-logins {
  margin-top: 14px;
  border-top: 1px solid #f1f5f9;
  padding-top: 12px;
}
.client-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: #475569;
  font: 600 13px/1 inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}
.client-toggle:hover { color: #0f172a; }
.client-toggle .chev { transition: transform .15s; font-size: 10px; }
.client-logins.is-open .client-toggle .chev { transform: rotate(180deg); }
.client-body {
  margin-top: 12px;
  background: #f8fafc;
  border-radius: 10px;
  padding: 14px 16px;
}
.client-hint {
  font-size: 12px;
  color: #64748b;
  margin: 0 0 12px;
  line-height: 1.5;
}
.client-invite {
  display: flex;
  gap: 10px;
  align-items: stretch;
}
.client-invite input {
  flex: 1 1 70%;
  min-width: 0;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  font: inherit;
  font-size: 14px;
}
.client-invite input:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.client-invite .btn-primary {
  /* Override the global .btn-primary { width: 100% } so the invite
     button is just wide enough for its label, leaving the input to
     own the horizontal space. */
  width: auto !important;
  flex: 0 0 auto;
  padding: 10px 18px;
  white-space: nowrap;
}
.client-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.client-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.client-row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.client-email {
  font-family: ui-monospace, "DM Mono", monospace;
  font-size: 13px;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.client-meta {
  font-size: 11px;
  color: #94a3b8;
}
.client-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.btn-sm {
  padding: 4px 10px !important;
  font-size: 12px !important;
}
.client-backup-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed #e2e8f0;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
}
.client-backup-toggle input { margin: 0; cursor: pointer; }

/* ── Sidebar legal-link strip ─────────────────────────────────────────── */
.sidebar-legal {
  padding: 0 16px 8px;
  font-size: 11px;
  color: #94a3b8;
  display: flex;
  gap: 6px;
  align-items: center;
}
.sidebar-legal a {
  color: #94a3b8;
  text-decoration: none;
}
.sidebar-legal a:hover { color: #475569; text-decoration: underline; }

/* ── Settings (GDPR) cards ────────────────────────────────────────────── */
.settings-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 24px 22px;
  margin-bottom: 16px;
}
.settings-card h2 {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: 600;
}
.settings-card .subtitle { margin: 0 0 16px; }
.settings-danger {
  border-color: #fecaca;
  background: #fef2f2;
}
.settings-danger h2 { color: #991b1b; }

/* ── Cookie consent banner ────────────────────────────────────────────── */
#cookie-banner {
  position: fixed;
  inset: auto 16px 16px 16px;
  z-index: 9999;
  display: flex;
  justify-content: center;
  pointer-events: none;
}
#cookie-banner[hidden] { display: none; }
.cookie-banner-card {
  pointer-events: auto;
  max-width: 540px;
  background: #0f172a;
  color: #fff;
  border-radius: 14px;
  padding: 18px 22px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, .35);
  font-size: 13px;
  line-height: 1.55;
}
.cookie-banner-card strong { font-size: 14px; }
.cookie-banner-card p { margin: 8px 0 14px; color: #cbd5e1; }
.cookie-banner-card code {
  background: rgba(255, 255, 255, .1);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
}
.cookie-banner-card a { color: #a5b4fc; text-decoration: underline; }
.cookie-banner-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}
.cookie-banner-actions .btn-secondary {
  background: transparent;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, .15);
}
.cookie-banner-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, .08);
  color: #fff;
}

/* ── Welcome banner (Free user, sites screen) ───────────────────────── */

.welcome-banner {
  display: flex;
  gap: 16px;
  align-items: center;
  background: linear-gradient(135deg, #eef2ff 0%, #f5f3ff 100%);
  border: 1px solid #c7d2fe;
  border-radius: 14px;
  padding: 18px 22px;
  margin-bottom: 20px;
}
/* `display: flex` above wins over the browser's default `[hidden]` rule
   (same specificity, mine declared later), which is why the Hide button
   appeared to do nothing — the attribute was set but the banner stayed
   visible. Force-hide on the attribute beats the flex declaration. */
.welcome-banner[hidden] { display: none !important; }
.welcome-icon { font-size: 32px; flex-shrink: 0; }
.welcome-text h3 { margin: 0 0 4px; font-size: 16px; font-weight: 700; }
.welcome-text p  { margin: 0; color: var(--text-soft, var(--muted)); font-size: 14px; }
.welcome-actions { margin-left: auto; display: flex; gap: 8px; flex-shrink: 0; }
@media (max-width: 720px) {
  .welcome-banner { flex-direction: column; align-items: flex-start; }
  .welcome-actions { margin-left: 0; }
}

/* ── Guide section ──────────────────────────────────────────────────── */

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}
@media (max-width: 880px) { .guide-grid { grid-template-columns: 1fr; } }

.guide-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 24px 22px 22px;
  box-shadow: var(--shadow-sm, 0 1px 2px rgba(15,23,42,.04));
}
.guide-card h3 {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.005em;
}
.guide-card p,
.guide-card .guide-list {
  margin: 0 0 10px;
  color: var(--text-soft, var(--text));
  font-size: 14px;
  line-height: 1.55;
}
.guide-card p.muted {
  color: var(--muted);
  font-size: 13px;
  margin-top: 6px;
}
.guide-card .guide-list {
  padding-left: 18px;
  display: grid;
  gap: 4px;
}
.guide-card .guide-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 4px;
  font-size: 12.5px;
  line-height: 1.4;
}
.guide-card .guide-table th,
.guide-card .guide-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.guide-card .guide-table thead th {
  font-weight: 600;
  color: var(--text);
  background: var(--bg);
  font-size: 12px;
  letter-spacing: .01em;
}
.guide-card .guide-table tbody th {
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.guide-card .guide-table tbody td { color: var(--text); }
.guide-card .guide-table tr:last-child th,
.guide-card .guide-table tr:last-child td { border-bottom: 0; }
.guide-card kbd {
  display: inline-block;
  padding: 1px 6px;
  font: 600 12px/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bg);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--text);
  white-space: nowrap;
}
.guide-card code {
  font: 12px/1.4 ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--primary-deep);
}
.guide-num {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 12px rgba(99,102,241,.28);
}

/* ── Inline mockups inside guide cards ──────────────────────────────── */

.guide-visual {
  margin-top: 14px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.mock-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  font-size: 12px;
  display: grid;
  gap: 8px;
}
.mock-card .mock-h { font-weight: 700; font-size: 13px; }
.mock-card .mock-input {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--muted);
  font-family: inherit;
}
.mock-card .mock-row {
  display: flex; align-items: center; justify-content: space-between;
}
.mock-btn {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: .01em;
}
.mock-btn.ghost   { background: var(--bg); color: var(--muted); border: 1px solid var(--border); }
.mock-btn.primary { background: var(--primary); color: #fff; }
.mock-btn-row { display: flex; gap: 6px; justify-content: flex-end; }
.mock-snippet {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10.5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  color: var(--text);
  line-height: 1.5;
  position: relative;
  word-break: break-all;
}
.mock-copy {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: inherit;
  font-size: 10px;
  font-weight: 600;
}

/* Mock browser */
.mock-browser {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.mock-browser .mock-bar {
  display: flex; gap: 5px;
  padding: 8px 10px;
  background: var(--surface-alt, var(--bg));
  border-bottom: 1px solid var(--border);
}
.mock-browser .mock-bar span {
  width: 9px; height: 9px; border-radius: 50%; background: #e2e8f0;
}
.mock-browser .mock-bar span:nth-child(1) { background: #fb7185; }
.mock-browser .mock-bar span:nth-child(2) { background: #fbbf24; }
.mock-browser .mock-bar span:nth-child(3) { background: #34d399; }
.mock-browser .mock-content { padding: 14px; display: grid; gap: 10px; }
.mock-h-frame {
  position: relative;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  outline: 1.5px dashed rgba(13, 155, 106, .55);
  outline-offset: 4px;
  padding: 4px 6px;
  border-radius: 3px;
}
.mock-h-frame em { color: #0D9B6A; font-style: italic; }
.mock-h-frame.is-active {
  outline: 2px solid #E08A2E;
  background: rgba(224, 138, 46, .08);
}
.mock-h-frame .caret {
  display: inline-block;
  width: 1px; height: 14px;
  background: var(--text);
  margin-left: 2px;
  vertical-align: middle;
  animation: blink 1s steps(2, end) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.mock-img-frame {
  height: 60px;
  border-radius: 6px;
  background: linear-gradient(135deg, #c7d2fe, #a78bfa);
  outline: 1.5px dashed rgba(13, 155, 106, .55);
  outline-offset: 4px;
}
.mock-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #0f172a;
  color: #fff;
  font-size: 11px;
  font-weight: 600;
}
.mock-panel .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #0D9B6A;
  box-shadow: 0 0 8px #0D9B6A;
}
.mock-panel .ghost { color: #94a3b8; font-weight: 500; margin-left: auto; }

.dirty-pill {
  display: inline-block;
  background: rgba(224, 138, 46, .15);
  color: #b45309;
  padding: 1px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
}

/* ── Pause card animation ───────────────────────────────────────────── */

.pause-anim {
  position: relative;
  height: 130px;
}
.pause-state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  /* CSS-only fade between Active and Paused. Each state runs its own
     animation with `infinite alternate` — when one fades out the other
     fades in, no JS or extra timing needed. */
}
.pause-state--active {
  animation: pause-fade 6s ease-in-out infinite alternate;
}
.pause-state--paused {
  animation: pause-fade 6s ease-in-out infinite alternate-reverse;
}
@keyframes pause-fade {
  0%, 30%   { opacity: 1; }
  70%, 100% { opacity: 0; }
}

.pause-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.pause-lang {
  position: relative;
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  outline: 1.5px dashed rgba(13, 155, 106, .55);
  outline-offset: 3px;
}
.pause-row.paused .pause-lang {
  outline-color: rgba(108, 117, 125, .35);
}
.pause-lang.current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.pause-cursor {
  position: absolute;
  right: -6px;
  bottom: -10px;
  font-size: 14px;
  /* hand cursor pointing at UA — bouncing animation */
  animation: pause-tap 6s ease-in-out infinite;
}
@keyframes pause-tap {
  0%, 20%   { transform: translate(0, 0) scale(1); opacity: 0.85; }
  35%, 50%  { transform: translate(2px, -3px) scale(1.15); opacity: 1; }
  65%, 100% { transform: translate(0, 0) scale(1); opacity: 0.85; }
}

.pause-msg {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.pause-msg.success { color: var(--success, #10b981); }

.pause-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #0f172a;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
}
.pause-panel.paused {
  background: #334155;
}
.pause-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #0D9B6A;
  box-shadow: 0 0 6px #0D9B6A;
}
.pause-dot.grey {
  background: #94a3b8;
  box-shadow: none;
}
.pause-pill {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}
.pause-pill.primary {
  background: var(--primary);
  color: #fff;
}

/* "Coming soon" placeholder */

.placeholder {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
}
.placeholder h2 { color: var(--text); margin: 0 0 8px; }
.placeholder .icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--primary-l);
  margin: 0 auto 16px;
  display: grid; place-items: center;
  color: var(--primary);
  font-size: 22px;
}

/* ── ✨ AI Site Builder modal ───────────────────────────────────────────── */
.modal.ai-builder { position: relative; max-width: 640px; }
.ai-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; cursor: pointer;
  font-size: 24px; line-height: 1; color: var(--muted);
}
.ai-close:hover { color: var(--text); }

/* Upgrade gate */
#ai-gate { text-align: center; padding: 12px 8px 4px; }
.ai-gate-icon { font-size: 40px; margin-bottom: 8px; }
.ai-gate-box {
  margin-top: 18px; padding: 20px;
  background: var(--primary-l);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.ai-gate-box p { margin: 0 0 14px; color: var(--text); }

/* Stepper */
.ai-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 6px; margin: 4px 0 22px;
}
.ai-step-dot {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg); border: 1px solid var(--border);
  color: var(--muted); font-size: 13px; font-weight: 600;
  transition: all .15s;
}
.ai-step-dot.is-active {
  background: var(--primary); border-color: var(--primary); color: #fff;
}
.ai-step-line { width: 36px; height: 2px; background: var(--border); }

.ai-counter { float: right; color: var(--muted); font-weight: 400; font-size: 12px; }
.ai-engine-hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); line-height: 1.4; }

/* AI credit pill — sidebar (dashboard) + editor toolbar use the same shape */
.credits-pill {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 8px 0; padding: 6px 12px;
  background: var(--primary-l); color: var(--primary);
  border: 1px solid transparent; border-radius: 999px;
  font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: background .12s, border-color .12s;
  width: 100%; justify-content: center;
}
.credits-pill:hover { background: #dbe5ff; border-color: var(--primary); }
.credits-pill .credits-icon { font-size: 13px; }
.credits-pill .credits-amount { font-variant-numeric: tabular-nums; }
.credits-pill .credits-label { color: var(--muted); font-weight: 500; font-size: 12px; }
.credits-pill.credits-low {
  background: #fef3c7; color: #b45309; border-color: #fbbf24;
}
.credits-pill.credits-low .credits-label { color: #92400e; }
.credits-pill.credits-empty {
  background: #fee2e2; color: #b91c1c; border-color: #f87171;
}
.credits-pill.credits-empty .credits-label { color: #991b1b; }
.ai-builder select,
.ai-builder textarea {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 8px; font: inherit; outline: none; background: var(--surface);
}
.ai-builder textarea { resize: vertical; }
.ai-builder select:focus,
.ai-builder textarea:focus { border-color: var(--primary); }

/* Colour-scheme swatches */
.ai-scheme { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.ai-swatch {
  position: relative; cursor: pointer; text-align: center;
  border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 6px; transition: border-color .12s, box-shadow .12s;
}
.ai-swatch input { position: absolute; opacity: 0; pointer-events: none; }
.ai-swatch-pv {
  display: block; height: 40px; border-radius: 7px; margin-bottom: 6px;
  border: 1px solid rgba(0,0,0,.06);
}
.ai-swatch-lbl { font-size: 12px; font-weight: 600; color: var(--muted); }
.ai-swatch--dark  .ai-swatch-pv { background: linear-gradient(135deg,#0f172a,#334155); }
.ai-swatch--light .ai-swatch-pv { background: linear-gradient(135deg,#ffffff,#e2e8f0); }
.ai-swatch--warm  .ai-swatch-pv { background: linear-gradient(135deg,#fef3c7,#f97316); }
.ai-swatch--cool  .ai-swatch-pv { background: linear-gradient(135deg,#cffafe,#0ea5e9); }
.ai-swatch:has(input:checked) {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-l);
}
.ai-swatch:has(input:checked) .ai-swatch-lbl { color: var(--primary); }

/* Cost box */
.ai-cost-box {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 8px;
}
.ai-cost-row { display: flex; justify-content: space-between; padding: 4px 0; }
.ai-cost-row.ai-cost-muted { color: var(--muted); font-size: 13px; }

/* Generating + result */
.ai-generating { text-align: center; padding: 28px 8px; }
.ai-spinner {
  width: 40px; height: 40px; margin: 0 auto 16px;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: ai-spin .8s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

.ai-preview-frame {
  width: 100%; height: 320px; border: 1px solid var(--border);
  border-radius: var(--radius); background: #fff; margin: 10px 0 14px;
  animation: ai-fade-in .5s ease;
}
@keyframes ai-fade-in { from { opacity: .5; } to { opacity: 1; } }
.ai-host-box {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 6px;
}
.ai-result-actions { flex-wrap: wrap; }
@media (max-width: 560px) {
  .ai-scheme { grid-template-columns: repeat(2, 1fr); }
}

/* =================================================================
   DIRECTION B — Site Health (dashboard shell)
   Appended last so it wins specificity ties against legacy styles.
   ================================================================= */

/* ---- Shell ---- */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

/* ============== SIDEBAR (dark) ============== */
.sidebar {
  position: sticky; top: 0; height: 100vh;
  background: var(--d-bg);
  border-right: 1px solid var(--d-line);
  display: flex; flex-direction: column;
  padding: 18px 14px;
  color: var(--d-mut);
}
.sidebar .brand-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.sidebar .brand-mark {
  width: 34px; height: 34px; border-radius: 10px; background: var(--ai-grad);
  display: grid; place-items: center;
  box-shadow: 0 6px 18px -6px rgba(108,71,255,.8);
}
.sidebar .brand-mark svg { width: 19px; height: 19px; }
.sidebar .brand-mark img { width: 22px; height: 22px; filter: brightness(0) invert(1); }
.sidebar .wm {
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  letter-spacing: -.02em; color: #fff;
}
.sidebar .wm b { color: #b69bff; font-weight: 700; }

/* Hide the legacy logo (replaced by .brand-row) */
.sidebar > .logo { display: none; }

.sidebar .navlabel {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: #615b78;
  padding: 14px 10px 6px;
}
.sidebar .nav { display: flex; flex-direction: column; gap: 2px; flex: 0 0 auto; }
.sidebar .nav-item {
  display: flex; align-items: center; gap: 11px;
  height: 38px; padding: 0 11px; border-radius: 9px;
  color: var(--d-mut); font-size: 13.5px; font-weight: 600;
  text-decoration: none; cursor: pointer;
  transition: background .12s, color .12s;
}
.sidebar .nav-item .nav-icon { width: 18px; height: 18px; opacity: .9; flex: none; color: currentColor; }
.sidebar .nav-item:hover { background: var(--d-surf); color: #fff; }
.sidebar .nav-item:hover .nav-icon { opacity: 1; }
.sidebar .nav-item.active {
  background: linear-gradient(100deg, rgba(108,71,255,.28), rgba(108,71,255,.12));
  color: #fff; box-shadow: inset 0 0 0 1px rgba(140,108,255,.35);
}
.sidebar .nav-item.active .nav-icon { color: #b69bff; opacity: 1; }
.sidebar .nav-item.disabled { cursor: not-allowed; opacity: .55; }
.sidebar .nav-item.disabled:hover { background: transparent; color: var(--d-mut); }
.sidebar .nav-item.disabled:hover .nav-icon { opacity: .9; }
.sidebar .nav-item .badge {
  margin-left: auto;
  font: 700 9.5px/1 var(--font-ui);
  letter-spacing: .08em;
  color: #615b78; background: #211d30;
  padding: 3px 6px; border-radius: 5px;
  text-transform: uppercase;
}

.sidebar .spacer { flex: 1; }

/* ---- Plan card ---- */
.sidebar .plan-card {
  margin: 8px 6px 0; padding: 13px;
  border-radius: 13px; background: var(--d-surf);
  border: 1px solid var(--d-line);
}
.sidebar .plan-card .row { display: flex; align-items: center; justify-content: space-between; }
.sidebar .plan-card .tier { font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #fff; }
.sidebar .plan-card .badge {
  font-size: 9.5px; font-weight: 800; letter-spacing: .07em;
  padding: 2px 7px; border-radius: 6px;
  color: #f0c98a; background: rgba(207,122,18,.18);
  border: 1px solid rgba(207,122,18,.35);
}
.sidebar .plan-card .badge--free { color: #b69bff; background: rgba(108,71,255,.18); border-color: rgba(108,71,255,.35); }
.sidebar .plan-card .badge--personal { color: #93c5fd; background: rgba(59,130,246,.18); border-color: rgba(59,130,246,.35); }
.sidebar .plan-card .badge--smartai { color: #f0c98a; background: rgba(207,122,18,.18); border-color: rgba(207,122,18,.35); }
.sidebar .plan-card .badge--agency { color: #86efac; background: rgba(21,163,90,.18); border-color: rgba(21,163,90,.35); }
.sidebar .plan-card .credits { font-size: 11.5px; color: var(--d-mut); margin: 9px 0 7px; }
.sidebar .plan-card .credits b { color: #ece9f6; font-weight: 700; font-variant-numeric: tabular-nums; }
.sidebar .plan-card .meter { height: 6px; border-radius: 999px; background: #2a2640; overflow: hidden; }
.sidebar .plan-card .meter > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); transition: width .25s; }
.sidebar .plan-card .upgrade-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; height: 34px; border-radius: 9px; margin-top: 11px;
  background: var(--ai-grad); color: #fff;
  font: 700 12.5px/1 var(--font-ui); text-decoration: none;
  border: 0; cursor: pointer;
}
.sidebar .plan-card .upgrade-btn:hover { filter: brightness(1.05); }
.sidebar .plan-card .upgrade-btn svg { width: 14px; height: 14px; }

/* ---- Account row ---- */
.sidebar .acct {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 8px 2px; margin-top: 6px;
}
.sidebar .acct .avatar-init {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 11px/1 var(--font-display);
  background: #2b2640; color: #c9b8ff;
  flex: none;
}
.sidebar .acct .who {
  font-size: 12.5px; font-weight: 600; color: #ece9f6; line-height: 1.2;
  min-width: 0; overflow: hidden; flex: 1;
}
.sidebar .acct .who span {
  display: block; font-size: 11px; font-weight: 500; color: var(--d-mut);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar .acct .logout {
  margin-left: auto; color: var(--d-mut); cursor: pointer;
  background: none; border: 0; padding: 4px; border-radius: 6px;
  display: grid; place-items: center;
}
.sidebar .acct .logout:hover { color: #ff9aa9; background: rgba(255,154,169,.08); }
.sidebar .acct .logout svg { width: 17px; height: 17px; }

.sidebar-legal {
  display: flex; gap: 8px; justify-content: flex-start;
  padding: 10px 8px 4px; font-size: 11px; color: var(--d-mut);
}
.sidebar-legal a { color: var(--d-mut); text-decoration: none; }
.sidebar-legal a:hover { color: #fff; }
.sidebar-legal span { color: #3a3650; }

/* Hide the legacy sidebar-footer block (replaced by plan-card + acct) */
.sidebar .sidebar-footer { display: none; }

/* ============== MAIN ============== */
.main { padding: 30px 40px 64px; }
.wrap { max-width: 1060px; margin: 0 auto; }

/* ---- Page header (greeting + actions) ---- */
.pagehead {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 20px; margin-bottom: 6px; flex-wrap: wrap;
}
.pagehead h1 {
  font-family: var(--font-display); font-weight: 700; font-size: 27px;
  letter-spacing: -.025em; margin: 0; color: var(--ink-900);
}
.pagehead p { margin: 5px 0 0; color: var(--ink-500); font-size: 14px; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

/* ---- Credits chip (page header) ---- */
.credits-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 6px 0 13px;
  border-radius: 10px;
  border: 1px solid var(--brand-tint-2); background: var(--brand-tint);
  text-decoration: none; box-shadow: var(--sh-sm);
  cursor: pointer; font: inherit; color: var(--brand-ink);
}
.credits-chip:hover { border-color: var(--brand); }
.credits-chip svg { width: 15px; height: 15px; color: var(--brand); flex: none; }
.credits-chip .cc-label { font-size: 11px; font-weight: 600; letter-spacing: .03em; color: var(--brand); opacity: .55; }
.credits-chip .cc-val   { font-family: var(--font-display); font-weight: 700; font-size: 14px; color: var(--brand-ink); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.credits-chip .cc-of    { font-size: 12px; font-weight: 600; color: var(--brand); opacity: .7; font-variant-numeric: tabular-nums; }
.credits-chip .cc-div   { width: 1px; height: 18px; background: var(--brand-tint-2); }
.credits-chip .cc-add   {
  display: inline-flex; align-items: center; height: 26px; padding: 0 11px;
  border-radius: 7px; white-space: nowrap;
  background: var(--white); color: var(--brand);
  font-size: 12px; font-weight: 700;
  border: 1px solid var(--brand-tint-2);
}
.credits-chip:hover .cc-add { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---- Page-header buttons (overrides legacy btn-secondary spacing) ---- */
.pagehead .btn-secondary,
.pagehead .btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm);
  font: 600 13.5px/1 var(--font-ui);
  border: 1px solid transparent; cursor: pointer;
}
.pagehead .btn-secondary {
  background: var(--white); color: var(--ink-700);
  border-color: var(--ink-200); box-shadow: var(--sh-sm);
}
.pagehead .btn-secondary:hover { border-color: var(--ink-300); background: var(--ink-50); }
.pagehead .btn-primary {
  background: var(--ai-grad); color: #fff; border: 0;
  box-shadow: 0 4px 14px -4px rgba(108,71,255,.55), inset 0 1px 0 rgba(255,255,255,.22);
}
.pagehead .btn-primary:hover { filter: brightness(1.05); }

/* ---- Section label (h2 + segmented control) ---- */
.sectlabel { display: flex; align-items: center; justify-content: space-between; margin: 26px 0 14px; }
.sectlabel h2 { font-family: var(--font-display); font-weight: 700; font-size: 16px; margin: 0; color: var(--ink-800); }
.seg { display: flex; background: var(--ink-100); padding: 3px; border-radius: 9px; }
.seg button {
  height: 30px; padding: 0 13px; border: none; background: none; border-radius: 6px;
  font: 600 12.5px/1 var(--font-ui); color: var(--ink-500); cursor: pointer;
}
.seg button.on { background: var(--white); color: var(--ink-900); box-shadow: var(--sh-sm); }

/* ============== SITE HEALTH CARD ============== */
.site-card {
  display: flex; background: var(--white);
  border: 1px solid var(--ink-200); border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  margin-bottom: 15px; overflow: hidden;
}
.site-card .rail { width: 5px; flex: none; }
.site-card .rail-live { background: var(--live); }
.site-card .rail-hold { background: var(--hold); }
.site-card .rail-rest { background: var(--rest); }
.site-card .cbody { flex: 1; min-width: 0; padding: 19px 22px; }
.site-card .crow { display: flex; align-items: flex-start; gap: 20px; }
.site-card .ident { min-width: 0; flex: 1; }
.site-card .titlerow { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.site-card .titlerow h3 {
  font-family: var(--font-display); font-weight: 700; font-size: 18px;
  margin: 0; color: var(--ink-900); letter-spacing: -.01em;
}
.site-card .siteurl {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 5px;
  color: var(--ink-500); font-size: 13px; text-decoration: none;
}
.site-card .siteurl:hover { color: var(--brand); }
.site-card .siteurl svg { width: 13px; height: 13px; }
.site-card .meta {
  font-size: 11.5px; color: var(--ink-400); margin-top: 4px;
  font-family: var(--font-mono);
}
.site-card .meta code {
  font-family: var(--font-mono); font-size: 11px;
  background: var(--ink-100); padding: 1px 6px; border-radius: 4px;
}
.site-card .primarycol { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }

/* ---- Status pill ---- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px 0 8px;
  border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; letter-spacing: .01em;
  border: 1px solid transparent;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.pill-live { background: var(--live-bg); color: #0d7a3f; border-color: var(--live-ring); }
.pill-live .dot { background: var(--live); box-shadow: 0 0 0 3px rgba(21,163,90,.18); }
.pill-hold { background: var(--hold-bg); color: #9a5a06; border-color: var(--hold-ring); }
.pill-hold .dot { background: var(--hold); }
.pill-rest { background: var(--rest-bg); color: #4a5066; border-color: var(--rest-ring); }
.pill-rest .dot { background: var(--rest); }

/* ---- Chip (demo / archived / read-only tag) ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 24px; padding: 0 10px;
  border-radius: var(--r-pill);
  background: var(--ink-100); color: var(--ink-600);
  font-size: 11.5px; font-weight: 500;
}

/* ---- Health strip (4 cells) ---- */
.site-card .health {
  display: grid; grid-template-columns: 1.1fr 1fr 1.2fr 1.4fr; gap: 0;
  margin-top: 17px;
  border: 1px solid var(--ink-150); border-radius: var(--r-md);
  background: var(--ink-50); overflow: hidden;
}
.site-card .health .cell { padding: 12px 16px; border-right: 1px solid var(--ink-150); min-width: 0; }
.site-card .health .cell:last-child { border-right: none; }
.site-card .health .label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--ink-400); margin-bottom: 5px;
}
.site-card .health .big {
  font-family: var(--font-display); font-weight: 700; font-size: 20px;
  color: var(--ink-900); line-height: 1; letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.site-card .health .big small {
  font-family: var(--font-ui); font-size: 12px; font-weight: 600; color: var(--ink-400);
}
.site-card .health .sub { font-size: 11.5px; color: var(--ink-400); margin-top: 4px; }
.site-card .health .mid { font-size: 14px; font-weight: 700; color: var(--ink-800); }
.site-card .editmeter { margin-top: 8px; height: 6px; border-radius: 999px; background: var(--ink-150); overflow: hidden; }
.site-card .editmeter > i { display: block; height: 100%; border-radius: 999px; background: var(--brand); }
.site-card .clientcell { display: flex; align-items: center; gap: 9px; margin-top: 1px; }
.site-card .clientcell .avatar-init {
  width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  font: 700 10px/1 var(--font-display); color: #fff;
  flex: none;
}
.site-card .clientcell .nm { font-size: 13px; font-weight: 600; color: var(--ink-800); line-height: 1.15; min-width: 0; overflow: hidden; }
.site-card .clientcell .nm span { display: block; font-size: 11px; font-weight: 500; color: var(--ink-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-card .invite-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 8px; margin-top: 2px;
  border: 1px dashed var(--ink-300); color: var(--ink-500);
  font-size: 12px; font-weight: 600; cursor: pointer; background: none;
  white-space: nowrap;
}
.site-card .invite-btn:hover { border-color: var(--brand); color: var(--brand); }
.site-card .invite-btn svg { width: 13px; height: 13px; flex: none; }

/* ---- Actions row ---- */
.site-card .actions {
  display: flex; align-items: center; gap: 9px; margin-top: 16px; flex-wrap: wrap;
}
.site-card .actions .grow { flex: 1; }
.site-card .actions .b-soft {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--r-xs);
  background: var(--ink-100); color: var(--ink-700);
  font: 600 12.5px/1 var(--font-ui); border: 0; cursor: pointer;
}
.site-card .actions .b-soft:hover { background: var(--ink-150); }
.site-card .actions .b-danger {
  display: inline-flex; align-items: center; height: 32px; padding: 0 12px;
  border-radius: var(--r-xs); background: var(--danger-bg); color: var(--danger-color);
  font: 600 12.5px/1 var(--font-ui); border: 0; cursor: pointer;
}
.site-card .actions .b-danger:hover { background: #fbd6dd; }
.badge-n {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px;
  padding: 0 5px; border-radius: 6px;
  background: var(--brand-tint-2); color: var(--brand-ink);
  font: 700 10.5px/1 var(--font-ui); margin-left: 4px;
}

/* Primary "Open editor" button */
.site-card .primarycol .btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm);
  font: 600 13.5px/1 var(--font-ui);
  background: var(--brand); color: #fff; border: 0; cursor: pointer;
  box-shadow: 0 1px 2px rgba(76,45,196,.4), inset 0 1px 0 rgba(255,255,255,.18);
  text-decoration: none; white-space: nowrap;
}
.site-card .primarycol .btn-primary:hover { background: var(--brand-600); }
.site-card .primarycol .btn-warm {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 15px; border-radius: var(--r-sm);
  font: 600 13.5px/1 var(--font-ui);
  background: var(--hold); color: #fff; border: 0; cursor: pointer;
  white-space: nowrap;
}
.site-card .primarycol .btn-warm:hover { filter: brightness(1.05); }
.site-card .primarycol button svg { width: 16px; height: 16px; flex: none; }

/* Empty state */
.empty {
  background: var(--white); border: 1px dashed var(--ink-200);
  border-radius: var(--r-lg); padding: 60px 20px; text-align: center;
  color: var(--ink-500);
}
.empty h2 { font-family: var(--font-display); font-weight: 700; color: var(--ink-800); margin: 0 0 8px; }

/* Hide the old toolbar credits-pill (replaced by .credits-chip in pagehead) */
.sidebar-footer .credits-pill { display: none; }

/* Sub-panels inside .site-card (snippet, API, clients) — keep working with
   their existing classes but tighten spacing to match the new card. */
.site-card .snippet,
.site-card .api-panel,
.site-card .client-logins {
  margin-top: 14px;
  border-top: 1px solid var(--ink-150);
  padding-top: 14px;
}
.site-card .snippet code {
  background: var(--ink-100); padding: 8px 10px; border-radius: 8px;
  font: 12px/1.4 var(--font-mono); display: block; overflow-x: auto; margin-bottom: 8px;
  color: var(--ink-800);
}
.site-card .snippet button { font-size: 12px; padding: 6px 12px; }

/* Soft "show archived" toggle in section header */
.archive-toggle-soft {
  display: inline-flex; align-items: center;
  height: 30px; padding: 0 13px; border-radius: 6px;
  background: var(--ink-100); color: var(--ink-500);
  font: 600 12.5px/1 var(--font-ui); border: 0; cursor: pointer;
}
.archive-toggle-soft:hover { background: var(--ink-150); }

/* ---- Site ID copy icon (top of card, next to "Site ID:") ---- */
.site-card .meta { display: inline-flex; align-items: center; gap: 6px; }
.site-card .siteid-copy {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px; border-radius: 6px;
  border: 1px solid var(--ink-200); background: var(--white);
  color: var(--ink-500); cursor: pointer; padding: 0;
}
.site-card .siteid-copy:hover { color: var(--brand); border-color: var(--brand); }
.site-card .siteid-copy svg { width: 13px; height: 13px; }

/* ---- Active-state for the Connect action button ---- */
.site-card .actions .b-soft.active {
  background: var(--brand-tint); color: var(--brand-ink);
  box-shadow: inset 0 0 0 1px var(--brand);
}

/* ============== CONNECT & DELIVER panel (tabbed) ============== */
.connect-panel {
  margin: 16px -22px -19px;
  border-top: 1px solid var(--ink-150);
  background: var(--ink-50);
  padding: 16px 22px 20px;
}
.connect-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.connect-head .ttl {
  display: flex; align-items: center; gap: 9px;
  font-size: 13.5px; font-weight: 700; color: var(--ink-900);
}
.connect-head .ttl svg { width: 16px; height: 16px; color: var(--brand); }
.connect-head .x {
  display: grid; place-items: center; width: 28px; height: 28px;
  border-radius: 7px; border: 0; background: transparent;
  color: var(--ink-400); cursor: pointer;
}
.connect-head .x:hover { background: var(--ink-150); color: var(--ink-800); }
.connect-head .x svg { width: 16px; height: 16px; }

.connect-tabs { display: flex; gap: 4px; background: var(--ink-100); padding: 4px; border-radius: var(--r-sm); }
.connect-tab {
  flex: 1; height: 32px; border: none; background: transparent; cursor: pointer;
  font: 600 12.5px/1 var(--font-ui); color: var(--ink-500);
  border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.connect-tab.on { background: var(--white); color: var(--brand); box-shadow: var(--sh-sm); }

.connect-pane { margin-top: 15px; display: flex; flex-direction: column; gap: 11px; }
.connect-pane[hidden] { display: none; }
.connect-lbl { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-400); }
.connect-hint { font-size: 12.5px; color: var(--ink-500); line-height: 1.5; margin: 0; }

/* mono field with inline copy icon */
.connect-field {
  display: flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 8px 8px 8px 12px;
  background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-sm);
}
.connect-field .val {
  flex: 1; font-family: var(--font-mono); font-size: 12.5px; color: var(--ink-700);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.connect-field .copy {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 11px; border-radius: var(--r-xs);
  background: var(--white); border: 1px solid var(--ink-200);
  font: 600 12px/1 var(--font-ui); color: var(--ink-600); cursor: pointer; flex: none;
}
.connect-field .copy:hover { color: var(--brand); border-color: var(--brand); }
.connect-field .copy svg { width: 14px; height: 14px; }

/* AI install prompt — multi-line copyable box */
.connect-prompt {
  position: relative;
  background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-sm);
  padding: 12px 14px; padding-right: 84px;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.6; color: var(--ink-700);
  white-space: pre-wrap; word-break: break-word;
}
.connect-prompt .copy {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 11px; border-radius: var(--r-xs);
  background: var(--brand); color: #fff; border: 0;
  font: 700 12px/1 var(--font-ui); cursor: pointer; white-space: nowrap;
}
.connect-prompt .copy:hover { background: var(--brand-600); }
.connect-prompt .copy svg { width: 14px; height: 14px; flex: none; }

/* dark code block (fetch / curl) */
.connect-code {
  position: relative;
  background: #17141f; color: #d9d3ea;
  border-radius: var(--r-sm); padding: 13px 15px; padding-right: 64px;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.7;
  overflow-x: auto; white-space: pre;
}
.connect-code .copy {
  position: absolute; top: 10px; right: 10px;
  display: inline-flex; align-items: center;
  height: 26px; padding: 0 10px; border-radius: 6px; cursor: pointer;
  background: rgba(255,255,255,.08); color: #c9c3df; border: 1px solid rgba(255,255,255,.1);
  font: 700 11px/1 var(--font-ui);
}
.connect-code .copy:hover { background: rgba(255,255,255,.16); }

/* webhooks — proper input + Add layout */
.connect-hook-row { display: flex; gap: 8px; }
.connect-hook-input {
  flex: 1; height: 40px; padding: 0 12px;
  border: 1px solid var(--ink-200); border-radius: var(--r-sm);
  font: 13px var(--font-ui); color: var(--ink-800); background: var(--white); outline: none;
}
.connect-hook-input:focus { border-color: var(--brand); }
.connect-hook-add {
  flex: none; height: 40px; padding: 0 18px; border-radius: var(--r-sm);
  background: var(--brand); color: #fff; border: 0;
  font: 700 13px/1 var(--font-ui); cursor: pointer;
}
.connect-hook-add:hover { background: var(--brand-600); }
.connect-hooks { display: flex; flex-direction: column; gap: 7px; }
.connect-hook {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--white); border: 1px solid var(--ink-200); border-radius: var(--r-xs);
  padding: 8px 8px 8px 12px;
}
.connect-hook-url { font-family: var(--font-mono); font-size: 12px; color: var(--ink-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.connect-hook-del {
  flex: none; height: 28px; padding: 0 10px; border-radius: 6px;
  background: var(--danger-bg); color: var(--danger-color); border: 0;
  font: 600 12px/1 var(--font-ui); cursor: pointer;
}
.connect-empty { font-size: 12.5px; color: var(--ink-400); }

/* ---- Connected-client view inside the health "Client login" cell ---- */
.site-card .client-cell-slot { margin-top: 1px; }

/* ---- Kebab "⋮" overflow menu (holds Delete) ---- */
.card-menu-wrap { position: relative; flex: none; }
.site-card .actions .kebab {
  width: 32px; height: 32px; padding: 0;
  display: grid; place-items: center; border-radius: var(--r-xs);
  background: transparent; color: var(--ink-500); border: 0; cursor: pointer;
}
.site-card .actions .kebab:hover { background: var(--ink-100); color: var(--ink-800); }
.site-card .actions .kebab.open { background: var(--ink-150); color: var(--ink-900); }
.site-card .actions .kebab svg { width: 18px; height: 18px; }
.card-menu {
  position: absolute; right: 0; bottom: calc(100% + 6px);
  min-width: 168px; padding: 5px; z-index: 30;
  background: var(--white); border: 1px solid var(--ink-200);
  border-radius: var(--r-sm); box-shadow: var(--sh-lg);
}
.card-menu[hidden] { display: none; }
.card-menu .card-menu-item {
  display: flex; align-items: center; gap: 9px;
  width: 100%; height: 34px; padding: 0 11px;
  border: 0; background: transparent; border-radius: 7px;
  font: 600 13px/1 var(--font-ui); color: var(--ink-700);
  cursor: pointer; text-align: left;
}
.card-menu .card-menu-item:hover { background: var(--ink-100); }
.card-menu .card-menu-item svg { width: 15px; height: 15px; flex: none; }
.card-menu .card-menu-item.danger { color: var(--danger-color); }
.card-menu .card-menu-item.danger:hover { background: var(--danger-bg); }

/* Analytics health cells — "Top page" is a Pro feature; lower plans see a lock. */
.health .an-lock { font-weight: 700; color: #8b8fa3; font-size: 13px; }
.health .an-up {
  appearance: none; border: 0; cursor: pointer; padding: 2px 10px; border-radius: 999px;
  font: 700 11px inherit; color: #fff; background: linear-gradient(120deg, #5b6cff, #8b5cf6);
}
.health .an-up:hover { filter: brightness(1.08); }

/* AI builder — design style picker (tiles). */
.ai-style { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ai-style-tile {
  position: relative; display: flex; flex-direction: column; gap: 2px; cursor: pointer;
  border: 1.5px solid var(--ink-200, #e2e8f0); border-radius: 12px; padding: 12px 12px 10px;
  background: #fff; transition: border-color .12s, background .12s, box-shadow .12s;
}
.ai-style-tile:hover { border-color: #c7d2fe; background: #f8faff; }
.ai-style-tile input { position: absolute; opacity: 0; pointer-events: none; }
.ai-style-tile:has(input:checked) {
  border-color: #6366f1; background: #eef2ff; box-shadow: 0 0 0 2px rgba(99, 102, 241, .2);
}
.ai-style-em { font-size: 20px; line-height: 1; }
.ai-style-nm { font-weight: 700; font-size: 13px; }
.ai-style-d  { font-size: 11px; color: #64748b; line-height: 1.35; }
@media (max-width: 560px) { .ai-style { grid-template-columns: repeat(2, 1fr); } }

/* AI builder — template gallery */
.ai-gate-or { text-align: center; color: #94a3b8; font-size: 12px; margin: 14px 0 10px; }
.ai-tpl-link {
  display: inline-block; margin: 4px 0 12px; padding: 0; border: 0; background: none;
  color: #6366f1; font: 600 13px inherit; cursor: pointer;
}
.ai-tpl-link:hover { text-decoration: underline; }
.ai-tpl-back {
  border: 0; background: none; color: #64748b; cursor: pointer; font: 600 13px inherit;
  padding: 0; margin-bottom: 10px;
}
.ai-tpl-back:hover { color: #0f172a; }
.ai-tpl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px; margin-top: 12px; max-height: 62vh; overflow-y: auto; padding: 2px;
}
.ai-tpl-loading { grid-column: 1 / -1; text-align: center; color: #94a3b8; padding: 40px 0; }
.ai-tpl-card {
  border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; background: #fff;
  display: flex; flex-direction: column; transition: border-color .12s, box-shadow .12s;
}
.ai-tpl-card:hover { border-color: #c7d2fe; box-shadow: 0 8px 24px rgba(15, 23, 42, .08); }
.ai-tpl-frame-wrap {
  position: relative; height: 190px; overflow: hidden; background: #fff;
  border-bottom: 1px solid #eef2f6;
}
.ai-tpl-frame {
  position: absolute; top: 0; left: 0; width: 1280px; height: 760px; border: 0;
  transform: scale(.26); transform-origin: top left; pointer-events: none;
}
.ai-tpl-meta { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 4px; }
.ai-tpl-cat { font-size: 11px; font-weight: 700; color: #8b8fa3; text-transform: uppercase; letter-spacing: .04em; }
.ai-tpl-name { font-size: 16px; font-weight: 700; color: #0f172a; }
.ai-tpl-chips { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 10px; }
.ai-tpl-chip { font-size: 10.5px; color: #475569; background: #f1f5f9; border-radius: 999px; padding: 2px 8px; text-transform: capitalize; }
.ai-tpl-use { width: 100%; }
