/* ───────── Atelier de vizită — stil ───────── */
:root {
  --font-ui: 'Instrument Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Bricolage Grotesque', 'Instrument Sans', system-ui, sans-serif;
  --r-lg: 16px; --r: 10px; --r-sm: 7px;
  --topbar-h: 54px;
  color-scheme: light;
}
[data-theme='light'] {
  --bg: #edeff2; --surface: #fff; --surface-2: #f5f6f8; --ink: #0f141b; --ink-2: #4b5563; --ink-3: #78838f;
  --line: #dce0e6; --line-2: #c8ced8; --accent: #cc0074; --accent-ink: #fff; --accent-soft: #fde6f2; --accent-line: #f3b4d6;
  --mat: #cbd4dd; --mat-major: rgba(255,255,255,.6); --mat-minor: rgba(255,255,255,.24);
  --shadow-card: 0 2px 0 rgba(15,20,27,.14), 0 26px 38px -16px rgba(15,20,27,.5);
  --ok: #08774b; --ok-soft: #dff5ea; --warn: #a8480a; --warn-soft: #fdf0dc; --err: #b81f2a; --err-soft: #fde4e6;
}
[data-theme='dark'] {
  color-scheme: dark;
  --bg: #0b1017; --surface: #121921; --surface-2: #18212c; --ink: #e9eef4; --ink-2: #a3afbd; --ink-3: #6e7b8a;
  --line: #233040; --line-2: #2e3d51; --accent: #ff3fa4; --accent-ink: #1a0612; --accent-soft: #3a1429; --accent-line: #6b2750;
  --mat: #16202b; --mat-major: rgba(255,255,255,.085); --mat-minor: rgba(255,255,255,.032);
  --shadow-card: 0 0 0 1px rgba(255,255,255,.07), 0 28px 44px -16px rgba(0,0,0,.85);
  --ok: #3dd598; --ok-soft: #10301f; --warn: #f5a13d; --warn-soft: #382710; --err: #ff6b73; --err-soft: #3a1519;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 400 14px/1.45 var(--font-ui); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.015em; font-weight: 700; }
p { margin: 0; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.grow { flex: 1 1 auto; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; line-height: 1.45; }
.icon { flex: none; }
.spin { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } }

/* ───────── butoane ───────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--ink-3); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: var(--accent); filter: brightness(1.1); border-color: var(--accent); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger-text { color: var(--err); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.wide { width: 100%; height: 44px; font-size: 15px; }
.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--ink-2); text-decoration: none; transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--err); background: var(--err-soft); }

/* ───────── câmpuri ───────── */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.input { width: 100%; height: 40px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); transition: border-color .15s, box-shadow .15s; }
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.4; }
.input::placeholder { color: var(--ink-3); }
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mono { font-variant-numeric: tabular-nums; letter-spacing: .02em; text-transform: lowercase; }
.field-msg { font-size: 12px; color: var(--ink-3); }
.field-msg.err { color: var(--err); font-weight: 500; }
.has-error .input { border-color: var(--err); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 460px) { .row2 { grid-template-columns: 1fr; } }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); }
.seg button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 13px; transition: background .15s, color .15s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 0 0 1px var(--line); }
[data-theme='dark'] .seg button.on { background: var(--line-2); box-shadow: none; }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; font-weight: 500; user-select: none; }
.toggle.disabled { opacity: .5; cursor: not-allowed; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle-track { width: 32px; height: 18px; border-radius: 99px; background: var(--line-2); position: relative; transition: background .2s; flex: none; }
.toggle-thumb { position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.toggle input:checked + .toggle-track { background: var(--accent); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(14px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ───────── shell ───────── */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.shell.is-editor { height: 100dvh; }
.shell-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.topbar { height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 8px; padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: inline-flex; align-items: center; gap: 11px; font: 700 17px var(--font-display); letter-spacing: -.02em; text-decoration: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.08; }
.brand-text b { font: 700 16px var(--font-display); letter-spacing: -.02em; }
.brand-text small { font: 600 11.5px var(--font-ui); letter-spacing: .02em; color: var(--accent); }
.brand.big .brand-text b { font-size: 21px; }
.brand.big .brand-text small { font-size: 13px; }
.regmark { color: var(--ink); }
.user { display: flex; align-items: center; gap: 4px; padding-left: 10px; margin-left: 6px; border-left: 1px solid var(--line); }
.user-name { font-size: 13px; font-weight: 500; color: var(--ink-2); }
@media (max-width: 560px) { .user-name { display: none; } .topbar { padding: 0 12px; } }
.page-center { flex: 1; display: grid; place-items: center; padding: 40px; }
.loader { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: spin .8s linear infinite; }

/* ───────── login ───────── */
.login { min-height: 100dvh; display: grid; grid-template-columns: minmax(360px, 520px) 1fr; }
.login-form { padding: clamp(28px, 6vw, 64px); display: flex; flex-direction: column; justify-content: center; gap: 18px; background: var(--surface); }
.login-form .brand { margin-bottom: 28px; }
.login-form h1 { font-size: clamp(32px, 4.2vw, 46px); line-height: 1.02; max-width: 12ch; text-wrap: balance; }
.lead { color: var(--ink-2); max-width: 44ch; font-size: 15.5px; line-height: 1.55; }
.login-fields { display: flex; flex-direction: column; gap: 14px; margin-top: 10px; max-width: 380px; }
.banner { padding: 10px 12px; border-radius: 8px; font-size: 13.5px; }
.banner.err { background: var(--err-soft); color: var(--err); font-weight: 500; }
.login-art { position: relative; overflow: hidden; display: grid; place-items: center; min-height: 360px; border-left: 1px solid var(--line); }
.fan { position: absolute; margin: 0; width: min(56%, 440px); aspect-ratio: 85/55; border-radius: 2px; box-shadow: var(--shadow-card); background: #fff; }
.fan img { width: 100%; height: 100%; display: block; }
.fan-0 { transform: translate(-16%, -52%) rotate(-7deg); }
.fan-1 { transform: translate(10%, -16%) rotate(4deg); z-index: 1; }
.fan-2 { transform: translate(-22%, 30%) rotate(-3deg); z-index: 2; }
.fan-3 { transform: translate(16%, 62%) rotate(8deg); z-index: 3; }
.crop { position: absolute; width: 40px; height: 40px; fill: none; stroke: var(--ink-3); stroke-width: 1; }
.crop-tl { left: 28px; top: 28px; } .crop-br { right: 28px; bottom: 28px; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login-art { display: none; } .login-form { min-height: 100dvh; } }

/* ───────── mat (suprafața de lucru) ───────── */
.mat {
  position: relative; overflow: hidden; background-color: var(--mat);
  --ox: 50%; --oy: 50%;
  background-image:
    linear-gradient(var(--mat-major) 1px, transparent 1px), linear-gradient(90deg, var(--mat-major) 1px, transparent 1px),
    linear-gradient(var(--mat-minor) 1px, transparent 1px), linear-gradient(90deg, var(--mat-minor) 1px, transparent 1px);
  background-size: calc(var(--mm) * 10) calc(var(--mm) * 10), calc(var(--mm) * 10) calc(var(--mm) * 10), calc(var(--mm) * 2) calc(var(--mm) * 2), calc(var(--mm) * 2) calc(var(--mm) * 2);
  background-position: var(--ox) var(--oy);
}
.login-art.mat { --mm: 9px; }
.mat-legend { position: absolute; left: 14px; bottom: 10px; display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-2); opacity: .9; }
.mat-legend i { width: 14px; height: 14px; border: 1px solid var(--ink-3); display: inline-block; }

.stage-card { position: absolute; left: 50%; top: 50%; translate: -50% -50%; perspective: 1800px; }
.flipper { position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .85s cubic-bezier(.3, .8, .2, 1); }
.flipper.is-back { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: var(--shadow-card); background: #fff; }
.flip-face.back { transform: rotateY(180deg); }
.dim { position: absolute; color: var(--ink-2); font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; pointer-events: none; }
.dim span { position: relative; background: var(--mat); padding: 1px 7px; border-radius: 4px; }
.dim-w { left: 0; top: -30px; height: 14px; display: flex; align-items: center; justify-content: center; border-left: 1px solid currentColor; border-right: 1px solid currentColor; }
.dim-w::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; border-top: 1px solid currentColor; }
.dim-h { left: -30px; top: 0; width: 14px; display: flex; align-items: center; justify-content: center; border-top: 1px solid currentColor; border-bottom: 1px solid currentColor; }
.dim-h::before { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; border-left: 1px solid currentColor; }
.dim-h span { writing-mode: vertical-rl; transform: rotate(180deg); }

.pframe { position: relative; display: block; overflow: hidden; background: #fff; }
.pframe-iframe { position: absolute; left: 0; top: 0; border: 0; transform-origin: 0 0; background: transparent; pointer-events: none; }
.pframe-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fitframe { width: 100%; background: #fff; overflow: hidden; }

/* ───────── pagina de clienți ───────── */
.clients-page { width: min(1240px, 100%); margin: 0 auto; padding: 32px clamp(16px, 3vw, 36px) 64px; display: flex; flex-direction: column; gap: 26px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: clamp(30px, 4vw, 40px); }
.page-tools { display: flex; gap: 10px; align-items: center; }
@media (max-width: 680px) { .page-tools { flex-wrap: wrap; width: 100%; } .search { flex: 1 1 100%; } }
.search { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--surface); color: var(--ink-3); min-width: min(300px, 100%); }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: 0; outline: 0; background: transparent; width: 100%; color: var(--ink); }
.client-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
.client-card { position: relative; }
.client-link { display: flex; flex-direction: column; text-decoration: none; border-radius: var(--r-lg); overflow: hidden; background: var(--surface); border: 1px solid var(--line); transition: transform .2s, box-shadow .2s, border-color .2s; }
.client-link:hover { transform: translateY(-3px); border-color: var(--line-2); box-shadow: 0 18px 30px -18px rgba(0,0,0,.35); }
.client-art { display: block; padding: 22px; background: var(--mat); position: relative;
  background-image: linear-gradient(var(--mat-major) 1px, transparent 1px), linear-gradient(90deg, var(--mat-major) 1px, transparent 1px); background-size: 22px 22px; }
.client-art .fitframe { box-shadow: var(--shadow-card); }
.client-meta { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 15px; min-width: 0; }
.client-meta b { font: 700 16.5px var(--font-display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-meta > span { color: var(--ink-2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.client-foot { display: flex !important; align-items: center; gap: 9px; margin-top: 8px; font-size: 12px !important; color: var(--ink-3) !important; }
.dots { display: inline-flex; } .dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); margin-right: -5px; }
.client-del { position: absolute; right: 10px; top: 10px; background: color-mix(in srgb, var(--surface) 88%, transparent); opacity: 0; transition: opacity .15s; }
.client-card:hover .client-del, .client-del:focus-visible { opacity: 1; }
@media (hover: none) { .client-del { opacity: 1; } }
.empty-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 40px 20px; color: var(--ink-2); }
.empty-state h3 { color: var(--ink); font-size: 20px; }
.empty-state p { max-width: 38ch; }
.empty-state.big { padding: 80px 20px; border: 1.5px dashed var(--line-2); border-radius: var(--r-lg); }

/* ───────── editor ───────── */
.editor { flex: 1; min-height: 0; display: grid; grid-template-columns: 410px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: 'head head' 'side main'; }
.ed-head { grid-area: head; display: flex; align-items: center; gap: 16px; padding: 12px 22px; border-bottom: 1px solid var(--line); background: var(--surface); }
.back { display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px 6px 6px; margin-left: -6px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-weight: 600; }
.back:hover { background: var(--surface-2); color: var(--ink); }
.ed-title { display: flex; align-items: baseline; gap: 14px; min-width: 0; flex: 1; }
.ed-title h1 { font-size: 22px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.save-state { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.save-state i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.save-state.saving i, .save-state.dirty i { background: var(--warn); }
.save-state.error i { background: var(--err); } .save-state.error { color: var(--err); }
.ed-side { grid-area: side; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.tabs { display: flex; gap: 2px; padding: 10px 14px 0; border-bottom: 1px solid var(--line); }
.tab { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; border: 0; background: none; color: var(--ink-2); font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--ink); border-bottom-color: var(--accent); }
.tab em { font-style: normal; font-size: 11px; min-width: 18px; height: 18px; display: inline-grid; place-items: center; border-radius: 9px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); }
.side-scroll { overflow-y: auto; flex: 1; min-height: 0; }
.panel-body { padding: 18px 20px 28px; display: flex; flex-direction: column; gap: 20px; }
.group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 13px; min-width: 0; }
.group legend { padding: 0 0 9px; font: 700 15px var(--font-display); letter-spacing: -.01em; float: left; width: 100%; }
.group legend + * { clear: both; }
.qr-chip { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }
.qr-chip.empty { border-style: dashed; background: transparent; }
.qr-mini { width: 44px; height: 44px; flex: none; border: 1px solid var(--line-2); background: #fff; }
.qr-mini svg { width: 100%; height: 100%; display: block; }

.drop { position: relative; display: grid; place-items: center; min-height: 128px; border-radius: 12px; border: 1.5px dashed var(--line-2); transition: border-color .15s, background .15s; padding: 12px;
  background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px; }
.drop.over { border-color: var(--accent); background-color: var(--accent-soft); }
.drop.busy { opacity: .6; }
.drop-empty { display: flex; flex-direction: column; align-items: center; gap: 5px; text-align: center; color: var(--ink-2); font-size: 12.5px; background: var(--surface); padding: 12px 18px; border-radius: 9px; }
.drop-empty b { color: var(--ink); font-size: 14px; }
.logo-view { display: grid; place-items: center; width: 100%; background: var(--surface); border-radius: 9px; padding: 14px; }
.logo-view img { width: auto; max-width: 100%; height: 84px; object-fit: contain; }
.logo-actions { display: flex; gap: 8px; }
.logo-meta { display: flex; align-items: flex-start; gap: 6px; font-size: 12.5px; color: var(--ok); }
.logo-meta.warn { color: var(--warn); }
.logo-meta .icon { margin-top: 2px; }
.suggest { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 10px; background: var(--accent-soft); border: 1px solid var(--accent-line); }
.suggest-head { display: flex; align-items: center; gap: 7px; font-weight: 600; font-size: 13px; }
.suggest-swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); background: var(--c); box-shadow: 0 0 0 1px var(--line-2); transition: transform .12s; }
.dot:hover { transform: scale(1.12); }
.pair { display: inline-flex; } .pair i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--surface); margin-right: -4px; box-shadow: 0 0 0 1px var(--line-2); }
.suggest .btn { align-self: flex-start; gap: 12px; }
.color-row { display: flex; gap: 12px; align-items: flex-end; }
.swatch-btn { position: relative; width: 40px; height: 40px; flex: none; border-radius: 8px; background: var(--c); border: 1px solid var(--line-2); box-shadow: inset 0 0 0 3px var(--surface); overflow: hidden; cursor: pointer; }
.swatch-btn input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }

.history { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.hist-item { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.hist-ico { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); color: var(--accent); }
.hist-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.hist-main b { font-size: 13.5px; }
.hist-main span { font-size: 12px; color: var(--ink-2); }
.hist-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.tag { font-size: 11px !important; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--surface); }
.tag.warn { color: var(--warn) !important; border-color: var(--warn); }
.hist-actions { display: flex; }

.ed-main { grid-area: main; display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow-y: auto; }
.stage-bar { display: flex; align-items: center; gap: 10px; padding: 12px 20px; flex-wrap: wrap; }
.zoom { display: inline-flex; align-items: center; gap: 2px; }
.zoom-val { min-width: 52px; height: 30px; border: 0; background: none; font-weight: 600; font-variant-numeric: tabular-nums; border-radius: 7px; }
.zoom-val:hover { background: var(--surface-2); }
.ed-main > .mat { flex: 1 1 420px; min-height: 320px; margin: 0 20px; border-radius: var(--r-lg); border: 1px solid var(--line); }
.guide-legend { display: flex; gap: 16px; align-items: center; padding: 10px 24px 0; font-size: 12.5px; color: var(--ink-2); flex-wrap: wrap; }
.guide-legend .k { width: 14px; height: 0; border-top: 2px solid; display: inline-block; margin-right: -9px; }
.k.bleed { border-color: #ff2850; } .k.trim { border-color: #19b4ff; } .k.safe { border-color: #14c47a; border-top-style: dashed; }
.exportbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; flex-wrap: wrap; }
.export-opts { display: flex; gap: 16px; }
.pre-chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 99px; border: 1px solid; font-weight: 600; font-size: 13px; background: transparent; }
.pre-chip.ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.pre-chip.warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.pre-chip.bad { color: var(--err); border-color: var(--err); background: var(--err-soft); }
.pre-panel { margin: 0 20px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 7px; font-size: 13px; }
.pre-panel p { display: flex; gap: 8px; align-items: flex-start; }
.pre-panel .icon { margin-top: 2px; }
.ok-line { color: var(--ok); } .issue.error { color: var(--err); } .issue.warn { color: var(--warn); } .note { color: var(--ink-2); }

.gallery { padding: 12px 0 18px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--line); margin-top: 14px; background: var(--surface); }
.gallery-head { display: flex; align-items: center; gap: 16px; padding: 0 20px; flex-wrap: wrap; }
.gallery-head h2 { font-size: 17px; } .gallery-head h2 small { font: 600 12px var(--font-ui); color: var(--ink-3); margin-left: 4px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { height: 28px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-2); background: transparent; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.gallery-strip { display: flex; gap: 14px; overflow-x: auto; padding: 6px 20px 12px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.tile { flex: none; width: 156px; display: flex; flex-direction: column; gap: 6px; text-align: left; padding: 7px; border: 1.5px solid transparent; border-radius: 12px; background: transparent; scroll-snap-align: start; transition: background .15s, border-color .15s; }
.tile:hover { background: var(--surface-2); }
.tile.on { border-color: var(--accent); background: var(--accent-soft); }
.tile-art { display: block; border-radius: 3px; overflow: hidden; box-shadow: 0 1px 0 rgba(0,0,0,.2), 0 8px 14px -8px rgba(0,0,0,.45); }
.tile-name { font-weight: 700; font-size: 13px; } .tile-cat { display: none; }

/* ───────── dialog + toast ───────── */
.dialog { border: 0; padding: 0; border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px rgba(0,0,0,.45); max-width: min(440px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(8, 12, 18, .55); backdrop-filter: blur(2px); }
.dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.dialog-body h3 { font-size: 20px; } .dialog-body p { color: var(--ink-2); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.toasts { position: fixed; z-index: 50; left: 50%; bottom: 20px; translate: -50% 0; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(520px, calc(100vw - 24px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--surface); font-weight: 500; box-shadow: 0 12px 30px rgba(0,0,0,.3); animation: toast-in .25s ease-out; }
.toast.error { background: var(--err); color: #fff; } .toast.warn { background: var(--warn); color: #fff; }
.toast-action { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ───────── responsive ───────── */
@media (max-width: 1080px) {
  .shell.is-editor { height: auto; min-height: 100dvh; }
  .editor { display: flex; flex-direction: column; }
  .ed-main { display: contents; }
  .ed-head { order: 0; } .stage-bar { order: 1; } .ed-main > .mat { order: 2; flex: none; height: min(78vw, 420px); }
  .guide-legend { order: 3; } .exportbar { order: 4; } .pre-panel { order: 5; }
  .ed-side { order: 6; border-right: 0; border-top: 1px solid var(--line); margin-top: 8px; }
  .side-scroll { overflow: visible; }
  .gallery { order: 7; }
  .ed-main > .mat { margin: 0 12px; } .stage-bar, .exportbar { padding-left: 12px; padding-right: 12px; }
  .ed-head { padding: 10px 14px; }
}
@media (max-width: 560px) {
  .ed-head-actions .btn { padding: 0 10px; font-size: 0; gap: 0; } .ed-head-actions .btn .icon { margin: 0; }
  .exportbar .btn { flex: 1 1 100%; } .export-opts { flex: 1 1 100%; }
}
