/* =========================================================
   CREOVA app styles (app.html)
   Violet identity: deep ink sidebar, one violet accent, amber highlights,
   soft shadows and gentle motion. Edit the tokens on :root.
   ========================================================= */
:root {
  --bg: #f6f5fb;
  --panel: #ffffff;
  --sunken: #f1effa;
  --ink: #1c1840;
  --ink-2: #413c68;
  --muted: #6e6a8c;
  --line: #e8e5f4;
  --line-2: #d7d2ee;
  --accent: #4b3bd6;
  --accent-2: #3a2bb8;
  --accent-soft: #eceaff;
  --amber: #ffb547;
  --amber-soft: #fff3df;
  --ok: #16855a;
  --ok-soft: #e1f4ea;
  --warn: #a15c00;
  --warn-soft: #fff1da;
  --danger: #c8322b;
  --danger-soft: #fdeceb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(28, 24, 64, .05), 0 6px 20px rgba(28, 24, 64, .05);
  --shadow-lg: 0 2px 6px rgba(28, 24, 64, .06), 0 18px 44px rgba(28, 24, 64, .12);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: 'Readex Pro', 'Tajawal', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.65; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 700; letter-spacing: 0; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
[hidden] { display: none !important; }

.muted { color: var(--muted); }
.sm { font-size: 13px; }
.center { text-align: center; }
.row { display: flex; align-items: center; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt { margin-top: 16px; }
.center-row { justify-content: center; }
.eyebrow { font-size: 13px; color: var(--muted); margin-bottom: 2px; }
.pill { display: inline-block; padding: 2px 10px; border: 1px solid currentColor; border-radius: 99px; font-size: 12px; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--panel); border-inline-end: 1px solid var(--line); padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 22px;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.logo-mark { width: 34px; height: 34px; border-radius: 7px; background: var(--ink); color: var(--panel); display: grid; place-items: center; font: 800 17px 'Cairo'; }
.logo-mark.big { width: 52px; height: 52px; font-size: 26px; border-radius: 10px; }
.logo-name { font: 800 17px 'Cairo'; letter-spacing: 2px; }
.logo-tag { font-size: 11.5px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink-2); cursor: pointer; font-weight: 500; text-align: start; position: relative;
}
.nav-item:hover { background: var(--sunken); color: var(--ink); }
.nav-item.active { background: var(--sunken); color: var(--ink); font-weight: 600; }
.nav-item.active::before { content: ''; position: absolute; inset-inline-start: -14px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.side-store { margin-top: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; display: flex; align-items: center; gap: 10px; cursor: pointer; }
.side-store:hover { border-color: var(--line-2); }
.side-store img { width: 58px; height: 26px; object-fit: contain; }
.ss-name { font-weight: 600; font-size: 14px; }
.ss-sub { font-size: 12px; color: var(--muted); }
.side-account { display: flex; align-items: center; gap: 8px; padding: 10px 8px 0; border-top: 1px solid var(--line); }
.sa-info { flex: 1; min-width: 0; }
.sa-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-email { font-size: 12px; color: var(--muted); direction: ltr; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sa-out { border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius-sm); width: 34px; height: 34px; display: grid; place-items: center; cursor: pointer; color: var(--ink-2); }
.sa-out:hover { color: var(--danger); border-color: var(--danger); }

.main { padding: 30px 36px 60px; min-width: 0; max-width: 1400px; }
.view { display: none; }
.view.active { display: block; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p.muted { margin-top: 4px; max-width: 620px; }

/* ---------- Cards / Buttons / Fields ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card + .card, .stats + .card, .card + .steps { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid transparent; font-weight: 600; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn-primary { background: var(--ink); color: var(--panel); }
.btn-primary:hover:not(:disabled) { background: #000; }
.btn-ghost { background: var(--panel); border-color: var(--line-2); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink); }
.btn-ok { background: var(--accent); color: #fff; }
.btn-ok:hover { background: #163a2f; }
.btn-danger { background: var(--panel); color: var(--danger); border-color: #ecc8c3; }
.btn-danger:hover { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-lg { padding: 12px 22px; font-size: 15.5px; }
.btn.sm { padding: 5px 11px; font-size: 13px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input:not([type]), select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 70px; }
input[type=color] { width: 44px; height: 38px; padding: 2px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--panel); cursor: pointer; }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field code { direction: ltr; font-size: 13px; color: var(--muted); }
.drop { border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--sunken); min-height: 120px; display: grid; place-items: center; cursor: pointer; padding: 14px; text-align: center; color: var(--muted); }
.drop:hover { border-color: var(--ink); color: var(--ink); }
.drop img { max-height: 120px; object-fit: contain; }
.drop.tall { min-height: 220px; }
.drop.tall img { max-height: 260px; }

/* ---------- Dashboard ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.stat { display: flex; align-items: center; gap: 14px; }
.stat.clickable { cursor: pointer; }
.stat.clickable:hover { border-color: var(--line-2); }
.stat-ico { width: 44px; height: 44px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--sunken); color: var(--ink-2); }
.stat-ico svg { width: 20px; height: 20px; }
.stat-num { font: 700 28px/1.15 var(--font); font-variant-numeric: tabular-nums; }
.stat-num.sm { font-size: 18px; }
.stat-label { color: var(--muted); font-size: 13.5px; display: flex; align-items: center; gap: 8px; }
.swatches { display: inline-flex; gap: 4px; }
.swatches i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.step b { font: 600 13px var(--font); color: var(--muted); }
.step .btn { margin-top: auto; }
.foot-actions { margin-top: 18px; display: flex; justify-content: center; }

/* Design cards */
.design-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.design-grid.big { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.d-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--panel); display: flex; flex-direction: column; }
.d-card:hover { border-color: var(--line-2); }
.d-thumb { background: var(--sunken); aspect-ratio: 4/5; display: grid; place-items: center; cursor: pointer; overflow: hidden; }
.d-thumb img { width: 100%; height: 100%; object-fit: contain; }
.d-info { padding: 10px 12px 8px; }
.d-name { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.d-sub { font-size: 12px; color: var(--muted); }
.d-actions { display: flex; gap: 6px; padding: 0 12px 12px; flex-wrap: wrap; }
.d-actions .btn { flex: 1; padding: 5px 8px; font-size: 12.5px; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; grid-column: 1 / -1; }
.empty h2 { color: var(--ink); }

/* ---------- Brand ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.two-col > .card + .card { margin-top: 0; }
.presets { display: flex; flex-wrap: wrap; gap: 8px; }
.preset { display: flex; border-radius: 6px; overflow: hidden; border: 1px solid var(--line-2); cursor: pointer; padding: 0; background: none; }
.preset:hover { border-color: var(--ink); }
.preset i { width: 24px; height: 28px; display: block; }
.brand-preview { --bp1: #8e3b5f; --bp2: #e9c9a8; background: color-mix(in srgb, var(--bp2) 30%, var(--panel)); position: sticky; top: 20px; }
.bp-top { display: flex; align-items: center; gap: 12px; justify-content: center; min-height: 60px; }
.bp-top img { max-height: 60px; max-width: 200px; object-fit: contain; }
.bp-name { font: 700 20px 'El Messiri'; color: var(--bp1); }
.bp-body { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 28px 0; }
.bp-title { font: 700 30px 'El Messiri'; color: var(--bp1); }
.bp-badge { width: 104px; height: 104px; border-radius: 50%; background: var(--bp1); color: #fff; display: grid; place-items: center; font: 800 19px 'Cairo'; }
.bp-cta { padding: 9px 30px; border-radius: 99px; background: var(--bp1); color: #fff; font-weight: 700; }

/* ---------- Products ---------- */
.prod-layout { grid-template-columns: 370px minmax(0, 1fr); }
.prod-layout form h2 { margin-bottom: 16px; }
.discount-box { background: var(--sunken); border-radius: var(--radius-sm); padding: 9px 12px; font-weight: 600; margin-bottom: 16px; font-size: 14px; }
.prod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.p-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.p-img { aspect-ratio: 1; background: var(--sunken); display: grid; place-items: center; position: relative; }
.p-img img { max-width: 84%; max-height: 84%; object-fit: contain; }
.p-off { position: absolute; top: 10px; inset-inline-start: 10px; background: var(--ink); color: var(--panel); border-radius: 4px; padding: 1px 8px; font-weight: 600; font-size: 12.5px; }
.p-body { padding: 12px 14px; }
.p-name { font-weight: 600; }
.p-price { display: flex; gap: 8px; align-items: baseline; }
.p-price b { font-size: 16px; }
.p-price s { color: var(--muted); font-size: 13px; }
.p-bundle { font-size: 13px; color: var(--accent); font-weight: 600; margin-top: 2px; }
.p-actions { display: flex; gap: 6px; padding: 0 14px 14px; }
.p-actions .btn { flex: 1; padding: 5px 8px; font-size: 12.5px; }

/* ---------- Create wizard ---------- */
.wiz-step + .wiz-step { margin-top: 14px; }
.wiz-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 14px; }
.wiz-head b { font: 600 13px var(--font); color: var(--muted); font-variant-numeric: tabular-nums; }
.wiz-head b::after { content: ' /'; }
.wiz-head .btn, .wiz-head .muted { margin-inline-start: auto; }
.pick-products { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; }
.pp { flex: 0 0 146px; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 10px; cursor: pointer; background: var(--panel); text-align: center; }
.pp img { height: 88px; margin: 0 auto 6px; object-fit: contain; }
.pp-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pp-price { font-size: 12.5px; color: var(--muted); }
.pp.active, .plat.active, .tpl-card.active { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 14px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--panel); cursor: pointer; font-weight: 500; font-size: 14px; }
.chip:hover { border-color: var(--ink); }
.chip.active { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.pick-platforms { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.plat { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 12px 10px; cursor: pointer; background: var(--panel); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.plat-shape { height: 52px; display: flex; align-items: center; }
.plat-shape i { display: block; border: 1.5px solid var(--ink-2); border-radius: 3px; background: var(--sunken); }
.plat.active .plat-shape i { background: var(--accent); border-color: var(--accent); }
.plat-name { font-weight: 600; font-size: 13px; direction: ltr; }
.plat-size { font-size: 12px; color: var(--muted); direction: ltr; font-variant-numeric: tabular-nums; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tpl-card { border: 1px solid var(--line-2); border-radius: var(--radius); overflow: hidden; cursor: pointer; background: var(--panel); }
.tpl-thumb { background: var(--sunken); display: grid; place-items: center; }
.tpl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.tpl-meta { padding: 8px 10px; border-top: 1px solid var(--line); }
.tpl-meta b { display: block; font-size: 13.5px; font-weight: 600; }
.tpl-meta span { font-size: 11.5px; color: var(--muted); direction: ltr; display: block; text-align: right; }
.wiz-bar {
  position: sticky; bottom: 14px; margin-top: 16px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius);
  padding: 10px 10px 10px 10px; display: flex; align-items: center; gap: 12px; justify-content: space-between; z-index: 5;
  box-shadow: 0 6px 20px rgba(28, 27, 24, .08);
}
.wiz-summary { font-size: 14px; color: var(--ink-2); padding-inline-start: 6px; }
.wiz-summary b { color: var(--ink); }

/* ---------- Editor ---------- */
.editor { display: flex; flex-direction: column; gap: 12px; }
.ed-top { display: flex; align-items: center; gap: 12px; padding: 10px 12px; flex-wrap: wrap; }
.ed-name { max-width: 300px; font-weight: 600; }
.ed-meta { font-size: 13px; color: var(--muted); direction: ltr; }
.ed-status { font-size: 12.5px; color: var(--ok); }
.ed-top-actions { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ed-top-actions select { width: auto; }
.icon-btn { width: 38px; height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--panel); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover:not(:disabled) { border-color: var(--ink); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.ed-body { display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 12px; align-items: start; }
.ed-panel { padding: 0; overflow: hidden; max-height: calc(100vh - 140px); overflow-y: auto; position: sticky; top: 14px; }
.panel-sec { padding: 16px 18px; }
.panel-sec + .panel-sec { border-top: 1px solid var(--line); }
.panel-sec h3 { margin-bottom: 12px; }
.panel-sec .field { margin-bottom: 12px; }
.panel-sec input, .panel-sec select, .panel-sec textarea { padding: 7px 10px; }
.prop-head { display: inline-block; border: 1px solid var(--line-2); font-weight: 600; font-size: 12.5px; border-radius: 4px; padding: 1px 8px; margin-bottom: 12px; }
.prop-row { display: flex; gap: 10px; align-items: flex-end; }
.prop-row .field { flex: 1; }
.toggle { display: flex; gap: 6px; }
.toggle button { flex: 1; padding: 6px; border: 1px solid var(--line-2); background: var(--panel); border-radius: var(--radius-sm); cursor: pointer; font-weight: 600; }
.toggle button.on { background: var(--ink); color: var(--panel); border-color: var(--ink); }
input[type=range] { width: 100%; accent-color: var(--ink); }
.ed-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.ed-tools { display: flex; align-items: center; gap: 2px; padding: 6px; flex-wrap: wrap; }
.tool { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; border-radius: var(--radius-sm); border: 0; background: transparent; cursor: pointer; font-size: 12px; color: var(--ink-2); min-width: 58px; }
.tool:hover { background: var(--sunken); color: var(--ink); }
.tool.danger:hover { background: var(--danger-soft); color: var(--danger); }
.tool-sep { width: 1px; height: 32px; background: var(--line); margin: 0 4px; }
.color-tool input { width: 26px; height: 20px; border-radius: 4px; padding: 0; }
.ed-stage {
  height: calc(100vh - 220px); min-height: 460px; border-radius: var(--radius); border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden;
  background-color: #ebe8e1;
  background-image: radial-gradient(#d6d1c5 1px, transparent 1px);
  background-size: 16px 16px;
}
.ed-stage .canvas-container { box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 10px 30px rgba(28,27,24,.12); }

/* ---------- Admin ---------- */
.status { display: inline-block; padding: 1px 9px; border-radius: 4px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.st-active { background: var(--ok-soft); color: var(--ok); }
.st-suspended { background: var(--danger-soft); color: var(--danger); }

/* ---------- Auth & gate ---------- */
.auth { position: fixed; inset: 0; z-index: 150; display: grid; grid-template-columns: 420px 1fr; background: var(--bg); overflow-y: auto; }
.auth-side { background: var(--ink); color: #eae7df; padding: 40px; display: flex; flex-direction: column; gap: 22px; }
.auth-side .logo-mark { background: var(--panel); color: var(--ink); }
.auth-side .logo-tag { color: #a9a597; }
.auth-side h2 { font-size: 26px; margin-top: auto; color: #fff; }
.auth-side ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 10px; color: #cfcbc0; }
.auth-side li { padding-inline-start: 16px; position: relative; }
.auth-side li::before { content: ''; position: absolute; inset-inline-start: 0; top: .75em; width: 6px; height: 1px; background: #cfcbc0; }
.auth-side .pill { align-self: flex-start; color: #a9a597; }
.auth-main { display: grid; place-items: center; padding: 32px 18px; }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; }
.auth-card h2 { font-size: 22px; margin: 22px 0 18px; }
.auth-card .btn { width: 100%; }
.auth-tabs { display: flex; border-bottom: 1px solid var(--line-2); gap: 18px; }
.auth-tabs button { background: none; border: 0; padding: 8px 0; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.auth-tabs button.on { color: var(--ink); border-color: var(--ink); }
.auth-msg { padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; margin-bottom: 14px; background: var(--danger-soft); color: var(--danger); }
.auth-msg.ok { background: var(--ok-soft); color: var(--ok); }
.auth-links { display: flex; justify-content: center; margin-top: 16px; }
.gate { position: fixed; inset: 0; z-index: 160; background: var(--bg); display: grid; place-items: center; padding: 18px; }
.gate-card { max-width: 440px; text-align: center; display: flex; flex-direction: column; gap: 12px; padding: 32px; }
.gate-ico { font-size: 30px; }

/* ---------- Toasts / boot ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 300; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: var(--panel); padding: 9px 16px; border-radius: var(--radius-sm); font-weight: 500; font-size: 14px; transition: opacity .25s; }
.toast.error { background: var(--danger); color: #fff; }
.toast.out { opacity: 0; }
.boot { position: fixed; inset: 0; background: var(--bg); color: var(--ink-2); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; z-index: 400; transition: opacity .25s; }
.boot.hide { opacity: 0; pointer-events: none; }

/* ---------- Plan & usage ---------- */
a.logo { color: inherit; text-decoration: none; }
.sidebar { overflow-y: auto; }
.stats.four { grid-template-columns: repeat(4, 1fr); }
.side-usage { margin-top: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; cursor: pointer; font-size: 13px; display: flex; flex-direction: column; gap: 6px; }
.side-usage:hover { border-color: var(--line-2); }
.side-usage + .side-store { margin-top: 0; }
.su-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.su-top span { color: var(--muted); font-size: 12px; }
.su-top .su-warn, .su-warn { color: var(--warn); font-weight: 600; }
.su-sub { color: var(--muted); font-size: 12.5px; }
.su-link { color: var(--accent); font-weight: 600; font-size: 12.5px; }
.su-bar { height: 5px; border-radius: 99px; background: var(--sunken); overflow: hidden; }
.su-bar i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.su-bar i.full { background: var(--warn); }
.su-bar.big { height: 8px; margin-top: 16px; }
.local-note { font-size: 12px; color: var(--warn); background: var(--warn-soft); border-radius: var(--radius-sm); padding: 8px 10px; line-height: 1.5; }

.form-sec { margin: 22px 0 12px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.bp-contact { text-align: center; color: var(--bp1); font-size: 13px; font-weight: 600; min-height: 20px; margin-bottom: 8px; }
.check { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 14px; cursor: pointer; flex-wrap: wrap; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.check span { color: var(--muted); }

.acc-plan .ap-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.acc-plan h2 { font-size: 22px; }
.ap-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 18px; }
.ap-grid > div { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; }
.ap-grid span { color: var(--muted); font-size: 13px; }
.ap-grid small { color: var(--warn); font-weight: 600; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 3px; gap: 2px; background: var(--sunken); }
.seg button { border: 0; background: transparent; padding: 5px 14px; border-radius: 6px; cursor: pointer; color: var(--ink-2); font-weight: 500; font-size: 14px; }
.seg button.on { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.seg small { color: var(--accent); font-size: 11.5px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.plan-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 10px; position: relative; background: var(--panel); }
.plan-card.featured { border-color: var(--ink); }
.plan-card.chosen { box-shadow: 0 0 0 2px var(--accent); border-color: var(--accent); }
.plan-flag { position: absolute; top: -11px; inset-inline-start: 16px; background: var(--ink); color: var(--panel); font-size: 12px; font-weight: 600; padding: 1px 10px; border-radius: 4px; }
.plan-price { display: flex; align-items: baseline; gap: 6px; }
.plan-price b { font-size: 34px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.plan-price span { color: var(--muted); font-size: 14px; }
.plan-card .save { color: var(--accent); font-weight: 600; margin-top: -6px; }
.plan-card ul { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.plan-card li { padding-inline-start: 22px; position: relative; }
.plan-card li::before { content: ''; position: absolute; inset-inline-start: 2px; top: .55em; width: 10px; height: 5px; border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); transform: rotate(-45deg); }
.plan-card .btn { margin-top: auto; }
.pay-box { margin-top: 18px; border: 1px solid var(--line-2); border-radius: var(--radius); padding: 20px; background: var(--sunken); display: flex; flex-direction: column; gap: 12px; }
.pay-steps { margin: 0; padding-inline-start: 20px; display: flex; flex-direction: column; gap: 8px; }
.pay-ways { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.pay-way { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; display: flex; flex-direction: column; }
.pay-way span { font-size: 12px; color: var(--muted); }
.two-col.even { margin-top: 18px; }
a.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }

/* ---------- Onboarding & modal ---------- */
.onboard { position: fixed; inset: 0; z-index: 140; background: var(--bg); overflow-y: auto; display: grid; place-items: center; padding: 28px 16px; }
.onboard-card { width: 100%; max-width: 980px; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.ob-main { padding: 32px; display: flex; flex-direction: column; gap: 4px; }
.ob-main h1 { margin-bottom: 4px; }
.ob-main > .muted { margin-bottom: 18px; }
.ob-main .btn-lg { margin-top: 10px; align-self: flex-start; }
.ob-side { background: var(--sunken); padding: 32px; display: grid; place-items: center; border-inline-start: 1px solid var(--line); }
.ob-side .brand-preview { width: 100%; max-width: 320px; border-radius: var(--radius); padding: 20px; position: static; border: 1px solid var(--line); }
.drop.small { min-height: 88px; padding: 10px; }
.drop.small img { max-height: 64px; }
.ob-main .presets { margin-top: 8px; }
.ob-main .row.wrap > .grow, #view-brand .row.wrap > .grow { flex: 1 1 160px; }
.ob-main .presets .preset i { width: 18px; height: 22px; }
.modal { position: fixed; inset: 0; z-index: 170; background: rgba(28, 27, 24, .42); display: grid; place-items: center; padding: 18px; }
.modal-card { max-width: 440px; display: flex; flex-direction: column; gap: 12px; padding: 26px; }
.auth-note { color: #a9a597; font-size: 14px; }
.gate-card h2 { font-size: 20px; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) { .stats.four { grid-template-columns: repeat(2, 1fr); } .ap-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1100px) {
  .ed-body { grid-template-columns: 1fr; }
  .ed-panel { position: static; max-height: none; order: 2; }
  .ed-stage { height: 70vh; min-height: 380px; }
  .prod-layout { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; height: auto; z-index: 20; padding: 10px 12px; gap: 8px; border-inline-end: 0; border-bottom: 1px solid var(--line); }
  .logo-tag { display: none; }
  .nav { flex-direction: row; overflow-x: auto; gap: 2px; scrollbar-width: none; }
  .nav-item { flex: 0 0 auto; width: auto; padding: 7px 11px; font-size: 13.5px; }
  .nav-item.active::before { display: none; }
  .nav-item svg { width: 16px; height: 16px; }
  .side-store, .side-usage, .local-note { display: none; }
  .onboard-card { grid-template-columns: 1fr; }
  .ob-side { display: none; }
  .ob-main { padding: 22px 18px; }
  .stats.four { grid-template-columns: 1fr 1fr; }
  .side-account { position: absolute; top: 10px; inset-inline-end: 12px; border: 0; padding: 0; }
  .side-account .sa-info { display: none; }
  .main { padding: 18px 16px 50px; }
  .two-col, .stats, .steps { grid-template-columns: 1fr; }
  .brand-preview { position: static; }
  .auth { grid-template-columns: 1fr; }
  .auth-side { padding: 24px 18px; }
  .auth-side h2, .auth-side ul { display: none; }
}
@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .wiz-bar { flex-direction: column; align-items: stretch; }
  .wiz-bar .btn { width: 100%; }
  .ed-top-actions { margin-inline-start: 0; width: 100%; }
  .ed-top-actions .btn { flex: 1; }
  .ed-name { max-width: none; }
  .tool { min-width: 50px; padding: 6px; }
  .design-grid, .design-grid.big, .prod-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .ap-grid { grid-template-columns: 1fr; }
  .card-head { flex-wrap: wrap; gap: 10px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px -16px; }
}

/* =========================================================
   Theme v2: violet identity, dark sidebar, motion
   (kept as a layer on top of the base rules above)
   ========================================================= */
h1, h2, h3 { font-weight: 600; }
h1 { font-size: 28px; letter-spacing: -.2px; }
body { font-size: 15px; }
::selection { background: var(--accent-soft); color: var(--accent-2); }

/* Logo */
.logo-svg { width: 36px; height: 36px; flex-shrink: 0; stroke: none; }
.logo-svg.big { width: 52px; height: 52px; }
.logo-name { font: 600 17px var(--font); letter-spacing: 3px; direction: ltr; }

/* Sidebar: deep ink */
.sidebar { background: var(--ink); border-inline-end: 0; color: #d9d6f2; }
.sidebar .logo-name { color: #fff; }
.sidebar .logo-tag { color: #a39fcc; }
.nav-item { color: #bcb8e0; border-radius: 10px; transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease); }
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.nav-item.active { background: var(--accent); color: #fff; font-weight: 500; }
.nav-item.active::before { display: none; }
.nav-item[data-go="create"] { margin-top: 6px; }
.side-store, .side-usage { border-color: rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .04); color: #e7e5f8; }
.side-store:hover, .side-usage:hover { border-color: rgba(255, 255, 255, .22); }
.ss-sub, .su-top span, .su-sub { color: #a39fcc; }
.su-link { color: var(--amber); }
.su-bar { background: rgba(255, 255, 255, .1); }
.su-bar i { background: var(--amber); }
.side-account { border-top-color: rgba(255, 255, 255, .1); }
.sa-name { color: #fff; }
.sa-email { color: #a39fcc; }
.sa-out { background: transparent; border-color: rgba(255, 255, 255, .14); color: #bcb8e0; }
.local-note { background: rgba(255, 181, 71, .12); color: var(--amber); }

/* Surfaces */
.card { border-color: var(--line); box-shadow: var(--shadow); }
.d-card, .p-card, .tpl-card, .pp, .plat, .plan-card { box-shadow: var(--shadow); border-color: var(--line); }

/* Buttons */
.btn { border-radius: 10px; font-weight: 500; transition: background .18s var(--ease), border-color .18s var(--ease), color .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease); }
.btn:active:not(:disabled) { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--accent-2); box-shadow: 0 6px 18px rgba(75, 59, 214, .28); }
.btn-ghost { border-color: var(--line-2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.btn-ok { background: var(--accent); }
.btn-ok:hover { background: var(--accent-2); }
.link { color: var(--accent); }
.icon-btn { border-radius: 10px; transition: border-color .18s, color .18s; }
.icon-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }

/* Fields */
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input:not([type]), select, textarea { border-radius: 10px; transition: border-color .18s, box-shadow .18s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.drop:hover { border-color: var(--accent); color: var(--accent); }
input[type=range] { accent-color: var(--accent); }

/* Selection states */
.pp.active, .plat.active, .tpl-card.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent), var(--shadow); }
.chip { transition: all .18s var(--ease); }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.plat.active .plat-shape i { background: var(--accent); border-color: var(--accent); }
.toggle button.on, .seg button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.seg button.on { box-shadow: none; }
.auth-tabs button.on { color: var(--accent); border-color: var(--accent); }
.p-off { background: var(--accent); }
.p-bundle { color: var(--accent); }
.stat-ico { background: var(--accent-soft); color: var(--accent); }
.plan-card.featured { border-color: var(--accent); }
.plan-flag { background: var(--accent); }
.plan-card.chosen { box-shadow: 0 0 0 2px var(--accent); }
.plan-card li::before { border-color: var(--accent); }
.toast { background: var(--ink); border-radius: 12px; box-shadow: var(--shadow-lg); }

/* Hover lift on pickable cards */
.pp, .plat, .tpl-card, .d-card, .p-card, .stat.clickable { transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease); }
.pp:hover, .plat:hover, .tpl-card:hover, .d-card:hover, .p-card:hover, .stat.clickable:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

/* Auth & onboarding */
.auth-side { background: var(--ink); }
.auth-side .logo-tag, .auth-note { color: #a39fcc; }
.auth-side li::before { background: var(--amber); width: 8px; height: 2px; }
.ob-side { background: var(--accent-soft); }

/* Editor stage */
.ed-stage { background-color: #eeecf8; background-image: radial-gradient(#d9d4f1 1px, transparent 1px); }
.prop-head { background: var(--accent-soft); color: var(--accent); border: 0; border-radius: 6px; }

/* ---------- Motion ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.view.active { animation: rise .38s var(--ease) both; }
.view.active .card, .view.active .d-card, .view.active .p-card, .view.active .tpl-card, .view.active .stat { animation: rise .45s var(--ease) both; }
.view.active > :nth-child(2) { animation-delay: .04s; }
.view.active > :nth-child(3) { animation-delay: .08s; }
.view.active > :nth-child(4) { animation-delay: .12s; }
.view.active > :nth-child(5) { animation-delay: .16s; }
.view.active .stats > :nth-child(2), .view.active .design-grid > :nth-child(2), .view.active .prod-grid > :nth-child(2) { animation-delay: .05s; }
.view.active .stats > :nth-child(3), .view.active .design-grid > :nth-child(3), .view.active .prod-grid > :nth-child(3) { animation-delay: .1s; }
.view.active .stats > :nth-child(4), .view.active .design-grid > :nth-child(4), .view.active .prod-grid > :nth-child(4) { animation-delay: .15s; }
.toast { animation: slideUp .3s var(--ease) both; }
.modal-card, .gate-card, .onboard-card { animation: pop .3s var(--ease) both; }
.tpl-thumb img { animation: pop .35s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Create: steps + live preview ---------- */
.wiz-steps { display: flex; gap: 6px; margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.wiz-tab { flex: 1 0 auto; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; color: var(--muted); font-weight: 500; transition: all .2s var(--ease); }
.wiz-tab b { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--sunken); font-size: 12.5px; color: var(--ink-2); transition: all .2s var(--ease); }
.wiz-tab:hover { border-color: var(--line-2); color: var(--ink); }
.wiz-tab.on { border-color: var(--accent); color: var(--ink); box-shadow: 0 0 0 1px var(--accent); }
.wiz-tab.on b { background: var(--accent); color: #fff; }
.wiz-tab.done b { background: var(--amber); color: var(--ink); }
.wiz-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.wiz-layout .wiz-step { display: none; }
.wiz-layout .wiz-step.on { display: block; animation: rise .35s var(--ease) both; }
.wiz-layout .wiz-step + .wiz-step { margin-top: 0; }
.wiz-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.wiz-preview { position: sticky; top: 18px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.wp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wp-head h3 { margin: 0; display: flex; align-items: center; gap: 8px; }
.wp-live { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 0 rgba(34, 197, 94, .5); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .45); } 70% { box-shadow: 0 0 0 8px rgba(34, 197, 94, 0); } 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); } }
.wp-frame { background: var(--sunken); border-radius: 12px; display: grid; place-items: center; padding: 12px; min-height: 240px; position: relative; overflow: hidden; }
.wp-frame img { max-height: 52vh; width: auto; max-width: 100%; border-radius: 6px; box-shadow: var(--shadow-lg); transition: opacity .25s var(--ease); }
.wp-frame.busy img { opacity: .55; }
.wp-frame.busy::after { content: ''; position: absolute; top: 12px; inset-inline-end: 12px; width: 16px; height: 16px; border: 2px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.wiz-preview .wiz-summary { padding: 0; font-size: 13.5px; line-height: 1.7; }
.wiz-preview .btn-lg { width: 100%; }
.tpl-card { position: relative; }
.tpl-flag { position: absolute; top: 8px; inset-inline-start: 8px; background: var(--amber); color: var(--ink); font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 6px; z-index: 1; }
.hint { display: flex; gap: 8px; align-items: flex-start; background: var(--accent-soft); color: var(--accent-2); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-top: 12px; }
.promo-row { display: flex; gap: 8px; align-items: flex-end; }
.promo-row .field { flex: 1; margin-bottom: 0; }

/* ---------- Caption panel ---------- */
.cap-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cap-head h3 { margin: 0 !important; }
.cap-list { display: flex; flex-direction: column; gap: 10px; }
.cap-card { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--sunken); animation: rise .35s var(--ease) both; }
.cap-card:nth-child(2) { animation-delay: .06s; }
.cap-card:nth-child(3) { animation-delay: .12s; }
.cap-tag { font-size: 11.5px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border-radius: 6px; padding: 1px 8px; display: inline-block; margin-bottom: 6px; }
.cap-text { white-space: pre-wrap; font-size: 14px; line-height: 1.8; color: var(--ink); }
.cap-actions { display: flex; gap: 6px; margin-top: 8px; }
.cap-actions .btn { padding: 5px 12px; font-size: 13px; }
.cap-opts { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; font-size: 13.5px; }
.cap-opts label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.cap-opts input { accent-color: var(--accent); }
.tool.on { background: var(--accent-soft); color: var(--accent); }

@media (max-width: 1100px) {
  .wiz-layout { grid-template-columns: 1fr; }
  .wiz-preview { position: static; order: -1; }
  .wp-frame img { max-height: 40vh; }
}
@media (max-width: 900px) {
  .sidebar { background: var(--ink); }
  .nav-item[data-go="create"] { margin-top: 0; }
}
@media (max-width: 700px) {
  .wiz-preview { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; padding: 12px; }
  .wiz-preview .wp-head { grid-column: 1 / -1; }
  .wp-frame { min-height: 0; padding: 6px; grid-row: span 2; }
  .wp-frame img { max-height: 150px; }
  .wiz-preview .wiz-summary { font-size: 12.5px; }
  .wiz-preview .btn-lg { align-self: end; padding: 10px 14px; font-size: 15px; }
}
