/* Paysite Image Studio — black / red / white admin theme. Change brand colours here. */
:root {
  --brand: #e10600;
  --brand-dark: #b00500;
  --brand-soft: #fde8e7;
  --black: #0a0a0a;
  --ink: #141414;
  --ink-2: #1e1e1e;
  --ink-3: #2a2a2a;
  --white: #ffffff;
  --bg: #f6f6f7;
  --surface: #ffffff;
  --line: #e4e4e7;
  --text: #111111;
  --muted: #6b6b70;
  --ok: #138a36;
  --warn: #b45309;
  --warn-bg: #fff7e6;
  --radius: 14px;
  --sidebar: 236px;
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
svg { width: 20px; height: 20px; fill: currentColor; flex: none; }
[hidden] { display: none !important; }
a { color: var(--brand); }
code { background: #f1f1f2; padding: 1px 5px; border-radius: 4px; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.grow { flex: 1; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; min-height: 100dvh; }
.sidebar { width: var(--sidebar); background: var(--black); color: #cfcfcf; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40; border-right: 1px solid #000; }
.brand { display: flex; gap: 10px; align-items: center; padding: 18px 18px 16px; border-bottom: 1px solid #1d1d1d; }
.brand strong { display: block; color: #fff; letter-spacing: .12em; font-size: 15px; }
.brand span { display: block; color: var(--brand); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.nav { padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #bdbdbd; text-decoration: none; font-weight: 500; border-left: 3px solid transparent; }
.nav a:hover { background: #161616; color: #fff; }
.nav a.active { background: #1a1a1a; color: #fff; border-left-color: var(--brand); }
.nav a.active svg { color: var(--brand); }
.pill { font-style: normal; font-size: 9.5px; font-weight: 700; letter-spacing: .06em; background: var(--brand); color: #fff; padding: 2px 6px; border-radius: 99px; margin-left: auto; vertical-align: middle; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid #1d1d1d; font-size: 12px; display: flex; gap: 8px; align-items: center; }
.sidebar-foot .dot { width: 8px; height: 8px; border-radius: 50%; background: #555; }
.sidebar-foot.authed .dot { background: #22c55e; }
.sidebar-foot button { margin-left: auto; }
.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 58px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 22px; position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-size: 17px; margin: 0; font-weight: 700; }
.topbar h1::before { content: ""; display: inline-block; width: 4px; height: 16px; background: var(--brand); margin-right: 10px; vertical-align: -2px; border-radius: 2px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.view { padding: 28px 32px; display: none; }
.view.active { display: block; }
#view-editor, #view-collage { padding: 0; }
.bottom-nav { display: none; }
.only-mobile { display: none !important; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 13px var(--font); cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none; }
.btn:hover { border-color: #c9c9cf; }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-dark { background: var(--black); color: #fff; border-color: var(--black); }
.btn-ghost-light { background: transparent; color: #fff; border-color: #444; }
.btn-ghost-light:hover { border-color: #fff; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; height: 42px; font-size: 14px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-danger { color: var(--brand); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; background: transparent; border-radius: 8px; cursor: pointer; color: var(--text); }
.icon-btn:hover { background: #f1f1f2; }
.icon-btn.on { background: var(--brand-soft); color: var(--brand); }
.icon-btn:disabled { opacity: .35; }
input, select, textarea { font: 13.5px var(--font); color: var(--text); }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label, .field { display: flex; flex-direction: column; gap: 5px; font-weight: 600; font-size: 12.5px; color: #333; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .field input:not([type=checkbox]):not([type=radio]):not([type=range]), .field select, .field textarea {
  height: 38px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; font-weight: 400; width: 100%; }
.field textarea { height: auto; min-height: 64px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(225, 6, 0, .25); border-color: var(--brand) !important; }
.check { flex-direction: row !important; align-items: flex-start; gap: 8px !important; font-weight: 500 !important; cursor: pointer; }
.check input { margin-top: 2px; accent-color: var(--brand); width: 16px; height: 16px; flex: none; }
.err { color: var(--brand); min-height: 1em; margin: 0; font-weight: 600; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; touch-action: pan-y; }
input[type=range]::-webkit-slider-runnable-track { height: 4px; background: linear-gradient(to right, var(--brand) var(--fill, 50%), #ddd var(--fill, 50%)); border-radius: 3px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); margin-top: -6px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
input[type=range]::-moz-range-track { height: 4px; background: #ddd; border-radius: 3px; }
input[type=range]::-moz-range-progress { height: 4px; background: var(--brand); border-radius: 3px; }
input[type=range]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 2px solid var(--brand); }

/* ---------- dashboard ---------- */
.dash { max-width: 1180px; margin: 0 auto; padding: 18px 8px 40px; display: flex; flex-direction: column; gap: 28px; }
.eyebrow { margin: 0 0 6px; color: var(--brand); font-weight: 700; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.dash-head h2 { margin: 0 0 8px; font-size: 32px; line-height: 1.15; letter-spacing: -.02em; font-weight: 700; }
.dash-head p.muted { margin: 0; font-size: 15px; max-width: 640px; }
.dash-h { margin: 0 0 14px; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #3a3a3f; }
.dropbig { display: flex; align-items: center; gap: 20px; padding: 28px 30px; border: 2px dashed #cfcfd4; border-radius: 18px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.dropbig:hover { border-color: var(--brand); background: #fffafa; }
.dropbig-ic { width: 56px; height: 56px; border-radius: 16px; background: var(--brand-soft); color: var(--brand); display: flex; align-items: center; justify-content: center; flex: none; }
.dropbig-ic svg { width: 28px; height: 28px; }
.dropbig-tx { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.dropbig-tx strong { font-size: 17px; }
.dropbig-tx span { color: var(--muted); }
.tools { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.tool { display: flex; gap: 14px; align-items: flex-start; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; color: var(--text); text-decoration: none; cursor: pointer; transition: transform .15s, box-shadow .15s, border-color .15s; }
.tool:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(0,0,0,.07); border-color: #d6d6db; }
.tool-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--black); color: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.tool:hover .tool-ic { background: var(--brand); }
.tool-tx { display: flex; flex-direction: column; gap: 4px; }
.tool-tx strong { font-size: 15px; }
.tool-tx span { color: var(--muted); font-size: 13px; line-height: 1.45; }
.dash-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.dash-panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 22px; }
.recent { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; }
.recent a { text-decoration: none; color: var(--text); font-size: 12px; display: flex; flex-direction: column; gap: 6px; }
.recent img { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 10px; background: #eee; }
.recent span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent .empty { color: var(--muted); grid-column: 1 / -1; padding: 10px 0; }
.panel-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.panel-card h3 { margin: 0 0 10px; font-size: 15px; }
.caps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.caps li { display: flex; gap: 8px; align-items: center; }
.caps b { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: #fff; background: var(--ok); }
.caps b.no { background: #aaa; }
.narrow { max-width: 460px; margin: 0 auto; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.row-between h3 { margin: 0; }

/* ---------- editor ---------- */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 360px; height: calc(100vh - 58px); height: calc(100dvh - 58px); }
.stage-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #e9e9eb; }
.stage-toolbar { display: flex; align-items: center; gap: 4px; padding: 8px 12px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.stage-toolbar .sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.stage-toolbar .meta { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.stage { flex: 1; position: relative; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 18px; overflow: hidden;
  background-color: #dcdcdf; background-image: linear-gradient(45deg, #d2d2d6 25%, transparent 25%), linear-gradient(-45deg, #d2d2d6 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d2d2d6 75%), linear-gradient(-45deg, transparent 75%, #d2d2d6 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.canvas-wrap { position: relative; line-height: 0; box-shadow: 0 6px 30px rgba(0,0,0,.25); touch-action: none; }
.canvas-wrap canvas { display: block; max-width: 100%; }
.canvas-wrap.grab { cursor: grab; }
.canvas-wrap.grabbing { cursor: grabbing; }
.drop-empty { text-align: center; background: var(--surface); border: 2px dashed #c7c7cc; border-radius: 14px; padding: 36px 28px; max-width: 420px; }
.drop-empty svg { width: 46px; height: 46px; color: var(--brand); }
.drop-empty h3 { margin: 8px 0 4px; }
.drop-empty p { color: var(--muted); margin: 0 0 16px; }
.drop-empty.over, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.crop-layer { position: absolute; inset: 0; }
.crop-box { position: absolute; border: 1px solid #fff; box-shadow: 0 0 0 9999px rgba(0,0,0,.55); cursor: move; touch-action: none; }
.crop-box .h { position: absolute; width: 18px; height: 18px; background: #fff; border: 2px solid var(--brand); border-radius: 3px; }
.crop-box .nw { left: -9px; top: -9px; cursor: nwse-resize; } .crop-box .se { right: -9px; bottom: -9px; cursor: nwse-resize; }
.crop-box .ne { right: -9px; top: -9px; cursor: nesw-resize; } .crop-box .sw { left: -9px; bottom: -9px; cursor: nesw-resize; }
.crop-box .n, .crop-box .s { left: calc(50% - 12px); width: 24px; height: 8px; cursor: ns-resize; } .crop-box .n { top: -5px; } .crop-box .s { bottom: -5px; }
.crop-box .w, .crop-box .e { top: calc(50% - 12px); height: 24px; width: 8px; cursor: ew-resize; } .crop-box .w { left: -5px; } .crop-box .e { right: -5px; }
.crop-box .third { position: absolute; background: rgba(255,255,255,.35); pointer-events: none; }
.crop-box .v1, .crop-box .v2 { top: 0; bottom: 0; width: 1px; } .crop-box .v1 { left: 33.33%; } .crop-box .v2 { left: 66.66%; }
.crop-box .h1, .crop-box .h2 { left: 0; right: 0; height: 1px; } .crop-box .h1 { top: 33.33%; } .crop-box .h2 { top: 66.66%; }
.sel-box { position: absolute; border: 1.5px dashed var(--brand); pointer-events: none; box-shadow: 0 0 0 1px rgba(255,255,255,.6); }
.drag-tip { position: absolute; transform: translate(-50%, -130%); background: var(--black); color: #fff; font: 600 11.5px var(--font); padding: 4px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; line-height: 1.3; }
.busy { position: absolute; inset: 0; background: rgba(10,10,10,.55); color: #fff; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; z-index: 5; font-weight: 600; }
.spinner { width: 34px; height: 34px; border: 3px solid rgba(255,255,255,.25); border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { width: min(320px, 80%); height: 6px; border-radius: 3px; background: rgba(255,255,255,.2); overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--brand); width: 0; transition: width .2s; }

.filmstrip { display: flex; gap: 8px; padding: 10px 12px; background: var(--ink); overflow-x: auto; min-height: 98px; align-items: center; }
.filmstrip .thumb { position: relative; width: 74px; height: 74px; flex: none; border-radius: 6px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: #333; }
.filmstrip .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.filmstrip .thumb.sel { border-color: var(--brand); }
.filmstrip .thumb .x { position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; border-radius: 50%; background: rgba(0,0,0,.7); color: #fff; border: 0; font-size: 13px; line-height: 20px; padding: 0; cursor: pointer; display: none; }
.filmstrip .thumb:hover .x, .filmstrip .thumb.sel .x { display: block; }
.filmstrip .thumb .st { position: absolute; left: 0; right: 0; bottom: 0; font-size: 10px; color: #fff; background: rgba(0,0,0,.65); padding: 1px 4px; line-height: 1.4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filmstrip .thumb .st.ok { background: rgba(19,138,54,.85); }
.filmstrip .thumb .badge { position: absolute; top: 3px; left: 3px; background: var(--brand); color: #fff; font-size: 9px; font-weight: 700; padding: 1px 4px; border-radius: 3px; }
.filmstrip .add { width: 74px; height: 74px; flex: none; border: 2px dashed #555; border-radius: 6px; color: #aaa; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.filmstrip .count { color: #aaa; font-size: 12px; padding: 0 6px; white-space: nowrap; }

.panel-col { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: grid; grid-template-columns: repeat(5, 1fr); overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; flex: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 0; background: none; padding: 10px 2px 8px; font-size: 11.5px !important; font: 600 12.5px var(--font); color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tabs button svg { width: 18px; height: 18px; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); }
.panel-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.panel-foot { border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 8px; background: #fafafa; }
.estimate { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; font-variant-numeric: tabular-nums; }
.estimate strong { color: var(--text); }
.estimate .over { color: var(--brand); }

.group { border: 1px solid var(--line); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.group > h4 { margin: 0; font-size: 11.5px; text-transform: uppercase; letter-spacing: .07em; color: #444; display: flex; align-items: center; gap: 8px; }
.group > h4 .grow + * { margin-left: auto; }
.slider { display: grid; grid-template-columns: 1fr 58px; gap: 2px 8px; align-items: center; }
.slider label { font-size: 12.5px; font-weight: 600; color: #333; grid-column: 1 / -1; display: flex; justify-content: space-between; }
.slider label .reset { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 11px; padding: 0; visibility: hidden; }
.slider.changed label .reset { visibility: visible; }
.slider.changed label { color: var(--brand); }
.slider input[type=number] { height: 28px; border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; width: 58px; text-align: right; font-variant-numeric: tabular-nums; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 10px; font: 600 12px var(--font); cursor: pointer; color: #333; }
.chip:hover { border-color: #bbb; }
.chip.active { background: var(--black); border-color: var(--black); color: #fff; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; border: 0; background: #fff; padding: 8px 4px; font: 600 12px var(--font); cursor: pointer; color: #444; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.active { background: var(--black); color: #fff; }
.anchor-grid { display: grid; grid-template-columns: repeat(3, 30px); gap: 4px; }
.anchor-grid button { width: 30px; height: 30px; border: 1px solid var(--line); background: #fff; border-radius: 6px; cursor: pointer; padding: 0; display: flex; align-items: center; justify-content: center; }
.anchor-grid button::after { content: ""; width: 8px; height: 8px; border-radius: 2px; background: #ccc; }
.anchor-grid button.active { border-color: var(--brand); }
.anchor-grid button.active::after { background: var(--brand); }
.pos-row { display: flex; gap: 12px; align-items: flex-start; }
.pos-row .grid2 { flex: 1; }
.hint { font-size: 12px; color: var(--muted); margin: 0; }
.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f6d79b; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.warn button { align-self: flex-start; }
.ok-note { background: #ecfdf3; color: var(--ok); border: 1px solid #b7ebc6; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 38px; height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: #fff; }
.layer-list { display: flex; flex-direction: column; gap: 6px; }
.layer { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.layer.active { border-color: var(--brand); background: var(--brand-soft); }
.layer span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.wm-img { display: flex; gap: 10px; align-items: center; }
.wm-img img { width: 64px; height: 40px; object-fit: contain; background: repeating-conic-gradient(#ddd 0 25%, #fff 0 50%) 0 0/10px 10px; border: 1px solid var(--line); border-radius: 6px; }
.names { font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; background: #f6f6f7; border-radius: 8px; padding: 8px 10px; max-height: 140px; overflow: auto; white-space: pre; }
.histo { width: 100%; height: 64px; background: #111; border-radius: 8px; display: block; }

/* ---------- SFW ---------- */
.sfw-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dropzone { border: 2px dashed #c7c7cc; border-radius: 10px; padding: 22px; text-align: center; display: flex; flex-direction: column; gap: 4px; cursor: pointer; }
.dropzone span { color: var(--muted); font-size: 12px; }
.sfw-queue { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.sfw-queue img { width: 64px; height: 64px; object-fit: cover; border-radius: 6px; }
.sfw-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.sfw-result { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fafafa; }
.sfw-result .pair { display: grid; grid-template-columns: 1fr 1fr; }
.sfw-result img { width: 100%; aspect-ratio: 3/4; object-fit: cover; display: block; background: #eee; }
.sfw-result .bar { padding: 8px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.sfw-result .bar .st { font-size: 12px; color: var(--muted); flex: 1; }
.sfw-result .bar .st.err { color: var(--brand); }

/* ---------- presets ---------- */
.preset-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.preset { border: 1px solid var(--line); border-radius: 10px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.preset h4 { margin: 0; display: flex; gap: 8px; align-items: center; }
.preset p { margin: 0; color: var(--muted); font-size: 12.5px; }
.tag { font-size: 10px; font-weight: 700; background: #f1f1f2; color: #555; padding: 2px 6px; border-radius: 4px; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #fff; border-radius: 14px; padding: 20px; width: min(460px, 100%); max-height: 90vh; overflow: auto; display: flex; flex-direction: column; gap: 12px; }
.modal-card h3 { margin: 0; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 200; }
.toast { background: var(--black); color: #fff; padding: 10px 14px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-weight: 500; border-left: 4px solid var(--brand); max-width: 340px; animation: tin .2s; }
.toast.ok { border-left-color: #22c55e; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }
.global-drop { position: fixed; inset: 0; background: rgba(225,6,0,.12); border: 4px dashed var(--brand); z-index: 150; display: flex; align-items: center; justify-content: center; pointer-events: none; }
.global-drop div { background: var(--black); color: #fff; padding: 16px 24px; border-radius: 12px; font-weight: 700; font-size: 16px; }
.prose h2 { margin-top: 0; } .prose h3 { margin: 20px 0 6px; } .prose li { margin: 4px 0; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) { .editor { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  body:has(#view-editor.active) .main, body:has(#view-collage.active) .main { padding-bottom: 0; }
  .only-mobile { display: inline-flex !important; }
  .hide-mobile { display: none !important; }
  .topbar { padding: 0 10px; height: 52px; }
  .view { padding: 14px; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(60px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: var(--black); z-index: 45; }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #9a9a9a; text-decoration: none; font-size: 10.5px; font-weight: 600; }
  .bottom-nav a.active { color: #fff; }
  .bottom-nav a.active svg { color: var(--brand); }
  .editor { display: flex; flex-direction: column; height: calc(100dvh - 52px - 60px - env(safe-area-inset-bottom)); }
  .stage-col { flex: none; }
  .stage { height: 38vh; height: 38dvh; flex: none; padding: 10px; }
  .filmstrip { min-height: 70px; padding: 5px 8px; }
  .filmstrip .thumb, .filmstrip .add { width: 58px; height: 58px; }
  .filmstrip .count { font-size: 11px; }
  .panel-col { border-left: 0; flex: 1; min-height: 0; }
  .panel-body { padding: 12px; }
  .panel-foot { padding: 8px 12px; flex-direction: row; align-items: center; }
  .panel-foot .estimate { flex: 1; flex-direction: column; gap: 0; font-size: 11.5px; }
  .panel-foot .btn-block { width: auto; flex: none; height: 40px; }
  .tabs { display: flex; }
  .tabs button { padding: 9px 9px 7px; }
  .topbar h1 { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sfw-grid { grid-template-columns: 1fr; }
  .dash { padding: 4px 0 24px; gap: 22px; }
  .dash-head h2 { font-size: 24px; }
  .dropbig { padding: 20px; gap: 14px; flex-wrap: wrap; }
  .dropbig .btn { width: 100%; }
  .dash-cols { grid-template-columns: 1fr; }
  .tools { grid-template-columns: 1fr; gap: 10px; }
  .toasts { left: 12px; right: 12px; bottom: 76px; }
  .stage-toolbar { padding: 6px 8px; }
  .icon-btn { width: 38px; height: 38px; }
  .col-tray { min-height: 70px; padding: 6px 8px; }
  .col-thumb { width: 58px; height: 58px; }
  .hist-list { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .hist-item .bar .btn { flex: 1; }
}

/* ---------- collage ---------- */
.col-stage canvas { box-shadow: 0 6px 30px rgba(0,0,0,.25); touch-action: none; cursor: grab; background: #fff; }
.col-stage canvas:active { cursor: grabbing; }
.col-tray { display: flex; gap: 8px; overflow-x: auto; padding: 8px 12px; background: var(--surface); border-top: 1px solid var(--line); min-height: 86px; align-items: center; }
.col-tray .hint { padding: 0 4px; }
.col-thumb { position: relative; flex: none; width: 70px; height: 70px; border: 2px solid transparent; border-radius: 8px; padding: 0; overflow: hidden; background: #eee; cursor: pointer; }
.col-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.col-thumb.on { border-color: var(--brand); }
.col-thumb i { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; font: 700 13px/18px var(--font); font-style: normal; text-align: center; }
.col-layouts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.col-layout { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px; cursor: pointer; aspect-ratio: 1; display: flex; }
.col-layout svg { width: 100%; height: 100%; fill: #c9c9cf; }
.col-layout:hover svg { fill: #9d9da5; }
.col-layout.active { border-color: var(--black); background: var(--black); }
.col-layout.active svg { fill: var(--brand); }
.field .row-between em { font-style: normal; color: var(--muted); font-weight: 500; }

/* ---------- history ---------- */
.hist-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
.hist-item { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fafafa; display: flex; flex-direction: column; }
.hist-item img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: #e9e9eb; display: block; }
.hist-item .info { padding: 8px 10px 4px; font-size: 12px; color: var(--muted); flex: 1; }
.hist-item .info strong { display: block; color: var(--text); font-size: 13px; word-break: break-all; }
.hist-item .bar { padding: 6px 10px 10px; display: flex; gap: 6px; flex-wrap: wrap; }
.hist-empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* ---------- per-photo scope (Photo Sets) ---------- */
.scope { display: flex; flex-direction: column; gap: 6px; padding-bottom: 2px; }
.scope .seg button.active { background: var(--brand); }
.linkish { border: 0; background: none; padding: 0; color: var(--brand); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.variants { display: flex; flex-direction: column; gap: 8px; }
.variant { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; padding: 8px 36px 8px 8px; border: 1px solid var(--line); border-radius: 8px; }
.variant [data-vdel] { position: absolute; top: 6px; right: 4px; }
.variant .field { min-width: 0; font-size: 11px; }
.variant input, .variant select { width: 100%; min-width: 0; }
