:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --text: #0f172a;
  --muted: #5b6478;
  --line: #e3e7f0;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --accent: #06b6d4;
  --ok: #059669;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 20px 50px rgba(30, 27, 75, .18);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .5em; }
h1 { font-size: clamp(2rem, 4.6vw, 3.4rem); font-weight: 800; }
h2 { font-size: 1.6rem; font-weight: 750; }
h3 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.grow { flex: 1; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }
.hidden { display: none !important; }

/* nav */
.nav { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.nav .container { display: flex; align-items: center; gap: 24px; height: 62px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; color: var(--text); }
.logo:hover { text-decoration: none; }
.logo-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-2) 60%, var(--accent)); display: grid; place-items: center; color: #fff; font-size: .85rem; box-shadow: 0 4px 12px rgba(79,70,229,.35); }
.nav-links { display: flex; gap: 18px; }
.nav-links a { color: var(--muted); font-weight: 550; }
.nav-links a.active, .nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-right { margin-left: auto; display: flex; gap: 10px; align-items: center; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 9px 16px; border-radius: 10px; font: inherit; font-weight: 600; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: #c9cfe0; box-shadow: var(--shadow); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border: 0; box-shadow: 0 6px 18px rgba(79,70,229,.3); }
.btn-primary:hover { box-shadow: 0 10px 26px rgba(79,70,229,.4); transform: translateY(-1px); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { color: var(--err); }
.btn-lg { padding: 13px 24px; font-size: 1.02rem; border-radius: 12px; }
.btn-sm { padding: 6px 11px; font-size: .85rem; border-radius: 8px; }
.icon-btn { width: 30px; height: 30px; padding: 0; border-radius: 8px; }

/* cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 650; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: #e7f8f1; color: var(--ok); }
.badge.warn { background: #fff4e0; color: var(--warn); }
.badge.err { background: #fde8e8; color: var(--err); }
.badge.brand { background: #eef0ff; color: var(--brand); }

/* forms */
label { font-weight: 600; font-size: .9rem; display: block; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; transition: .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 4px rgba(79,70,229,.12); }
textarea { resize: vertical; min-height: 90px; }
.field { margin-bottom: 16px; }
.field .help { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.errorlist { list-style: none; padding: 0; margin: 4px 0 0; color: var(--err); font-size: .85rem; }
.dropzone { border: 2px dashed #cfd5e6; border-radius: 12px; padding: 22px; text-align: center; background: var(--surface-2); cursor: pointer; transition: .15s; }
.dropzone:hover, .dropzone.drag { border-color: var(--brand); background: #f3f2ff; }
.dropzone input { display: none; }
.file-list { font-size: .85rem; color: var(--muted); margin-top: 8px; }
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 550; }
.toggle input { width: 18px; height: 18px; accent-color: var(--brand); }

/* messages */
.flash { padding: 12px 16px; border-radius: 10px; margin: 16px 0; background: #eef0ff; color: #312e81; }
.flash.error { background: #fde8e8; color: #991b1b; }
.flash.success { background: #e7f8f1; color: #065f46; }

/* hero */
.hero { position: relative; overflow: hidden; padding: 84px 0 64px; background: radial-gradient(1100px 500px at 85% -10%, rgba(124,58,237,.18), transparent 60%), radial-gradient(900px 500px at -10% 20%, rgba(6,182,212,.14), transparent 60%); }
.hero .eyebrow { display: inline-flex; gap: 8px; align-items: center; padding: 6px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: .82rem; font-weight: 650; color: var(--brand); margin-bottom: 20px; }
.hero h1 .grad { background: linear-gradient(120deg, var(--brand), var(--brand-2) 50%, var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: 1.2rem; color: var(--muted); max-width: 640px; }
.quickstart { margin-top: 30px; display: flex; gap: 10px; max-width: 720px; background: #fff; padding: 8px; border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.quickstart input { border: 0; font-size: 1.05rem; padding: 12px 14px; box-shadow: none !important; }
.hero-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero-art { position: relative; height: 380px; }
.hero-art .slide { position: absolute; width: 78%; border-radius: 12px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); background: #fff; overflow: hidden; transition: .4s; }
.hero-art .slide:nth-child(1) { top: 0; right: 0; transform: rotate(3deg); }
.hero-art .slide:nth-child(2) { top: 90px; left: 0; transform: rotate(-3deg); z-index: 2; }
.hero-art .slide:nth-child(3) { top: 200px; right: 8%; transform: rotate(1deg); z-index: 3; }
.hero-art:hover .slide:nth-child(1) { transform: rotate(5deg) translateY(-8px); }
.hero-art:hover .slide:nth-child(3) { transform: rotate(-1deg) translateY(8px); }
.section { padding: 64px 0; }
.section-title { text-align: center; max-width: 680px; margin: 0 auto 36px; }
.entry-card { padding: 26px; display: flex; flex-direction: column; gap: 10px; transition: .2s; color: var(--text); }
.entry-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); text-decoration: none; }
.entry-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.4rem; background: #eef0ff; }
.feature { padding: 22px; }
.feature .entry-icon { margin-bottom: 10px; }
.steps { counter-reset: step; }
.entry-grid, .steps.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 860px) { .entry-grid, .steps.grid-3 { grid-template-columns: 1fr; } }
.step { position: relative; padding: 22px 22px 22px 70px; }
.step::before { counter-increment: step; content: counter(step); position: absolute; left: 22px; top: 22px; width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; display: grid; place-items: center; font-weight: 800; }
.cta { background: linear-gradient(135deg, #1e1b4b, #4c1d95 60%, #0e7490); color: #fff; border-radius: 22px; padding: 46px; text-align: center; }
.cta .muted { color: #c7d2fe; }
footer.foot { padding: 30px 0 40px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); margin-top: 40px; }

/* designs */
.design-card { overflow: hidden; cursor: pointer; transition: .15s; position: relative; }
.design-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.design-card input { position: absolute; opacity: 0; }
.design-card .thumbs { display: grid; grid-template-columns: 1fr; aspect-ratio: 16/9; background: var(--surface-2); position: relative; }
.design-card .thumbs img { width: 100%; height: 100%; object-fit: cover; }
.design-card .thumbs img.second { position: absolute; inset: 0; opacity: 0; transition: .3s; }
.design-card:hover .thumbs img.second { opacity: 1; }
.design-card .meta { padding: 12px 14px; }
.design-card.selected, .design-card:has(input:checked) { outline: 3px solid var(--brand); outline-offset: -1px; }
.swatches { display: flex; gap: 4px; margin-top: 6px; }
.swatches span { width: 18px; height: 18px; border-radius: 5px; border: 1px solid rgba(0,0,0,.08); }
.swatch-thumb { display: flex; height: 100%; align-items: stretch; }
.swatch-thumb span { flex: 1; }

/* wizard */
.mode-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 24px; }
.mode-tab { padding: 18px; cursor: pointer; border: 2px solid var(--line); transition: .15s; }
.mode-tab:hover { border-color: #c7cbe0; }
.mode-tab.active { border-color: var(--brand); background: #f6f5ff; }
.mode-tab input { display: none; }
.wizard { display: grid; grid-template-columns: 1fr 340px; gap: 22px; align-items: start; }
.panel-title { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.range-out { font-weight: 800; color: var(--brand); }

/* dashboard */
.deck-card { overflow: hidden; display: flex; flex-direction: column; }
.deck-card .thumb { aspect-ratio: 16/9; background: linear-gradient(135deg, #eef0ff, #e0f7fb); display: grid; place-items: center; color: var(--muted); border-bottom: 1px solid var(--line); }
.deck-card .thumb img { width: 100%; height: 100%; object-fit: contain; }
.deck-card .body { padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.deck-card .title { font-weight: 700; color: var(--text); }
.stat { padding: 18px; }
.stat .num { font-size: 1.7rem; font-weight: 800; }
table.list { width: 100%; border-collapse: collapse; }
table.list td, table.list th { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: .9rem; }
table.list th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }

/* editor */
body.editor-page { overflow: hidden; }
.editor { display: flex; flex-direction: column; height: calc(100vh - 62px); }
.editor-top { display: flex; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fff; }
.editor-top input.title-input { border: 1px solid transparent; font-weight: 750; font-size: 1.05rem; max-width: 420px; padding: 6px 8px; }
.editor-top input.title-input:hover { border-color: var(--line); }
.editor-body { flex: 1; display: grid; grid-template-columns: 220px 1fr 380px; min-height: 0; }
.slides-col { overflow-y: auto; padding: 14px 12px; background: #fff; border-right: 1px solid var(--line); }
.slide-item { position: relative; margin-bottom: 12px; cursor: pointer; display: flex; gap: 8px; }
.slide-item .num { font-size: .75rem; color: var(--muted); width: 18px; padding-top: 2px; text-align: right; }
.slide-item .frame { flex: 1; border-radius: 8px; overflow: hidden; border: 2px solid var(--line); background: var(--surface-2); aspect-ratio: 16/9; transition: .12s; }
.slide-item .frame img { width: 100%; height: 100%; object-fit: contain; }
.slide-item .frame .ph { padding: 8px; font-size: .72rem; color: var(--muted); }
.slide-item.active .frame { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.slide-item .tools { position: absolute; right: 4px; top: 4px; display: none; gap: 3px; }
.slide-item:hover .tools { display: flex; }
.slide-item .tools button { width: 24px; height: 24px; border-radius: 6px; border: 0; background: rgba(15,23,42,.75); color: #fff; cursor: pointer; font-size: .75rem; }
.stage { overflow: auto; padding: 26px; display: flex; flex-direction: column; align-items: center; gap: 14px; background: radial-gradient(800px 400px at 50% 0%, #eef0ff, transparent 70%), var(--bg); }
.stage-frame { width: 100%; max-width: 980px; max-height: calc(100vh - 260px); aspect-ratio: 16/9; margin: 0 auto; border-radius: 12px; overflow: hidden; background: #fff; box-shadow: var(--shadow-lg); position: relative; }
.stage-frame img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.stage-nav { display: flex; gap: 10px; align-items: center; color: var(--muted); }
.stage-info { width: 100%; max-width: 980px; }
.notes { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: .88rem; color: var(--muted); }
.warnings { background: #fff8eb; border: 1px solid #fde3b0; border-radius: 10px; padding: 10px 14px; font-size: .85rem; color: #92400e; }
.warnings ul { margin: 4px 0 0; padding-left: 18px; }
.processing { position: absolute; inset: 0; background: rgba(255,255,255,.82); backdrop-filter: blur(2px); display: grid; place-items: center; z-index: 5; text-align: center; }
.spinner { width: 42px; height: 42px; border-radius: 50%; border: 4px solid #e0e3f5; border-top-color: var(--brand); animation: spin 1s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.chat-col { display: flex; flex-direction: column; background: #fff; border-left: 1px solid var(--line); min-height: 0; }
.chat-head { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.chat-log { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 92%; padding: 10px 13px; border-radius: 14px; font-size: .9rem; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; border-bottom-right-radius: 4px; }
.msg.assistant { align-self: flex-start; background: var(--surface-2); border-bottom-left-radius: 4px; }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-size: .78rem; padding: 2px 8px; }
.msg .meta { display: block; font-size: .7rem; opacity: .7; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 16px 10px; }
.chip { font-size: .78rem; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--text); }
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chat-input { border-top: 1px solid var(--line); padding: 12px; display: flex; gap: 8px; align-items: flex-end; }
.chat-input textarea { min-height: 46px; max-height: 160px; resize: none; }
.dropdown { position: relative; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 260px; z-index: 40; max-height: 60vh; overflow-y: auto; }
.dropdown-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 8px; font: inherit; cursor: pointer; }
.dropdown-menu button:hover { background: var(--surface-2); }
.typing { display: inline-flex; gap: 4px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .2; } 40% { opacity: 1; } }

/* auth */
.auth-wrap { min-height: calc(100vh - 62px); display: grid; place-items: center; padding: 40px 20px; background: radial-gradient(900px 400px at 80% 0%, rgba(124,58,237,.12), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; padding: 32px; }

@media (max-width: 1100px) {
  .editor-body { grid-template-columns: 160px 1fr 320px; }
  .wizard { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .mode-tabs { grid-template-columns: 1fr; }
  body.editor-page { overflow: auto; }
  .editor-body { grid-template-columns: 1fr; }
  .slides-col { display: flex; gap: 8px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .slide-item { min-width: 140px; }
  .chat-col { height: 70vh; }
  .nav-links { display: none; }
}
