/* ============================================================
   Quick Access Dashboard – Styles
   ============================================================ */

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #0f172a;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --success: #22c55e;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 8px;
  --sidebar-w: 240px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---------- Login ---------- */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 36px 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
}

.logo-icon.small {
  width: 28px;
  height: 28px;
  font-size: 13px;
  border-radius: 6px;
}

.logo h1 { font-size: 22px; font-weight: 600; }

.subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  margin-top: 14px;
}

input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
}

input:focus {
  outline: none;
  border-color: var(--primary);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
  margin-top: 20px;
}

.btn-primary:hover { background: var(--primary-hover); }
.btn-primary:disabled {
  background: #475569;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--border);
  color: var(--text);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

.btn-success {
  background: var(--success);
  color: #052e16;
}

.btn-success:hover { background: #16a34a; }

/* ---------- Alerts ---------- */
.alert {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.4;
}

.alert-error {
  background: #7f1d1d;
  color: #fca5a5;
}

.alert-success {
  background: #14532d;
  color: #86efac;
}

.alert-info {
  background: #1e3a5f;
  color: #93c5fd;
}

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

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}

.brand {
  font-weight: 600;
  font-size: 15px;
}

.nav {
  flex: 1;
  padding: 12px 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
  background: rgba(59, 130, 246, 0.1);
  color: var(--text);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
  font-weight: 600;
}

.nav-icon { font-size: 16px; }

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
}

.user-email {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  word-break: break-all;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 12px;
}

/* ---------- Main ---------- */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
}

.topbar h2 {
  font-size: 18px;
  font-weight: 600;
}

.ext-status {
  font-size: 12px;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-ok { background: #14532d; color: #86efac; }
.badge-warn { background: #78350f; color: #fcd34d; }
.badge-err { background: #7f1d1d; color: #fca5a5; }

.content {
  flex: 1;
  padding: 28px;
  overflow-y: auto;
}

/* ---------- Placeholder cards ---------- */
.placeholder {
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 48px 32px;
  text-align: center;
  color: var(--text-muted);
}

.placeholder h3 {
  color: var(--text);
  font-size: 16px;
  margin-bottom: 8px;
}

.placeholder p {
  font-size: 14px;
  line-height: 1.5;
  max-width: 420px;
  margin: 0 auto;
}

/* ---------- Sites grid (Task 3.2) ---------- */
.sites-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.sites-count {
  font-size: 13px;
  color: var(--text-muted);
}

.sites-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.site-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s;
}

.site-card:hover {
  border-color: var(--primary);
}

.site-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.site-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.site-meta {
  flex: 1;
}

.site-domain {
  font-size: 12px;
  color: var(--primary);
  font-weight: 500;
  margin-bottom: 4px;
}

.site-url {
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
  line-height: 1.4;
}

.btn-launch {
  width: 100%;
  margin-top: 4px;
}

.btn-launch:disabled {
  background: #475569;
  color: #94a3b8;
  cursor: not-allowed;
}

.launch-status {
  margin-top: 20px;
}

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  color: var(--text-muted);
  gap: 16px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Admin tables & forms (Task 3.3) ---------- */
.admin-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.admin-form {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.admin-form h3 {
  font-size: 15px;
  margin-bottom: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.form-group label {
  margin-top: 0;
}

.form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  font-size: 14px;
}

.form-actions {
  display: flex;
  gap: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: #162032;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: rgba(59, 130, 246, 0.05);
}

.mono {
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

.url-cell {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 12px;
}

.actions-cell {
  white-space: nowrap;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 11px;
  margin-right: 4px;
}

.tiny-muted {
  font-size: 11px;
  color: var(--text-muted);
}

.access-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 14px;
}

.access-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.access-item:hover {
  background: rgba(59, 130, 246, 0.08);
}

.access-item input {
  width: auto;
  margin: 0;
}

/* ---------- Utility ---------- */
[hidden] { display: none !important; }

@media (max-width: 700px) {
  .app { flex-direction: column; }
  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .nav { flex-direction: row; overflow-x: auto; }
}

/* ---- U-16: auth toggle + capability editor ---- */
.auth-toggle { text-align: center; margin-top: 14px; font-size: 13px; color: var(--muted, #8a94a6); }
.auth-toggle a { color: var(--primary, #3b82f6); text-decoration: none; }
.auth-toggle a:hover { text-decoration: underline; }

.cap-label { display: block; margin: 16px 0 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted, #8a94a6); }
.preset-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 6px; }
.cap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px 16px; }
.cap-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cap-item input[disabled] + span { opacity: .5; }
.cap-note { font-style: normal; font-size: 11px; color: var(--muted, #8a94a6); }

/* U-19 watchdog badges/alerts */
.badge-error { background: rgba(239,68,68,.15); color: #f87171; }
.alert-warn { background: rgba(234,179,8,.12); color: #eab308; border: 1px solid rgba(234,179,8,.3); padding: 10px 14px; border-radius: 8px; }

/* P4-T9 traffic-light + health badges */
.traffic-light {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}
.traffic-light.tl-green { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.traffic-light.tl-amber { background: rgba(245, 158, 11, 0.18); color: #fbbf24; }
.traffic-light.tl-red { background: rgba(239, 68, 68, 0.18); color: #f87171; }

.health-pill {
  display: inline-block;
  min-width: 2.5rem;
  text-align: center;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.health-hi { background: rgba(34, 197, 94, 0.15); color: #86efac; }
.health-mid { background: rgba(245, 158, 11, 0.15); color: #fcd34d; }
.health-lo { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

.exit-ip { font-size: 11px; opacity: 0.9; }
.badge-persist {
  background: rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}


/* P4-T1 remote noVNC modal */
.remote-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.remote-modal.open { display: block; }
.remote-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.65);
}
.remote-modal-panel {
  position: absolute;
  top: 4vh;
  left: 4vw;
  right: 4vw;
  bottom: 4vh;
  background: #0f172a;
  border-radius: 12px;
  border: 1px solid rgba(148,163,184,.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 20px 50px rgba(0,0,0,.45);
}
.remote-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(148,163,184,.15);
}
.remote-modal-actions { display: flex; gap: 8px; }
.remote-novnc-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #000;
}

.badge-stream { background: rgba(14, 165, 233, 0.2); color: #7dd3fc; }
.badge-sandbox { background: rgba(168, 85, 247, 0.2); color: #d8b4fe; }

/* ==================== M7 (SaaS) — utility bar, storefront, cart, checkout ==================== */

.muted { color: var(--text-muted); }
.empty-state { text-align: center; padding: 48px 16px; color: var(--text-muted); }
.empty-state p { margin: 0 0 16px; }
.badge-danger { background: rgba(239, 68, 68, 0.15); color: #f87171; }
.badge-muted { background: rgba(148, 163, 184, 0.15); color: #94a3b8; }

/* ----- Top utility bar ----- */
.utility-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}
.utility-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 18px;
}
.utility-bar .brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: 0;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.logo-icon.small { width: 26px; height: 26px; font-size: 13px; }
.utility-nav { display: flex; gap: 4px; }
.utility-item {
  background: none;
  border: 0;
  color: var(--text-muted);
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}
.utility-item:hover { color: var(--text); background: rgba(148, 163, 184, 0.12); }
.utility-item.active { color: var(--primary); background: rgba(59, 130, 246, 0.12); }
.utility-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.top-user { font-size: 13px; color: var(--text-muted); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ----- Storefront ----- */
.storefront { min-height: 100vh; }
.storefront-main { max-width: 1120px; margin: 0 auto; padding: 28px 16px 60px; }
.store-title { font-size: 22px; margin: 0 0 6px; }
.store-sub { color: var(--text-muted); margin: 0 0 22px; max-width: 640px; }
.cat-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px; }
.cat-tab {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
}
.cat-tab:hover { color: var(--text); }
.cat-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.store-section { margin-bottom: 30px; }
.store-section > h3 { font-size: 16px; margin: 0 0 12px; color: var(--text); }
.store-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tool-card { display: flex; flex-direction: column; gap: 8px; }
.tool-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.tool-head h4 { margin: 0; font-size: 15px; }
.tool-desc { color: var(--text-muted); font-size: 13px; margin: 0; }
.tool-note { color: var(--text-muted); font-size: 12px; margin: 0; }
.tool-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 8px; }
.tool-price { font-weight: 600; color: var(--text); font-size: 14px; }
.tool-count { margin-top: auto; }
.countdown { font-variant-numeric: tabular-nums; color: var(--primary); font-weight: 600; font-size: 14px; }
.countdown.expired { color: var(--text-muted); }

/* ----- Cart drawer ----- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 50;
}
.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  max-width: 92vw;
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  z-index: 51;
  display: flex;
  flex-direction: column;
}
.cart-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.cart-header h3 { margin: 0; font-size: 16px; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; }
.cart-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.cart-name { flex: 1; }
.cart-price { color: var(--text-muted); font-size: 13px; }
.cart-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cart-total { font-weight: 600; }

/* ----- Checkout modal ----- */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  z-index: 60;
  padding: 16px;
}
.modal-card {
  width: 460px;
  max-width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
}
.modal-card h3 { margin: 0 0 14px; font-size: 17px; }
.checkout-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.checkout-item { display: flex; justify-content: space-between; font-size: 14px; }
.checkout-totals { border-top: 1px solid var(--border); padding-top: 10px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 4px; }
.checkout-line { display: flex; justify-content: space-between; font-size: 14px; }
.checkout-line.checkout-discount { color: var(--success); }
.checkout-total { font-weight: 700; border-top: 1px dashed var(--border); margin-top: 4px; padding-top: 6px; }
.coupon-row { display: flex; gap: 8px; margin-bottom: 8px; }
.coupon-row input { flex: 1; min-width: 0; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 14px; background: transparent; color: inherit; }
.coupon-msg { font-size: 13px; margin: 0 0 12px; color: var(--success); }
.coupon-msg.coupon-error { color: var(--danger); }
.method-group { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.method-title { display: block; width: 100%; font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.method-group label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.checkout-hint { color: var(--text-muted); font-size: 12px; margin: 0 0 14px; }
.checkout-actions { display: flex; justify-content: flex-end; gap: 8px; }
.receipt-step { display: flex; flex-direction: column; gap: 12px; }
.receipt-line { margin: 0; font-size: 14px; color: var(--text-muted); }
.receipt-step input[type="file"] { font-size: 13px; }

/* ----- My Orders ----- */
.orders-grid, .tools-grid { display: flex; flex-direction: column; gap: 12px; }
.order-card { display: flex; flex-direction: column; gap: 8px; }
.order-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.order-head strong { font-size: 14px; }
.order-items { margin: 0; padding-left: 18px; color: var(--text); font-size: 14px; }
.order-meta { color: var(--text-muted); font-size: 13px; }
.order-pay { color: var(--text-muted); font-size: 13px; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }

/* ----- FAQ ----- */
.faq { display: flex; flex-direction: column; gap: 10px; max-width: 760px; }
.faq-item { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; padding: 0 16px; }
.faq-item summary { cursor: pointer; padding: 14px 0; font-weight: 600; color: var(--text); list-style: none; }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before { content: "▸"; display: inline-block; width: 16px; color: var(--primary); }
.faq-item[open] summary::before { transform: rotate(90deg); }
.faq-item p { color: var(--text-muted); font-size: 14px; margin: 0 0 14px 16px; }

/* ----- Signup optional-field hints ----- */
.opt { color: var(--text-muted); font-size: 12px; font-weight: 400; }

/* ----- Admin Analytics (P2d) ----- */
.analytics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.stat-num {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  color: var(--text);
}
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.analytics-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

/* ----- P2e Admin Builder ----- */
.builder-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.builder-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.builder-meta {
  color: var(--text-muted);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.builder-select {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 10px;
}
.builder-palette {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 10px;
}
.builder-palette-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.builder-canvas {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.builder-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: grab;
}
.builder-block:active { cursor: grabbing; }
.builder-block-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.builder-drag {
  color: var(--text-muted);
  cursor: grab;
  letter-spacing: 1px;
}
.builder-block-head strong {
  text-transform: capitalize;
  font-size: 13px;
}
.builder-block-actions {
  margin-left: auto;
  display: flex;
  gap: 4px;
}
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.builder-block-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.builder-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.builder-field .input {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 6px 10px;
  font-size: 13px;
}
.builder-items { grid-column: 1 / -1; }
.builder-items h5 { font-size: 12px; color: var(--text-muted); margin: 4px 0 8px; text-transform: uppercase; letter-spacing: 0.04em; }
.builder-item {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  border-top: 1px dashed var(--border);
  padding-top: 8px;
  margin-top: 8px;
}
.builder-preview {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.builder-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.builder-status { font-size: 13px; }
.builder-widgets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.widget-chip {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: grab;
  user-select: none;
}
.widget-chip.active { border-color: var(--primary); }
.widget-chip label { cursor: grab; display: flex; align-items: center; gap: 6px; }
.widget-chip input { accent-color: var(--primary); }

/* ----- P2e storefront sections (single renderer output) ----- */
.sec { margin-bottom: 14px; }
.sec-inner { max-width: 720px; }
.sec-hero { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 22px; text-align: center; }
.sec-text, .sec-features, .sec-faq, .sec-cta { background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.sec-title { font-size: 20px; font-weight: 700; margin: 0 0 8px; color: var(--text); }
.sec-body { color: var(--text-muted); font-size: 14px; line-height: 1.55; margin: 0 0 10px; }
.sec-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-top: 12px; }
.sec-col { background: var(--bg); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.sec-col h4 { margin: 0 0 6px; font-size: 15px; color: var(--text); }
.sec-col p { margin: 0; font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.sec-qa { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.sec-qa-item { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; }
.sec-qa-item summary { cursor: pointer; padding: 10px 0; font-weight: 600; font-size: 14px; color: var(--text); list-style: none; }
.sec-qa-item summary::-webkit-details-marker { display: none; }
.sec-qa-item summary::before { content: "▸"; display: inline-block; width: 14px; color: var(--primary); }
.sec-qa-item[open] summary::before { transform: rotate(90deg); }
.sec-qa-item p { margin: 0 0 10px 14px; font-size: 13px; color: var(--text-muted); }
.sec-spacer { height: 14px; }

/* P3a: card payment element container + transient toast */
.card-element {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin: 10px 0;
}
.qa-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(10px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 13px;
  z-index: 999;
  opacity: 0;
  transition: opacity .2s ease, transform .2s ease;
  max-width: 90vw;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.qa-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }


/* ---------- Phase-4: plans, subscriptions, access grid ---------- */
.mysub-section { margin-bottom: 22px; }
.mysub-section h3 { margin: 0 0 10px; font-size: 16px; }
.mysub-head p { margin: 0; font-size: 14px; color: var(--text-muted, inherit); }
.plan-sub-card .tool-head h4 { margin-right: auto; }

/* Access grid — the clean unlock/lock view */
.access-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.access-tool {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--bg-card);
}
.access-tool-name { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.access-tool-name strong { font-size: 14px; }
.access-tool .tool-note { margin: 0; }
.access-tool-actions { margin-top: auto; }
.access-unlocked { border-left: 3px solid var(--success, #22c55e); }

/* Storefront plan deep-link highlight */
.plan-highlight {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  transition: outline-color .3s ease;
}
