/* ==================================================================
   Area12 Studios — creator dashboard
   Dark, gold-accented UI. Plain CSS, no build step.
   ================================================================== */

:root {
  color-scheme: dark;
  --bg: #050506;
  --bg-2: #08070a;
  --panel: #0b0a0c;
  --card: #100e11;
  --card-2: #141217;
  --line: #221f27;
  --line-2: #2e2a35;
  --gold: #dcc79a;
  --gold-dim: #b9a377;
  --text: #f3f0e8;
  --muted: #9a978f;
  --ok: #4ade80;
  --err: #ff6b57;
  --warn: #f5c451;
  --sans: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --display: 'Syne', 'IBM Plex Sans', sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  --sidebar-w: 268px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(900px 500px at 12% -8%, rgba(220, 199, 154, 0.07), transparent),
    radial-gradient(700px 420px at 92% 4%, rgba(220, 199, 154, 0.05), transparent),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }
svg { flex: none; }
[hidden] { display: none !important; }
img { max-width: 100%; }

::selection { background: rgba(220, 199, 154, 0.28); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

.display {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 3.4vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.display em {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  color: var(--gold);
}

.eyebrow {
  margin: 0;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.muted { color: var(--muted); }
.sub { color: var(--muted); font-size: 13px; }
.help { display: block; color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.help.ok { color: var(--ok); }
.help.err { color: var(--err); }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; }
.link { color: var(--gold); background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.left { margin-right: auto; }
.right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---------------------------------------------------------------- */
/* Boot placeholder                                                   */
/* ---------------------------------------------------------------- */
.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  gap: 14px;
  grid-auto-flow: row;
  align-content: center;
  color: var(--muted);
}
.boot p { font-family: var(--serif); font-size: 20px; color: var(--muted); }
.boot-mark {
  width: 46px; height: 46px; border-radius: 14px;
  border: 1px solid rgba(220, 199, 154, 0.35);
  background: radial-gradient(circle at 50% 40%, rgba(220, 199, 154, 0.3), transparent 70%);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ---------------------------------------------------------------- */
/* Brand mark                                                         */
/* ---------------------------------------------------------------- */
.mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border-radius: 10px;
  border: 1px solid rgba(220, 199, 154, 0.28);
  background: rgba(220, 199, 154, 0.08);
  transform: translateY(5px);
}
.mark svg, .mark img {
  width: 22px;
  height: 22px;
  display: block;
  border-radius: 4px;
  transform: translateY(2px);
}
/* ---------------------------------------------------------------- */
/* Buttons                                                           */
/* ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--card-2);
  color: var(--text);
  font: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, opacity 0.15s;
}
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: #1a1720; border-color: #3a3543; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn.primary {
  background: linear-gradient(180deg, #e6d3ab, var(--gold));
  border-color: transparent;
  color: #17130c;
  font-weight: 600;
}
.btn.primary:hover { background: linear-gradient(180deg, #f0e0c0, #e2ceA0); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); }
.btn.outline { background: transparent; border-color: rgba(220, 199, 154, 0.4); color: var(--gold); }
.btn.danger { background: rgba(255, 107, 87, 0.14); border-color: rgba(255, 107, 87, 0.4); color: #ff8f7f; }
.btn.danger:hover { background: rgba(255, 107, 87, 0.22); }
.btn.sm { padding: 7px 12px; font-size: 13px; }
.btn.lg { padding: 13px 20px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon { padding: 9px; border-radius: 12px; }
.btn.icon svg { width: 18px; height: 18px; }
.google-btn { background: #fff; color: #1f1f1f; border-color: #fff; font-weight: 600; }
.google-btn:hover { background: #f1f1f1; border-color: #f1f1f1; }
.google-btn svg { width: 18px; height: 18px; }

.close {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border-radius: 10px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer;
}
.close:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.close svg { width: 17px; height: 17px; }

.spinner {
  width: 15px; height: 15px; flex: none;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- */
/* Forms                                                             */
/* ---------------------------------------------------------------- */
.field { margin-bottom: 18px; }
.field > label {
  display: flex; align-items: center; gap: 8px; justify-content: space-between;
  font-size: 13px; font-weight: 500; margin-bottom: 7px; color: var(--text);
}
.input {
  width: 100%;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: #0a090c;
  color: var(--text);
  font: inherit; font-size: 14.5px;
  transition: border-color 0.15s, background 0.15s;
}
.input::placeholder { color: #6b6862; }
.input:focus { outline: none; border-color: rgba(220, 199, 154, 0.55); background: #0d0b10; }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.55; }
textarea.input.code {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 13px; min-height: 320px; line-height: 1.5;
}
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: 0; }
.input-group .addon {
  display: grid; place-items: center;
  padding: 0 13px;
  border: 1px solid var(--line-2); border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: #17141b; color: var(--muted); font-size: 13.5px; white-space: nowrap;
}
input[type='color'] {
  width: 46px; height: 38px; padding: 3px;
  background: #0a090c; border: 1px solid var(--line-2); border-radius: 10px; cursor: pointer;
}
.color-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.swatch-list { display: flex; gap: 7px; flex-wrap: wrap; }
.swatch-list button {
  width: 26px; height: 26px; border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18); cursor: pointer;
}
.swatch-list button[aria-pressed='true'] { box-shadow: 0 0 0 2px var(--gold); }

.form-error, .form-ok {
  padding: 10px 13px; border-radius: var(--radius-sm);
  font-size: 13.5px; margin-bottom: 14px;
}
.form-error { background: rgba(255, 107, 87, 0.12); border: 1px solid rgba(255, 107, 87, 0.35); color: #ff9d90; }
.form-ok { background: rgba(74, 222, 128, 0.1); border: 1px solid rgba(74, 222, 128, 0.3); color: #86efac; }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted); font-size: 12px; margin: 16px 0;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--line);
}

.file-drop {
  padding: 16px; margin-bottom: 12px;
  border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
  color: var(--muted); font-size: 13px; text-align: center;
}
.file-drop.over { border-color: var(--gold); color: var(--text); background: rgba(220, 199, 154, 0.07); }
.code-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 10px; color: var(--muted); font-size: 12.5px;
}
.code-bar .left { display: flex; gap: 8px; flex-wrap: wrap; }

.warn {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 13px 15px; margin-bottom: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 196, 81, 0.32);
  background: rgba(245, 196, 81, 0.08);
  color: #f0dcae; font-size: 13px; line-height: 1.55;
}
.warn svg { width: 18px; height: 18px; color: var(--warn); margin-top: 2px; }
.warn b { color: #fbe7bb; }

.mode-switch { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.mode-switch button {
  display: grid; gap: 5px; text-align: left;
  padding: 13px 15px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2);
  background: #0a090c; color: var(--text); font: inherit; cursor: pointer;
}
.mode-switch button b { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.mode-switch button b svg { width: 16px; height: 16px; }
.mode-switch button span { color: var(--muted); font-size: 12.5px; }
.mode-switch button[aria-pressed='true'] {
  border-color: rgba(220, 199, 154, 0.6);
  background: rgba(220, 199, 154, 0.08);
}

.links-editor { display: grid; gap: 8px; margin-bottom: 10px; }
.link-row { display: flex; gap: 8px; align-items: center; }
.link-row .input { flex: 1; }
.row-actions { display: flex; gap: 6px; }

/* ---------------------------------------------------------------- */
/* Cards + layout primitives                                          */
/* ---------------------------------------------------------------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--card);
  padding: 22px;
}
.card.pad { padding: 22px; }
.card > .pad { padding: 0; }
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
  padding: 0;
  margin: 0 0 16px;
}
.card-head h2 { font-size: 17px; }
.card-head:last-child { margin-bottom: 0; }
.card.tcard, .tcard, .card.preview-pane, .preview-pane { padding: 0; }

.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 18px; flex-wrap: wrap; margin-bottom: 24px;
}
.page-head p { color: var(--muted); max-width: 62ch; margin-top: 8px; }
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

.two-col { display: grid; gap: 18px; grid-template-columns: 1.4fr 1fr; align-items: start; }
.settings-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stats { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); margin-bottom: 22px; }
.stat { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.stat .k { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.stat .k svg { width: 20px; height: 20px; color: var(--gold-dim); }
.stat .v { font-family: var(--display); font-size: 30px; font-weight: 700; margin: 6px 0 2px; }
.stat .v small { font-size: 15px; color: var(--muted); font-weight: 500; margin-left: 4px; }
.stat .d { color: var(--muted); font-size: 12.5px; }

.kv { display: grid; gap: 12px; padding: 2px 0 4px; }
.kv .row, .usage .row { font-size: 13.5px; }
.kv code, code {
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px; color: var(--gold);
  background: rgba(220, 199, 154, 0.09);
  padding: 2px 6px; border-radius: 6px;
}

.meter { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); overflow: hidden; margin: 8px 0; }
.meter i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--gold-dim), var(--gold)); transition: width 0.3s; }
.usage { display: grid; gap: 4px; }

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.03em;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, 0.04); color: var(--muted);
  vertical-align: middle;
  height: auto; min-height: 0; max-height: none;
  align-self: center; flex: none;
}
.badge.live { border-color: rgba(74, 222, 128, 0.4); background: rgba(74, 222, 128, 0.12); color: #86efac; }
.badge.draft { border-color: var(--line-2); color: var(--muted); }
.badge.pro { border-color: rgba(220, 199, 154, 0.45); background: rgba(220, 199, 154, 0.13); color: var(--gold); }
.badge.plain { border-color: var(--line-2); color: var(--muted); }

.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.03);
  color: var(--muted); font-size: 11.5px;
}

.chip {
  padding: 7px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: transparent;
  color: var(--muted); font: inherit; font-size: 13px; cursor: pointer;
}
.chip:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.chip[aria-pressed='true'] { background: rgba(220, 199, 154, 0.14); border-color: rgba(220, 199, 154, 0.45); color: var(--gold); }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; }
.seg button {
  display: grid; place-items: center;
  padding: 6px 10px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
}
.seg button svg { width: 16px; height: 16px; }
.seg button[aria-pressed='true'] { background: rgba(220, 199, 154, 0.16); color: var(--gold); }

.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent;
  color: var(--muted); font: inherit; font-size: 13.5px; cursor: pointer;
}
.tabs button svg { width: 15px; height: 15px; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected='true'] {
  background: rgba(220, 199, 154, 0.13); border-color: rgba(220, 199, 154, 0.42); color: var(--gold);
}

.skeleton {
  border-radius: var(--radius);
  background: linear-gradient(90deg, #0f0e12, #16141a, #0f0e12);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  border: 1px solid var(--line);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty {
  display: grid; justify-items: center; gap: 10px; text-align: center;
  padding: 52px 24px; border: 1px dashed var(--line-2); border-radius: var(--radius);
  color: var(--muted);
}
.empty h3 { color: var(--text); font-size: 17px; }
.empty p { max-width: 46ch; }
.empty .glyph { color: var(--gold-dim); }
.empty .glyph svg { width: 30px; height: 30px; }

.error-box {
  padding: 20px; border-radius: var(--radius);
  border: 1px solid rgba(255, 107, 87, 0.35); background: rgba(255, 107, 87, 0.08);
}
.error-box h3 { color: #ff9d90; margin-bottom: 6px; }

.steps { display: grid; gap: 10px; }
.steps .d, .steps > div {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.015);
}
.steps .check { color: var(--ok); }

.success-state { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 20px 0; }
.success-state .check {
  display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%;
  background: rgba(74, 222, 128, 0.14); color: var(--ok);
}
.success-state .check svg { width: 26px; height: 26px; }

.kofi-note {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px 18px; border-radius: var(--radius);
  border: 1px solid rgba(220, 199, 154, 0.28); background: rgba(220, 199, 154, 0.06);
  font-size: 13px; color: #e8dcc2;
}
.kofi-note svg { width: 18px; height: 18px; color: var(--gold); margin-top: 2px; }

.danger-zone { border-color: rgba(255, 107, 87, 0.3); background: rgba(255, 107, 87, 0.05); padding: 22px; margin-top: 20px; }
.danger-zone h2 { color: #ff9d90; font-size: 15px; }

.url-preview {
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
  color: var(--muted); font-size: 13px;
}
.url-preview svg { width: 16px; height: 16px; color: var(--gold-dim); }
.url-preview b { color: var(--text); }

/* ---------------------------------------------------------------- */
/* Auth screen                                                        */
/* ---------------------------------------------------------------- */
.auth-page {
  position: relative;
  min-height: 100vh;
  display: grid; place-items: center; align-content: center;
  gap: 18px; padding: 40px 20px;
}
.auth-grid-bg {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(220, 199, 154, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(220, 199, 154, 0.045) 1px, transparent 1px);
  background-size: 62px 62px;
  mask-image: radial-gradient(700px 460px at 50% 32%, #000 20%, transparent 78%);
}
.auth-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 452px;
  padding: 36px;
  border-radius: 22px;
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent), #0d0b10;
  box-shadow: var(--shadow);
}
.auth-brand { display: flex; align-items: center; gap: 11px; margin-bottom: 22px; }
.auth-brand b, .sb-brand b, .auth-brand div b { display: block; font-size: 14px; }
.auth-brand span, .sb-brand span { display: block; color: var(--muted); font-size: 12px; }
.auth-head { margin-bottom: 20px; }
.auth-head .display { font-size: clamp(23px, 4.4vw, 29px); }
.auth-head p { color: var(--muted); font-size: 13.5px; margin-top: 10px; }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  padding: 4px; margin-bottom: 20px;
  border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
}
.auth-tabs button {
  padding: 9px; border: 0; border-radius: 999px;
  background: transparent; color: var(--muted);
  font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
}
.auth-tabs button[aria-selected='true'] { background: rgba(220, 199, 154, 0.15); color: var(--gold); }
.auth-form { margin: 0; }
.auth-foot { margin: 18px 0 0; color: var(--muted); font-size: 12px; text-align: center; }
.auth-meta { position: relative; z-index: 1; color: #6f6c66; font-size: 12px; text-align: center; }

/* ---------------------------------------------------------------- */
/* App shell: sidebar + content                                       */
/* ---------------------------------------------------------------- */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky; top: 0; align-self: start;
  display: flex; flex-direction: column;
  height: 100vh; padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--panel);
}
.sb-brand { display: flex; align-items: center; gap: 11px; color: var(--text); margin-bottom: 18px; }
.sb-brand:hover { text-decoration: none; }
.sb-cta { margin-bottom: 22px; }
.sb-nav { display: grid; gap: 3px; }
.sb-label {
  padding: 0 10px 8px;
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: #6f6c66;
}
.sb-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 11px; border-radius: var(--radius-sm);
  color: var(--muted); font-size: 14px;
}
.sb-item svg { width: 17px; height: 17px; }
.sb-item:hover { background: rgba(255, 255, 255, 0.04); color: var(--text); text-decoration: none; }
.sb-item[aria-current='page'] {
  background: rgba(220, 199, 154, 0.12);
  color: var(--gold);
  box-shadow: inset 2px 0 0 var(--gold);
}
.sb-item .count {
  margin-left: auto; padding: 1px 8px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.07); color: var(--muted); font-size: 11.5px;
}
.sb-foot { margin-top: auto; display: grid; gap: 12px; padding-top: 18px; }
.sb-plan {
  padding: 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
  font-size: 12.5px;
}
.sb-plan .row { font-size: 12.5px; }
.sb-user { display: flex; align-items: center; gap: 10px; }
.avatar {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border-radius: 50%; overflow: hidden;
  background: rgba(220, 199, 154, 0.16); color: var(--gold);
  font-size: 12.5px; font-weight: 600;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.who { min-width: 0; }
.who b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who span { display: block; color: var(--muted); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.out {
  display: grid; place-items: center;
  width: 32px; height: 32px; margin-left: auto; flex: none;
  border-radius: 9px; border: 1px solid var(--line);
  background: transparent; color: var(--muted); cursor: pointer;
}
.out:hover { color: var(--err); border-color: rgba(255, 107, 87, 0.4); }
.out svg { width: 16px; height: 16px; }
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 11.5px; }
.legal-links a { color: #6f6c66; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.content { padding: 40px 40px 80px; max-width: 1220px; width: 100%; }
.drawer-backdrop { display: none; }

/* ---------------------------------------------------------------- */
/* Sites list                                                         */
/* ---------------------------------------------------------------- */
.site-list { display: grid; }
.site-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1.5fr) minmax(140px, 0.9fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.site-row:first-child { border-top: 0; }
.site-row .thumb {
  width: 88px; height: 55px; flex: none;
  aspect-ratio: 16 / 10;
  border-radius: 10px;
  border: 1px solid var(--line);
  padding: 6px 7px;
}
.site-row .name { min-width: 0; }
.site-row .name b {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 14.5px; font-weight: 600;
}
.site-row .name .badge { flex: none; }
.site-row .url { color: var(--muted); font-size: 12.5px; display: block; margin-top: 2px; }
.site-row .meta { min-width: 0; color: var(--muted); font-size: 12.5px; line-height: 1.4; }
.site-row .meta b { display: block; color: var(--text); font-size: 13px; font-weight: 600; margin-bottom: 2px; }
.site-row .row-actions, .site-row .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tpl-mini {
  display: grid; gap: 8px;
  min-width: 156px; flex: none;
  padding: 0 0 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font: inherit; font-size: 12.5px; font-weight: 600;
  text-align: left; cursor: pointer;
}
.tpl-mini:hover { border-color: var(--line-2); }
.tpl-mini .thumb {
  width: 100%; aspect-ratio: 16 / 10;
  border-radius: 12px 12px 0 0; border-bottom: 1px solid var(--line);
}
.tpl-mini b { padding: 0 10px; }
@media (max-width: 860px) {
  .site-row { grid-template-columns: 72px minmax(0, 1fr); }
  .site-row .meta, .site-row .row-actions, .site-row .actions { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- */
/* Template gallery                                                   */
/* ---------------------------------------------------------------- */
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 20px; }
.filters .search { max-width: 240px; margin-left: auto; padding: 8px 13px; font-size: 13.5px; border-radius: 999px; }
.gallery { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.tcard { position: relative; overflow: hidden; cursor: pointer; transition: transform 0.15s, border-color 0.15s; }
.tcard:hover { transform: translateY(-2px); border-color: var(--line-2); }
.tcard-body { padding: 16px 17px 18px; display: grid; gap: 9px; }
.tcard-body .row { align-items: center; }
.tcard-body h3 { font-size: 15px; }
.tcard-body p { color: var(--muted); font-size: 13px; margin: 0; }
.tcard-hover {
  position: absolute; inset: 0 0 auto; height: 58%;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: rgba(5, 5, 6, 0.72);
  opacity: 0; transition: opacity 0.15s;
}
.tcard:hover .tcard-hover, .tcard:focus-visible .tcard-hover { opacity: 1; }
.pick { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); }
.pick button {
  display: grid; gap: 8px; padding: 10px;
  border-radius: var(--radius-sm); border: 1px solid var(--line);
  background: #0a090c; color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer;
  text-align: left;
}
.pick button[aria-pressed='true'] { border-color: rgba(220, 199, 154, 0.55); background: rgba(220, 199, 154, 0.08); }
.selected-tpl {
  display: flex; align-items: center; gap: 13px; margin-bottom: 18px;
  padding: 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: rgba(255, 255, 255, 0.02);
}
.selected-tpl .thumb { width: 84px; flex: none; }
.selected-tpl b { display: block; font-size: 14px; }
.selected-tpl span { display: block; color: var(--muted); font-size: 12.5px; }
.selected-tpl button { margin-left: auto; }
.tpl-strip { display: flex; gap: 12px; overflow-x: auto; padding: 2px 2px 8px; }

/* ---------------------------------------------------------------- */
/* Plans                                                             */
/* ---------------------------------------------------------------- */
.plans { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(258px, 1fr)); }
.plan { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.plan.current { border-color: rgba(220, 199, 154, 0.45); box-shadow: 0 0 0 1px rgba(220, 199, 154, 0.2); }
.plan .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.plan .name { font-family: var(--display); font-size: 17px; font-weight: 700; }
.plan .price { font-family: var(--display); font-size: 32px; font-weight: 700; }
.plan .price small { font-size: 14px; color: var(--muted); font-weight: 500; margin-left: 3px; }
.plan .tagline { color: var(--muted); font-size: 13px; min-height: 40px; }
.plan ul { list-style: none; margin: 0 0 auto; padding: 0; display: grid; gap: 9px; }
.plan li { display: flex; gap: 9px; align-items: flex-start; font-size: 13.5px; }
.plan li svg { width: 15px; height: 15px; color: var(--gold); margin-top: 3px; }

/* ---------------------------------------------------------------- */
/* Editor                                                            */
/* ---------------------------------------------------------------- */
.editor { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr); align-items: start; }
.editor-pane { min-width: 0; }
.save-bar {
  position: sticky; bottom: 0;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 16px; padding: 13px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: rgba(11, 10, 12, 0.92);
  backdrop-filter: blur(8px);
}
.save-bar .status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.save-bar .status svg { width: 15px; height: 15px; color: var(--ok); }
.save-bar .status.dirty { color: var(--warn); }
.save-bar .status.dirty svg { color: var(--warn); }

.preview-pane { position: sticky; top: 22px; overflow: hidden; }
.live-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.live-bar .url { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.live-bar .url i { width: 8px; height: 8px; border-radius: 50%; background: #4b4740; }
.live-bar .url i.on { background: var(--ok); box-shadow: 0 0 8px rgba(74, 222, 128, 0.7); }
.live-frame { position: relative; height: min(72vh, 720px); background: #08070a; }
.live-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.live-frame .stale, .frame-loading {
  position: absolute; z-index: 2; top: 12px; left: 50%; transform: translateX(-50%);
  padding: 5px 12px; border-radius: 999px;
  background: rgba(5, 5, 6, 0.85); border: 1px solid var(--line-2);
  color: var(--muted); font-size: 12px;
  opacity: 0; transition: opacity 0.2s; pointer-events: none;
}
.live-frame.stale .stale { opacity: 1; }
.live-frame.device-mobile iframe, .preview-frame-wrap.device-mobile iframe {
  width: 390px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line);
}

/* ---------------------------------------------------------------- */
/* Toasts                                                            */
/* ---------------------------------------------------------------- */
.toasts {
  position: fixed; z-index: 60; right: 18px; bottom: 18px;
  display: grid; gap: 10px; max-width: min(380px, calc(100vw - 36px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: #13111a;
  box-shadow: var(--shadow); font-size: 13.5px;
  animation: toast-in 0.2s ease-out;
}
.toast button { border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; margin-left: auto; }
.toast button svg { width: 15px; height: 15px; }
.toast.ok { border-color: rgba(74, 222, 128, 0.4); }
.toast.err { border-color: rgba(255, 107, 87, 0.45); }
.toast.info { border-color: rgba(220, 199, 154, 0.35); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity 0.2s, transform 0.2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------------------------------------------------------------- */
/* Modals                                                            */
/* ---------------------------------------------------------------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 24px;
  background: rgba(3, 3, 4, 0.72); backdrop-filter: blur(5px);
  overflow: auto;
}
.modal {
  width: 100%; max-width: 520px;
  border-radius: 20px; border: 1px solid var(--line-2);
  background: #0d0b10; box-shadow: var(--shadow);
  animation: modal-in 0.18s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.99); } }
.modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 22px 22px 0;
}
.modal-head h2 { font-family: var(--display); font-size: 19px; }
.modal-head p { color: var(--muted); font-size: 13px; margin: 6px 0 0; }
.modal-body { padding: 22px; }
.modal-foot {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 16px 22px; border-top: 1px solid var(--line);
}

/* Full-bleed template preview modal */
.modal.preview { max-width: 1180px; }
.preview { display: flex; flex-direction: column; }
.preview-top {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.preview-top .title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.preview-top h2 { font-family: var(--display); font-size: 18px; }
.preview-top .tools { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.preview-stage { display: grid; grid-template-columns: minmax(0, 1fr) 320px; min-height: 0; }
.preview-frame-wrap { position: relative; background: #08070a; height: min(74vh, 780px); }
.preview-frame-wrap iframe { width: 100%; height: 100%; border: 0; display: block; opacity: 0; transition: opacity 0.25s; }
.preview-frame-wrap.loaded iframe { opacity: 1; }
.preview-frame-wrap .frame-loading { opacity: 1; }
.preview-frame-wrap.loaded .frame-loading { opacity: 0; }
.preview-side {
  display: grid; gap: 18px; align-content: start;
  padding: 20px; border-left: 1px solid var(--line);
  max-height: min(74vh, 780px); overflow: auto;
}
.preview-side h3 { font-size: 17px; }
.preview-side .about { color: var(--muted); font-size: 13px; }
.preview-side .sections { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.preview-side .sections li {
  position: relative; padding-left: 15px; color: var(--muted); font-size: 13px;
}
.preview-side .sections li::before {
  content: ''; position: absolute; left: 0; top: 8px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--gold-dim);
}
.preview-side .cta { display: grid; gap: 9px; }
.nav-tpl { display: flex; gap: 8px; }
.nav-tpl .btn { flex: 1; }

/* ---------------------------------------------------------------- */
/* Responsive                                                         */
/* ---------------------------------------------------------------- */
@media (max-width: 1120px) {
  .editor, .two-col, .preview-stage { grid-template-columns: minmax(0, 1fr); }
  .preview-pane { position: static; }
  .preview-side { border-left: 0; border-top: 1px solid var(--line); max-height: none; }
  .preview-frame-wrap { height: min(56vh, 560px); }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 40; top: 0; left: 0;
    width: min(300px, 86vw); height: 100vh;
    transform: translateX(-102%); transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }
  body.drawer-open .sidebar { transform: none; }
  body.drawer-open { overflow: hidden; }
  .drawer-backdrop {
    display: block; position: fixed; inset: 0; z-index: 30;
    background: rgba(3, 3, 4, 0.6);
    opacity: 0; pointer-events: none; transition: opacity 0.2s;
  }
  body.drawer-open .drawer-backdrop { opacity: 1; pointer-events: auto; }
  .topbar {
    display: flex; align-items: center; gap: 12px;
    position: sticky; top: 0; z-index: 20;
    padding: 12px 16px; border-bottom: 1px solid var(--line);
    background: rgba(5, 5, 6, 0.9); backdrop-filter: blur(8px);
  }
  .tb-brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 600; }
  .tb-brand .mark { width: 28px; height: 28px; border-radius: 8px; }
  .topbar .btn.icon:last-child { margin-left: auto; }
  .content { padding: 22px 16px 64px; }
  .filters .search { max-width: none; margin-left: 0; width: 100%; }
}

@media (max-width: 560px) {
  .page-head { gap: 12px; }
  .card, .card.pad, .plan { padding: 17px; }
  .modal-backdrop { padding: 0; align-items: stretch; }
  .modal { max-width: none; border-radius: 0; min-height: 100vh; }
  .stats { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ==================================================================
   Template thumbnails (CSS wireframes)
   ================================================================== */
.thumb {
  position: relative;
  display: grid; align-content: start; gap: 7%;
  aspect-ratio: 16 / 10;
  padding: 9% 10%;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(420px 220px at 24% -10%, color-mix(in srgb, var(--a, #dcc79a) 26%, transparent), transparent),
    #0a090c;
  overflow: hidden;
}
.thumb .t-bar { display: flex; gap: 4%; align-items: center; }
.thumb .t-bar i { display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); }
.thumb .t-bar i:first-child { width: 22%; background: var(--a, #dcc79a); }
.thumb .t-bar i:last-child { width: 34%; }
.thumb .t-line { display: block; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, 0.16); width: 100%; }
.thumb .t-line.h { height: 11px; width: 82%; background: rgba(255, 255, 255, 0.34); }
.thumb .t-line.s { height: 5px; width: 56%; }
.thumb .t-line.a { height: 5px; width: 30%; background: var(--a, #dcc79a); }
.thumb .t-line.on { background: var(--a, #dcc79a); }
.thumb .t-btn { width: 30%; height: 12px; border-radius: 999px; background: var(--a, #dcc79a); }
.thumb .t-cols { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5%; }
.thumb .t-block { border-radius: 6px; background: rgba(255, 255, 255, 0.09); aspect-ratio: 1 / 0.72; }
.thumb .t-dot { width: 15%; aspect-ratio: 1; border-radius: 50%; background: var(--a, #dcc79a); opacity: 0.85; }
.thumb .t-glow {
  position: absolute; left: 50%; top: 8%; width: 46%; aspect-ratio: 1; transform: translateX(-50%);
  border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--a, #f97316) 55%, transparent), transparent 70%);
  pointer-events: none;
}
.thumb .t-cards { display: grid; gap: 7%; }
.thumb .t-cards i {
  display: grid; grid-template-columns: 18px 1fr; gap: 8px; align-items: center;
  height: 18px; border-radius: 6px; background: rgba(255, 255, 255, 0.08);
  box-shadow: inset 8px 0 0 color-mix(in srgb, var(--a, #f97316) 70%, transparent);
}
.thumb .t-rules { display: grid; gap: 0; }
.thumb .t-rules i { display: block; height: 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.16); }
.thumb[data-kind="paper"] {
  background:
    radial-gradient(420px 220px at 50% -20%, color-mix(in srgb, var(--a, #e85d04) 28%, transparent), transparent),
    #f6f1ea;
}
.thumb[data-kind="paper"] .t-line { background: rgba(28, 25, 23, 0.16); }
.thumb[data-kind="paper"] .t-line.h { background: rgba(28, 25, 23, 0.78); }
.thumb[data-kind="paper"] .t-rules i { border-bottom-color: rgba(28, 25, 23, 0.16); }
.thumb .t-film { display: grid; grid-template-columns: 32% 1fr; gap: 8%; height: 100%; align-items: stretch; }
.thumb .t-film .frame {
  border-radius: 4px;
  background: linear-gradient(#3a2418, #0c0b0a);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--a, #f97316) 55%, transparent);
}
.thumb .t-film .frame.light { background: linear-gradient(#f6e7d4, #c9844a); }
.thumb .t-film .copy { display: grid; gap: 12%; align-content: center; }
.thumb[data-kind="matinee"] {
  background:
    radial-gradient(420px 220px at 70% -20%, color-mix(in srgb, var(--a, #e85d04) 24%, transparent), transparent),
    #f4efe6;
}
.thumb[data-kind="matinee"] .t-line { background: rgba(28, 22, 18, 0.16); }
.thumb[data-kind="matinee"] .t-line.h { background: rgba(28, 22, 18, 0.8); }
.split-3 { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .split-3 { grid-template-columns: 1fr; } }
.thumb .t-stack { display: grid; gap: 5%; }
.thumb .t-stack i { display: block; height: 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); }
.thumb .t-stack i:first-child { background: color-mix(in srgb, var(--a, #dcc79a) 55%, transparent); }
.thumb .t-feed { display: grid; gap: 5%; }
.thumb .t-feed .r { display: grid; gap: 4px; padding: 5% 6%; border-radius: 7px; background: rgba(255, 255, 255, 0.05); }
.thumb .t-split { display: grid; grid-template-columns: 1.1fr 1fr; gap: 6%; align-items: center; }
.thumb .t-split .l { display: grid; gap: 8%; }
.thumb .t-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4%; }
.thumb .t-stats i { display: block; height: 7px; border-radius: 3px; background: rgba(255, 255, 255, 0.12); }
.thumb .t-count { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5%; }
.thumb .t-count i { display: block; height: 12px; border-radius: 5px; background: rgba(255, 255, 255, 0.1); }
.thumb .t-tl { display: grid; gap: 6%; }
.thumb .t-tl .r { display: flex; align-items: center; gap: 5%; }
.thumb .t-tl .r .t-dot { width: 8px; height: 8px; flex: none; }
.thumb .t-tl .r .t-line { flex: 1; }
.thumb .t-sw { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4%; }
.thumb .t-sw i { display: block; aspect-ratio: 1; border-radius: 5px; }
.thumb .t-type { display: grid; gap: 6%; }
.thumb .t-type .serif-like { background: var(--a, #dcc79a); opacity: 0.8; }
.thumb .t-reel {
  position: relative; display: grid; place-items: center;
  border-radius: 8px; background: rgba(255, 255, 255, 0.07); aspect-ratio: 16 / 7;
}
.thumb .t-play {
  width: 0; height: 0;
  border-left: 13px solid var(--a, #dcc79a);
  border-top: 8px solid transparent; border-bottom: 8px solid transparent;
}
.thumb .t-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4%; }
.thumb .t-strip i { display: block; border-radius: 4px; background: rgba(255, 255, 255, 0.1); aspect-ratio: 1 / 0.7; }
.thumb .t-form { display: grid; gap: 5%; }
.thumb .t-form i { display: block; height: 11px; border-radius: 5px; background: rgba(255, 255, 255, 0.09); }
.thumb .t-faces { display: flex; gap: 3%; }
.thumb .t-faces i { display: block; width: 13%; aspect-ratio: 1; border-radius: 50%; background: rgba(255, 255, 255, 0.14); }
.thumb .t-call { height: 16px; border-radius: 6px; background: color-mix(in srgb, var(--a, #dcc79a) 30%, transparent); }
.thumb .t-doc { display: grid; grid-template-columns: 0.6fr 1.5fr 0.6fr; gap: 5%; }
.thumb .t-doc .c { display: grid; gap: 14%; align-content: start; }
.thumb .t-doc .c.m { gap: 10%; }
.thumb[data-kind="code"] { padding: 8% 9%; gap: 5%; }
.thumb[data-kind="code"] .t-code { display: grid; gap: 6%; }
.thumb[data-kind="code"] .t-code i { display: block; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); }
.thumb[data-kind="code"] .t-code i.k { background: var(--a); width: 34%; }
.thumb[data-kind="code"] .t-code i.i1 { margin-left: 10%; width: 62%; }
.thumb[data-kind="code"] .t-code i.i2 { margin-left: 20%; width: 48%; }
.thumb[data-kind="code"] .t-code i.i3 { margin-left: 20%; width: 56%; background: rgba(255, 255, 255, 0.32); }
.thumb[data-kind="code"] .t-code i.i4 { margin-left: 10%; width: 30%; }
.thumb[data-kind="code"] .t-tag { position: absolute; right: 9%; bottom: 10%; font-family: ui-monospace, monospace; font-size: 10px; color: var(--a); border: 1px solid color-mix(in srgb, var(--a) 40%, transparent); border-radius: 6px; padding: 3px 7px; background: color-mix(in srgb, var(--a) 10%, transparent); }

/* ------------------------------------------------------------------
   Site editor
   ------------------------------------------------------------------ */
.editor { display: grid; grid-template-columns: minmax(360px, 460px) 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } }
.editor-pane { display: grid; gap: 16px; }
.tabs { display: flex; gap: 4px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; }
.tabs button { flex: 1; padding: 9px 10px; border-radius: 9px; font-family: var(--display); font-weight: 600; font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; gap: 7px; transition: 0.15s; }
.tabs button svg { width: 14px; height: 14px; }
.tabs button[aria-selected="true"] { background: var(--bg-4); color: var(--text); }
.tab-panel { display: grid; gap: 16px; }
.tab-panel[hidden] { display: none; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mode-switch button { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); display: grid; gap: 4px; transition: 0.15s; }
.mode-switch button b { font-family: var(--display); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.mode-switch button span { font-size: 12px; color: var(--muted); }
.mode-switch button[aria-pressed="true"] { border-color: var(--gold); background: var(--gold-dim); }
.mode-switch button[aria-pressed="true"] b::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--gold); margin-left: auto; }
.code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.55; min-height: 380px; resize: vertical; tab-size: 2; white-space: pre; overflow: auto; background: #08080b; }
.code-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.code-bar .left { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.warn { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: rgba(242, 166, 90, 0.08); border: 1px solid rgba(242, 166, 90, 0.35); font-size: 13px; color: #f4d7b8; line-height: 1.5; }
.warn svg { width: 18px; height: 18px; color: #f2a65a; flex: none; margin-top: 1px; }
.warn b { color: #ffe1c2; }
.warn a { color: var(--gold); text-decoration: underline; }
.links-editor { display: grid; gap: 8px; }
.link-row { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 8px; align-items: center; }
.link-row .btn.icon { color: var(--muted); }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type="color"] { width: 44px; height: 40px; padding: 3px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; }
.color-row .swatch-list { display: flex; gap: 6px; }
.color-row .swatch-list button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; }
.color-row .swatch-list button[aria-pressed="true"] { border-color: #fff; }
.preview-pane {
  position: sticky; top: 24px;
  display: grid; grid-template-rows: auto 1fr;
  overflow: hidden;
  height: calc(100vh - 80px); min-height: 480px;
  padding: 0;
}
@media (max-width: 1100px) { .preview-pane { position: static; height: 70vh; } }
@media (max-width: 960px) { .preview-pane { top: 70px; } }
.live-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.live-bar .url { font-family: var(--display); color: var(--text-2); display: flex; align-items: center; gap: 8px; min-width: 0; }
.live-bar .url span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-bar .url i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); flex: none; }
.live-bar .url i.on { background: var(--green); box-shadow: 0 0 0 3px rgba(166, 227, 127, 0.18); }
.live-frame { position: relative; background: #000; min-height: 0; }
.live-frame iframe { width: 100%; height: 100%; border: 0; background: var(--bg); }
.live-frame.device-mobile { display: grid; place-items: center; padding: 20px; background: radial-gradient(ellipse at top, #15151b, #050506); }
.live-frame.device-mobile iframe { width: 390px; max-width: 100%; max-height: 100%; border-radius: 26px; border: 6px solid #1c1c22; }
.live-frame .stale { position: absolute; top: 10px; right: 10px; font-size: 11px; font-family: var(--display); letter-spacing: 0.06em; text-transform: uppercase; color: var(--gold); background: rgba(10, 10, 12, 0.85); border: 1px solid var(--gold-line); padding: 5px 9px; border-radius: 999px; opacity: 0; transition: 0.2s; pointer-events: none; }
.live-frame.stale .stale { opacity: 1; }
.save-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); position: sticky; bottom: 12px; z-index: 5; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); }
.save-bar .status { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.save-bar .status.dirty { color: var(--gold); }
.save-bar .right { display: flex; gap: 8px; }
.file-drop { border: 1px dashed var(--line-2); border-radius: 12px; padding: 14px; display: flex; gap: 12px; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--muted); background: var(--bg-2); flex-wrap: wrap; }
.file-drop.over { border-color: var(--gold); background: var(--gold-dim); }
.zip-status { display: grid; gap: 6px; font-size: 12.5px; color: var(--muted); }
.zip-status .meter { height: 6px; border-radius: 99px; background: var(--bg-2); overflow: hidden; border: 1px solid var(--line); }
.zip-status .meter i { display: block; height: 100%; width: 0%; background: var(--gold); }
.zip-error { color: var(--red, #ff8b7a); margin: 0; }
.zip-files-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 4px; }
.zip-files-head b { font-size: 13px; }
.zip-files { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; max-height: 220px; overflow: auto; }
.zip-files li { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 6px 8px; border-radius: 8px; background: var(--bg-2); }
.zip-files li.entry { color: var(--gold); }
.dir-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.dir-card { display: grid; gap: 8px; align-content: start; text-decoration: none; color: inherit; border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--bg-2); min-height: 150px; }
.dir-card:hover { border-color: var(--gold-line, var(--gold)); }
.dir-card h3 { margin: 0; font-size: 16px; }
.dir-card p { margin: 0; color: var(--muted); font-size: 13px; }
.dir-card-top { display: flex; gap: 6px; flex-wrap: wrap; }
.dir-host { font-size: 12px; color: var(--text-2, var(--text)); }
.legal-links { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; font-size: 11.5px; color: var(--muted-2); }
.legal-links a { color: var(--muted); }
.legal-links a:hover { color: var(--gold); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.repeater { display: grid; gap: 10px; }
.repeater-card {
  display: grid; gap: 8px;
  padding: 12px; border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,0.02);
}
.repeater-card .top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.split-2 { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .split-2 { grid-template-columns: 1fr; } }


/* ---------------------------------------------------------------- */
/* Admin                                                             */
/* ---------------------------------------------------------------- */
.admin-table-wrap { overflow-x: auto; padding: 4px 18px 18px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th {
  text-align: left; color: var(--muted);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 10px 8px; border-bottom: 1px solid var(--line); font-weight: 600;
}
.admin-table td { padding: 12px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table select {
  font: inherit; font-size: 13px; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 6px 8px;
}
.badge { white-space: nowrap; line-height: 1.15; }
.site-row .name .badge { align-self: center; height: fit-content; }
.admin-table-wrap { padding: 0; }


/* Visual editor — avatar row + preview hint */
.preview-hint {
  margin: 0; padding: 8px 14px 0;
  font-size: 12px; color: var(--muted);
}
.avatar-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.avatar-preview {
  width: 72px; height: 72px; border-radius: 50%;
  border: 1px solid var(--line-2);
  background: rgba(220, 199, 154, 0.08);
  overflow: hidden; flex: none;
  display: grid; place-items: center;
}
.avatar-preview img {
  width: 100%; height: 100%; object-fit: cover;
}
.avatar-actions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.editor-pane .tab-panel.card.pad .field { margin-bottom: 14px; }
.editor-pane .tab-panel.card.pad .field:last-child { margin-bottom: 0; }

.page-create { display: grid; gap: 12px; margin-top: 12px; padding: 12px; border: 1px dashed var(--line-2); border-radius: 12px; }
.page-row-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.link-image-row { display: flex; align-items: center; gap: 10px; }
.link-thumb {
  width: 36px; height: 36px; border-radius: 8px; overflow: hidden; flex: none;
  border: 1px solid var(--line-2); background: rgba(220, 199, 154, 0.08);
  display: grid; place-items: center;
}
.link-thumb img { width: 100%; height: 100%; object-fit: cover; }
.library-toolbar, .library-url, .library-pick-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px;
}
.library-url { margin-bottom: 16px; }
.library-url .input, .library-pick-row .input { flex: 1; min-width: 180px; }
.library-grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.lib-card {
  display: grid; gap: 8px; padding: 10px;
  border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,0.02);
}
.lib-preview {
  height: 88px; border-radius: 8px; overflow: hidden;
  background: #0c0b0a; display: grid; place-items: center; color: var(--gold);
}
.lib-preview img, .lib-preview video { width: 100%; height: 100%; object-fit: cover; }
.lib-kind { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-dim); }
.lib-meta { display: grid; gap: 2px; }
.lib-meta b { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-meta span { font-size: 12px; color: var(--muted); }
.lib-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.verify-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 12px 16px 0;
  padding: 10px 14px;
  border: 1px solid var(--line-2);
  background: rgba(220, 199, 154, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13.5px;
}
.verify-banner[hidden] { display: none !important; }
