/* Studio admin styles — extends styles.css from /app/web/public/css/styles.css */

:root {
  --surface: #ffffff;
  --surface-elevated: #fafafa;
  --surface-sunken: #f4f4f5;
  --border: rgba(0, 0, 0, 0.09);
  --border-strong: rgba(0, 0, 0, 0.16);
  --input-bg: #ffffff;
  --input-border: #e3e3e6;
  --input-border-focus: #18181b;
  --danger: #d4324a;
  --success: #16a34a;
  --warning: #d97706;

  /* Admin owns its text + filled-button tokens (don't inherit the portfolio
     Light theme's grays from styles.css). Inverts cleanly for dark mode. */
  --text: #1f1f23;
  --muted: #6c6c74;
  --btn-bg: #18181b;
  --btn-bg-hover: #000000;

  --studio-nav-h: 56px;
  --studio-max: 1200px;
}

/* Studio dark mode — per-user preference, set on <html data-ui-theme="dark">. */
[data-ui-theme="dark"] {
  --surface: #141417;
  --surface-elevated: #1b1b1f;
  --surface-sunken: #202025;
  --border: rgba(255, 255, 255, 0.10);
  --border-strong: rgba(255, 255, 255, 0.18);
  --input-bg: #1b1b1f;
  --input-border: rgba(255, 255, 255, 0.14);
  --input-border-focus: #e8e8ea;
  --danger: #ff6b7d;
  --success: #4ade80;
  --warning: #fbbf24;
  --text: #e8e8ea;
  --muted: #97979f;
  --btn-bg: #ececee;
  --btn-bg-hover: #ffffff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { background: var(--surface); color: var(--text); }
body { font-family: var(--font); margin: 0; -webkit-font-smoothing: antialiased; }
a { color: inherit; }

/* ----- Top bar ----- */
.studio-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--studio-nav-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 32px;
}

.studio-brand {
  display: inline-flex;
  align-items: center;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}

.studio-nav {
  display: flex;
  gap: 24px;
  align-items: center;
}

.studio-nav a {
  text-decoration: none;
  font-size: 14px;
  color: var(--muted);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
  transition: color 150ms ease, border-color 150ms ease;
}

.studio-nav a:hover { color: var(--text); }
.studio-nav a.is-active { color: var(--text); border-bottom-color: var(--text); }

.studio-bar-spacer { flex: 1; }

.studio-bar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.user-menu {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  background: var(--surface-sunken);
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  border: 1px solid var(--border);
  list-style: none;
  user-select: none;
}
.user-menu::-webkit-details-marker { display: none; }
.user-menu::marker { content: ""; }

.user-menu-wrap {
  position: relative;
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
  padding: 6px;
  z-index: 60;
}

.user-menu-panel-header {
  padding: 10px 12px 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}
.user-menu-panel-header .name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.user-menu-panel-header .email {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}

.user-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: 0;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}
.user-menu-item:hover { background: var(--surface-sunken); }
.user-menu-item svg { width: 14px; height: 14px; fill: currentColor; flex-shrink: 0; }

.user-menu-divider {
  height: 1px;
  background: var(--border);
  margin: 6px -6px;
}

.user-menu-item-danger { color: var(--danger); }
.user-menu-item-danger:hover { background: rgba(212, 50, 74, 0.08); }

/* ----- Container ----- */
.studio-main {
  max-width: var(--studio-max);
  margin: 0 auto;
  padding: 40px 24px 80px;
}

/* ----- Mobile bottom nav (app-like; shown only at <=639.98px, hidden on desktop) ----- */
.studio-mobile-logo,
.studio-tabbar,
.studio-sheet,
.studio-sheet-scrim { display: none; }
.studio-mobile-logo { color: var(--text); padding: 17px 16px 6px; }
.studio-mobile-logo svg { display: block; }
.studio-tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--surface); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); align-items: stretch; }
.studio-tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 5px 2px; text-decoration: none; color: var(--muted); font: 500 11px/1.2 var(--font); border: 0; background: none; cursor: pointer; position: relative; }
.studio-tab svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; position: relative; z-index: 1; }
.studio-tab.tab-filled svg { fill: currentColor; stroke: none; }   /* works uses a filled glyph, not an outline */
.studio-tab > span { position: relative; z-index: 1; }
.studio-tab.is-active { color: var(--accent); }
.studio-tab.is-active::before { content: ""; position: absolute; top: 3px; width: 56px; height: 30px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 12%, transparent); z-index: 0; }
.studio-tab-av { width: 26px; height: 26px; border-radius: 50%; background: var(--text); color: var(--surface); display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.studio-tab-you.open .studio-tab-av { box-shadow: 0 0 0 2px var(--accent); }
.studio-sheet-scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.32); opacity: 0; pointer-events: none; transition: opacity 0.2s ease; z-index: 60; }
.studio-sheet-scrim.open { opacity: 1; pointer-events: auto; }
.studio-sheet { position: fixed; left: 0; right: 0; bottom: 0; transform: translateY(110%); transition: transform 0.26s cubic-bezier(0.2,0.8,0.2,1); background: var(--surface); border-radius: 18px 18px 0 0; padding: 8px 10px calc(14px + env(safe-area-inset-bottom)); z-index: 61; box-shadow: 0 -10px 30px rgba(0,0,0,0.16); }
.studio-sheet.open { transform: translateY(0); }
.studio-sheet-grab { width: 38px; height: 4px; border-radius: 999px; background: var(--border); margin: 6px auto 10px; }
.studio-sheet-who { display: flex; align-items: center; gap: 11px; padding: 8px 12px 12px; }
.studio-sheet-who .name { font-size: 14px; font-weight: 600; color: var(--text); }
.studio-sheet-who .email { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.studio-sheet-div { height: 1px; background: var(--border); margin: 6px 8px; }
.studio-sheet-item { display: flex; align-items: center; gap: 13px; padding: 13px 12px; border-radius: 11px; text-decoration: none; color: var(--text); font: 500 15px var(--font); width: 100%; background: none; border: 0; cursor: pointer; text-align: left; }
.studio-sheet-item:active { background: var(--surface-sunken); }
.studio-sheet-item svg { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.studio-sheet-item.danger { color: var(--danger); }

.studio-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 32px;
  gap: 24px;
  flex-wrap: wrap;
}

.studio-header h1 {
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.01em;
  margin: 0;
}

.studio-header .subtitle {
  font-size: 14px;
  color: var(--muted);
  margin: 4px 0 0;
}

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
  white-space: nowrap;
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--surface);
}
.btn-primary:hover { background: var(--btn-bg-hover); }

.btn-secondary {
  background: var(--surface);
  border-color: var(--input-border);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--text); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
}
.btn-ghost:hover { color: var(--text); background: var(--surface-sunken); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
}
.btn-danger:hover { background: rgba(212, 50, 74, 0.08); }

.btn-icon {
  padding: 8px;
  width: 32px;
  height: 32px;
  justify-content: center;
}

.btn svg { width: 14px; height: 14px; fill: currentColor; }
.btn-icon svg { width: 16px; height: 16px; }

/* ----- Filter bar ----- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 24px;
  padding: 8px;
  background: var(--surface-sunken);
  border-radius: 10px;
  flex-wrap: wrap;
}

.filter-bar input[type="search"] {
  flex: 1;
  min-width: 200px;
  padding: 8px 12px;
  border: 1px solid transparent;
  background: var(--surface);
  border-radius: 6px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
}
.filter-bar input[type="search"]:focus {
  outline: none;
  border-color: var(--input-border-focus);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--surface-sunken);
  color: var(--muted);
  border: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
}
.chip.is-active { background: var(--btn-bg); color: var(--surface); border-color: var(--btn-bg); }
.chip-static { cursor: default; }

/* ----- Works toolbar ----- */
.works-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.wt-search { position: relative; display: flex; align-items: center; flex: 0 1 320px; min-width: 200px; margin: 0; }
.wt-search svg { position: absolute; left: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.wt-search input[type="search"] {
  width: 100%; padding: 8px 12px 8px 34px; border: 1px solid var(--border);
  background: var(--surface); border-radius: 8px; font-family: var(--font); font-size: 14px; color: var(--text);
}
.wt-search input[type="search"]:focus { outline: none; border-color: var(--input-border-focus); }
.wt-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.wt-chips .chip { text-decoration: none; }
.wt-controls { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.wt-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.wt-form select {
  padding: 7px 10px; font-size: 13px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-family: var(--font); max-width: 200px;
}
/* Custom dropdown chevron (replaces the native OS arrow) — reusable across studio selects. */
.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap select { appearance: none; -webkit-appearance: none; -moz-appearance: none; padding-right: 30px; }
.select-chevron {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; pointer-events: none; color: var(--muted); display: block;
}
.select-chevron svg { width: 100%; height: 100%; fill: currentColor; display: block; }
.wt-filters-btn { display: none; padding: 7px 12px; }
.wt-view { display: inline-flex; gap: 2px; padding: 2px; background: var(--surface-sunken); border-radius: 8px; }
.wt-view-btn {
  display: grid; place-items: center; width: 30px; height: 28px; border: 0; background: transparent;
  border-radius: 6px; cursor: pointer; color: var(--muted);
}
.wt-view-btn svg { width: 16px; height: 16px; }
.wt-view-btn[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Tablet / medium: the toolbar no longer fits on one line, but the phone layout (bottom tab bar, 2-col
   grid) hasn't kicked in yet. Without this, the row wraps and `.wt-controls` (margin-left:auto) jumps to
   the far right of the second line while search+chips stay left — misaligned. Reflow into clean rows like
   the phone (search row, scrollable chips, Filters sheet), but KEEP the grid/list toggle since list view
   works at ≥640px. The mobile block below (<640) takes over from here and hides the toggle. */
@media (min-width: 640px) and (max-width: 899.98px) {
  .works-toolbar { gap: 10px; }
  .wt-search { flex: 1 1 100%; order: 0; }
  .wt-chips { order: 1; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .wt-chips .chip { flex: none; }
  .wt-filters-btn { display: inline-flex; order: 2; }
  .wt-view { order: 3; margin-left: auto; }
  .wt-controls {
    order: 4; flex: 1 1 100%; margin-left: 0; display: none; flex-direction: column;
    align-items: stretch; gap: 8px; padding: 10px; background: var(--surface-sunken); border-radius: 10px;
  }
  .wt-controls.open { display: flex; }
  .wt-controls .wt-form { width: 100%; }
  .wt-controls .select-wrap { flex: 1; }
  .wt-controls select { width: 100%; max-width: none; flex: 1; }
}

/* ----- Works (grid + list share one markup; list layout is desktop-only below) ----- */
.works { display: grid; gap: 20px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.work-item { position: relative; }
.work-item[hidden] { display: none; }

.wi-select {
  position: absolute; top: 8px; left: 8px; z-index: 3; width: 24px; height: 24px; cursor: pointer;
  display: grid; place-items: center; opacity: 0; transition: opacity .12s;
}
.work-item:hover .wi-select, .work-item.is-selected .wi-select { opacity: 1; }
/* touch devices have no hover, so the select affordance is always available there */
@media (hover: none) { .wi-select { opacity: 1; } }
.wi-select input { position: absolute; opacity: 0; width: 0; height: 0; }
/* Three stacked square glyphs (no drop shadow — the old box-shadow read as a floating chip).
   - base: a --surface square. Its only job is to sit behind the checked glyph so the cut-out check reveals
     --surface, which is always the inverse of --btn-bg (works in BOTH studio themes — in dark mode --btn-bg
     is light, so the check must be dark = --surface).
   - empty: a white square + 1px hairline, on top, shown when UNCHECKED (stays visible over any cover).
   - filled: the --btn-bg square with the cut-out check, shown when CHECKED (empty hides, so the cut-out
     reveals the --surface base → a properly-contrasting check). */
.wi-box2 { position: relative; width: 22px; height: 22px; display: block; }
.wi-box2 > span { position: absolute; inset: 0; display: block; }
.wi-box2 svg { width: 100%; height: 100%; display: block; }
.wi-ck-base { color: var(--surface); }
.wi-ck-empty { color: #fff; }
.wi-ck-empty svg { stroke: rgba(0,0,0,.30); stroke-width: 1; vector-effect: non-scaling-stroke; }
.wi-ck-filled { color: var(--btn-bg); opacity: 0; }
.wi-select input:checked + .wi-box2 .wi-ck-empty { opacity: 0; }
.wi-select input:checked + .wi-box2 .wi-ck-filled { opacity: 1; }
.work-item.is-selected .wi-thumb { outline: 2px solid var(--btn-bg); outline-offset: 2px; }

.wi-link { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: var(--text); }
.wi-thumb {
  aspect-ratio: 4 / 3; background: var(--surface-sunken); border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); position: relative;
}
.wi-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wi-nocover { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 11px; }
.wi-kind {
  position: absolute; top: 8px; right: 8px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px;
  padding: 3px 8px; border-radius: 4px; letter-spacing: .02em; text-transform: uppercase;
}
.wi-badge {
  position: absolute; bottom: 8px; left: 8px; font-size: 11px; font-weight: 600; padding: 3px 9px;
  border-radius: 999px; background: var(--warning); color: var(--surface); letter-spacing: .01em;
}
.wi-body { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.wi-title { font-size: 14px; line-height: 1.3; font-weight: 500; margin: 0; overflow: hidden; text-overflow: ellipsis; }
.wi-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.wi-tags .chip { font-size: 11px; padding: 2px 8px; }
.wi-rowmeta { display: none; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.wi-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--muted); flex: none; }
.wi-continue { font-size: 12px; font-weight: 600; color: var(--warning); }
.work-item.is-draft .wi-thumb, .work-item.is-draft .wi-title { opacity: .6; transition: opacity .12s; }
.work-item.is-draft:hover .wi-thumb, .work-item.is-draft:hover .wi-title { opacity: 1; }

/* list view — desktop only (mobile keeps the grid; the toggle is hidden there) */
@media (min-width: 640px) {
  .works[data-view="list"] { grid-template-columns: 1fr; gap: 8px; }
  .works[data-view="list"] .work-item { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
  .works[data-view="list"] .wi-select { top: 50%; left: 12px; transform: translateY(-50%); opacity: 1; }
  .works[data-view="list"] .wi-link { flex-direction: row; align-items: center; gap: 14px; padding: 10px 14px 10px 46px; }
  .works[data-view="list"] .wi-thumb { width: 64px; height: 48px; aspect-ratio: auto; border-radius: 8px; flex: none; }
  .works[data-view="list"] .wi-kind, .works[data-view="list"] .wi-badge { display: none; }
  .works[data-view="list"] .wi-body { flex: 1; flex-direction: row; align-items: center; gap: 14px; }
  .works[data-view="list"] .wi-title { flex: 1 1 auto; }
  .works[data-view="list"] .wi-tags { display: none; }
  .works[data-view="list"] .wi-rowmeta { display: flex; flex: none; }
  .works[data-view="list"] .wi-continue { margin-left: auto; flex: none; }
  .works[data-view="list"] .work-item.is-draft .wi-thumb, .works[data-view="list"] .work-item.is-draft .wi-title { opacity: .7; }
}

/* ----- Selection action bar ----- */
.sel-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60;
  display: flex; align-items: center; gap: 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.22); padding: 10px 14px; max-width: calc(100vw - 32px);
}
.sel-bar[hidden] { display: none; }
.sel-count { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; }
.sel-clear { border: 0; background: var(--surface-sunken); color: var(--muted); width: 22px; height: 22px; border-radius: 6px; cursor: pointer; font-size: 12px; line-height: 1; }
.sel-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sel-form { margin: 0; }
.sel-del { color: var(--danger); }
.sel-add-menu {
  position: absolute; bottom: calc(100% + 8px); right: 0; min-width: 220px; max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,.2); padding: 6px;
}
.sel-add-menu[hidden] { display: none; }
.sel-add-title, .sel-add-empty { font-size: 12px; color: var(--muted); padding: 6px 10px; margin: 0; }
.sel-add-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; font: inherit;
  font-size: 13px; color: var(--text); padding: 8px 10px; border-radius: 6px; cursor: pointer;
}
.sel-add-item:hover { background: var(--surface-sunken); }
.sel-add-wrap { position: relative; }
.sel-add-div { height: 1px; background: var(--border); margin: 6px -6px; }
.sel-add-new { font-weight: 600; }
.sel-add-plus { color: var(--accent); font-weight: 700; }

/* ----- Portfolios list ----- */
.portfolio-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Portfolio list row — composite (separate edit / view-live / copy / menu affordances), not one big link */
.portfolio-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 16px 18px;
  align-items: center;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  transition: border-color 120ms ease;
}
.portfolio-row:hover { border-color: var(--border-strong); }
.portfolio-row.is-draft { background: var(--surface-sunken); }

.pr-thumb-link { display: block; text-decoration: none; }
.portfolio-row.is-draft .pr-thumb-link { opacity: .72; transition: opacity .12s; }
.portfolio-row.is-draft:hover .pr-thumb-link { opacity: 1; }

.pr-info { min-width: 0; }
.pr-title-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 3px; }
.pr-title {
  font-size: 16px; font-weight: 500; color: var(--text); text-decoration: none;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.pr-title:hover { text-decoration: underline; }
.pr-badge { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.pr-default { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.pr-draft { background: rgba(217, 119, 6, 0.12); color: var(--warning); }

.pr-url-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.pr-url {
  font-size: 13px; color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%;
}
.pr-url:hover { color: var(--text); border-bottom-color: var(--border-strong); }
.pr-ext { display: inline-flex; align-items: center; vertical-align: middle; margin-left: 4px; opacity: .7; }
.pr-ext svg { width: 13px; height: 13px; fill: currentColor; }
.pr-copy {
  flex: none; display: grid; place-items: center; width: 26px; height: 26px; border: 0; background: transparent;
  color: var(--muted); border-radius: 6px; cursor: pointer;
}
.pr-copy svg { width: 15px; height: 15px; }
.pr-copy:hover { background: var(--surface-sunken); color: var(--text); }
.pr-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.pr-actions { display: flex; align-items: center; gap: 6px; }
.pr-menu { position: relative; }
.pr-menu > summary { list-style: none; cursor: pointer; }
.pr-menu > summary::-webkit-details-marker { display: none; }
.pr-menu-panel {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 30; min-width: 190px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,.14); padding: 6px;
}
.pr-menu-panel form { margin: 0; }
.pr-menu-panel a, .pr-menu-panel button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent; font: inherit;
  font-size: 13px; color: var(--text); padding: 8px 10px; border-radius: 6px; cursor: pointer; text-decoration: none;
}
.pr-menu-panel a:hover, .pr-menu-panel button:hover { background: var(--surface-sunken); }
.pr-menu-del { color: var(--danger); }

/* section labels separating the Hub (a meta-portfolio that aggregates) from the real portfolios */
.pl-section { margin-bottom: 22px; }
.pl-eyebrow {
  font-size: 12.5px; font-weight: 600; letter-spacing: normal;
  color: var(--muted); margin: 0 0 10px; padding-left: 2px;
}

/* ----- First-time screen hint (dismissible card; variants a/b/c via ?hint=) ----- */
.hint-card { position: relative; display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; padding: 14px 44px 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.hint-card[hidden] { display: none; }
.hint-ic { flex: none; width: 22px; height: 22px; color: var(--accent); margin-top: 1px; }
.hint-ic svg { width: 100%; height: 100%; }
.hint-title { font-size: 14px; font-weight: 600; margin: 0 0 2px; color: var(--text); }
.hint-text { font-size: 13px; line-height: 1.55; color: var(--muted); margin: 0; max-width: 72ch; }
.hint-x { position: absolute; top: 8px; right: 8px; width: 28px; height: 28px; border: 0; background: transparent; color: var(--muted); font-size: 20px; line-height: 1; border-radius: 6px; cursor: pointer; }
.hint-x:hover { background: var(--surface-sunken); color: var(--text); }
.hint-a { border-left: 3px solid var(--accent); }
.hint-b { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 22%, var(--border)); }
.hint-c .hint-ic { width: 34px; height: 34px; border-radius: 9px; background: color-mix(in srgb, var(--accent) 12%, transparent); display: grid; place-items: center; padding: 7px; }

/* ----- Offerings list — reuses .portfolio-row / .pr-* with an extra price column ----- */
.off-filters { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.off-filters .chip { text-decoration: none; }
.off-row { grid-template-columns: auto 1fr auto auto; padding: 11px 16px; gap: 14px 16px; }
.off-row.dragging { opacity: .5; }
.off-thumb { width: 64px; height: 48px; border-radius: 8px; overflow: hidden; background: var(--surface-sunken); flex: none; }
.off-thumb picture, .off-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.off-thumb-ph { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); font-size: 10px; text-align: center; }
.off-thumb-ph svg { width: 16px; height: 16px; fill: currentColor; opacity: .55; }
.off-badge { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; }
.off-pub { color: var(--muted); border: 1px solid var(--border); }          /* public = discreet (the default, desired state) */
.off-draft { color: var(--warning); background: rgba(217, 119, 6, 0.12); }  /* draft = the exception that needs attention */
.off-tag { font-size: 11px; color: var(--muted); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.off-tagline { font-size: 13px; color: var(--muted); margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.off-price { font-size: 14px; font-weight: 600; white-space: nowrap; color: var(--text); }
.off-arrows { display: none; flex-direction: column; gap: 2px; color: var(--muted); }
.off-arrows button { border: 0; background: transparent; cursor: pointer; color: inherit; line-height: 0; padding: 1px 2px; }
.off-arrows button svg { width: 19px; height: 19px; fill: currentColor; display: block; }
@media (hover: hover) and (pointer: fine) {
  .off-row { cursor: grab; }       /* whole row is draggable to reorder; inner links keep their pointer cursor */
  .off-row.dragging { cursor: grabbing; }
}

/* Small stacked-cover thumbnail in a list row (portfolios). Same Tilt-3D motif as the public hub,
   shrunk; the whole row's hover fans the layers out. */
.row-stack { position: relative; width: 56px; aspect-ratio: 4 / 3; flex: none; perspective: 520px; }
.row-stack .lyr {
  position: absolute; inset: 0;
  border-radius: 5px; overflow: hidden;
  background: var(--surface-sunken);
  box-shadow: 0 1px 3px rgba(0,0,0,0.16);
  transform-origin: center bottom;
  transition: transform 260ms cubic-bezier(.2,.7,.3,1), box-shadow 260ms ease;
}
.row-stack .lyr picture, .row-stack .lyr img { width: 100%; height: 100%; display: block; object-fit: cover; }
.row-stack .lyr.l3 { transform: rotate(-5deg) translate(-3px, 2px) scale(0.92); z-index: 1; }
.row-stack .lyr.l2 { transform: rotate(3deg) translate(3px, 1px) scale(0.96); z-index: 2; }
.row-stack .lyr.l1 { transform: rotate(0deg); z-index: 3; }
.row-stack.is-empty .lyr { background: var(--placeholder, var(--surface-sunken)); }
@media (hover: hover) and (pointer: fine) {
  .portfolio-row:hover .row-stack .lyr.l3 { transform: rotateX(10deg) rotate(-9deg) translate(-8px, 2px) scale(0.92); }
  .portfolio-row:hover .row-stack .lyr.l2 { transform: rotateX(10deg) rotate(7deg) translate(8px, 1px) scale(0.96); }
  .portfolio-row:hover .row-stack .lyr.l1 { transform: rotateX(10deg) translateY(-2px); box-shadow: 0 6px 14px rgba(0,0,0,0.22); }
}
@media (prefers-reduced-motion: reduce) { .row-stack .lyr { transition: none; } }

/* ----- Forms ----- */
.form {
  max-width: 720px;
}

.form-section {
  padding-bottom: 32px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.form-section:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }

.form-section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 16px;
}

.form-row {
  margin-bottom: 20px;
}
.form-row:last-child { margin-bottom: 0; }

.form-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  color: var(--text);
}

.label-hint {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  margin-left: 6px;
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  border-radius: 8px;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  transition: border-color 120ms ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--input-border-focus);
}

textarea { min-height: 100px; resize: vertical; line-height: 1.5; }
textarea.markdown-input { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 13px; min-height: 280px; }

.input-help {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
  line-height: 1.4;
}

/* radio cards (for kind selection) */
.radio-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}

.radio-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.radio-card:hover { border-color: var(--border-strong); }
.radio-card input { display: none; }
.radio-card.is-checked,
.radio-card:has(input:checked) { border-color: var(--text); background: var(--surface-sunken); }
.radio-card .title { font-size: 13px; font-weight: 500; }
.radio-card .desc { font-size: 11px; color: var(--muted); line-height: 1.3; }

/* tile-ratio variant: SVG diagram + ratio + caption, compact and centered */
.radio-cards-ratio {
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  max-width: 720px;
}
.radio-card-ratio {
  align-items: center;
  gap: 6px;
  padding: 10px 8px;
  text-align: center;
}
.radio-card-ratio .ratio-card-svg {
  color: var(--muted);
  transition: color 120ms ease;
}
.radio-card-ratio:hover .ratio-card-svg,
.radio-card-ratio.is-checked .ratio-card-svg,
.radio-card-ratio:has(input:checked) .ratio-card-svg { color: var(--text); }
.ratio-card-meta { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.ratio-card-label { font-size: 12px; font-weight: 500; }
.ratio-card-caption { font-size: 10px; color: var(--muted); text-transform: lowercase; letter-spacing: 0.02em; }

/* tag input */
.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--input-border);
  border-radius: 8px;
  min-height: 42px;
  background: var(--input-bg);
}
.tag-input .chip {
  background: var(--btn-bg);
  color: var(--surface);
  border-color: var(--btn-bg);
}
.tag-input .chip button {
  background: transparent;
  border: 0;
  color: color-mix(in srgb, var(--surface) 65%, transparent);
  cursor: pointer;
  font-size: 14px;
  padding: 0 2px;
  margin-left: 2px;
}
.tag-input input {
  border: 0;
  padding: 4px;
  font-size: 13px;
  font-family: var(--font);
  background: transparent;
  flex: 1;
  min-width: 80px;
  color: var(--text);
}
.tag-input input:focus { outline: none; }

/* cover zone — single dropzone that doubles as preview */
.cover-zone {
  position: relative;
  display: block;
  max-width: 520px;
  aspect-ratio: 16/9;
  border: 2px dashed var(--input-border);
  border-radius: 12px;
  background: var(--surface-sunken);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 120ms ease, background 120ms ease;
}
.cover-zone:hover { border-color: var(--text); background: var(--surface); }
.cover-zone.is-dragover { border-color: var(--text); background: var(--surface); border-style: solid; }
.cover-zone.has-image { border-style: solid; border-color: var(--border); background: var(--surface-sunken); }

.cover-zone-empty {
  position: absolute; inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  pointer-events: none;
}
.cover-zone-empty p { margin: 0; font-size: 13px; color: var(--muted); }

.cover-zone-image {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain; /* show whole image so the focal-point dot lands on a real point of it */
  display: block;
}
.cover-focal-dot {
  position: absolute;
  width: 18px;
  height: 18px;
  margin: 0;
  padding: 0;
  border: 2px solid #fff;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.4), 0 2px 6px rgba(0, 0, 0, 0.5);
  cursor: grab;
  transform: translate(-50%, -50%);
  z-index: 5;
  transition: transform 80ms ease;
  touch-action: none;
}
.cover-focal-dot:hover,
.cover-focal-dot:focus-visible {
  transform: translate(-50%, -50%) scale(1.18);
  outline: none;
}
.cover-focal-dot:active { cursor: grabbing; }
.cover-zone-overlay {
  position: absolute; inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 13px;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}
.cover-zone.has-image:hover .cover-zone-overlay,
.cover-zone.has-image.is-dragover .cover-zone-overlay { opacity: 1; }

.cover-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.cover-actions .input-help { margin: 0; }
.btn-sm { padding: 6px 12px; font-size: 13px; }

/* markdown editor toolbar + drop state */
.md-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.markdown-input.is-dragover {
  border-color: var(--text);
  background: var(--surface-sunken);
}

/* lightbox items editor */
.lb-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lb-item {
  display: grid;
  grid-template-columns: 16px 60px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  transition: box-shadow 80ms ease, opacity 80ms ease;
}
.lb-item-grip {
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  opacity: 0;
  pointer-events: none;
  transition: opacity 100ms ease;
}
.lb-item:hover .lb-item-grip { opacity: 0.6; }
.lb-item-thumb {
  width: 60px;
  height: 60px;
  border-radius: 6px;
  background: var(--surface-sunken);
  overflow: hidden;
  display: block;
}
.lb-item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-item-fields input { padding: 6px 10px; font-size: 13px; width: 100%; }
.lb-item-actions { display: flex; gap: 4px; align-items: center; }
.lb-item-actions .btn[disabled] { opacity: 0.3; cursor: not-allowed; }

/* Drag visual states (desktop). Touch users use ↑↓ — see media query below. */
.lb-item.is-dragging { opacity: 0.4; }
.lb-item.is-drop-before { box-shadow: inset 0 3px 0 0 var(--text); }
.lb-item.is-drop-after { box-shadow: inset 0 -3px 0 0 var(--text); }

/* Cursor affordance only on real pointer devices */
@media (hover: hover) and (pointer: fine) {
  .lb-item { cursor: grab; }
  .lb-item:active { cursor: grabbing; }
  .lb-item input,
  .lb-item a,
  .lb-item button { cursor: auto; }
  .lb-item input { cursor: text; }
  .lb-item a,
  .lb-item button:not(:disabled) { cursor: pointer; }
}

/* Touch: hide the grip column entirely — ↑↓ buttons are the canon for mobile */
@media (hover: none) {
  .lb-item { grid-template-columns: 60px 1fr auto; }
  .lb-item-grip { display: none; }
}

/* portfolio works list (orderable) */
.pw-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pw-row {
  display: grid;
  grid-template-columns: 36px 56px 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.pw-position {
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}
.pw-thumb {
  width: 56px;
  height: 42px;
  border-radius: 4px;
  background: var(--surface-sunken);
  overflow: hidden;
}
.pw-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pw-meta-title { font-size: 14px; font-weight: 500; }
.pw-meta-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.pw-span {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.pw-span select {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: 4px;
  border: 1px solid var(--input-border);
  background: var(--surface);
}
.pw-span input {
  width: 44px;
  padding: 4px 6px;
  font-size: 12px;
  text-align: center;
}
.pw-remove {
  width: 28px; height: 28px;
  border: 1px solid var(--input-border);
  background: var(--surface);
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
  display: grid; place-items: center;
}
.pw-remove:hover { color: var(--danger); border-color: var(--danger); }
.pw-remove svg { width: 12px; height: 12px; }

/* avatar zone (per-portfolio profile) — smaller circular variant of cover-zone */
.avatar-zone {
  position: relative;
  display: block;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px dashed var(--input-border);
  background: var(--surface-sunken);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 120ms ease, background 120ms ease;
  flex-shrink: 0;
}
.avatar-zone:hover { border-color: var(--text); background: var(--surface); }
.avatar-zone.is-dragover { border-color: var(--text); background: var(--surface); border-style: solid; }
.avatar-zone.has-image { border-style: solid; border-color: var(--border); }
.avatar-empty {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 4px;
  font-size: 11px; color: var(--muted);
  pointer-events: none;
}
.avatar-image {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}
.avatar-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  color: white;
  font-size: 12px;
  opacity: 0;
  transition: opacity 120ms ease;
  pointer-events: none;
}
.avatar-zone.has-image:hover .avatar-overlay,
.avatar-zone.has-image.is-dragover .avatar-overlay { opacity: 1; }

/* socials list editor */
.socials-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.social-row {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 8px;
  align-items: center;
}
.social-row select {
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 6px;
  border: 1px solid var(--input-border);
  background: var(--surface);
}
.social-row input {
  padding: 6px 10px;
  font-size: 13px;
}

/* CTA icon picker (radio grid) */
.icon-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.icon-opt { cursor: pointer; }
.icon-opt input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.icon-opt-box {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 2px solid var(--input-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  transition: border-color .12s, background .12s;
}
.icon-opt-box svg { width: 22px; height: 22px; fill: currentColor; }
.icon-opt:hover .icon-opt-box { border-color: var(--border-strong); }
.icon-opt input:checked + .icon-opt-box {
  border-color: var(--input-border-focus);
  background: var(--surface-sunken);
}
.icon-opt input:focus-visible + .icon-opt-box {
  outline: 2px solid var(--input-border-focus);
  outline-offset: 2px;
}

/* ===== Theme & color controls ===== */
.theme-presets { display: flex; flex-wrap: wrap; gap: 8px; }
.theme-preset {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 8px; border: 1px solid var(--input-border);
  border-radius: 999px; cursor: pointer;
}
.theme-preset input { position: absolute; opacity: 0; width: 0; height: 0; }
.theme-preset:hover { border-color: var(--border-strong); }
.theme-preset:has(input:checked) { border-color: var(--input-border-focus); background: var(--surface-sunken); }
.theme-chip { width: 22px; height: 22px; flex: none; display: block; }
.theme-chip svg { width: 100%; height: 100%; display: block; }
.theme-name { font-size: 13px; }

/* segmented toggle (e.g. Settings → Studio theme) */
.seg-control { display: inline-flex; border: 1px solid var(--input-border); border-radius: 8px; overflow: hidden; }
.seg-option { display: inline-flex; align-items: center; gap: 6px; margin: 0; padding: 8px 18px; cursor: pointer; font-size: 13px; font-weight: 500; color: var(--muted); }
.seg-option input { position: absolute; opacity: 0; width: 0; height: 0; }
.seg-option + .seg-option { border-left: 1px solid var(--input-border); }
.seg-option:has(input:checked) { background: var(--btn-bg); color: var(--surface); }
.seg-option svg { width: 15px; height: 15px; fill: currentColor; }

/* color slots (accent + CTA fill/border/text) */
.color-slot, .cta-slot { position: relative; display: inline-flex; align-items: center; gap: 8px; }
.cta-controls { display: flex; flex-direction: column; gap: 10px; }
.cslot-ind, .cta-icon-btn {
  width: 26px; height: 26px; flex: none; padding: 0;
  border: 0; background: transparent; cursor: pointer;
  display: grid; place-items: center; color: var(--muted);
}
.cta-icon-btn { color: var(--text); }
.cslot-ind svg { width: 22px; height: 22px; fill: currentColor; }
.cta-icon-btn svg { width: 18px; height: 18px; fill: currentColor; }
.cslot-ind:hover, .cta-icon-btn:hover { opacity: .7; }
.cslot-label { font-size: 13px; color: var(--text); min-width: 42px; }
.cslot-label .hint { color: var(--muted); font-size: 11px; }
.cslot-reset { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px; display: inline-flex; }
.cslot-reset[hidden] { display: none; }
.cslot-reset svg { width: 15px; height: 15px; fill: currentColor; }
.cslot-reset:hover { color: var(--text); }

.cta-icon-pop {
  position: absolute; top: 34px; left: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px;
  padding: 8px; width: max-content;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
.cta-icon-pop[hidden] { display: none; }
.cta-icon-pop button { width: 34px; height: 34px; border: 1px solid var(--border); border-radius: 7px; background: transparent; color: var(--text); cursor: pointer; display: grid; place-items: center; }
.cta-icon-pop button:hover { border-color: var(--text); }
.cta-icon-pop button svg { width: 18px; height: 18px; fill: currentColor; }

/* Add-works modal grid */
.add-works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  max-height: 50vh;
  overflow-y: auto;
  padding: 4px;
}
.add-work-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 120ms ease;
}
.add-work-card:hover { border-color: var(--border-strong); }
.add-work-card.is-selected { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.add-work-card-thumb {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface-sunken);
  overflow: hidden;
}
.add-work-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.add-work-card-body { padding: 8px 10px; display: flex; align-items: center; gap: 8px; }
.add-work-card-body input[type="checkbox"] { margin: 0; flex-shrink: 0; }
.add-work-card-title { font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.add-work-card-kind { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.pw-arrows {
  display: flex; flex-direction: column; gap: 1px;
}
.pw-arrows button {
  width: 24px; height: 18px;
  border: 1px solid var(--input-border);
  background: var(--surface);
  cursor: pointer;
  padding: 0; display: grid; place-items: center;
  color: var(--muted);
}
.pw-arrows button:first-child { border-radius: 4px 4px 0 0; }
.pw-arrows button:last-child { border-radius: 0 0 4px 4px; border-top: 0; }
.pw-arrows button:hover { color: var(--text); background: var(--surface-sunken); }
.pw-arrows svg { width: 10px; height: 10px; fill: currentColor; }

/* form footer */
.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 24px;
  margin-top: 32px;
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--surface);
  padding-bottom: 24px;
}

/* ----- Hub card (top of portfolios list) ----- */
/* Hub now lives under its own "Hub" section label, so it no longer needs a grey fill to stand out
   (that read as "featured"). A dashed border is a quiet "different object class" cue. */
.hub-card { border-style: dashed; }

/* ----- Hub curated picker (in hub editor) ----- */
.hub-pick { display:flex; flex-direction:column; gap:6px; }
.hub-pick-row { display:grid; grid-template-columns:auto 1fr auto; gap:12px; align-items:center; padding:10px 12px; border:1px solid var(--border); border-radius:8px; background:var(--surface); }
.hub-pick-check { display:flex; align-items:center; }
.hub-pick-check input { width:16px; height:16px; cursor:pointer; }
.hub-pick-title { font-size:14px; font-weight:500; }
.hub-pick-sub { font-size:12px; color:var(--muted); margin-top:2px; }
.hub-pick-arrows { display:flex; flex-direction:column; gap:1px; }
.hub-pick-arrows button { width:24px; height:18px; border:1px solid var(--input-border); background:var(--surface); cursor:pointer; padding:0; display:grid; place-items:center; color:var(--muted); }
.hub-pick-arrows button:first-child { border-radius:4px 4px 0 0; }
.hub-pick-arrows button:last-child { border-radius:0 0 4px 4px; border-top:0; }
.hub-pick-arrows button:hover { color:var(--text); background:var(--surface-sunken); }
.hub-pick-arrows svg { width:10px; height:10px; fill:currentColor; }

/* ----- Toast notifications (top-of-page bar that slides down) ----- */
#fwk-toast-root {
  position: fixed;
  top: 12px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  pointer-events: none;
  z-index: 300;
}
.fwk-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 520px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.12);
  font-size: 13px;
  line-height: 1.4;
  transform: translateY(-14px);
  opacity: 0;
  transition: transform 220ms cubic-bezier(.2,.7,.2,1), opacity 220ms ease;
}
.fwk-toast.is-showing { transform: translateY(0); opacity: 1; }
.fwk-toast.is-closing { transform: translateY(-14px); opacity: 0; }
.fwk-toast > span { flex: 1; }
.fwk-toast-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.fwk-toast-error { background: #fff1f2; border-color: #fecdd3; color: #9f1239; }
.fwk-toast-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.fwk-toast-close {
  background: transparent;
  border: 0;
  color: currentColor;
  opacity: 0.6;
  cursor: pointer;
  padding: 4px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  flex-shrink: 0;
}
.fwk-toast-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }

/* ----- Modal ----- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 100;
  display: grid; place-items: center;
  padding: 24px;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  background: var(--surface);
  border-radius: 14px;
  max-width: 720px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { margin: 0; font-size: 18px; font-weight: 500; }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface-sunken);
}

/* picker (for adding works to portfolio) */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.picker-card {
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
  position: relative;
  transition: border-color 120ms ease;
}
.picker-card:hover { border-color: var(--border-strong); }
.picker-card.is-selected { border-color: var(--text); background: var(--surface-sunken); }
.picker-card.is-already-in { opacity: 0.4; cursor: not-allowed; }
.picker-card-thumb {
  aspect-ratio: 4/3;
  border-radius: 6px;
  background: var(--surface-sunken);
  overflow: hidden;
  margin-bottom: 6px;
}
.picker-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.picker-card-title { font-size: 12px; line-height: 1.3; }
.picker-card-check {
  position: absolute;
  top: 12px; right: 12px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 4px;
  display: grid; place-items: center;
  border: 1px solid var(--border-strong);
}
.picker-card.is-selected .picker-card-check { background: var(--text); border-color: var(--text); }
.picker-card.is-selected .picker-card-check::after {
  content: "";
  width: 5px; height: 9px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* ----- Empty state ----- */
.empty {
  text-align: center;
  padding: 80px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 14px;
  background: var(--surface-sunken);
}
.empty h3 { font-size: 18px; font-weight: 500; margin: 0 0 8px; }
.empty p { font-size: 14px; color: var(--muted); margin: 0 0 24px; }

/* ----- Auth screens ----- */
.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--surface);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 40px 32px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.auth-logo {
  margin: 0 0 24px;
  color: var(--text);
}
.auth-card h1 {
  font-size: 22px;
  font-weight: 500;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.auth-card p {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 28px;
  line-height: 1.5;
}
.auth-card .form-row { margin-bottom: 16px; }

.auth-divider {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  margin: 24px 0;
  position: relative;
}
.auth-divider::before {
  content: ""; position: absolute; top: 50%; left: 0; right: 0;
  border-top: 1px solid var(--border); z-index: 0;
}
.auth-divider span {
  background: var(--surface); padding: 0 12px; position: relative; z-index: 1;
}

.btn-google {
  width: 100%;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--input-border);
}
.btn-google:hover { border-color: var(--text); }
.btn-google svg { width: 18px; height: 18px; }

.btn-block {
  width: 100%;
  justify-content: center;
  padding: 12px 16px;
}

/* ----- Mobile (< 640) ----- */
@media (max-width: 639.98px) {
  .studio-bar { display: none; }              /* replaced by the bottom tab bar + page-top logo */
  .studio-mobile-logo { display: block; }
  .studio-tabbar { display: flex; }
  .studio-sheet-scrim { display: block; }
  .studio-sheet { display: block; }
  .studio-main { padding: 8px 16px 88px; }    /* logo sits above; bottom clears the fixed tab bar */
  .studio-header { flex-direction: column; align-items: stretch; }
  .form-row-grid { grid-template-columns: 1fr; }
  .pw-row {
    grid-template-columns: 36px 1fr auto;
    grid-template-areas: "pos meta arrows" "span span span";
    gap: 8px;
  }
  .pw-thumb { display: none; }
  .pw-position { grid-area: pos; }
  .pw-meta { grid-area: meta; }
  .pw-arrows { grid-area: arrows; }
  .pw-span-group { grid-area: span; display: flex; gap: 12px; padding-top: 4px; }
  .works { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .works-toolbar { gap: 10px; }
  .wt-search { flex: 1 1 100%; order: 0; }
  .wt-chips { order: 1; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .wt-chips .chip { flex: none; }
  .wt-filters-btn { display: inline-flex; order: 2; }
  .wt-controls { order: 3; flex: 1 1 100%; margin-left: 0; display: none; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; background: var(--surface-sunken); border-radius: 10px; }
  .wt-controls.open { display: flex; }
  .wt-controls .wt-form { width: 100%; }
  .wt-controls .select-wrap { flex: 1; }
  .wt-controls select { width: 100%; max-width: none; flex: 1; }
  .wt-view { display: none; }
  /* Compact horizontal row: the cover keeps its natural aspect on the left, the title/url/meta block takes
     the middle, and the actions sit INLINE on the right (vertically centered) — there's room for them, so
     they shouldn't drop to an orphaned bottom row. Portfolios keep the desktop auto/1fr/auto columns. */
  .portfolio-row { gap: 4px 12px; padding: 12px 14px; }
  .pr-actions { justify-content: flex-end; flex-wrap: wrap; }
  /* Offerings carry an extra price + reorder arrows. Grid areas: cover and actions span both text rows;
     the price tucks under the info block, so the right column stays a clean Edit/⋯/arrows cluster. */
  .off-row {
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "thumb info actions" "thumb price actions";
    align-items: start; gap: 2px 14px; cursor: default;
  }
  .off-row .pr-thumb-link { grid-area: thumb; align-self: start; }
  .off-row .pr-info { grid-area: info; }
  .off-row .off-price { grid-area: price; align-self: end; margin-top: 2px; }
  .off-row .pr-actions { grid-area: actions; align-self: center; }
  .off-arrows { display: flex; }
  /* selection bar: full-width and sitting ABOVE the fixed bottom tab bar (~62px + safe area) */
  .sel-bar { left: 10px; right: 10px; transform: none; max-width: none; bottom: calc(70px + env(safe-area-inset-bottom)); justify-content: space-between; }
  .sel-add-menu { left: 0; right: auto; max-width: calc(100vw - 40px); }
  .picker-grid { grid-template-columns: repeat(2, 1fr); }
  .auth-card { padding: 32px 24px; }
}

/* Mobile menu drawer */
.mobile-menu-btn { display: none; }
@media (max-width: 639.98px) {
  .mobile-menu-btn {
    display: inline-grid;
    place-items: center;
    width: 32px; height: 32px;
    border: 0; background: transparent; cursor: pointer;
  }
  .mobile-menu-btn svg { width: 18px; height: 18px; fill: currentColor; }
}

/* Sandbox-only index banner */
.sandbox-banner {
  background: #fff8e1;
  border-bottom: 1px solid #f7d775;
  padding: 8px 16px;
  font-size: 12px;
  color: #6b4d00;
  text-align: center;
}
.sandbox-banner a { color: inherit; text-decoration: underline; }

/* ----- File upload (md / avatar) ----- */
.file-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface-sunken);
  border: 1px dashed var(--input-border);
  border-radius: 8px;
}
.file-upload-row span { font-size: 13px; color: var(--muted); flex: 1; }
.file-upload-row .btn { padding: 6px 12px; font-size: 12px; }

.input-with-or {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.input-with-or > * { flex: 1; }
.input-with-or-sep {
  display: grid; place-items: center;
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  flex: 0 0 auto; padding: 0 4px;
}

/* ----- Span/size hint (col x row) ----- */
.span-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  background: var(--surface-sunken);
  border-radius: 6px;
}
.span-controls label {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.span-controls input {
  width: 38px;
  padding: 3px 4px;
  font-size: 12px;
  text-align: center;
  border-radius: 4px;
}
.span-controls .x { color: var(--muted); font-size: 12px; }

/* ----- Filters checklist ----- */
.tags-checklist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
  padding: 12px;
  background: var(--surface-sunken);
  border-radius: 10px;
  max-height: 240px;
  overflow-y: auto;
}
.tags-checklist-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  font-size: 13px;
  background: var(--surface);
  border-radius: 6px;
  border: 1px solid var(--border);
  cursor: pointer;
}
.tags-checklist-row input { margin: 0; cursor: pointer; }
.tags-checklist-row .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.tags-checklist-summary {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}

/* ----- Portfolio multi-picker (for Used in add) ----- */
.portfolio-multi-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.portfolio-multi-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 120ms ease, background 120ms ease;
}
.portfolio-multi-row:hover { border-color: var(--border-strong); }
.portfolio-multi-row.is-selected { border-color: var(--text); background: var(--surface-sunken); }
.portfolio-multi-row.is-already-in {
  opacity: 0.5; cursor: not-allowed;
}
.portfolio-multi-row input[type="checkbox"] {
  margin: 0;
  width: 16px; height: 16px;
  cursor: pointer;
}
.portfolio-multi-row .pm-title { font-size: 14px; font-weight: 500; }
.portfolio-multi-row .pm-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.portfolio-multi-row .pm-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
}

/* ----- Auth code input ----- */
.code-input {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.code-input input {
  width: 44px;
  height: 54px;
  text-align: center;
  font-size: 22px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  padding: 0;
  border-radius: 8px;
}
.code-input input:focus { border-color: var(--input-border-focus); }
@media (max-width: 380px) {
  .code-input input { width: 36px; height: 46px; font-size: 18px; }
}
