:root {
  --bg: #060606;
  --surface: #0e0e0f;
  --surface-2: #151517;
  --surface-3: #1c1c1f;
  --border: #222226;
  --border-strong: #2f2f34;
  --text: #f4f4f5;
  --text-2: #d4d4d8;
  --muted: #8b8b94;
  --primary: #c6f432;
  --primary-2: #5fe36a;
  --primary-ink: #0a1204;
  --primary-soft: rgba(198, 244, 50, .1);
  --primary-line: rgba(198, 244, 50, .35);
  --success: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 10px 30px rgba(0, 0, 0, .35);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .6);
  --topbar: 60px;
  --sidebar: 236px;
  --glow: 0 0 0 1px rgba(198, 244, 50, .35), 0 8px 30px rgba(198, 244, 50, .18);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
[dir="rtl"], [dir="auto"] { font-family: 'Inter', 'Cairo', system-ui, sans-serif; }
a { color: var(--primary); text-decoration: none; }
code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 6px; border-radius: 6px; font-size: 12px; color: var(--text-2); }
hr { border: 0; border-top: 1px solid var(--border); margin: 24px 0; }
h1, h2, h3 { margin: 0; letter-spacing: -.02em; }
.muted { color: var(--muted); }
.row { display: flex; align-items: center; }
.between { justify-content: space-between; }
.gap { gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; }
[hidden] { display: none !important; }
::selection { background: rgba(198, 244, 50, .3); }
* { scrollbar-width: thin; scrollbar-color: #2a2a2e transparent; }
.ico { flex: none; }

/* ---------- App shell ---------- */
body.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 6px;
  padding: 16px 12px; background: #090909; border-right: 1px solid var(--border); z-index: 50;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; padding: 4px 8px 14px; }
.brand-mark { flex: none; filter: drop-shadow(0 4px 14px rgba(198, 244, 50, .25)); }
.brand-name { font-size: 18px; letter-spacing: -.03em; }
.side-new { margin: 2px 0 14px; justify-content: flex-start; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px;
  color: var(--muted); font-weight: 600; font-size: 13.5px; transition: background .15s, color .15s;
}
.side-link:hover { background: var(--surface-2); color: var(--text); }
.side-link.active { background: var(--primary-soft); color: var(--primary); }
.side-link.disabled { cursor: not-allowed; opacity: .55; }
.side-link.disabled:hover { background: transparent; color: var(--muted); }
.soon { margin-left: auto; font-style: normal; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border: 1px solid var(--border-strong); border-radius: 999px; padding: 1px 7px; }
.side-user {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.side-user form { margin: 0; }
.avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; color: var(--primary-ink); background: linear-gradient(135deg, var(--primary), var(--primary-2)); flex: none; }
.side-user-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.side-user-text b, .side-user-text small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user-text b { font-size: 13px; }
.side-user-text small { color: var(--muted); font-size: 11.5px; }
.main { min-width: 0; display: flex; flex-direction: column; }

/* compact rail (builder) */
body.app.rail { grid-template-columns: 68px 1fr; }
body.rail .sidebar { padding: 14px 10px; align-items: center; }
body.rail .brand { padding: 4px 0 14px; }
body.rail .brand-name, body.rail .side-link > span, body.rail .side-new span, body.rail .soon, body.rail .side-user-text { display: none; }
body.rail .side-new { width: 42px; padding: 0; justify-content: center; }
body.rail .side-link { justify-content: center; padding: 10px; }
body.rail .side-user { flex-direction: column; padding: 8px 6px; border: 0; background: transparent; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar);
  display: flex; align-items: center; gap: 18px; padding: 0 22px;
  background: rgba(6, 6, 6, .82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border);
}
.topbar-title { font-weight: 700; font-size: 15px; white-space: nowrap; }
body.builder-body .topbar-title { display: none; }
.menu-btn { display: none !important; }
.topbar-slot { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-width: 0; }
.tb-project { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.tb-name {
  font: 700 15px 'Inter', 'Cairo', sans-serif; color: var(--text);
  border: 1px solid transparent; background: transparent; border-radius: 8px;
  padding: 6px 8px; min-width: 60px; max-width: 320px; flex: 0 1 320px; text-overflow: ellipsis;
}
.tb-name:hover { border-color: var(--border); }
.tb-name:focus { outline: none; border-color: var(--primary-line); background: var(--surface); }
.tb-actions { display: flex; gap: 8px; flex-shrink: 0; }
.tb-credits { flex-shrink: 0; font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; padding: 4px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 14px;
  font: 600 13.5px 'Inter', sans-serif;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: 10px;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s, color .15s;
}
.btn:hover { background: var(--surface-3); border-color: #3a3a40; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary {
  color: var(--primary-ink); border-color: transparent;
  background: linear-gradient(135deg, var(--primary), #9cef3f);
  box-shadow: 0 6px 22px rgba(198, 244, 50, .22);
}
.btn-primary:hover { background: linear-gradient(135deg, #d6ff52, #aaf54c); border-color: transparent; box-shadow: 0 8px 28px rgba(198, 244, 50, .32); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: transparent; }
.btn-outline { background: transparent; border-color: var(--primary-line); color: var(--primary); }
.btn-outline:hover { background: var(--primary-soft); border-color: var(--primary); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.btn-lg { height: 50px; font-size: 15px; border-radius: 12px; padding: 0 22px; }
.btn-block { width: 100%; }
.danger { color: var(--danger) !important; }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center;
  border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  cursor: pointer; font-size: 20px; line-height: 1;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.icon-btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.loading, .icon-btn.loading { pointer-events: none; opacity: .8; }
.btn.loading::before {
  content: ''; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-right-color: transparent;
  animation: spin .7s linear infinite;
}
.btn-publish, .btn-mirocho { color: var(--primary-ink); border-color: transparent; background: linear-gradient(135deg, var(--primary), var(--primary-2)); box-shadow: 0 6px 22px rgba(95, 227, 106, .22); }
.btn-publish:hover, .btn-mirocho:hover { background: linear-gradient(135deg, #d6ff52, #74ee7e); border-color: transparent; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-weight: 600; font-size: 13px; color: var(--text-2); }
.field em { font-style: normal; font-weight: 500; color: var(--muted); margin-left: 4px; font-size: 12px; }
input[type=text], input[type=password], input[type=number], input[type=email], input[type=search], select, textarea, .input-sm {
  width: 100%; font: 14px 'Inter', 'Cairo', sans-serif; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 10px 12px; transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: #5d5d66; }
select option { background: var(--surface-2); color: var(--text); }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary-line); box-shadow: 0 0 0 4px rgba(198, 244, 50, .08); background: #18181b; }
.input-sm { padding: 8px 10px; font-size: 13px; margin-top: 8px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 6px 0 12px; cursor: pointer; color: var(--text-2); }
.check input { accent-color: var(--primary); width: 16px; height: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hint { color: var(--muted); font-size: 12px; margin: 8px 0 0; }
input[type=range] { width: 100%; accent-color: var(--primary); }

/* ---------- Alerts / toasts / pills ---------- */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; border: 1px solid; font-size: 13.5px; }
.alert-warn { background: rgba(251, 191, 36, .08); border-color: rgba(251, 191, 36, .3); color: #fcd34d; }
.alert-ok { background: rgba(74, 222, 128, .08); border-color: rgba(74, 222, 128, .3); color: #86efac; }
.alert-error { background: rgba(248, 113, 113, .08); border-color: rgba(248, 113, 113, .3); color: #fca5a5; }
.alert a { color: inherit; text-decoration: underline; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.toast {
  background: #18181b; color: var(--text); padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-strong); font-size: 13.5px; animation: toastIn .25s ease; display: flex; gap: 10px; align-items: flex-start;
}
.toast.error { border-color: rgba(248, 113, 113, .45); color: #fecaca; background: #1f1212; }
.toast.success { border-color: var(--primary-line); color: #ecfccb; background: #121a0b; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 700; text-transform: capitalize;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border);
}
.pill-ready, .pill-live { background: rgba(74, 222, 128, .1); color: #86efac; border-color: rgba(74, 222, 128, .3); }
.pill-generating, .pill-analyzing { background: var(--primary-soft); color: var(--primary); border-color: var(--primary-line); }
.pill-planned { background: rgba(251, 191, 36, .08); color: #fcd34d; border-color: rgba(251, 191, 36, .3); }
.pill-error { background: rgba(248, 113, 113, .08); color: #fca5a5; border-color: rgba(248, 113, 113, .3); }

/* ---------- Pages ---------- */
.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 30px 28px 80px; }
.page-narrow { max-width: 820px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-head h2 { font-size: 18px; }
.section-head h1 { font-size: 26px; }
.page-lead { color: var(--muted); margin: -8px 0 24px; max-width: 640px; }
.empty { padding: 44px 24px; text-align: center; color: var(--muted); border: 1px dashed var(--border-strong); border-radius: 16px; background: var(--surface); }
.empty .btn { margin-top: 14px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.card h2 { font-size: 16px; margin-bottom: 6px; }
.card > p.muted { margin: 0 0 18px; }
.settings-form h2 { font-size: 16px; margin-bottom: 6px; }
.settings-form p { margin: 0 0 16px; }
.form-actions { margin-top: 18px; display: flex; justify-content: flex-end; gap: 10px; }
.eyebrow { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--primary); background: var(--primary-soft); border: 1px solid var(--primary-line); padding: 4px 10px; border-radius: 999px; }
.grad { background: linear-gradient(120deg, var(--primary), var(--primary-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* dashboard */
.dash-hero {
  position: relative; overflow: hidden; display: grid; grid-template-columns: 1.3fr 1fr; gap: 28px; align-items: center;
  padding: 34px; border-radius: 22px; border: 1px solid var(--border);
  background: radial-gradient(700px 300px at 0% 0%, rgba(198, 244, 50, .14), transparent 60%), radial-gradient(500px 260px at 100% 100%, rgba(95, 227, 106, .1), transparent 60%), var(--surface);
}
.dash-hero h1 { font-size: 34px; line-height: 1.12; margin: 14px 0 10px; font-weight: 800; }
.dash-hero p { color: var(--muted); font-size: 15px; margin: 0 0 22px; max-width: 520px; }
.dash-hero .row { gap: 10px; flex-wrap: wrap; }
.dash-steps { display: flex; flex-direction: column; gap: 10px; }
.dash-step { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .02); border: 1px solid var(--border); }
.dash-step b { display: block; font-size: 13.5px; }
.dash-step small { color: var(--muted); font-size: 12px; }
.dash-step .n { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; background: var(--surface-3); color: var(--primary); flex: none; border: 1px solid var(--border-strong); }
.dash-step.done .n { background: var(--primary); color: var(--primary-ink); border-color: transparent; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin: 22px 0 34px; }
.stat { padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.stat span { color: var(--muted); font-size: 12px; font-weight: 600; }
.stat b { display: block; font-size: 26px; margin-top: 4px; letter-spacing: -.02em; }
.stat a { font-size: 12.5px; font-weight: 600; }

/* projects */
.search-input { position: relative; width: min(300px, 100%); }
.search-input .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input input { padding-left: 36px; height: 38px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; overflow: hidden; transition: transform .15s, border-color .15s, box-shadow .15s; }
.project-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-lg); }
.project-cover { display: block; aspect-ratio: 4 / 3.4; background: linear-gradient(135deg, #141a0d, #0d0d0f); overflow: hidden; position: relative; }
.project-cover img { width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .4s; }
.project-card:hover .project-cover img { transform: scale(1.03); }
.project-cover .pill { position: absolute; top: 10px; left: 10px; backdrop-filter: blur(6px); background: rgba(6, 6, 6, .7); }
.project-body { padding: 14px; }
.project-body h3 { font-size: 14.5px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.project-meta { display: flex; gap: 10px; align-items: center; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.project-actions { display: flex; gap: 8px; margin-top: 12px; }
.project-actions .btn-ghost { margin-left: auto; }
.new-card { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 280px; border: 1px dashed var(--border-strong); border-radius: 16px; color: var(--muted); font-weight: 600; transition: .15s; }
.new-card:hover { border-color: var(--primary-line); color: var(--primary); background: var(--primary-soft); }
.new-card .plus { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border-strong); }

/* integrations */
.int-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.int-card { display: flex; flex-direction: column; gap: 12px; padding: 20px; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); position: relative; }
.int-card.connected { border-color: var(--primary-line); box-shadow: var(--glow); }
.int-card.soon { opacity: .7; }
.int-head { display: flex; align-items: center; gap: 12px; }
.int-logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; flex: none; }
.int-head h3 { font-size: 16px; }
.int-head small { color: var(--muted); font-size: 12px; }
.int-card p { margin: 0; color: var(--muted); font-size: 13px; }
.int-store { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; }
.int-store b { font-size: 13.5px; }
.int-store a { font-size: 12.5px; word-break: break-all; }
.int-actions { display: flex; gap: 8px; margin-top: auto; flex-wrap: wrap; }
.status-chip { margin-left: auto; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border-strong); color: var(--muted); }
.status-chip.on { color: var(--primary); border-color: var(--primary-line); background: var(--primary-soft); }

/* settings */
.settings-grid { display: grid; grid-template-columns: 220px 1fr; gap: 26px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar) + 24px); display: flex; flex-direction: column; gap: 2px; }
.settings-nav a { color: var(--muted); padding: 8px 12px; border-radius: 9px; font-weight: 600; }
.settings-nav a:hover { color: var(--text); background: var(--surface-2); }
.settings-nav a.active { color: var(--primary); background: var(--primary-soft); }
.kv { display: grid; grid-template-columns: 160px 1fr; gap: 10px; font-size: 13.5px; padding: 6px 0; }
.kv span { color: var(--muted); }

/* ---------- Auth ---------- */
body.auth { min-height: 100vh; display: grid; place-items: center; overflow-x: hidden; }
.auth-glow { position: fixed; inset: -20% -10% auto; height: 70vh; background: radial-gradient(600px 300px at 50% 30%, rgba(198, 244, 50, .16), transparent 70%); pointer-events: none; }
.auth-wrap { position: relative; width: min(440px, 100%); padding: 40px 20px; display: flex; flex-direction: column; align-items: center; }
.auth-brand { padding: 0 0 22px; }
.auth-card { width: 100%; background: rgba(14, 14, 15, .9); border: 1px solid var(--border); border-radius: 22px; padding: 30px; box-shadow: var(--shadow-lg); backdrop-filter: blur(10px); animation: rise .35s ease; }
.auth-card h1 { font-size: 23px; margin-bottom: 6px; }
.auth-card > p.muted { margin: 0 0 22px; }
.auth-card .btn-lg { margin-top: 6px; }
.auth-alt { text-align: center; margin: 18px 0 0; color: var(--muted); font-size: 13.5px; }
.auth-foot { color: #55555d; font-size: 12px; margin-top: 22px; text-align: center; }
.auth-icon { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; background: var(--primary-soft); border: 1px solid var(--primary-line); color: var(--primary); margin-bottom: 16px; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 70px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; color: var(--muted); font: 600 12px 'Inter', sans-serif; cursor: pointer; padding: 6px 8px; }
.pw-meter { height: 4px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 2px; }
.pw-meter i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .25s, background .25s; }
.code-inputs { display: flex; gap: 8px; justify-content: center; margin: 6px 0 18px; direction: ltr; }
.code-inputs input { width: 48px; height: 58px; text-align: center; font: 700 24px 'Inter', sans-serif; padding: 0; border-radius: 12px; }
.code-inputs input:focus { border-color: var(--primary); }
.resend { display: flex; justify-content: center; gap: 6px; font-size: 13px; color: var(--muted); }
.resend button { border: 0; background: none; color: var(--primary); font: 600 13px 'Inter', sans-serif; cursor: pointer; padding: 0; }
.resend button:disabled { color: var(--muted); cursor: default; }

/* ---------- Create wizard ---------- */
.wizard { max-width: 860px; margin: 0 auto; padding: 28px 24px 60px; }
.wz-steps { display: flex; gap: 6px; margin-bottom: 26px; }
.wz-step {
  flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font: 600 12.5px 'Inter', sans-serif; cursor: pointer; text-align: left; transition: .2s;
}
.wz-step .n { width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--surface-3); border: 1px solid var(--border-strong); flex: none; transition: .2s; }
.wz-step:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.wz-step:disabled { cursor: not-allowed; opacity: .5; }
.wz-step.active { border-color: var(--primary-line); color: var(--text); background: linear-gradient(180deg, rgba(198, 244, 50, .08), transparent); }
.wz-step.active .n { background: var(--primary); color: var(--primary-ink); border-color: transparent; box-shadow: 0 0 18px rgba(198, 244, 50, .45); }
.wz-step.done .n { background: rgba(198, 244, 50, .15); color: var(--primary); border-color: var(--primary-line); }
.wz-step small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); }
.wz-progress { height: 3px; border-radius: 99px; background: var(--surface-3); margin: -14px 0 26px; overflow: hidden; }
.wz-progress i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.wz-viewport { position: relative; }
.wz-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 22px; padding: 30px; box-shadow: var(--shadow); }
.wz-panel h2 { font-size: 24px; margin-bottom: 6px; }
.wz-panel > p.muted { margin: 0 0 22px; font-size: 14.5px; }
.wz-panel.enter-next { animation: wzInNext .42s cubic-bezier(.2, .8, .2, 1); }
.wz-panel.enter-prev { animation: wzInPrev .42s cubic-bezier(.2, .8, .2, 1); }
.wz-panel.leave-next { animation: wzOutNext .22s ease forwards; }
.wz-panel.leave-prev { animation: wzOutPrev .22s ease forwards; }
.wz-actions { display: flex; align-items: center; gap: 10px; margin-top: 26px; padding-top: 20px; border-top: 1px solid var(--border); }
.wz-actions .spacer { flex: 1; }
.wz-kbd { color: #55555d; font-size: 12px; }
.wz-kbd kbd { font: 600 11px 'Inter', sans-serif; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; color: var(--muted); }
.opt-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.opt-card { position: relative; display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; transition: .15s; }
.opt-card input { position: absolute; opacity: 0; pointer-events: none; }
.opt-card b { font-size: 14px; }
.opt-card small { color: var(--muted); font-size: 12px; }
.opt-card .big { font: 800 20px 'Cairo', 'Inter', sans-serif; color: var(--text); }
.opt-card:hover { border-color: #3d3d44; }
.opt-card:has(input:checked) { border-color: var(--primary); background: linear-gradient(180deg, rgba(198, 244, 50, .1), rgba(198, 244, 50, .02)); box-shadow: var(--glow); }
.block-chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin-bottom: 8px; }
.block-chip { position: relative; display: flex; flex-direction: column; gap: 3px; padding: 10px 12px 10px 34px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; transition: .15s; }
.block-chip input { position: absolute; left: 12px; top: 12px; margin: 0; accent-color: var(--primary); }
.block-chip b { font-size: 13px; }
.block-chip small { color: var(--muted); font-size: 11.5px; line-height: 1.35; }
.block-chip:hover { border-color: #3d3d44; }
.block-chip:has(input:checked) { border-color: var(--primary-line); background: var(--primary-soft); }
.wa-create-opts { margin: 8px 0 0; padding: 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.wa-create-opts .field { margin-bottom: 10px; }
.count-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.count-chip { position: relative; min-width: 46px; height: 42px; padding: 0 14px; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--surface-2); font-weight: 700; cursor: pointer; transition: .15s; }
.count-chip input { position: absolute; opacity: 0; pointer-events: none; }
.count-chip:hover { border-color: #3d3d44; }
.count-chip:has(input:checked) { border-color: var(--primary); color: var(--primary-ink); background: var(--primary); }
.review-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.review-item { padding: 14px 16px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); position: relative; }
.review-item span { color: var(--muted); font-size: 12px; font-weight: 600; display: block; }
.review-item b { font-size: 14px; display: block; margin-top: 2px; word-break: break-word; }
.review-item button { position: absolute; top: 10px; right: 10px; }
.review-thumbs { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.review-thumbs img { width: 46px; height: 46px; border-radius: 9px; object-fit: cover; border: 1px solid var(--border-strong); }
.gen-launch { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 20px 0 6px; }
.orb { width: 74px; height: 74px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #eaff9a, var(--primary) 45%, #3cbf4b 100%); box-shadow: 0 0 50px rgba(198, 244, 50, .45); animation: orb 2.4s ease-in-out infinite; }

/* dropzone */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: 18px; background: var(--surface-2);
  min-height: 220px; display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: border-color .15s, background .15s; padding: 14px;
}
.dropzone.drag, .dropzone:hover { border-color: var(--primary-line); background: rgba(198, 244, 50, .04); }
.dropzone.has-files { cursor: default; align-items: stretch; justify-content: stretch; }
.dz-empty { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--muted); }
.dz-empty strong { color: var(--text); font-size: 16px; }
.dz-icon { width: 60px; height: 60px; display: grid; place-items: center; border-radius: 18px; background: var(--primary-soft); border: 1px solid var(--primary-line); color: var(--primary); margin-bottom: 8px; }
.dz-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; width: 100%; }
.dz-grid:empty { display: none; }
.dz-item { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-3); border: 1px solid var(--border-strong); animation: pop .25s ease; }
.dz-item img { width: 100%; height: 100%; object-fit: cover; }
.dz-item button {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .75); color: #fff; cursor: pointer; font-size: 15px; line-height: 1;
}
.dz-item .dz-index { position: absolute; left: 6px; bottom: 6px; background: rgba(0, 0, 0, .75); color: #fff; font-size: 11px; border-radius: 6px; padding: 1px 6px; }
.dz-item:first-child .dz-index { background: var(--primary); color: var(--primary-ink); font-weight: 700; }
.dz-add { aspect-ratio: 1; border-radius: 12px; border: 1.5px dashed var(--border-strong); display: grid; place-items: center; color: var(--muted); font-size: 28px; cursor: pointer; background: transparent; }
.dz-add:hover { border-color: var(--primary-line); color: var(--primary); }
.dz-meta { display: flex; justify-content: space-between; font-size: 12px; margin: 10px 2px 0; gap: 10px; color: var(--muted); }

/* ---------- Builder ---------- */
.builder-body { overflow: hidden; }
.builder {
  display: grid; grid-template-columns: 290px 1fr 360px;
  height: calc(100vh - var(--topbar));
}
.panel { background: var(--surface); overflow-y: auto; }
.panel-left { border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.panel-right { border-left: 1px solid var(--border); }
.panel-block { padding: 16px; border-bottom: 1px solid var(--border); }
.panel-block.grow { flex: 1; }
.block-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 12px; }
.thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.thumbs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; }

.insight-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.insight-promise { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.palette { display: flex; gap: 6px; margin: 8px 0; }
.palette span { width: 24px; height: 24px; border-radius: 7px; border: 1px solid rgba(255, 255, 255, .12); }
.insight-meta { font-size: 12px; color: var(--muted); }
.insight-meta b { color: var(--text-2); font-weight: 600; }

.outline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.outline li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; cursor: pointer;
  border: 1px solid transparent; user-select: none;
}
.outline li:hover { background: var(--surface-2); }
.outline li.active { background: var(--primary-soft); border-color: var(--primary-line); }
.outline li.dragging { opacity: .4; }
.outline li.drop-before { box-shadow: 0 -2px 0 var(--primary); }
.outline .num { width: 22px; height: 22px; border-radius: 6px; background: var(--surface-3); border: 1px solid var(--border-strong); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--muted); flex: none; }
.outline .o-text { flex: 1; min-width: 0; }
.outline .o-label { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.outline .o-head { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: 'Cairo', sans-serif; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #3f3f46; flex: none; }
.status-dot.done { background: var(--success); }
.status-dot.generating { background: var(--primary); animation: pulse 1s infinite; }
.status-dot.error { background: var(--danger); }
.drag-handle { color: #52525b; cursor: grab; font-size: 14px; }

.stage {
  overflow-y: auto; padding: 28px 20px 80px;
  background-color: #08080a;
  background-image: radial-gradient(#1d1d22 1px, transparent 1px);
  background-size: 18px 18px;
}
.phone {
  width: min(460px, 100%); margin: 0 auto; background: #141416; border-radius: 28px; padding: 10px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7), 0 0 0 1px #26262b, 0 0 60px rgba(198, 244, 50, .05);
}
.phone-inner { border-radius: 19px; overflow: hidden; background: #fff; min-height: 400px; }
.stage-section { position: relative; cursor: pointer; outline: 0 solid transparent; transition: outline-color .15s; }
.stage-section img { display: block; width: 100%; height: auto; user-select: none; -webkit-user-drag: none; }
.stage-section:hover { outline: 2px solid rgba(198, 244, 50, .55); outline-offset: -2px; z-index: 2; }
.stage-section.active { outline: 3px solid var(--primary); outline-offset: -3px; z-index: 3; }
.stage-section .s-badge {
  position: absolute; top: 10px; left: 10px; z-index: 4;
  background: rgba(6, 6, 6, .82); color: #fff; font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px; opacity: 0; transition: opacity .15s; pointer-events: none;
}
.stage-section:hover .s-badge, .stage-section.active .s-badge { opacity: 1; }
.s-toolbar {
  position: absolute; top: 10px; right: 10px; z-index: 4; display: flex; gap: 6px; opacity: 0; transition: opacity .15s;
}
.stage-section:hover .s-toolbar, .stage-section.active .s-toolbar { opacity: 1; }
.s-toolbar button {
  height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(10, 10, 12, .9); color: var(--text);
  font: 600 12px 'Inter', sans-serif; cursor: pointer; box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.s-toolbar button:hover { color: var(--primary); border-color: var(--primary-line); }

.s-placeholder {
  aspect-ratio: 2 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 28px; text-align: center; color: #71717a; border-bottom: 1px solid #e4e4e7;
  background: #f4f4f5;
}
.s-placeholder .ph-type { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.s-placeholder .ph-head { font: 800 22px/1.35 'Cairo', sans-serif; color: #18181b; max-width: 90%; }
.s-placeholder .ph-sub { font: 500 14px 'Cairo', sans-serif; max-width: 85%; }
.s-placeholder.error { background: #fef2f2; color: #b91c1c; }
.s-placeholder.error .ph-err { font-size: 12px; max-width: 90%; word-break: break-word; }
.s-generating {
  position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: rgba(6, 6, 6, .6); color: #fff; backdrop-filter: blur(2px); text-align: center; padding: 20px;
}
.s-placeholder.generating {
  background: linear-gradient(110deg, #0f120b 8%, #1a2410 18%, #0f120b 33%);
  background-size: 200% 100%; animation: shimmer 1.4s linear infinite; color: var(--primary); border-bottom-color: #1a1a1d;
}
.s-placeholder.generating .ph-head { color: #f4f4f5; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: var(--primary); animation: spin .8s linear infinite; }
.s-placeholder .spinner { border-color: rgba(198, 244, 50, .2); border-top-color: var(--primary); }
.gen-title { font-weight: 700; }
.gen-timer { font-size: 12px; opacity: .85; font-variant-numeric: tabular-nums; }

/* zone selection */
.zone-layer { position: absolute; inset: 0; z-index: 6; cursor: crosshair; }
.zone-rect {
  position: absolute; border: 2px dashed #fff; outline: 2px dashed var(--primary); outline-offset: -2px;
  background: rgba(198, 244, 50, .16); box-shadow: 0 0 0 9999px rgba(0, 0, 0, .5);
}
.zone-info { display: flex; align-items: center; justify-content: space-between; background: var(--primary-soft); color: var(--primary); border-radius: 10px; padding: 6px 10px; font-weight: 600; font-size: 12.5px; margin: 10px 0; }

/* analysis card */
.analysis-card {
  width: min(560px, 100%); margin: 0 auto 22px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
  padding: 20px 22px; box-shadow: var(--shadow);
}
.analysis-card h3 { font-size: 16px; margin-bottom: 4px; }
.steps { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; }
.steps li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-weight: 500; }
.steps li .st { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--border-strong); flex: none; font-size: 12px; }
.steps li.active { color: var(--text); }
.steps li.active .st { border-color: var(--primary); border-right-color: transparent; animation: spin .8s linear infinite; }
.steps li.done { color: var(--text); }
.steps li.done .st { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.progress { height: 8px; background: var(--surface-3); border-radius: 999px; overflow: hidden; margin-top: 14px; border: 1px solid var(--border); }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-2)); width: 0; transition: width .4s; }

/* inspector */
.inspector-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); padding: 40px; gap: 6px; }
.inspector-body { padding: 16px; }
.insp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.insp-kicker { font-size: 11px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: .06em; }
.insp-title { font-weight: 700; font-size: 15px; }
.insp-tools { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.insp-tools .icon-btn { width: 30px; height: 30px; }
.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--border); padding: 4px; border-radius: 12px; margin-bottom: 16px; }
.tab { flex: 1; border: 0; background: transparent; padding: 7px 6px; border-radius: 8px; font: 600 12.5px 'Inter', sans-serif; color: var(--muted); cursor: pointer; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255, 255, 255, .04) inset, 0 2px 8px rgba(0, 0, 0, .3); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fade .2s; }
.seg { display: flex; border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; margin-bottom: 6px; }
.seg-btn { flex: 1; border: 0; background: var(--surface-2); padding: 9px; font: 600 12.5px 'Inter', sans-serif; cursor: pointer; color: var(--muted); }
.seg-btn + .seg-btn { border-left: 1px solid var(--border-strong); }
.seg-btn.active { background: var(--primary-soft); color: var(--primary); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 10px; }
.chip { border: 1px solid var(--border-strong); background: var(--surface-2); border-radius: 999px; padding: 4px 10px; font: 500 12px 'Inter', sans-serif; cursor: pointer; color: var(--text-2); }
.chip:hover { border-color: var(--primary-line); color: var(--primary); }
.ref-picker { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.ref-picker label { position: relative; cursor: pointer; }
.ref-picker img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; border: 2px solid transparent; opacity: .4; transition: .15s; }
.ref-picker input { position: absolute; opacity: 0; }
.ref-picker input:checked + img { border-color: var(--primary); opacity: 1; }
.history { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hist-item { border: 2px solid var(--border); border-radius: 12px; overflow: hidden; cursor: pointer; background: var(--surface-2); transition: border-color .15s; }
.hist-item.current { border-color: var(--primary); }
.hist-item img { width: 100%; display: block; aspect-ratio: 2 / 3; object-fit: cover; object-position: top; }
.hist-meta { padding: 6px 8px; font-size: 11px; color: var(--muted); }
.hist-meta b { display: block; color: var(--text); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* modal */
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, .7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .15s; }
.modal-card { background: var(--surface); border: 1px solid var(--border-strong); border-radius: 20px; padding: 22px; width: min(480px, 100%); box-shadow: var(--shadow-lg); animation: rise .25s ease; }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h3 { font-size: 17px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.lightbox { cursor: zoom-out; }
.lightbox img { max-width: 92vw; max-height: 92vh; border-radius: 12px; box-shadow: var(--shadow-lg); }

/* order form in the builder */
.stage-section.is-form .form-preview { pointer-events: none; user-select: none; font-family: 'Cairo', 'Inter', system-ui, sans-serif; }
.stage-section.is-form .form-preview .ailp-form { animation: none; }
.stage-section.is-form .ailp-thanks { display: none !important; }
.outline li.is-form .num { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary); }
.outline li.is-block .num { background: rgba(251, 191, 36, .1); border-color: rgba(251, 191, 36, .4); color: var(--warn); }

/* live (code based) sections in the builder */
.stage-section.is-block .block-preview { font-family: 'Cairo', 'Inter', system-ui, sans-serif; color: #111; }
.stage-section.is-block .ab.is-sticky { position: relative; top: auto; }
.stage-section.is-block .block-preview a { cursor: default; }
.sub-title { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.img-picks { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; margin-bottom: 10px; }
.img-picks.sm { grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 4px; margin: 0; flex: 1; }
.img-pick { position: relative; padding: 0; aspect-ratio: 1; border: 2px solid transparent; border-radius: 8px; background: var(--surface-2); overflow: hidden; cursor: pointer; opacity: .5; transition: .15s; color: var(--muted); font: 700 11px 'Inter', sans-serif; }
.img-pick img { display: block; width: 100%; height: 100%; object-fit: cover; }
.img-pick:hover { opacity: .85; }
.img-pick.active { border-color: var(--primary); opacity: 1; }
.img-pick.none { border: 1px dashed var(--border-strong); }
.img-pick.none.active { border: 2px solid var(--primary); color: var(--primary); }
.vu { border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-bottom: 10px; background: var(--surface-2); }
.vu-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.vu-head select { width: auto; margin: 0; padding: 5px 8px; font-size: 12px; }
.vu-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--border); }
.vu-label { display: inline-flex; align-items: center; gap: 6px; width: 78px; flex: none; font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vu-label i { width: 12px; height: 12px; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }
.bitems { display: flex; flex-direction: column; gap: 6px; }
.bitem { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.bitem[open] { border-color: var(--border-strong); }
.bitem > summary { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; list-style: none; font-size: 13px; font-weight: 600; }
.bitem > summary::-webkit-details-marker { display: none; }
.bitem .bi-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bitem .bi-tools { display: flex; gap: 2px; flex: none; }
.bitem .bi-tools button { width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; }
.bitem .bi-tools button:hover:not(:disabled) { background: var(--surface-3); color: var(--text); }
.bitem .bi-tools button:disabled { opacity: .3; cursor: default; }
.bitem > .field, .bitem > .check { margin: 0 10px 10px; }
.bitem > .field input, .bitem > .field textarea, .bitem > .field select { padding: 7px 10px; font-size: 13px; }
#blockFields .field input, #blockFields .field select, #blockFields .field textarea { padding: 8px 10px; font-size: 13px; }
.extras .check { margin-top: 6px; }
.extra-sub { margin: 0 0 6px 24px; display: flex; flex-direction: column; gap: 6px; }
.extra-sub .input-sm { margin-top: 0; }
.extra-sub .grid-2 { gap: 6px; }
.seg-sm .seg-btn { padding: 6px; font-size: 11.5px; }
.ai-box { background: linear-gradient(135deg, rgba(198, 244, 50, .08), rgba(95, 227, 106, .04)); border: 1px solid var(--primary-line); border-radius: 12px; padding: 10px; margin-bottom: 14px; }
.ai-box textarea { margin-bottom: 8px; font-size: 13px; padding: 8px 10px; }
.ai-box .hint { margin-top: 6px; }
.color-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.color-field { display: flex; flex-direction: column; gap: 4px; align-items: stretch; font-size: 11.5px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.color-field input[type=color] { width: 100%; height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 2px; background: var(--surface-2); cursor: pointer; }
.color-field span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.color-field code { font-size: 10.5px; padding: 0 4px; text-align: center; color: var(--muted); }
.text-group { margin-bottom: 10px; }
.text-group .field { margin-bottom: 10px; }
.text-group .field input, .text-group .field textarea { padding: 8px 10px; font-size: 13px; }
.vg { border: 1px solid var(--border); border-radius: 12px; padding: 10px; margin-bottom: 10px; background: var(--surface-2); }
.vg-head { display: flex; gap: 6px; margin-bottom: 8px; }
.vg-head .vg-name { flex: 1; padding: 7px 10px; font-size: 13px; font-weight: 600; }
.vg-head .vg-type { width: 96px; padding: 7px 8px; font-size: 12.5px; }
.vg-values { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.vchip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: 999px; padding: 3px 4px 3px 10px; font-size: 12.5px; font-weight: 600; }
.vchip i { width: 14px; height: 14px; border-radius: 50%; box-shadow: 0 0 0 1px rgba(255, 255, 255, .25); }
.vchip button { width: 20px; height: 20px; border: 0; border-radius: 50%; background: var(--surface-2); cursor: pointer; line-height: 1; color: var(--muted); }
.vchip button:hover { background: rgba(248, 113, 113, .15); color: var(--danger); }
.vg-add { display: flex; gap: 6px; align-items: center; }
.vg-add .vg-val { flex: 1; padding: 7px 10px; font-size: 13px; }
.vg-add .vg-hex { width: 38px; height: 34px; padding: 2px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface-2); flex: none; }

/* publish */
.modal-wide { width: min(580px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; }
.dest-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 18px; }
.dest { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 8px; border-radius: 14px; border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; font: 600 12.5px 'Inter', sans-serif; color: var(--text); text-align: center; position: relative; }
.dest .int-logo { width: 34px; height: 34px; font-size: 14px; border-radius: 10px; }
.dest small { font-size: 10.5px; color: var(--muted); font-weight: 600; }
.dest.active { border-color: var(--primary); box-shadow: var(--glow); }
.dest:disabled { cursor: not-allowed; opacity: .5; }
.pub-account { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 16px; }
.pub-account .grow { min-width: 0; }
.pub-account b { display: block; }
.pub-account small { color: var(--muted); }
.pub-existing { padding: 10px 12px; }
.pub-existing .seg-btn { display: block; text-align: center; font-size: 12px; }
.pub-summary { font-size: 12px; margin: -4px 0 6px; }
.pub-progress { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 30px 10px; }
.spinner.dark { border-color: rgba(198, 244, 50, .2); border-top-color: var(--primary); }
.pub-done { text-align: center; padding: 6px 0; }
.pub-check { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%; background: var(--primary); color: var(--primary-ink); font-size: 30px; font-weight: 800; display: grid; place-items: center; box-shadow: 0 0 0 10px rgba(198, 244, 50, .12), 0 0 40px rgba(198, 244, 50, .35); }
.pub-done h3 { font-size: 19px; margin-bottom: 4px; }
.pub-url { display: flex; gap: 8px; margin: 16px 0 6px; }
.pub-url input { font-size: 13px; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.99); } }
@keyframes pop { from { opacity: 0; transform: scale(.9); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }
@keyframes orb { 50% { transform: scale(1.08); box-shadow: 0 0 80px rgba(198, 244, 50, .6); } }
@keyframes wzInNext { from { opacity: 0; transform: translateX(48px); } }
@keyframes wzInPrev { from { opacity: 0; transform: translateX(-48px); } }
@keyframes wzOutNext { to { opacity: 0; transform: translateX(-36px); } }
@keyframes wzOutPrev { to { opacity: 0; transform: translateX(36px); } }
@media (prefers-reduced-motion: reduce) {
  .wz-panel.enter-next, .wz-panel.enter-prev, .wz-panel.leave-next, .wz-panel.leave-prev { animation-duration: .01s; }
}

@media (max-width: 1280px) {
  .topbar { gap: 14px; }
  .builder { grid-template-columns: 250px 1fr 320px; }
}
@media (max-width: 1100px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .dash-hero { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}
@media (max-width: 900px) {
  body.app, body.app.rail { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sidebar); transform: translateX(-100%); transition: transform .25s; }
  body.rail .sidebar { align-items: stretch; padding: 16px 12px; }
  body.rail .brand-name, body.rail .side-link > span, body.rail .side-new span, body.rail .soon, body.rail .side-user-text { display: initial; }
  body.rail .side-link { justify-content: flex-start; padding: 9px 11px; }
  body.rail .side-new { width: auto; padding: 0 14px; justify-content: flex-start; }
  body.rail .side-user { flex-direction: row; }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: inline-grid !important; }
  .builder-body { overflow: auto; }
  .builder { grid-template-columns: 1fr; height: auto; }
  .panel-left, .panel-right { border: 0; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 14px; gap: 10px; }
  .topbar-slot { flex-wrap: wrap; }
  .grid-3, .opt-cards { grid-template-columns: 1fr 1fr; }
  .opt-cards.quality-cards { grid-template-columns: 1fr; }
  .wz-step small, .wz-step .t { display: none; }
  .wz-step { justify-content: center; }
  .review-grid { grid-template-columns: 1fr; }
  .dest-list { grid-template-columns: 1fr 1fr; }
  .page { padding: 22px 16px 60px; }
}
