/* All Design — shared styles for the home page and the editor */
:root {
  --primary: #2b5bd7;
  --primary-600: #2450c2;
  --primary-50: #eef3ff;
  --text: #111827;
  --text-2: #374151;
  --muted: #6b7280;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --ws: #eceef2;
  --danger: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .08);
  --font: 'Inter', 'Noto Sans Devanagari', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--text); background: var(--bg); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { flex: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ---------- primitives ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; font-weight: 500; white-space: nowrap; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn:hover { background: var(--bg-soft); border-color: var(--line-2); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-600); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--bg-soft); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: #fef2f2; border-color: #fecaca; }
.btn.lg { height: 44px; padding: 0 18px; font-size: 15px; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { display: flex; width: 100%; margin-top: 8px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-2); }
.icon-btn:hover:not(:disabled) { background: var(--bg-soft); }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn.active { background: var(--primary-50); color: var(--primary); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 6px 8px; border-radius: 6px; font-size: 13px; color: var(--text-2); }
.link-btn:hover { background: var(--bg-soft); }
.link { border: 0; background: none; color: var(--primary); font-weight: 600; padding: 0; }
.input { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; width: 100%; min-width: 0; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(43, 91, 215, .15); }
.input.sm { height: 30px; }
select.input { padding-right: 24px; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12.5px; margin: 8px 0; }
.hint.pad { padding: 0 16px; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: #111827; color: #fff; padding: 10px 16px; border-radius: 10px; font-weight: 500; opacity: 0; pointer-events: none; transition: .2s; z-index: 1000; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #3b6cf0, #2b5bd7); display: grid; place-items: center; box-shadow: 0 1px 2px rgba(43,91,215,.4); }
.fatal { position: fixed; inset: auto 20px 20px; padding: 16px; background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; border-radius: 10px; z-index: 2000; }

/* ---------- home ---------- */
body.home { background: #fff; }
.container { width: 100%; max-width: 880px; margin: 0 auto; padding: 0 20px; }
.site-head { border-bottom: 1px solid var(--line); background: #fff; position: sticky; top: 0; z-index: 10; }
.head-row { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.head-actions { display: flex; gap: 6px; }
.hero { display: grid; grid-template-columns: 1fr 380px; gap: 48px; align-items: center; padding: 56px 0 48px; }
.hero h1 { font-size: 40px; line-height: 1.15; letter-spacing: -.02em; margin: 0 0 14px; font-weight: 800; }
.hero p { color: var(--muted); font-size: 16px; margin: 0; max-width: 440px; }
.hero-card { border: 1px solid var(--line); border-radius: 14px; padding: 24px; box-shadow: var(--shadow); background: #fff; transition: .15s; }
.hero-card.drag { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(43,91,215,.15); }
.hc-icon { width: 44px; height: 44px; border-radius: 10px; background: var(--primary-50); color: var(--primary); display: grid; place-items: center; margin-bottom: 14px; }
.hc-icon svg { width: 22px; height: 22px; }
.hero-card h2 { font-size: 18px; margin: 0 0 6px; }
.hero-card p { color: var(--muted); margin: 0 0 18px; font-size: 13.5px; }
.hc-actions { display: grid; gap: 8px; }
.hc-actions .btn { width: 100%; }
.hero-card small { display: block; text-align: center; color: var(--muted); margin-top: 10px; font-size: 12px; }
.tools { padding-bottom: 56px; }
.sec-title { font-size: 20px; margin: 0 0 18px; }
.sec-label { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; }
.card-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tool-card { display: flex; gap: 12px; align-items: flex-start; padding: 16px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: .15s; min-height: 82px; }
.tool-card:hover { border-color: var(--line-2); box-shadow: var(--shadow); transform: translateY(-1px); }
.tool-card.custom { grid-column: span 2; }
.tool-card.custom:hover { transform: none; }
.tc-icon { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.tc-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.tc-text b { font-size: 13.5px; font-weight: 600; }
.tc-text small { color: var(--muted); font-size: 12px; }
.custom-row { display: flex; gap: 6px; align-items: center; margin-top: 4px; }
.custom-row .input { width: 84px; }
.tint-blue { background: #e8efff; color: #2b5bd7; } .tint-orange { background: #fff0e6; color: #ea580c; }
.tint-green { background: #e7f8ee; color: #16a34a; } .tint-teal { background: #e3f6f4; color: #0d9488; }
.tint-purple { background: #f3e8ff; color: #9333ea; } .tint-pink { background: #fde8f2; color: #db2777; }
.tint-indigo { background: #ebebff; color: #4f46e5; } .tint-red { background: #feecec; color: #dc2626; }
.tint-amber { background: #fff6dd; color: #d97706; } .tint-cyan { background: #e2f6fb; color: #0891b2; }
.tint-violet { background: #efe9ff; color: #7c3aed; } .tint-rose { background: #ffe9ec; color: #e11d48; }
.tint-slate { background: #eef1f5; color: #475569; }
.tpl-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.tpl-card { display: flex; flex-direction: column; gap: 8px; }
.tpl-card b { font-size: 13px; font-weight: 600; }
.tpl-thumb { aspect-ratio: 1; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); display: grid; place-items: center; overflow: hidden; padding: 10px; transition: .15s; }
.tpl-card:hover .tpl-thumb { box-shadow: var(--shadow); border-color: var(--line-2); }
.tpl-thumb canvas { max-width: 100%; max-height: 100%; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.design-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.design-card { position: relative; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; transition: .15s; }
.design-card:hover { box-shadow: var(--shadow); }
.dc-thumb { display: grid; place-items: center; aspect-ratio: 4/3; background: var(--bg-soft); padding: 10px; }
.dc-thumb img { max-width: 100%; max-height: 100%; border-radius: 3px; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
.dc-meta { padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.dc-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dc-meta small { color: var(--muted); font-size: 11.5px; }
.dc-del { position: absolute; top: 6px; right: 6px; background: #fff; box-shadow: var(--shadow); opacity: 0; }
.design-card:hover .dc-del, .dc-del:focus { opacity: 1; }
.empty { color: var(--muted); grid-column: 1 / -1; padding: 22px; border: 1px dashed var(--line-2); border-radius: 10px; text-align: center; margin: 0; }
.site-foot { border-top: 1px solid var(--line); background: var(--bg-soft); }
.foot-row { display: flex; justify-content: space-between; align-items: center; height: 54px; font-size: 12.5px; color: var(--muted); gap: 12px; }
.foot-safe { display: inline-flex; align-items: center; gap: 6px; }
.foot-safe svg { width: 15px; height: 15px; }
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 32px 0; }
  .hero h1 { font-size: 30px; }
  .card-grid, .tpl-cards, .design-grid { grid-template-columns: repeat(2, 1fr); }
  .tool-card.custom { grid-column: 1 / -1; }
}

/* ---------- editor layout ---------- */
body.editor { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; background: var(--ws); overscroll-behavior: none; }
.topbar { height: 56px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: #fff; border-bottom: 1px solid var(--line); z-index: 20; }
.topbar .brand b { font-size: 15px; }
.tb-group { display: flex; align-items: center; gap: 4px; }
.tb-group.right { margin-left: auto; gap: 8px; }
.tb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.tb-center { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; justify-content: center; }
.doc-name { border: 1px solid transparent; border-radius: 8px; height: 34px; padding: 0 10px; font-weight: 600; background: transparent; width: min(320px, 100%); text-align: center; text-overflow: ellipsis; }
.doc-name:hover { border-color: var(--line); }
.doc-name:focus { outline: none; border-color: var(--primary); background: #fff; text-align: left; }
.save-state { font-size: 12px; color: var(--muted); white-space: nowrap; }
.save-state[data-state="Saving…"] { color: #d97706; }
.save-state[data-state="Not saved"] { color: var(--danger); }
.workspace { flex: 1; display: flex; min-height: 0; }
.rail { width: 76px; flex: none; background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 8px 6px; gap: 2px; overflow-y: auto; z-index: 15; }
.rail-btn { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 9px 2px; border: 0; border-radius: 10px; background: none; font-size: 11px; color: var(--text-2); }
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover { background: var(--bg-soft); }
.rail-btn.active { background: var(--primary-50); color: var(--primary); font-weight: 600; }
.drawer { width: 320px; flex: none; background: #fff; border-right: 1px solid var(--line); display: none; flex-direction: column; min-height: 0; z-index: 14; }
body.drawer-open .drawer { display: flex; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 8px 18px; }
.drawer-head h3 { margin: 0; font-size: 16px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 4px 18px 24px; }
.drawer-body h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; font-weight: 600; }
.stage-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stage { position: relative; flex: 1; min-height: 0; overflow: hidden; touch-action: none; }
.stage.drop::after { content: ''; position: absolute; inset: 10px; border: 2px dashed var(--primary); border-radius: 12px; background: rgba(43,91,215,.05); pointer-events: none; }
#canvas { position: absolute; inset: 0; display: block; touch-action: none; }
#textEditor { position: absolute; display: none; margin: 0; padding: 0; border: 0; outline: 1.5px dashed rgba(43,91,215,.6); outline-offset: 2px; background: transparent; resize: none; overflow: hidden; white-space: pre-wrap; overflow-wrap: break-word; z-index: 5; transform-origin: center; }
.toolstrip { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; gap: 2px; background: #fff; padding: 5px; border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 6; }
.tool { width: 36px; height: 36px; display: grid; place-items: center; border: 0; background: none; border-radius: 8px; color: var(--text-2); }
.tool:hover { background: var(--bg-soft); }
.tool.active { background: var(--primary); color: #fff; }
.zoombar { position: absolute; right: 12px; bottom: 12px; display: flex; align-items: center; gap: 2px; background: #fff; border-radius: 10px; padding: 3px; box-shadow: var(--shadow-lg); z-index: 6; }
.zoom-label { border: 0; background: none; min-width: 56px; height: 32px; border-radius: 6px; font-weight: 600; font-size: 12.5px; }
.zoom-label:hover { background: var(--bg-soft); }
.pagesbar { flex: none; height: 92px; display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: #fff; border-top: 1px solid var(--line); overflow-x: auto; }
.pg { position: relative; flex: none; display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer; }
.pg-thumb { height: 56px; max-width: 120px; border-radius: 6px; border: 2px solid transparent; outline: 1px solid var(--line); overflow: hidden; background: #fff; display: grid; place-items: center; }
.pg-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pg.active .pg-thumb { border-color: var(--primary); outline-color: var(--primary); }
.pg span { font-size: 11px; color: var(--muted); }
.pg-acts { position: absolute; top: -2px; right: -4px; display: none; gap: 2px; background: #fff; border-radius: 6px; box-shadow: var(--shadow); padding: 2px; }
.pg:hover .pg-acts { display: flex; }
.pg-acts button { width: 22px; height: 22px; display: grid; place-items: center; border: 0; background: none; border-radius: 4px; font-size: 14px; color: var(--text-2); }
.pg-acts button:hover { background: var(--bg-soft); }
.pg-acts svg { width: 13px; height: 13px; }
.pg-add { flex: none; width: 56px; height: 56px; border-radius: 8px; border: 1.5px dashed var(--line-2); background: var(--bg-soft); display: grid; place-items: center; color: var(--muted); margin-bottom: 18px; }
.pg-add:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- panels ---------- */
.search { margin: 4px 0 4px; }
.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl { display: flex; flex-direction: column; gap: 6px; border: 0; background: none; padding: 0; text-align: left; font-size: 12px; font-weight: 500; }
.tpl canvas { width: 100%; aspect-ratio: 1; object-fit: contain; background: var(--bg-soft); border-radius: 8px; border: 1px solid var(--line); padding: 6px; transition: .15s; }
.tpl:hover canvas { border-color: var(--primary); }
.shape-grid, .icon-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.shape { aspect-ratio: 1; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); color: #334155; padding: 12px; transition: .12s; }
.shape:hover { border-color: var(--primary); background: var(--primary-50); color: var(--primary); }
.shape svg { width: 100%; height: 100%; fill: currentColor; }
.text-add { display: block; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--bg-soft); border-radius: 10px; padding: 12px 14px; margin-bottom: 8px; transition: .12s; }
.text-add:hover { border-color: var(--primary); background: var(--primary-50); }
.text-add.h1 { font-size: 22px; font-weight: 700; font-family: 'Poppins', var(--font); }
.text-add.h2 { font-size: 16px; font-weight: 600; font-family: 'Poppins', var(--font); }
.text-add.h3 { font-size: 13px; }
.style-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.text-style { height: 72px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); display: grid; place-items: center; overflow: hidden; padding: 4px; }
.text-style:hover { border-color: var(--primary); }
.text-style span { white-space: nowrap; line-height: 1.2; }
.asset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.asset { aspect-ratio: 1; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg-soft) repeating-conic-gradient(#eee 0 25%, #fff 0 50%) 0 0/16px 16px; }
.asset img { width: 100%; height: 100%; object-fit: cover; display: block; }
.asset:hover { outline: 2px solid var(--primary); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.swatches.big { grid-template-columns: repeat(6, 1fr); gap: 8px; }
.swatches.mini { grid-template-columns: repeat(8, 1fr); gap: 5px; margin-top: 8px; }
.sw { aspect-ratio: 1; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); padding: 0; position: relative; }
.swatches.big .sw { border-radius: 8px; }
.sw:hover { transform: scale(1.08); }
.sw.active { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary); }
.sw.custom { background: conic-gradient(red, yellow, lime, aqua, blue, magenta, red); overflow: hidden; cursor: pointer; }
.sw.custom input { opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.sw.transparent { background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0/10px 10px; }
.brush-preview { margin-top: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); padding: 6px; }
.brush-preview svg { width: 100%; height: 60px; display: block; }
.layers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.layer { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; user-select: none; }
.layer:hover { border-color: var(--line-2); }
.layer.sel { border-color: var(--primary); background: var(--primary-50); }
.layer.hidden .ly-name, .layer.hidden .ly-icon { opacity: .45; }
.layer.over { box-shadow: 0 -2px 0 var(--primary); }
.layer.dragging { opacity: .5; }
.ly-icon { color: var(--muted); display: grid; }
.ly-icon svg { width: 16px; height: 16px; }
.ly-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.ly-name em { color: var(--primary); font-style: normal; font-size: 11px; }
.ly-btn { width: 26px; height: 26px; display: grid; place-items: center; border: 0; background: none; border-radius: 6px; color: var(--muted); }
.ly-btn:hover { background: var(--bg-soft); color: var(--text); }
.ly-btn svg { width: 15px; height: 15px; }

/* ---------- properties ---------- */
.props { width: 288px; flex: none; background: #fff; border-left: 1px solid var(--line); overflow-y: auto; z-index: 14; }
.props-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 16px 16px 8px; position: sticky; top: 0; background: #fff; z-index: 2; }
.props-head b { font-size: 15px; }
.props-head .muted { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.psec { border-bottom: 1px solid var(--line); }
.psec details > summary { list-style: none; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; font-weight: 600; font-size: 13px; cursor: pointer; user-select: none; }
.psec details > summary::-webkit-details-marker { display: none; }
.psec details > summary::after { content: ''; width: 8px; height: 8px; border-right: 1.8px solid var(--muted); border-bottom: 1.8px solid var(--muted); transform: rotate(45deg); margin: -4px 4px 0 auto; transition: .15s; }
.psec details[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
.psec details > summary .switch-wrap { margin-left: auto; margin-right: 10px; }
.psec-body { padding: 0 16px 14px; display: flex; flex-direction: column; gap: 10px; }
.psec-body:empty { display: none; }
.psec h5 { margin: 4px 0 -2px; font-size: 11.5px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > span { font-size: 12px; color: var(--muted); font-weight: 500; }
.field.num { position: relative; }
.field.num i { position: absolute; right: 9px; bottom: 8px; font-style: normal; color: var(--muted); font-size: 12px; pointer-events: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; }
.range { display: flex; align-items: center; gap: 8px; }
.range input[type=range] { flex: 1; min-width: 0; accent-color: var(--primary); height: 20px; }
.range .out, .range output { width: 64px; flex: none; text-align: right; }
.range output { font-size: 12px; color: var(--muted); width: 32px; }
.range .out { height: 30px; padding: 0 6px; text-align: center; }
.color-row { display: flex; gap: 8px; }
.sw-input { width: 34px; height: 34px; flex: none; border-radius: 8px; border: 1px solid var(--line); overflow: hidden; position: relative; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0/10px 10px; }
.sw-input input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); border: 0; padding: 0; cursor: pointer; }
.hex { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; font-size: 12.5px; }
.seg { display: flex; gap: 2px; padding: 3px; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 9px; flex-wrap: wrap; }
.seg.wide > * { flex: 1; }
.seg button { height: 30px; min-width: 30px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 0; background: none; border-radius: 6px; color: var(--text-2); font-size: 12px; padding: 0 6px; }
.seg button:hover { background: #fff; }
.seg button.active { background: #fff; color: var(--primary); box-shadow: var(--shadow); }
.seg .icon-btn { width: auto; height: 30px; }
.chip { width: 16px; height: 16px; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); }
.chip.solid { background: #2b5bd7; } .chip.lin { background: linear-gradient(90deg, #2b5bd7, #ec4899); } .chip.rad { background: radial-gradient(#fde047, #ef4444); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); margin: 0; }
.check.slim { height: 34px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row.pad { padding: 14px 16px 24px; }
.btn-row .btn { flex: 1 1 auto; }
.btn-col { display: flex; flex-direction: column; gap: 8px; }
.btn-col .btn { justify-content: flex-start; }
.font-btn { display: flex; align-items: center; justify-content: space-between; text-align: left; font-size: 15px; cursor: pointer; }
.filter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.filter-chip { height: 30px; border-radius: 7px; border: 1px solid var(--line); background: var(--bg-soft); font-size: 11.5px; padding: 0 2px; }
.filter-chip:hover { border-color: var(--line-2); }
.filter-chip.active { border-color: var(--primary); color: var(--primary); background: var(--primary-50); font-weight: 600; }
.note { display: flex; align-items: center; gap: 8px; margin: 0 16px 10px; padding: 8px 10px; background: #fffbeb; border: 1px solid #fde68a; border-radius: 8px; font-size: 12.5px; }
.note span { flex: 1; }
.note svg { width: 15px; height: 15px; }

/* ---------- menus, popovers, modals ---------- */
.menu, .popover { position: fixed; z-index: 500; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 220px; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; background: none; border-radius: 7px; text-align: left; font-size: 13px; }
.menu-item:hover:not(:disabled) { background: var(--bg-soft); }
.menu-item:disabled { opacity: .4; }
.menu-item span { flex: 1; }
.menu-item svg { width: 16px; height: 16px; color: var(--muted); }
.mi-pad { width: 16px; flex: none !important; }
kbd { font-family: var(--font); font-size: 11px; color: var(--muted); background: var(--bg-soft); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.menu kbd { background: none; border: 0; padding: 0; }
.font-pop { width: 280px; padding: 8px; }
.font-list { max-height: 360px; overflow-y: auto; margin-top: 6px; }
.font-list h6 { margin: 10px 6px 4px; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: .05em; font-family: var(--font); }
.font-item { width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 6px; font-size: 16px; display: flex; justify-content: space-between; }
.font-item span { color: var(--muted); font-size: 14px; }
.font-item:hover { background: var(--bg-soft); }
.font-item.active { background: var(--primary-50); color: var(--primary); }
.modal-wrap { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: grid; place-items: center; z-index: 600; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg); width: min(560px, 100%); max-height: calc(100dvh - 32px); overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.modal.sm { width: min(440px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.preset-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; max-height: 300px; overflow-y: auto; }
.preset { display: grid; grid-template-columns: 28px 1fr; grid-template-rows: auto auto; column-gap: 10px; align-items: center; text-align: left; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 8px 10px; }
.preset:hover { border-color: var(--line-2); }
.preset.active { border-color: var(--primary); background: var(--primary-50); }
.preset b { font-size: 12.5px; font-weight: 600; }
.preset .muted { font-size: 11.5px; grid-column: 2; }
.pr-box { grid-row: span 2; max-width: 24px; max-height: 24px; width: 24px; border: 1.5px solid var(--muted); border-radius: 3px; justify-self: center; }
.kbd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.kbd-table td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.kbd-table td:first-child { width: 44%; }

/* ---------- responsive editor ---------- */
@media (max-width: 1100px) { .props { width: 260px; } .drawer { width: 290px; } }
@media (max-width: 900px) {
  .topbar { padding: 0 8px; gap: 4px; }
  .topbar .brand b, .hide-sm, .save-state { display: none; }
  .doc-name { width: 100%; }
  .btn#btnExport span { display: none; }
  .btn#btnExport { padding: 0 10px; }
  .workspace { flex-direction: column; position: relative; }
  .rail { order: 3; width: 100%; height: 62px; flex-direction: row; border-right: 0; border-top: 1px solid var(--line); padding: 4px; overflow-x: auto; overflow-y: hidden; }
  .rail-btn { flex: 1 0 64px; padding: 6px 2px; }
  .drawer { position: absolute; left: 0; right: 0; width: auto; bottom: 62px; height: 52%; border-right: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg); z-index: 30; }
  .stage-wrap { order: 1; }
  .pagesbar { height: 70px; padding: 6px 10px; }
  .pg-thumb { height: 42px; }
  .pg-add { width: 42px; height: 42px; }
  .props { display: none; position: absolute; left: 0; right: 0; bottom: 62px; width: auto; max-height: 46%; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: var(--shadow-lg); z-index: 29; }
  body.has-selection:not(.drawer-open) .props { display: block; }
  .toolstrip { flex-direction: row; top: 8px; left: 50%; transform: translateX(-50%); }
  .zoombar { bottom: 8px; right: 8px; }
}

/* ---------- v2: gradient editor, pathfinder, layers, AI, rulers, mobile ---------- */
.grad-ed { display: flex; flex-direction: column; gap: 8px; }
.grad-bar { position: relative; height: 26px; border-radius: 7px; margin: 4px 7px 14px; cursor: copy; touch-action: none;
  background: var(--g), repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0/10px 10px; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.gstop { position: absolute; top: 18px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; padding: 0; border: 2px solid #fff; background: var(--c); box-shadow: 0 0 0 1px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.3); cursor: grab; touch-action: none; }
.gstop::before { content: ''; position: absolute; left: 50%; top: -8px; width: 2px; height: 7px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); }
.gstop.active { box-shadow: 0 0 0 2px var(--primary), 0 1px 3px rgba(0,0,0,.3); transform: scale(1.15); }
.grad-row { display: flex; gap: 6px; align-items: center; }
.grad-row .hex { flex: 1; }
.grad-row .loc { position: relative; width: 66px; flex: none; }
.grad-row .loc i { position: absolute; right: 8px; top: 8px; font-style: normal; color: var(--muted); font-size: 12px; }
.grad-acts { display: flex; gap: 6px; flex-wrap: wrap; }
.grad-acts .btn { flex: 1 1 auto; padding: 0 8px; }
.hint.tiny { font-size: 11.5px; margin: 0; }
.color-row .icon-btn { flex: none; border: 1px solid var(--line); }
.pf-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pf { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg-soft); font-size: 10.5px; line-height: 1.2; text-align: center; color: var(--text-2); }
.pf:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-50); }
.pf svg { width: 22px; height: 22px; }
.pad-x { padding: 4px 16px 0; }
.qr-row { display: flex; gap: 8px; }
.ly-grip { display: grid; color: #9ca3af; cursor: grab; touch-action: none; margin-left: -4px; padding: 4px 0; }
.ly-grip svg { width: 14px; height: 14px; }
.layer.dragging { opacity: .85; box-shadow: var(--shadow-lg); position: relative; z-index: 3; cursor: grabbing; }
.layer.over { box-shadow: 0 -2px 0 var(--primary); }
.layer.over-below { box-shadow: 0 2px 0 var(--primary); }
.layer .ly-btn[data-ly=up], .layer .ly-btn[data-ly=down] { display: none; }
.layer:hover .ly-btn[data-ly=up], .layer:hover .ly-btn[data-ly=down], .layer.sel .ly-btn[data-ly=up], .layer.sel .ly-btn[data-ly=down] { display: grid; }
.ai-tabs { margin-bottom: 12px; }
.ai-prompt { height: auto; padding: 10px; resize: vertical; line-height: 1.4; }
section[data-aipane] { display: flex; flex-direction: column; gap: 10px; }
section[data-aipane][hidden] { display: none; }
.ai-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn { border: 1px solid var(--line); background: var(--bg-soft); border-radius: 999px; padding: 5px 10px; font-size: 12px; }
.chip-btn:hover { border-color: var(--primary); color: var(--primary); }
.chip-btn:disabled { opacity: .5; }
.ai-res { position: relative; }
.ai-res .asset { width: 100%; }
.ai-bg { position: absolute; right: 6px; bottom: 6px; width: 28px; height: 28px; display: grid; place-items: center; border: 0; border-radius: 7px; background: rgba(255,255,255,.92); box-shadow: var(--shadow); }
.ai-bg svg { width: 15px; height: 15px; }
.ai-out { display: flex; flex-direction: column; gap: 6px; }
.ai-out h4 { margin: 8px 0 0 !important; }
.ai-line { text-align: left; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 8px 10px; font-size: 13px; }
.ai-line.heading { font-weight: 700; font-size: 14px; }
.ai-line:hover { border-color: var(--primary); background: var(--primary-50); }
.ai-settings { margin-top: 18px; border-top: 1px solid var(--line); padding-top: 10px; }
.ai-settings summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--muted); }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ''; position: absolute; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.props-close { display: none; margin-left: 4px; }
body.rulers .toolstrip { left: 30px; top: 30px; }
@media (max-width: 900px) {
  .props-close { display: inline-grid; }
  .props-head { align-items: center; }
  .props-head .muted { flex: 1; text-align: right; }
  .toolstrip { max-width: calc(100% - 16px); overflow-x: auto; }
  .tool { flex: none; }
  body.rulers .toolstrip { left: 50%; top: 28px; }
  .ly-grip svg { width: 18px; height: 18px; }
  .layer .ly-btn[data-ly=up], .layer .ly-btn[data-ly=down] { display: grid; }
  .gstop { width: 22px; height: 22px; margin-left: -11px; }
}
