/* TPIX — light admin theme. Brand colours live in the theme blocks below. */
:root {
  /* TPIX brand: change colours here */
  --brand: #3b5bfd;
  --brand-dark: #2843d8;
  --brand-soft: #eef1ff;
  --brand-2: #8b5cf6;
  --black: #0f172a;
  --ink: #1e293b;
  --ink-2: #273449;
  --ink-3: #334155;
  --white: #ffffff;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --line: #e6e9f0;
  --text: #0f172a;
  --muted: #64748b;
  --ok: #16a34a;
  --warn: #b45309;
  --warn-bg: #fff7e6;
  --danger: #ef4444;
  --radius: 14px;
  --sidebar: 248px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.05), 0 1px 3px rgba(15,23,42,.06);
  --surface-2: #f8fafc;
  --surface-3: #f1f5f9;
  --text-2: #334155;
  --line-2: #cbd5e1;
  --stage-bg: #eceff5;
  color-scheme: light;
  --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: var(--surface-3); 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(--surface); color: var(--muted); display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40; border-right: 1px solid var(--line); }
.brand { display: flex; gap: 12px; align-items: center; padding: 20px 20px 18px; }
.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: 10px; color: var(--text-2); text-decoration: none; font-weight: 500; transition: background .12s, color .12s; }
.nav a svg { color: #94a3b8; }
.nav a:hover { background: var(--surface-3); color: var(--text); }
.nav a.active { background: var(--brand-soft); color: var(--brand-dark); font-weight: 600; }
.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 var(--line); 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, #view-pdf, #view-files { 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: var(--line-2); }
.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: var(--text-2); }
.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: var(--surface-3); }
.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: var(--text-2); }
.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: var(--surface); font-weight: 400; width: 100%; }
.field textarea { height: auto; min-height: 64px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--brand) 20%, transparent); 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%), var(--line-2) 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: var(--line-2); 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 var(--line-2); border-radius: 18px; background: var(--surface); cursor: pointer; transition: border-color .15s, background .15s; }
.dropbig:hover { border-color: var(--brand); background: var(--brand-soft); }
.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: var(--line-2); }
.tool-ic { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); 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: var(--surface-3); }
.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) 388px; height: calc(100vh - 58px); height: calc(100dvh - 58px); }
.stage-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface-3); }
.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 var(--line-2); 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(--surface); border-top: 1px solid var(--line); 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 var(--line-2); 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: var(--surface-2); }
.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: var(--text-2); 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: var(--text-2); 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: var(--surface); border-radius: 99px; padding: 5px 10px; font: 600 12px var(--font); cursor: pointer; color: var(--text-2); }
.chip:hover { border-color: var(--line-2); }
.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: var(--surface); padding: 8px 4px; font: 600 12px var(--font); cursor: pointer; color: var(--text-2); 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: var(--surface); 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: var(--surface); }
.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: var(--surface-2); 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 var(--line-2); 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: var(--surface-2); }
.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: var(--surface-3); }
.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: var(--surface-3); color: var(--text-2); 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: var(--surface); 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: color-mix(in srgb, var(--brand) 10%, transparent); 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) 350px; } .tabs button { font-size: 10px !important; } }
@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(--surface); border-top: 1px solid var(--line); z-index: 45; }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: #94a3b8; text-decoration: none; font-size: 10.5px; font-weight: 600; }
  .bottom-nav a.active { color: var(--brand); }
  .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: var(--surface); }
.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: var(--surface-3); 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: var(--surface); 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: var(--surface-2); display: flex; flex-direction: column; }
.hist-item img { width: 100%; aspect-ratio: 4/3; object-fit: contain; background: var(--surface-3); 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; }

.sel-del { position: absolute; top: -13px; right: -13px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: var(--danger, #ef4444); color: #fff; font: 700 15px/1 var(--font); cursor: pointer; pointer-events: auto; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 6px rgba(0,0,0,.25); padding: 0; }
.txt-colors { display: flex; flex-direction: column; gap: 6px; }
.txt-colors input[type=color] { width: 40px; height: 30px; border: 1px solid var(--line); border-radius: 6px; padding: 2px; background: var(--surface); }

/* ---------- TPIX polish ---------- */
.brand-logo { width: 34px; height: 34px; border-radius: 10px; flex: none; box-shadow: 0 4px 12px color-mix(in srgb, var(--brand) 30%, transparent); }
.brand strong { color: var(--text) !important; letter-spacing: -.01em !important; font-size: 18px !important; font-weight: 800; }
.brand span { color: var(--muted) !important; letter-spacing: .02em !important; text-transform: none !important; font-weight: 500 !important; font-size: 12px !important; }
.nav-label { padding: 14px 12px 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8; }
.nav .pill { background: linear-gradient(135deg, var(--brand), var(--brand-2)); }
.topbar { background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: saturate(1.4) blur(8px); }
.topbar h1::before { background: linear-gradient(180deg, var(--brand), var(--brand-2)); }
.btn-primary { background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; box-shadow: 0 2px 10px color-mix(in srgb, var(--brand) 30%, transparent); }
.btn-primary:hover { background: var(--brand-dark); border-color: transparent; }
.btn { border-radius: 10px; }
.btn-danger { color: var(--danger); }
.chip.active, .seg button.active { background: var(--brand); border-color: var(--brand); }
.col-layout.active { border-color: var(--brand); background: var(--brand-soft); }
.col-layout.active svg { fill: var(--brand); }
.tool, .dash-panel, .panel-card, .dropbig { box-shadow: var(--shadow-sm); }
.tool:hover .tool-ic { background: var(--brand); color: #fff; }
.dropbig:hover { background: var(--brand-soft); }
.dropbig-ic { background: var(--brand-soft); color: var(--brand); }
.eyebrow { color: var(--brand); }
.sidebar-foot { color: var(--muted); }
.sidebar-foot .btn-ghost-light { color: var(--text); border-color: var(--line); }
.filmstrip .count { color: var(--muted); }
.panel-col { background: var(--surface); }
.stage { background-color: var(--surface-3); }
.toast { background: var(--black); }
.recent img { border: 1px solid var(--line); }

/* ---------- TPIX themes (picked in the sidebar, saved in this browser) ---------- */
:root[data-theme=ocean] { --brand: #0891b2; --brand-dark: #0e7490; --brand-soft: #e6f7fb; --brand-2: #2563eb; }
:root[data-theme=teal] { --brand: #0d9488; --brand-dark: #0f766e; --brand-soft: #e7f8f5; --brand-2: #06b6d4; }
:root[data-theme=azure] { --brand: #2563eb; --brand-dark: #1d4ed8; --brand-soft: #eaf1fe; --brand-2: #06b6d4; }
:root[data-theme=indigo] { --brand: #3b5bfd; --brand-dark: #2843d8; --brand-soft: #eef1ff; --brand-2: #8b5cf6; }
.brand strong i { font-style: normal; }
.theme-pick { display: flex; align-items: center; gap: 8px; padding: 10px 20px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); font-weight: 600; }
.theme-pick span { flex: 1; }
.theme-pick button { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.theme-pick button.active { box-shadow: 0 0 0 2px var(--text); }

/* hero */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 34px 34px 30px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--brand-2) 85%, #fff) 0%, transparent 55%), linear-gradient(135deg, var(--brand-dark), var(--brand) 55%, var(--brand-2)); box-shadow: 0 12px 34px color-mix(in srgb, var(--brand) 28%, transparent); }
.hero::after { content: ''; position: absolute; right: -40px; bottom: -60px; width: 260px; height: 260px; border-radius: 40px; transform: rotate(18deg);
  background-image: linear-gradient(rgba(255,255,255,.14) 2px, transparent 2px), linear-gradient(90deg, rgba(255,255,255,.14) 2px, transparent 2px); background-size: 26px 26px; pointer-events: none; }
.hero .eyebrow { color: rgba(255,255,255,.85); }
.hero h2 { margin: 0 0 8px; font-size: 34px; line-height: 1.12; letter-spacing: -.02em; font-weight: 800; }
.hero-sub { margin: 0 0 22px; font-size: 15.5px; max-width: 620px; color: rgba(255,255,255,.9); }
.perks { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; position: relative; z-index: 1; }
.perks li { display: flex; gap: 10px; align-items: center; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22); border-radius: 14px; padding: 12px; backdrop-filter: blur(6px); }
.perks li > span { display: flex; flex-direction: column; font-size: 12.5px; color: rgba(255,255,255,.85); line-height: 1.35; }
.perks strong { color: #fff; font-size: 14px; }
.pk { width: 34px; height: 34px; border-radius: 10px; background: #fff; display: flex; align-items: center; justify-content: center; flex: none; }
.pk svg { width: 19px; height: 19px; }
.pk-1 { color: #0891b2; } .pk-2 { color: #7c3aed; } .pk-3 { color: #16a34a; } .pk-4 { color: #ea580c; }
@media (max-width: 1100px) { .perks { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .hero { padding: 24px 18px; border-radius: 18px; } .hero h2 { font-size: 26px; } .perks { grid-template-columns: 1fr 1fr; gap: 8px; } .perks li { padding: 9px; } .perks li > span { font-size: 11.5px; } .pk { width: 28px; height: 28px; } }

/* colourful tool cards */
.tool { --tc: var(--brand); }
.t-blue { --tc: #2563eb; } .t-cyan { --tc: #0891b2; } .t-teal { --tc: #0d9488; } .t-green { --tc: #16a34a; } .t-violet { --tc: #7c3aed; }
.t-pink { --tc: #db2777; } .t-amber { --tc: #d97706; } .t-orange { --tc: #ea580c; } .t-red { --tc: #dc2626; } .t-indigo { --tc: #4f46e5; }
.tool .tool-ic { background: color-mix(in srgb, var(--tc) 12%, var(--surface)); color: var(--tc); }
.tool:hover { border-color: color-mix(in srgb, var(--tc) 45%, var(--surface)); box-shadow: 0 12px 30px color-mix(in srgb, var(--tc) 16%, transparent); }
.tool:hover .tool-ic { background: var(--tc); color: #fff; }

/* editor tabs: coloured buttons */
.tabs { display: grid !important; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.tabs button { --tc: var(--brand); min-width: 0; font-size: 10.5px !important; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border: 1px solid var(--line) !important; border-radius: 11px; background: var(--surface); padding: 7px 4px 6px; box-shadow: var(--shadow-sm); color: var(--text-2); transition: transform .1s, box-shadow .12s, background .12s, color .12s; }
.tabs button svg { width: 26px; height: 26px; padding: 4px; border-radius: 8px; background: color-mix(in srgb, var(--tc) 13%, var(--surface)); color: var(--tc); }
.tabs button:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--tc) 45%, var(--surface)) !important; color: var(--text); }
.tabs button.active { background: var(--tc); border-color: var(--tc) !important; color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--tc) 35%, transparent); }
.tabs button.active svg { background: rgba(255,255,255,.2); color: #fff; }
.tab-crop { --tc: #2563eb !important; } .tab-size { --tc: #0891b2 !important; } .tab-color { --tc: #db2777 !important; } .tab-enhance { --tc: #d97706 !important; }
.tab-bg { --tc: #7c3aed !important; } .tab-frame { --tc: #0d9488 !important; } .tab-watermark { --tc: #4f46e5 !important; } .tab-text { --tc: #ea580c !important; }
.tab-rename { --tc: #64748b !important; } .tab-export { --tc: #16a34a !important; }
@media (max-width: 860px) { .tabs { display: flex !important; overflow-x: auto; padding: 8px; } .tabs button { flex: none; min-width: 68px; } }

/* PDF maker */
.pdf-stage { align-items: flex-start; justify-content: stretch; overflow: auto; padding: 18px; }
.pdf-empty { margin: auto; }
.pdf-empty .btn-row { justify-content: center; margin-top: 8px; }
.btn-row.center, .center { justify-content: center; text-align: center; }
.pdf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; width: 100%; align-content: start; }
.pdf-page { background: var(--surface); border: 2px solid transparent; border-radius: 12px; box-shadow: var(--shadow-sm); cursor: pointer; overflow: hidden; display: flex; flex-direction: column; }
.pdf-page.sel { border-color: var(--brand); box-shadow: 0 6px 18px color-mix(in srgb, var(--brand) 25%, transparent); }
.pdf-page.over { border-style: dashed; border-color: var(--brand); }
.pdf-thumb { aspect-ratio: 1 / 1.3; display: flex; align-items: center; justify-content: center; background: var(--surface-3); padding: 8px; }
.pdf-thumb img { max-width: 100%; max-height: 100%; box-shadow: 0 1px 4px rgba(15,23,42,.18); background: var(--surface); }
.pdf-page-bar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.pdf-page-bar span { flex: 1; }
.mini { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font: 700 15px/1 var(--font); color: var(--text); padding: 0; }
.mini:disabled { opacity: .35; cursor: default; }
.mini.danger { color: var(--danger); }
.pdf-add { aspect-ratio: 1 / 1.45; border: 2px dashed var(--line-2); border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: var(--muted); cursor: pointer; font-weight: 600; }
.pdf-add:hover { border-color: var(--brand); color: var(--brand); }
.pdfm .stage-col { position: relative; }
.pdfm .panel-foot .btn-row { gap: 6px; }
.corner-ed { margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.corner-wrap { position: relative; touch-action: none; box-shadow: 0 2px 10px rgba(15,23,42,.2); }
.corner-wrap canvas { display: block; }
.corner-svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.corner-svg polygon { fill: color-mix(in srgb, var(--brand) 18%, transparent); stroke: var(--brand); stroke-width: 2.5; }
.corner-h { position: absolute; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: #fff; border: 3px solid var(--brand); box-shadow: 0 2px 8px rgba(0,0,0,.3); cursor: grab; touch-action: none; }
.corner-bar { flex-wrap: wrap; }
.scanner { position: fixed; inset: 0; z-index: 200; background: #000; display: flex; flex-direction: column; }
.scanner video { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.scan-bar { display: flex; align-items: center; justify-content: space-between; padding: 16px 22px calc(16px + env(safe-area-inset-bottom)); }
.scan-bar .btn { min-width: 84px; }
.scan-count { color: #fff; font-weight: 600; min-width: 84px; text-align: right; }
.shutter { width: 72px; height: 72px; border-radius: 50%; border: 5px solid #fff; background: var(--brand); cursor: pointer; box-shadow: 0 0 0 3px rgba(255,255,255,.3); }
.shutter:active { transform: scale(.94); }
.scan-flash { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; }
.scan-flash.go { animation: flash .35s ease-out; }
@keyframes flash { from { opacity: .8; } to { opacity: 0; } }
.pdf-stage { background: var(--surface-3) !important; background-image: none !important; display: flex; }
@media (max-width: 860px) {
  .pdfm .stage { height: 46vh; height: 46dvh; padding: 10px; }
  .pdf-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
  body:has(#view-pdf.active) .main { padding-bottom: 0; }
}
@media (max-width: 860px) {
  .pdfm .panel-foot { flex-wrap: wrap; }
  .pdfm .panel-foot .btn-row { width: 100%; flex-wrap: nowrap; }
  .pdfm .panel-foot .btn-row .btn { padding: 0 6px; font-size: 12px; }
}

/* quick file tools */
.t-sky { --tc: #0284c7; } .t-lime { --tc: #65a30d; } .t-slate { --tc: #475569; }
.ft { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 340px; min-height: calc(100dvh - 58px); }
.ft-main { padding: 22px 28px 40px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.ft-modes { display: flex; gap: 8px; flex-wrap: wrap; }
.ft-modes button { --tc: var(--brand); display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 8px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font: 600 13.5px var(--font); color: var(--text-2); cursor: pointer; box-shadow: var(--shadow-sm); }
.ft-modes button svg { width: 28px; height: 28px; padding: 5px; border-radius: 8px; background: color-mix(in srgb, var(--tc) 13%, var(--surface)); color: var(--tc); }
.ft-modes button.active { background: var(--tc); border-color: var(--tc); color: #fff; }
.ft-modes button.active svg { background: rgba(255,255,255,.2); color: #fff; }
.m-convert { --tc: #0284c7 !important; } .m-compress { --tc: #65a30d !important; } .m-privacy { --tc: #475569 !important; }
.ft-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.ft-head h2 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.01em; }
.ft-head p { margin: 0; max-width: 640px; }
.ft-drop.over { border-color: var(--brand); background: var(--brand-soft); }
.ft-list { display: flex; flex-direction: column; gap: 8px; }
.ft-row { display: grid; grid-template-columns: 56px minmax(0, 1.2fr) minmax(0, 2fr) 28px; gap: 14px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; box-shadow: var(--shadow-sm); }
.ft-thumb { width: 56px; height: 56px; border-radius: 8px; background: var(--surface-3); display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 11px; font-weight: 700; color: var(--muted); }
.ft-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ft-info { display: flex; flex-direction: column; min-width: 0; }
.ft-info strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; }
.ft-info span { color: var(--muted); font-size: 12px; }
.ft-right { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 12.5px; }
.ft-res.ok { color: var(--ok); }
.ft-note { color: var(--muted); font-size: 12px; } .ft-note.bad { color: var(--danger); }
.ft-meta { display: flex; flex-wrap: wrap; gap: 4px; }
.mchip { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); }
.mchip.bad { background: #fef2f2; color: #b91c1c; } .mchip.ok { background: #ecfdf3; color: var(--ok); }
.ft-details summary { cursor: pointer; color: var(--brand); font-size: 12px; font-weight: 600; }
.ft-details dl { display: grid; grid-template-columns: max-content 1fr; gap: 2px 12px; margin: 6px 0 0; font-size: 12px; }
.ft-details dt { color: var(--muted); } .ft-details dd { margin: 0; word-break: break-word; } .ft-details dd.bad { color: #b91c1c; font-weight: 600; }
.ft-loc { margin: 6px 0 0; font-size: 12.5px; color: #b91c1c; font-weight: 600; }
.ft-side { background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 58px; height: calc(100dvh - 58px); }
.ft-panel { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.ft-foot { border-top: 1px solid var(--line); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.fmt-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.fmt { padding: 10px 4px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font: 700 13px var(--font); cursor: pointer; color: var(--text); }
.fmt:hover { border-color: var(--brand); }
.fmt.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.ft .busy { position: fixed; }
@media (max-width: 860px) {
  .ft { grid-template-columns: 1fr; min-height: 0; }
  .ft-main { padding: 14px; }
  .ft-side { position: static; height: auto; border-left: 0; border-top: 1px solid var(--line); }
  .ft-row { grid-template-columns: 44px minmax(0, 1fr) 26px; }
  .ft-thumb { width: 44px; height: 44px; }
  .ft-right { grid-column: 1 / -1; grid-row: 2; }
  .ft-modes button { padding: 6px 10px 6px 6px; font-size: 12.5px; }
}

/* filters gallery */
.filter-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.ftile { position: relative; border: 2px solid transparent; border-radius: 10px; background: var(--surface-3); padding: 0; cursor: pointer; overflow: hidden; display: flex; flex-direction: column; }
.ftile img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; background: var(--surface-3); }
.ftile span { font-size: 10.5px; font-weight: 600; padding: 3px 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #334155; }
.ftile.active { border-color: var(--brand); }
.ftile.active span { color: var(--brand); }
.ftile .x, .chip-x .x { position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border-radius: 50%; background: rgba(15,23,42,.7); color: #fff; font: 700 12px/18px var(--font); text-align: center; font-style: normal; border: 0; padding: 0; cursor: pointer; }
.chip-x { position: relative; display: inline-flex; }
.chip-x .chip { padding-right: 24px; }
.chip-x .x { top: 50%; transform: translateY(-50%); right: 4px; }
/* safe zones */
.safe-layer { position: absolute; inset: 0; pointer-events: none; z-index: 3; }
.safe-layer .sz { position: absolute; background: rgba(239,68,68,.28); border: 1.5px dashed rgba(239,68,68,.9); }
.safe-layer .sg { position: absolute; box-shadow: 0 0 0 9999px rgba(15,23,42,.5); border: 2px dashed #fff; }
.safe-layer .sg.circle { border-radius: 50%; }
.safe-layer span { position: absolute; left: 4px; top: 3px; font: 600 10px/1.2 var(--font); color: #fff; background: rgba(15,23,42,.65); padding: 1px 5px; border-radius: 4px; }
.safe-layer { overflow: hidden; }
.pack-list { display: grid; grid-template-columns: 1fr; gap: 4px; }
.pack-list em { font-style: normal; font-size: 11.5px; }
.group-inner { display: flex; flex-direction: column; gap: 8px; }
/* redact */
.redact-layer { position: absolute; inset: 0; z-index: 4; cursor: crosshair; touch-action: none; }
.redact-layer .rb { position: absolute; border: 2px solid #fff; outline: 1.5px solid rgba(15,23,42,.6); background: rgba(255,255,255,.08); cursor: move; }
.redact-layer .rb.oval { border-radius: 50%; }
.redact-layer .rface { position: absolute; border: 2px dashed rgba(255,255,255,.9); border-radius: 50%; pointer-events: none; }
.redact-layer .rx { position: absolute; top: -12px; right: -12px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; background: var(--danger); color: #fff; font: 700 13px/1 var(--font); padding: 0; cursor: pointer; }
.redact-layer .rh { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: #fff; border: 2px solid var(--brand); border-radius: 3px; cursor: nwse-resize; }
.rbox { border-top: 1px solid var(--line); padding-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.tab-redact { --tc: #475569 !important; }

/* ---------- dark mode (html[data-mode=dark]); brand colours stay the same ---------- */
.mode-btn { width: 30px; height: 26px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.mode-btn svg { width: 16px; height: 16px; }
:root[data-mode=dark] {
  color-scheme: dark;
  --bg: #0b0f17; --surface: #141a24; --surface-2: #1a212d; --surface-3: #212a38; --stage-bg: #0f141c;
  --line: #2a3443; --line-2: #3a4658; --text: #e6ebf2; --text-2: #c3ccd8; --muted: #8b97a8;
  --black: #2b3546; --brand-soft: color-mix(in srgb, var(--brand) 20%, #141a24);
  --warn-bg: #2d2412; --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
}
:root[data-mode=dark] .chip.active, :root[data-mode=dark] .seg button.active { background: var(--brand); border-color: var(--brand); }
:root[data-mode=dark] .nav a { color: var(--text-2); }
:root[data-mode=dark] .nav a:hover { background: var(--surface-3); }
:root[data-mode=dark] .nav a.active { color: #fff; }
:root[data-mode=dark] .nav a svg { color: var(--muted); }
:root[data-mode=dark] code, :root[data-mode=dark] .tag { background: var(--surface-3); color: var(--text-2); }
:root[data-mode=dark] .stage { background-color: #1b222d; background-image: linear-gradient(45deg, #232c39 25%, transparent 25%), linear-gradient(-45deg, #232c39 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #232c39 75%), linear-gradient(-45deg, transparent 75%, #232c39 75%); }
:root[data-mode=dark] .pdf-stage { background: var(--stage-bg) !important; }
:root[data-mode=dark] .anchor-grid button::after { background: var(--line-2); }
:root[data-mode=dark] .theme-pick button { border-color: var(--surface); }
:root[data-mode=dark] .pk { background: rgba(255,255,255,.92); }
:root[data-mode=dark] .warn { color: #fbbf24; }
:root[data-mode=dark] input, :root[data-mode=dark] select, :root[data-mode=dark] textarea { background: var(--surface-2); color: var(--text); border-color: var(--line); }
:root[data-mode=dark] .tabs button { color: var(--text-2); }
:root[data-mode=dark] .tabs button.active { color: #fff; }
:root[data-mode=dark] .tool-ic, :root[data-mode=dark] .tabs button svg { background: color-mix(in srgb, var(--tc, var(--brand)) 22%, var(--surface)); }
:root[data-mode=dark] .modal { background: rgba(0,0,0,.6); }
@media (max-width: 1100px) and (min-width: 821px) { .tabs button { font-size: 10px !important; padding: 7px 2px 6px; } }

/* proper dropdowns (platform sizes, safe zones) */
.select { -webkit-appearance: none; appearance: none; width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 0 36px 0 12px; font: 500 13.5px/1.2 var(--font); color: var(--text); cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2364748b'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E") no-repeat right 10px center / 20px; }
.select:hover { border-color: var(--line-2); }
.select optgroup { font-weight: 700; color: var(--muted); }
.select option { font-weight: 400; color: var(--text); }
.custom-size { border: 1px dashed var(--line-2); border-radius: 10px; padding: 0 12px; }
.custom-size[open] { padding-bottom: 12px; display: flex; flex-direction: column; gap: 10px; }
.custom-size summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 10px 0; list-style: none; }
.custom-size summary::-webkit-details-marker { display: none; }
.chip em { font-style: normal; font-weight: 500; }
.color-row .arrow { color: var(--muted); }
.btn-danger-soft { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); font-weight: 600; }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--danger) 12%, var(--surface)); border-color: var(--danger); }

/* font picker */
.fontpick { display: block; }
.font-btn { width: 100%; height: 40px; display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--text); padding: 0 8px 0 12px; cursor: pointer; font-size: 16px; text-align: left; }
.font-btn span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.font-btn svg { width: 18px; height: 18px; color: var(--muted); }
.font-btn:hover { border-color: var(--line-2); }
.font-pop { position: fixed; z-index: 200; max-height: min(460px, 70vh); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(15,23,42,.25); overflow: hidden; }
.fp-head { padding: 10px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line); }
.fp-head input { height: 38px; border: 1px solid var(--line); border-radius: 9px; padding: 0 10px; background: var(--surface-2); }
.fp-list { overflow-y: auto; flex: 1; padding: 6px; }
.fp-item { position: relative; display: flex; width: 100%; align-items: center; border: 0; background: none; color: var(--text); padding: 9px 30px 9px 10px; border-radius: 8px; cursor: pointer; font-size: 19px; text-align: left; line-height: 1.25; }
.fp-item:hover { background: var(--surface-3); }
.fp-item.active { background: var(--brand-soft); color: var(--brand-dark); }
.fp-item .x { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; border-radius: 50%; background: var(--surface-3); font: 700 13px/20px var(--font); font-style: normal; text-align: center; color: var(--muted); }
.fp-empty { padding: 10px; }
.fp-foot { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); background: var(--surface-2); }
:root[data-mode=dark] .fp-item.active { color: #fff; }

/* text panel */
.grid-font { display: grid; grid-template-columns: minmax(0, 1fr) 96px; gap: 10px; }
.color-line { display: grid; grid-template-columns: 58px 44px minmax(0, 1fr); align-items: center; gap: 10px; }
.color-line > span { font-weight: 600; font-size: 12.5px; color: var(--text-2); }
.color-line input[type=color] { width: 44px; height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface); cursor: pointer; }
.color-line .check { font-size: 12.5px; }
.outline-w .slider { margin: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.swatches button { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(15,23,42,.2); padding: 0; cursor: pointer; }
.swatches button.active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--brand); }
.togs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tog { height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--text-2); font: 600 12.5px var(--font); cursor: pointer; }
.tog.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.sub-details summary { cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--brand); }
.sub-details[open] { display: flex; flex-direction: column; gap: 8px; }

/* AI page: showcase + account */
#aiHome { display: flex; flex-direction: column; gap: 18px; max-width: 1100px; }
.ai-hero { border-radius: 20px; padding: 28px 30px; color: #fff; background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--brand-2) 80%, #fff) 0%, transparent 55%), linear-gradient(135deg, var(--brand-dark), var(--brand) 55%, var(--brand-2)); }
.ai-hero h2 { margin: 6px 0 8px; font-size: 26px; letter-spacing: -.02em; }
.ai-hero p { margin: 0; max-width: 640px; color: rgba(255,255,255,.9); }
.ai-hero .eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.85); }
.ai-sec { margin: 6px 0 -6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ai-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.ai-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm); }
.ai-card strong { font-size: 15px; padding-right: 50px; }
.ai-card span:not(.tag) { color: var(--muted); font-size: 13px; line-height: 1.45; }
.ai-card em { font-style: normal; font-weight: 600; color: var(--brand); font-size: 13px; margin-top: auto; }
.ai-card .tag { position: absolute; top: 14px; right: 14px; }
.ai-card.free:hover { border-color: var(--brand); transform: translateY(-1px); }
.ai-card.pro { background: linear-gradient(160deg, color-mix(in srgb, var(--brand-2) 8%, var(--surface)), var(--surface) 60%); }
.tag.ok { background: color-mix(in srgb, var(--ok) 14%, var(--surface)); color: var(--ok); }
.tag.pro { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.auth-card { max-width: 440px; width: 100%; }
.auth-tabs { margin-bottom: 14px; }
.ai-top { margin-bottom: 12px; }
.admin-list { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.admin-row { display: grid; grid-template-columns: minmax(160px, 2fr) 100px 70px 100px; gap: 10px; align-items: center; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: 13px; }
.admin-row.head { font-weight: 700; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; }
.select.sm { height: 32px; font-size: 12.5px; padding: 0 28px 0 8px; background-size: 16px; }

/* presets page */
.preset-list { display: block !important; }
.preset-sec { margin: 4px 0 10px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 18px; }
.preset { background: var(--surface); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-sm); }
.preset.mine { border-color: color-mix(in srgb, var(--brand) 35%, var(--line)); }
.preset-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.preset-top h4 { font-size: 14.5px; line-height: 1.3; }
.preset-top .tag { flex: none; white-space: nowrap; }
.preset-use { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: auto; }
.preset-more { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; }
.preset-more .linkish { text-decoration: none; }
.linkish.danger { color: var(--danger); }
.preset-new { align-items: center; justify-content: center; text-align: center; border: 2px dashed var(--line-2); background: var(--surface-2); cursor: pointer; color: var(--text); min-height: 150px; font: inherit; }
.preset-new span { font-size: 28px; color: var(--brand); line-height: 1; }
.preset-new em { font-style: normal; color: var(--muted); font-size: 12.5px; }
.preset-new:hover { border-color: var(--brand); }
.top-preset { width: 170px; }
.scan-view { position: relative; flex: 1; min-height: 0; display: flex; }
.scan-view video { flex: 1; min-height: 0; width: 100%; object-fit: contain; }
.scan-outline { position: absolute; inset: 0; pointer-events: none; }
.scan-tip { position: absolute; left: 50%; top: max(16px, env(safe-area-inset-top)); transform: translateX(-50%); background: rgba(0,0,0,.6); color: #fff; font-size: 13px; padding: 6px 12px; border-radius: 14px; max-width: 88vw; width: max-content; text-align: center; }
.scanner.found .scan-tip { background: rgba(22,163,74,.85); }

/* get the app */
.app-page { display: flex; flex-direction: column; gap: 18px; max-width: 1100px; }
.app-hero { display: grid; grid-template-columns: minmax(0, 1fr) 180px; gap: 24px; align-items: center; border-radius: 22px; padding: 30px; color: #fff; background: radial-gradient(120% 140% at 100% 0%, color-mix(in srgb, var(--brand-2) 80%, #fff) 0%, transparent 55%), linear-gradient(135deg, var(--brand-dark), var(--brand) 55%, var(--brand-2)); }
.app-hero h2 { margin: 6px 0 8px; font-size: 26px; letter-spacing: -.02em; }
.app-hero p { margin: 0 0 16px; color: rgba(255,255,255,.9); max-width: 560px; }
.app-hero .eyebrow { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.85); }
.btn-light { background: #fff; color: var(--brand-dark); border-color: #fff; font-weight: 700; }
.installed-note { font-weight: 600; }
.phone-mock { width: 150px; height: 280px; border-radius: 30px; border: 6px solid rgba(255,255,255,.85); background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; justify-self: center; }
.pm-screen { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.pm-screen svg { width: 56px; height: 56px; }
.app-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.app-steps .panel-card { margin: 0; }
.app-steps ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; color: var(--text-2); }
.app-steps .mine { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); order: -1; }
.app-perks { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.app-perks div { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.app-perks span { color: var(--muted); font-size: 13px; }
@media (max-width: 820px) {
  .app-hero { grid-template-columns: 1fr; padding: 22px; } .phone-mock { display: none; }
  .app-steps, .app-perks { grid-template-columns: 1fr; }
  .app-perks { grid-template-columns: 1fr 1fr; }
}
.hist-banner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 16px; margin: 4px 0 14px; border-radius: 12px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line)); }
.hist-banner div { display: flex; flex-direction: column; gap: 3px; }
.hist-banner span { color: var(--text-2); font-size: 13px; }
@media (max-width: 640px) { .hist-banner { flex-direction: column; align-items: flex-start; } }

/* background touch-up */
.touch-layer { position: absolute; inset: 0; z-index: 4; cursor: none; touch-action: none; overflow: hidden; }
.touch-layer.wand { cursor: crosshair; }
.tu-cursor { position: absolute; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.6), inset 0 0 0 1px rgba(0,0,0,.4); pointer-events: none; }
.touch-layer.wand .tu-cursor { display: none !important; }
@media (pointer: coarse) { .tu-cursor { display: none; } }
.sidebar-foot { min-width: 0; }
#accountLabel { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot button { flex: none; color: var(--text-2); border-color: var(--line); }
@media (max-width: 520px) {
  .ft-modes { display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .ft-modes button { flex-direction: column; padding: 8px 4px; font-size: 12px; gap: 4px; text-align: center; justify-content: center; }
}

/* phones: the settings use the whole page scroll; the preview stays pinned under the top bar,
   the tool tabs pin under the preview and the export bar pins above the bottom menu */
@media (max-width: 860px) {
  body:has(#view-editor.active) .main, body:has(#view-collage.active) .main, body:has(#view-pdf.active) .main { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }
  .editor { display: block !important; height: auto !important; }
  .editor .stage-col { position: sticky; top: 52px; z-index: 20; }
  .editor .stage { height: 30vh; height: 30dvh; }
  .pdfm .stage { height: 36vh; height: 36dvh; }
  .stage-toolbar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .stage-toolbar::-webkit-scrollbar { display: none; }
  .stage-toolbar > * { flex: none; }
  .editor .panel-col { display: flex; flex-direction: column; min-height: calc(100dvh - var(--stick-top, 300px) - 60px - env(safe-area-inset-bottom)); }
  .editor .tabs { position: sticky; top: var(--stick-top, 52px); z-index: 18; background: var(--surface-2); }
  .editor .panel-body { overflow: visible; padding-bottom: 16px; flex: 1 0 auto; }
  .editor .panel-foot { position: sticky; bottom: calc(60px + env(safe-area-inset-bottom)); z-index: 18; box-shadow: 0 -6px 16px rgba(15,23,42,.06); }
}
@media (max-width: 860px) {
  .sidebar { inset: 0 0 0 auto; border-right: 0; border-left: 1px solid var(--line); transform: translateX(100%); box-shadow: -10px 0 30px rgba(15,23,42,.15); }
  .sidebar.open { transform: none; }
  .topbar { gap: 8px; }
  .mobile-logo { display: inline-flex !important; width: 34px; height: 34px; flex: none; }
  .mobile-logo svg { width: 34px; height: 34px; }
  .topbar h1::before { display: none; }
  .topbar-actions { margin-left: auto; }
  .menu-btn { width: 46px !important; height: 46px !important; margin-right: -6px; border-radius: 12px; }
  .menu-btn svg { width: 28px; height: 28px; }
}

/* TPIX wordmark */
.wordmark { font-weight: 800; letter-spacing: .03em !important; color: var(--text); }
.wordmark i { font-style: normal; background: linear-gradient(135deg, var(--brand), var(--brand-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.mobile-word { display: none; font-size: 20px; }
/* Home page: the top bar shows the TPIX logo instead of the word "Home" */
body:has(#view-dashboard.active) #pageTitle { display: none; }
body:has(#view-dashboard.active) .mobile-word { display: inline; }
body:has(#view-dashboard.active) .mobile-logo { display: inline-flex !important; width: 34px; height: 34px; flex: none; }
body:has(#view-dashboard.active) .mobile-logo svg { width: 34px; height: 34px; }
body:has(#view-dashboard.active) .topbar { gap: 10px; }
.filmstrip .thumb.drop-on { border-color: var(--brand-2); box-shadow: -4px 0 0 var(--brand); }
.adv summary { cursor: pointer; font-weight: 600; color: var(--brand); padding: 8px 0; font-size: 13px; }
.adv[open] summary { margin-bottom: 6px; }
.scan-auto { min-width: 64px; height: 38px; border-radius: 99px; border: 1.5px solid rgba(255,255,255,.6); background: transparent; color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; }
.scan-auto[aria-pressed="true"] { background: #22c55e; border-color: #22c55e; }
.scan-last { position: relative; width: 56px; height: 72px; display: grid; place-items: center; }
.scan-last img { width: 56px; height: 72px; object-fit: cover; border-radius: 6px; border: 2px solid #fff; background: #fff; }
.scan-last .scan-count { position: absolute; top: -8px; right: -8px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 12px; display: grid; place-items: center; text-align: center; }
.scan-last img[hidden] + .scan-count { position: static; background: transparent; font-size: 15px; }
