/* ── Graflio: light studio ─────────────────────────────────────
   Stripe-like system: white surfaces on a cool-gray field, slate text
   in three strengths, a single warm accent, soft layered shadows.
   Hierarchy = color temperature + weight, never decoration. */

:root {
  /* field & surfaces */
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;

  /* text: three strengths only */
  --ink: #0a2540;
  --txt-2: #4f5e74;
  --muted: #8792a2;

  /* lines */
  --line: #e3e8ef;
  --line-strong: #d0d7e2;

  /* the one accent */
  --accent: #0c8a5f;
  --accent-deep: #0a6e4c;
  --accent-soft: #e8f4ee;

  --danger: #df1b41;
  --danger-soft: #ffe7ec;

  --shadow-xs: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.1), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
  --shadow-lg: 0 12px 24px -4px rgba(16, 24, 40, 0.12), 0 4px 8px -4px rgba(16, 24, 40, 0.05);

  --mono: 'Fragment Mono', monospace;
  --sans: 'Archivo', sans-serif;
  --display: 'Fraunces', serif;

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-soft); }

/* ── top bar ── */
.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  z-index: 60;
}

.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-mark { color: var(--accent); font-size: 18px; transform: translateY(1px); }
.brand h1 {
  font-family: 'Archivo', var(--sans);
  font-weight: 800;
  font-size: 23px;
  letter-spacing: -0.025em;
  color: var(--ink);
}
.wm-l { color: var(--accent, #0c8a5f); }
.wm-i { position: relative; }
.wm-i::before {
  content: ''; position: absolute; width: .165em; height: .165em; border-radius: 50%;
  background: var(--accent, #0c8a5f); left: .0625em; top: .075em;
}

.brand-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.topbar-actions { display: flex; align-items: center; gap: 10px; }

.job-status {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--txt-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px;
}
.job-status.busy {
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-color: #c5e3d4;
}

/* ── buttons ── */
.btn {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  border: none;
  cursor: pointer;
  padding: 8px 14px;
  border-radius: var(--r);
  transition: background 0.13s ease, box-shadow 0.13s ease, border-color 0.13s, color 0.13s, transform 0.08s;
}
.btn:active { transform: translateY(1px); }

.btn.primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-sm), inset 0 -1px 0 rgba(0, 0, 0, 0.12);
}
.btn.primary:hover { background: #0a6e4c; }

/* "dark" is the secondary button hook: Stripe-style white + border */
.btn.dark {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.btn.dark:hover { border-color: var(--muted); }

.btn.ghost {
  background: transparent;
  color: var(--txt-2);
  border: 1px solid transparent;
}
.btn.ghost:hover { background: var(--surface-2); color: var(--ink); }

.btn.full { width: 100%; }
.btn.big { padding: 12px 16px; font-size: 14px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.link-btn {
  background: none;
  border: none;
  color: var(--txt-2);
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 8px;
  padding: 0;
}
.link-btn:hover { color: var(--accent-deep); }

/* ── workbench layout ── */
.workbench {
  flex: 1;
  display: grid;
  grid-template-columns: 320px 1fr 250px;
  min-height: 0;
}

.rail {
  background: var(--surface);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.rail-left { border-right: 1px solid var(--line); }
.rail-right { border-left: 1px solid var(--line); }

.ticket-head {
  display: flex;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  position: sticky;
  top: 0;
  z-index: 5;
}

.panel { padding: 18px; border-bottom: 1px solid var(--line); }

.panel-label {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin-bottom: 9px;
}

input[type='url'], input[type='text'], textarea, select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--r);
  outline: none;
  margin-bottom: 8px;
  box-shadow: var(--shadow-xs);
  transition: border-color 0.13s, box-shadow 0.13s;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(12, 138, 95, 0.14);
}

.url-row { display: flex; gap: 8px; }
.url-row input { margin-bottom: 0; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0; }
.two-col select { margin-bottom: 0; }

.error {
  color: var(--danger);
  background: var(--danger-soft);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  font-size: 12px;
  margin-top: 8px;
  line-height: 1.45;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 12px; }

/* product card */
.product-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--r-lg);
  padding: 12px 14px;
  font-size: 12.5px;
  line-height: 1.5;
}
.product-card .pc-title { font-weight: 600; font-size: 13px; margin-bottom: 5px; }
.product-card .pc-meta {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--txt-2);
  margin-bottom: 6px;
  display: flex;
  gap: 10px;
}
.product-card ul { padding-left: 16px; color: var(--txt-2); }
.product-card li { margin-bottom: 3px; }

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.thumb {
  aspect-ratio: 1;
  background: var(--surface);
  border-radius: var(--r);
  border: 1px solid var(--line);
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  position: relative;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.thumb:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(12, 138, 95, 0.18);
}

.file-drop {
  display: block;
  border: 1px dashed var(--line-strong);
  border-radius: var(--r);
  padding: 14px;
  text-align: center;
  font-size: 12px;
  font-weight: 500;
  color: var(--txt-2);
  cursor: pointer;
  margin-bottom: 8px;
  background: var(--surface-2);
  transition: border-color 0.13s, color 0.13s, background 0.13s;
}
.file-drop:hover { border-color: var(--accent); color: var(--accent-deep); background: var(--accent-soft); }
.file-drop input { display: none; }
.file-drop.has-file {
  border-style: solid;
  border-color: var(--accent);
  color: var(--ink);
  background: var(--accent-soft);
}

/* ── stage ── */
.stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(rgba(80, 100, 130, 0.13) 1px, transparent 1px) 0 0 / 22px 22px,
    var(--bg);
  min-width: 0;
  overflow: hidden;
}

.stage-inner { display: flex; flex-direction: column; align-items: center; gap: 12px; }

.canvas-frame {
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    0 0 0 1px var(--line-strong),
    var(--shadow-lg),
    0 30px 60px -12px rgba(16, 24, 40, 0.18);
  line-height: 0;
  background: #fff;
}

.stage-hint {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* ── inspector ── */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.tool {
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--txt-2);
  border-radius: var(--r);
  padding: 10px 4px 7px;
  font-size: 15px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: border-color 0.12s, color 0.12s, box-shadow 0.12s;
}
.tool small {
  font-family: var(--mono);
  font-size: 8.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.tool:hover {
  border-color: var(--accent);
  color: var(--accent-deep);
  box-shadow: var(--shadow-sm);
}

.prop-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--txt-2);
}
.prop-row span { width: 34px; flex-shrink: 0; }
.prop-row select { margin-bottom: 0; font-size: 12px; padding: 6px 8px; }
.prop-row input[type='range'] { flex: 1; accent-color: var(--accent); }
.prop-row output { font-size: 11px; font-family: var(--mono); width: 26px; text-align: right; color: var(--txt-2); }

/* color inputs: the picked color fills the whole box (no inner swatch inset) */
input[type='color'] {
  -webkit-appearance: none;
  appearance: none;
  width: 34px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  background: none;
  cursor: pointer;
  padding: 0;
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}
input[type='color']::-webkit-color-swatch-wrapper { padding: 0; }
input[type='color']::-webkit-color-swatch { border: none; border-radius: 0; }
input[type='color']::-moz-color-swatch { border: none; border-radius: 0; }

.prop-actions { display: flex; gap: 6px; margin-top: 4px; }
.mini {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--txt-2);
  border-radius: var(--r-sm);
  padding: 7px 0;
  cursor: pointer;
  font-size: 13px;
  transition: border-color 0.12s, color 0.12s;
}
.mini:hover { border-color: var(--muted); color: var(--ink); }
.mini.danger:hover { border-color: var(--danger); color: var(--danger); }

/* ── loading overlay ── */
.loading {
  position: fixed;
  inset: 0;
  background: rgba(246, 248, 251, 0.78);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.loading-card {
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: 28px 40px;
}
.loading-spin {
  font-size: 34px;
  color: var(--accent);
  animation: spin 1.6s linear infinite;
  margin-bottom: 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── saved products ── */
.saved-list { display: flex; flex-direction: column; gap: 6px; }
.saved-item {
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 6px 8px;
  background: var(--surface);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.saved-item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.saved-item img,
.saved-noimg {
  width: 34px;
  height: 34px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--surface-2);
  border: 1px solid var(--line);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
}
.saved-load {
  flex: 1;
  text-align: left;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  padding: 0;
}
.saved-load:hover { color: var(--accent-deep); }
.saved-del {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  flex-shrink: 0;
}
.saved-del:hover { color: var(--danger); }

/* ── export menu ── */
.export-menu { position: relative; }
.export-drop {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 240px;
  z-index: 80;
  box-shadow: var(--shadow-lg);
}
.export-drop button {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  background: none;
  border: none;
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  padding: 9px 10px;
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
}
.export-drop button small {
  font-family: var(--mono);
  font-weight: 400;
  font-size: 10px;
  color: var(--muted);
}
.export-drop button:hover { background: var(--accent-soft); color: var(--accent-deep); }

/* ── layers panel ── */
.layer-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.layer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  color: var(--txt-2);
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 500;
  padding: 6px 9px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.layer-row:hover { background: var(--surface-2); color: var(--ink); }
.layer-row.active {
  background: var(--accent-soft);
  border-color: #c5e3d4;
  color: var(--accent-deep);
}
.layer-count {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 1px 7px;
}
.layer-row.active .layer-count {
  color: var(--accent-deep);
  border-color: #c5e3d4;
  background: transparent;
}

/* AI-generated thumb marker */
.thumb.gen::after {
  content: '✦';
  position: absolute;
  top: 2px;
  right: 4px;
  font-size: 11px;
  color: var(--accent);
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
}

/* ── lightbox (photo viewer stays dim — it frames the image) ── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(10, 37, 64, 0.55);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 30px;
}
.lightbox.hidden { display: none; }
#lb-img {
  max-width: min(82vw, 920px);
  max-height: 72vh;
  border-radius: var(--r-lg);
  background: #fff;
  box-shadow: 0 24px 70px rgba(10, 37, 64, 0.45);
}
#lb-close {
  position: absolute;
  top: 16px;
  right: 22px;
  background: rgba(255, 255, 255, 0.14);
  border: none;
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 16px;
  cursor: pointer;
}
#lb-close:hover { background: rgba(255, 255, 255, 0.28); }
.lb-bar { display: flex; gap: 8px; width: min(82vw, 920px); }
.lb-bar input { flex: 1; margin-bottom: 0; }

/* thumb zoom affordance */
.thumb-zoom {
  position: absolute;
  right: 3px;
  bottom: 3px;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  background: rgba(10, 37, 64, 0.65);
  color: #fff;
  border-radius: var(--r-sm);
  font-size: 12px;
  cursor: zoom-in;
  opacity: 0;
  transition: opacity 0.12s;
}
.thumb:hover .thumb-zoom { opacity: 1; }

#refine-notes { width: 100%; margin-bottom: 8px; }

/* ── scrollbars (WebKit) ── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 999px;
  border: 3px solid var(--surface);
}
::-webkit-scrollbar-track { background: transparent; }

/* ── batch studio ─────────────────────────────────────────── */
#batch-box { margin-top: 4px; border-top: 1px dashed var(--line-strong); padding-top: 4px; }
.batch-run {
  display: grid;
  grid-template-columns: 1fr 1fr 24px;
  gap: 6px;
  align-items: start;
  padding: 8px 0 2px;
  border-bottom: 1px dashed var(--line);
}
.batch-run select { font-size: 11.5px; padding: 6px 8px; min-width: 0; }
.batch-run .br-brief { grid-column: 1 / span 2; }
.batch-run .br-del {
  border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 13px; padding: 6px 2px;
}
.batch-run .br-del:hover { color: var(--danger); }
.batch-actions { display: flex; justify-content: space-between; align-items: center; margin: 6px 0; }

/* ── results overlay ──────────────────────────────────────── */
.results {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(10, 37, 64, 0.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 28px;
}
.results.hidden { display: none; }
.results-card {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: min(1060px, 100%); max-height: 90vh; display: flex; flex-direction: column;
}
.results-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--txt-2);
}
.results-head button { border: none; background: none; font-size: 16px; cursor: pointer; color: var(--muted); }
.results-head button:hover { color: var(--ink); }
.results-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px; padding: 18px; overflow-y: auto;
}
.result-card {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--surface-2); text-align: left; cursor: pointer; padding: 0;
  transition: border-color 0.15s, box-shadow 0.15s; position: relative;
}
.result-card:hover:not(.pending) { border-color: var(--accent); box-shadow: var(--shadow-md); }
.result-card.pending { cursor: default; }
.result-card.error { cursor: default; border-color: var(--danger); }
.result-thumb {
  aspect-ratio: 1; width: 100%; display: flex; align-items: center; justify-content: center;
  background: #fff; position: relative;
}
.result-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.result-spin { font-size: 26px; color: var(--accent); animation: spin 1.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-err-msg { padding: 14px; font-size: 12px; color: var(--danger); }
.result-concept {
  position: absolute; right: 8px; bottom: 8px; width: 64px; height: 64px;
  border: 2px solid var(--surface); border-radius: 8px; box-shadow: var(--shadow-md);
  object-fit: cover; background: #fff;
}
.result-meta {
  display: flex; justify-content: space-between; gap: 8px; align-items: center;
  padding: 9px 12px; border-top: 1px solid var(--line);
  font-family: var(--mono); font-size: 10.5px; color: var(--txt-2);
}
.result-meta .rm-mode { color: var(--accent); white-space: nowrap; }
.result-meta .rm-detail { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════════════ font picker + floating toolbar (editor v2) ════════════ */

.font-trigger {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  font-size: 13px;
  padding: 8px 26px 8px 10px;
  border-radius: var(--r);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  position: relative;
  transition: border-color 0.13s, box-shadow 0.13s;
}
.font-trigger::after {
  content: '⌄';
  position: absolute;
  right: 9px;
  top: 50%;
  transform: translateY(-58%);
  color: var(--muted);
  font-family: var(--sans);
}
.font-trigger:hover { border-color: var(--muted); }

.fontpop {
  position: fixed;
  z-index: 90;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px -12px rgba(16, 24, 40, 0.28), var(--shadow-md);
  overflow: hidden;
  animation: fontpop-in 0.14s ease;
}
@keyframes fontpop-in {
  from { opacity: 0; transform: translateY(-4px) scale(0.985); }
  to { opacity: 1; transform: none; }
}
.fontpop-search {
  margin: 10px 10px 8px !important;
  width: calc(100% - 20px) !important;
  margin-bottom: 8px !important;
}
.fontpop-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 6px 6px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}
.fontpop-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--r);
  cursor: pointer;
  font-size: 15px;
  color: var(--ink);
}
.fontpop-item:hover { background: var(--surface-2); }
.fontpop-item.active { background: var(--accent-soft); }
.fontpop-item .fp-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fontpop-ai .fp-name { font-family: var(--mono); font-size: 11px; color: var(--accent-deep); }
.fp-badge {
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 2px 6px;
}
.fp-del {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  padding: 2px 4px;
  border-radius: 4px;
}
.fp-del:hover { color: var(--danger); background: var(--danger-soft); }
.fontpop-none { padding: 14px; font-size: 12px; color: var(--muted); }
.fontpop-upload {
  display: block;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--txt-2);
  cursor: pointer;
  text-align: center;
  letter-spacing: 0.04em;
}
.fontpop-upload:hover { color: var(--accent-deep); background: var(--accent-soft); }

.brand-font-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.brand-font-chip {
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--ink);
}

/* floating contextual toolbar over the canvas */
.float-bar {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 5px;
  box-shadow: 0 12px 32px -8px rgba(16, 24, 40, 0.22), var(--shadow-sm);
  animation: fontpop-in 0.14s ease;
}
.fb-group { display: flex; align-items: center; gap: 4px; }
.float-bar .fb-font {
  width: 148px;
  margin: 0;
  padding: 7px 24px 7px 10px;
  box-shadow: none;
  font-size: 12.5px;
}
.fb-size { display: flex; align-items: center; border: 1px solid var(--line-strong); border-radius: var(--r); overflow: hidden; }
.fb-size button {
  background: var(--surface);
  border: none;
  width: 26px;
  height: 32px;
  font-size: 15px;
  color: var(--txt-2);
  cursor: pointer;
}
.fb-size button:hover { background: var(--surface-2); color: var(--ink); }
.fb-size input {
  width: 40px;
  border: none;
  text-align: center;
  font-size: 12.5px;
  padding: 0;
  margin: 0;
  box-shadow: none;
  border-radius: 0;
  -moz-appearance: textfield;
}
.fb-size input::-webkit-outer-spin-button, .fb-size input::-webkit-inner-spin-button { -webkit-appearance: none; }
.fb-tgl {
  background: var(--surface);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  font-size: 14px;
  color: var(--txt-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.12s, color 0.12s;
}
.fb-tgl:hover { background: var(--surface-2); color: var(--ink); }
.fb-tgl.on { background: var(--accent-soft); color: var(--accent-deep); }
.fb-tgl.fb-danger:hover { background: var(--danger-soft); color: var(--danger); }
.fb-color {
  width: 32px;
  height: 32px;
  border-radius: var(--r);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.fb-color:hover { background: var(--surface-2); }
.fb-color input {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  margin: 0;
  box-shadow: none;
  cursor: pointer;
}
.fb-sep { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }

/* editor v2 polish: softer canvas card, livelier tool tiles */
.canvas-frame { border-radius: 10px; }
.tool {
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.tool:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

/* brand mark in topbars: "Layers × K-pin" (transparent-backed — no clipping) */
.brand-mark svg.brand-kpin { width: 24px; height: 24px; display: block; }

/* AI spot edit: mask overlay over the canvas */
.canvas-frame { position: relative; }
#mask-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 6;
}
.canvas-frame.mask-mode #mask-overlay {
  pointer-events: auto;
  cursor: crosshair;
}
.legacy-rail.hidden { display: none !important; }

/* mask tool mode toggle */
.mask-modes { display: flex; gap: 8px; }
.mask-mode-btn {
  flex: 1;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--txt-2);
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
}
.mask-mode-btn:hover { border-color: var(--muted); color: var(--ink); }
.mask-mode-btn.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-deep);
}

/* undo / redo arrows */
.hist-btn { font-size: 17px; padding: 6px 10px; line-height: 1; }
.hist-btn:disabled { opacity: 0.3; }

/* ── credit glyph ── a 4-point spark used wherever a price is shown, so
   costs read as "◈ 0.5" rather than "0.5 cr". Inherits currentColor. */
.cr {
  display: inline-block;
  width: 0.82em; height: 0.82em;
  vertical-align: -0.06em;
  margin-right: 0.24em;
  background: currentColor;
  -webkit-mask: var(--cr-mask) center / contain no-repeat;
  mask: var(--cr-mask) center / contain no-repeat;
}
:root {
  --cr-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1.6c.55 5.05 4.3 8.8 9.35 9.35v2.1c-5.05.55-8.8 4.3-9.35 9.35h-2.1C9.35 17.35 5.6 13.6.55 13.05v-2.1C5.6 10.4 9.35 6.65 9.9 1.6z'/%3E%3C/svg%3E");
}
.cr-price { color: var(--accent-deep, #0a6e4c); white-space: nowrap; }

.cost-badge {
  margin-left: auto; padding-left: 10px;
  font-family: var(--mono); font-size: 10.5px; opacity: .75;
  display: inline-flex; align-items: center; white-space: nowrap;
}
.btn .cost-badge .cr { width: .78em; height: .78em; margin-right: .2em; }
