/* ==========================================================================
   PROMPT STUDIO — css/prompt-studio.css
   Loom's gold-on-ink look with Stash's violet (the two apps it merges), on
   the same phone-first frame as Zyentora's other apps: every control at
   least 44 px, text at least 11 px, nothing scrolls sideways at 320 px
   (Stash ran 579 px wide on a 375 px phone). Below 1024 px the pages sit
   behind a bottom tab bar (Home, Make, Vault, History, More).
   ========================================================================== */
:root {
  --r-sm: var(--c-r-sm); --r: var(--c-r); --r-lg: var(--c-r-lg); --r-full: var(--c-r-full);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Consolas, "Roboto Mono", monospace;
  --p-high: #F5A623; --p-medium: #4D9EFF; --p-low: #8E8CA3;
  --tap: 44px;
  --bar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
/* The accents (Settings > Look). --a1/--a2 are fills; --at-l/--at-d are the
   accent as text on light/dark surfaces, --a2t-l/--a2t-d the second accent's (AA). */
html[data-accent="gold"] { --a1: #E8B04B; --a2: #9D7FE8; --at-d: #F0C46E; --at-l: #7A5200; --a2t-d: #B8A2F2; --a2t-l: #5B3FD9; }
html[data-accent="violet"] { --a1: #9D7FE8; --a2: #E8B04B; --at-d: #B8A2F2; --at-l: #5B3FD9; --a2t-d: #F0C46E; --a2t-l: #7A5200; }
html[data-accent="teal"] { --a1: #2EC4B6; --a2: #9D7FE8; --at-d: #5AD8CC; --at-l: #0A6F68; --a2t-d: #B8A2F2; --a2t-l: #5B3FD9; }
html[data-accent="rose"] { --a1: #F07E96; --a2: #9D7FE8; --at-d: #F59BAE; --at-l: #B22B44; --a2t-d: #B8A2F2; --a2t-l: #5B3FD9; }
html[data-accent="blue"] { --a1: #5B8CFF; --a2: #9D7FE8; --at-d: #8DB0FF; --at-l: #2F5FD0; --a2t-d: #B8A2F2; --a2t-l: #5B3FD9; }
html[data-accent="emerald"] { --a1: #22C47E; --a2: #E8B04B; --at-d: #4ED99A; --at-l: #116E44; --a2t-d: #F0C46E; --a2t-l: #7A5200; }
/* Light and dark (Release B): the shared calm system (shared/zy-theme.css)
   with Prompt Studio's accents on top. Light is the default; zy-theme.js sets
   <html data-theme> before the first paint. --mix/--mix-p turn a category's
   colour into a readable icon colour on this theme's surfaces. */
html[data-theme="light"] {
  --bg: var(--c-bg); --bg2: var(--c-bg2); --side: var(--c-side); --surface: var(--c-surface); --surface2: var(--c-surface2); --hover: var(--c-hover);
  --border: var(--c-border); --border2: var(--c-border2); --field: var(--c-field);
  --t1: var(--c-t1); --t2: var(--c-t2); --t3: var(--c-t3); --overlay: var(--c-overlay); --on-accent: #0E0D12; --a-text: var(--at-l); --a2-text: var(--a2t-l);
  --good: var(--c-good); --warn: var(--c-warn); --bad: var(--c-bad); --info: var(--c-info);
  --good-t: var(--c-good-t); --warn-t: var(--c-warn-t); --bad-t: var(--c-bad-t); --star: #A86F00;
  --shadow-1: var(--c-shadow-1); --shadow-2: var(--c-shadow-2);
  --mix: #1B1726; --mix-p: 60%;
  --glow: none;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: var(--c-bg); --bg2: var(--c-bg2); --side: var(--c-side); --surface: var(--c-surface); --surface2: var(--c-surface2); --hover: var(--c-hover);
  --border: var(--c-border); --border2: var(--c-border2); --field: var(--c-field);
  --t1: var(--c-t1); --t2: var(--c-t2); --t3: var(--c-t3); --overlay: var(--c-overlay); --on-accent: #0E0D12; --a-text: var(--at-d); --a2-text: var(--a2t-d);
  --good: var(--c-good); --warn: var(--c-warn); --bad: var(--c-bad); --info: var(--c-info);
  --good-t: var(--c-good-t); --warn-t: var(--c-warn-t); --bad-t: var(--c-bad-t); --star: var(--c-warn);
  --shadow-1: var(--c-shadow-1); --shadow-2: var(--c-shadow-2);
  --mix: #FFFFFF; --mix-p: 80%;
  --glow: radial-gradient(1100px 620px at 8% -8%, color-mix(in srgb, var(--a1) 7%, transparent), transparent 60%);
  color-scheme: dark;
}
html { --zy-bg: var(--bg2); --zy-surface: var(--surface); --zy-border: var(--border2); --zy-text: var(--t1); --zy-muted: var(--t2); --zy-accent: var(--a1); --zy-accent-ink: var(--a-text); --zy-accent-text: var(--on-accent);
  --zy-ok: var(--good); --zy-warn: var(--warn); --zy-danger: var(--bad); --zy-font: var(--font); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--glow), var(--bg); background-attachment: fixed; color: var(--t1); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; overflow-x: hidden; min-height: 100vh; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.015em; line-height: 1.25; }
p { margin: 0 0 8px; }
a { color: var(--a-text); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex-shrink: 0; }
:focus-visible { outline: 2px solid var(--a1); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--a1) 35%, transparent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--t2); }
.small { font-size: 12.5px; }
.center { text-align: center; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.clamp-2, .clamp-3, .clamp-4 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { -webkit-line-clamp: 2; } .clamp-3 { -webkit-line-clamp: 3; } .clamp-4 { -webkit-line-clamp: 4; }
.good-text { color: var(--good-t); } .accent-text { color: var(--a-text); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ---------- loader (shown only until the device's data is read) ---------- */
.loader { position: fixed; inset: 0; z-index: 400; background: var(--bg); color: var(--a1); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; transition: opacity .25s, visibility .25s; }
.loader.hide { opacity: 0; visibility: hidden; }
.loader-word { font-weight: 700; letter-spacing: .3em; text-transform: uppercase; font-size: 13px; color: var(--t2); }

/* ---------- shell ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 272px; max-width: 86vw; z-index: 120; background: var(--side); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  transform: translateX(-102%); transition: transform .22s ease; padding-bottom: var(--safe-b); }
.sidebar.open { transform: none; box-shadow: var(--shadow-2); }
.brand { display: flex; align-items: center; gap: 10px; padding: 14px 12px 10px 16px; }
.brand-mark { width: 36px; height: 36px; border-radius: 11px; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--a1), var(--a2)); color: var(--on-accent); flex: none; }
.brand div { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.brand b { color: var(--t1); font-size: 17px; }
.brand span { color: var(--t3); font-size: 12px; }
.side-nav { flex: 1; overflow-y: auto; padding: 4px 10px 12px; overscroll-behavior: contain; }
.nav-group { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--t3); padding: 14px 10px 4px; }
.nav-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--tap); padding: 0 10px; border: 1px solid transparent; border-radius: var(--r-sm); background: none; color: var(--t2); font-weight: 600; font-size: 14.5px; text-align: left; }
.nav-item:hover { background: var(--hover); color: var(--t1); }
.nav-item.active { background: linear-gradient(90deg, color-mix(in srgb, var(--a1) 18%, transparent), color-mix(in srgb, var(--a1) 4%, transparent)); border-color: color-mix(in srgb, var(--a1) 28%, transparent); color: var(--t1); }
.nav-item.active svg { color: var(--a-text); }
.nav-item span:first-of-type { flex: 1; }
.nav-spark svg { color: var(--a2-text); }
.nav-count { font: 600 12px var(--mono); color: var(--t3); }
.side-foot { padding: 12px 18px 16px; border-top: 1px solid var(--border); font-size: 12.5px; color: var(--t3); display: flex; flex-direction: column; gap: 4px; }
.side-foot a { color: var(--t2); text-decoration: none; min-height: 32px; display: inline-flex; align-items: center; }
.scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 110; opacity: 0; visibility: hidden; transition: opacity .2s; }
.scrim.open { opacity: 1; visibility: visible; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 6px; min-height: 60px; padding: 8px 10px; padding-top: max(8px, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 86%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.topbar h1 { flex: 1; min-width: 0; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 4px; }
.topbar-actions { display: flex; align-items: center; gap: 4px; }
@media (max-width: 400px) { .topbar h1 { font-size: 17px; } .topbar { gap: 2px; padding-left: 6px; padding-right: 6px; } }
/* The narrowest phones: the chip says just "Free" so the page title fits. */
@media (max-width: 360px) { .topbar .zy-chip-cta { display: none; } .topbar h1 { font-size: 16px; } }
.topbar .zy-chip { min-height: var(--tap); }
.add-btn { background: linear-gradient(135deg, var(--a1), var(--a2)); color: var(--on-accent); border-radius: 50%; }
.add-btn:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--a1), var(--a2)); color: var(--on-accent); }
main { flex: 1; padding: 14px 14px calc(var(--bar-h) + 24px + var(--safe-b)); width: 100%; max-width: 1240px; margin: 0 auto; min-width: 0; }
.page { display: none; }
.page.active { display: block; animation: page-in .18s ease; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; display: grid; grid-template-columns: repeat(5, 1fr); height: calc(var(--bar-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  background: color-mix(in srgb, var(--bg2) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--border); }
.bn-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: none; color: var(--t3); font-size: 11.5px; font-weight: 600; min-width: 0; }
.bn-item.active { color: var(--a-text); }
.bn-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 1024px) {
  .sidebar { transform: none; position: sticky; top: 0; height: 100vh; flex: none; z-index: 1; box-shadow: none !important; }
  .sidebar-close, .menu-btn, .scrim, .bottom-nav { display: none !important; }
  main { padding: 22px 28px 40px; }
  .topbar { padding-left: 24px; padding-right: 20px; }
  .topbar h1 { font-size: 21px; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 16px; border-radius: var(--r-sm); border: 1px solid var(--border2); background: var(--surface2);
  color: var(--t1); font-weight: 600; font-size: 14.5px; text-decoration: none; white-space: nowrap; transition: filter .15s, background .15s; }
.btn:hover { background: var(--hover); }
.btn-primary { background: linear-gradient(135deg, var(--a1), var(--a2)); border-color: transparent; color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.06); background: linear-gradient(135deg, var(--a1), var(--a2)); }
.btn-danger { background: color-mix(in srgb, var(--bad) 16%, transparent); border-color: color-mix(in srgb, var(--bad) 45%, transparent); color: var(--bad-t); }
.btn-ghost { background: none; border-color: transparent; }
.btn-sm { padding: 0 12px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.danger-text { color: var(--bad-t); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--tap); height: var(--tap); flex: none; border: 0; border-radius: 50%; background: none; color: var(--t2); }
.icon-btn:hover { background: var(--hover); color: var(--t1); }
.icon-btn.star.on { color: var(--star); }
.icon-btn.star.on svg { fill: currentColor; }
.link { border: 0; background: none; padding: 0; color: var(--a-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 0; text-align: left; }
.card-link { display: inline-flex; align-items: center; gap: 2px; min-height: var(--tap); padding: 0 4px; text-decoration: none; font-size: 13.5px; white-space: nowrap; }
.pro-badge { display: inline-block; padding: 2px 7px; border-radius: var(--r-full); background: linear-gradient(135deg, var(--a1), var(--a2)); color: var(--on-accent); font-size: 11px; font-weight: 800; letter-spacing: .05em; line-height: 1.4; vertical-align: middle; }

/* ---------- cards and layout ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px; margin-bottom: 14px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; min-height: var(--tap); margin-top: -8px; flex-wrap: wrap; }
.card-head h3 { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--t2); min-width: 0; }
.card-head h3 svg { color: var(--a-text); }
.grid-2 { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); margin-bottom: 14px; }
.grid-2 > .card { margin-bottom: 0; }
@media (min-width: 760px) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.page-sub { margin: 0; color: var(--t2); font-size: 14px; flex: 1 1 180px; min-width: 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.page-lede { color: var(--t2); max-width: 680px; }
.quota-note { margin: 0 0 14px; padding: 10px 14px; border-radius: var(--r); background: color-mix(in srgb, var(--a1) 9%, transparent); border: 1px solid color-mix(in srgb, var(--a1) 28%, transparent); font-size: 14px; color: var(--t2); }
.quota-note b { color: var(--t1); }
.quota-note .link { min-height: var(--tap); display: inline-flex; align-items: center; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.toolbar .input { flex: 1 1 130px; width: auto; min-width: 0; }
/* The search field carries its own edge (3:1, like every field); the icon sits inside it. */
.search-box { position: relative; display: flex; align-items: center; flex: 2 1 200px; color: var(--t3); min-width: 0; }
.search-box svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-box input { flex: 1; width: 100%; min-width: 0; min-height: var(--tap); padding: 0 12px 0 38px; border-radius: var(--r-sm); border: 1px solid var(--field); background: var(--surface); outline: none; color: var(--t1); font-size: 15px; }
.search-box input:focus { border-color: var(--a-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a1) 22%, transparent); }
.search-box.big { margin-bottom: 12px; }
.search-box.big input { padding-left: 40px; }
.input::placeholder, .search-box input::placeholder { color: var(--t3); opacity: 1; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { min-height: var(--tap); padding: 0 14px; border-radius: var(--r-full); border: 1px solid var(--border2); background: var(--surface); color: var(--t2); font-weight: 600; font-size: 14px; }
.chips.static { margin: 0; }
.chip.static { display: inline-flex; align-items: center; min-height: 32px; font-weight: 500; color: var(--t1); background: var(--surface2); }
.stats-4 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
@media (min-width: 760px) { .stats-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 12px; min-width: 0; }
.card .stat { background: var(--surface2); }
.stat-lbl { font-size: 12px; color: var(--t3); font-weight: 600; }
.stat-val { font: 700 19px/1.3 var(--mono); overflow-wrap: anywhere; letter-spacing: -.02em; }
.stat-sub { font-size: 12px; color: var(--t3); }
.empty { text-align: center; padding: 26px 16px; color: var(--t2); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.empty svg { color: var(--a-text); opacity: .85; }
.empty h4 { color: var(--t1); font-size: 16px; }
.empty p { max-width: 380px; margin: 0; }
details summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; font-weight: 600; color: var(--t2); }
.done-block { padding-top: 6px; padding-bottom: 6px; }
.done-block[open] { padding-bottom: 16px; }

/* ---------- tags ---------- */
.ptag { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--t2); white-space: nowrap; }
.ptag i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.stag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; color: var(--t1); padding: 1px 8px; border-radius: var(--r-full); background: color-mix(in srgb, var(--c) 18%, transparent); border: 1px solid color-mix(in srgb, var(--c) 45%, transparent); white-space: nowrap; }
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; color: var(--t2); }
.prio i, .pdot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex: none; }
.prio-high i, .pdot.prio-high { background: var(--p-high); }
.prio-medium i, .pdot.prio-medium { background: var(--p-medium); } .prio-low i, .pdot.prio-low { background: var(--p-low); }
.meta { display: inline-flex; align-items: center; gap: 4px; }
.meta.rest { color: var(--t3); }
.meta.rest svg { width: 14px; height: 14px; }

/* ---------- rows ---------- */
.rows { display: flex; flex-direction: column; gap: 6px; }
.row { display: flex; align-items: center; gap: 6px; min-height: 52px; padding: 4px; border-radius: var(--r); background: var(--surface2); border: 1px solid transparent; width: 100%; text-align: left; color: var(--t1); min-width: 0; }
button.row:hover, .row-main:hover { background: var(--hover); }
.row-main, .row-main-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; gap: 4px; min-height: var(--tap); padding: 4px 6px; border: 0; background: none; text-align: left; color: inherit; border-radius: var(--r-sm); }
.row-title { font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.row-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; font-size: 12.5px; color: var(--t2); }
.row-meta:empty { display: none; }
.group { margin-bottom: 16px; }
.group-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--t2); margin: 6px 2px 8px; }
.count { font: 600 12px var(--mono); color: var(--t3); letter-spacing: 0; }
.search-row svg { color: var(--a-text); margin-left: 8px; }
.search-results { max-height: 60vh; overflow-y: auto; }

/* ---------- dashboard ---------- */
.hero { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.greet { font-size: 24px; }
.spotlight .insight { margin: 0; }
.refer-banner { display: flex; align-items: center; gap: 4px; margin-bottom: 14px; border-radius: var(--r); border: 1px solid color-mix(in srgb, var(--a1) 35%, transparent); background: color-mix(in srgb, var(--a1) 8%, transparent); }
.refer-main { flex: 1; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 12px; border: 0; background: none; text-align: left; color: var(--t1); min-width: 0; }
.refer-main svg { color: var(--a-text); }
.activity { display: flex; flex-direction: column; }
.act-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.act-row:last-child { border-bottom: 0; }
.act-row svg { color: var(--a-text); margin-top: 2px; }
.act-row span { min-width: 0; overflow-wrap: anywhere; }
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.quick-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 74px; padding: 8px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface2); color: var(--t1); font-weight: 600; font-size: 13px; }
.quick-btn svg { color: var(--a-text); }
.quick-btn:hover { border-color: var(--a1); }

/* ---------- vaults ---------- */
.vault-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .vault-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .vault-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.v-card { display: flex; flex-direction: column; padding: 4px; margin: 0; }
.v-card.archived, .v-card.resting { opacity: .78; }
.v-main { flex: 1; display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 4px; border: 0; background: none; text-align: left; color: var(--t1); border-radius: var(--r); min-width: 0; min-height: var(--tap); }
.v-main:hover { background: var(--hover); }
.v-title { font-size: 15px; overflow-wrap: anywhere; }
.v-text { margin: 0; color: var(--t2); font-size: 14px; overflow-wrap: anywhere; }
.v-quote { margin: 0; font-size: 14.5px; font-weight: 500; overflow-wrap: anywhere; }
.v-mono { margin: 0; font: 13px/1.5 var(--mono); color: var(--a-text); overflow-wrap: anywhere; }
.v-actions { display: flex; justify-content: flex-end; gap: 2px; border-top: 1px solid var(--border); padding-top: 2px; }
.group-card .g-bar { display: block; height: 5px; border-radius: var(--r-full); background: var(--c); margin-bottom: 4px; }

/* ---------- charts ---------- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; margin: 4px 0 8px; }
.bars.dense { gap: 2px; }
.bar-col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
.bar-val { font: 600 11px var(--mono); color: var(--t2); text-align: center; overflow: hidden; white-space: nowrap; text-overflow: clip; }
.bar-track { flex: 1; display: flex; align-items: flex-end; }
.bar { width: 100%; border-radius: 5px 5px 2px 2px; background: linear-gradient(180deg, var(--a2), var(--a1)); min-height: 2px; }
.bar.empty { background: var(--surface2); }
.bar-lbl { font-size: 11px; color: var(--t3); text-align: center; overflow: hidden; white-space: nowrap; }
@media (max-width: 559px) { .bars .bar-col:nth-child(odd):not(:last-child) .bar-lbl, .bars .bar-col:nth-child(odd):not(:last-child) .bar-val { visibility: hidden; } }
.shares { display: flex; flex-direction: column; gap: 10px; }
.share-head { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.share-name { display: inline-flex; align-items: center; gap: 8px; min-width: 0; overflow-wrap: anywhere; }
.share-name .dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.share-val { font-family: var(--mono); color: var(--t2); white-space: nowrap; }
.meter { height: 8px; border-radius: var(--r-full); background: var(--surface2); border: 1px solid var(--border); overflow: hidden; margin: 6px 0; }
.meter i { display: block; height: 100%; border-radius: var(--r-full); background: linear-gradient(90deg, var(--a1), var(--a2)); }
.meter.good i { background: var(--good); }
.shares .meter { margin: 4px 0 0; }
.progress-line { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 8px 0 6px; font-size: 13.5px; flex-wrap: wrap; }
.progress-line b { font-family: var(--mono); }

/* ---------- insights and ask ---------- */
.insight { display: flex; gap: 12px; padding: 12px; border-radius: var(--r); background: var(--surface2); margin-bottom: 8px; border-left: 3px solid var(--info); }
.insight-good { border-left-color: var(--good); } .insight-warn { border-left-color: var(--warn); }
.insight-ic { width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex: none; background: color-mix(in srgb, var(--a1) 16%, transparent); color: var(--a-text); }
.insight-tx { min-width: 0; }
.insight-h { font-weight: 700; overflow-wrap: anywhere; }
.insight-d { color: var(--t2); font-size: 14px; overflow-wrap: anywhere; }
.insight-tip { margin-top: 4px; font-size: 13px; color: var(--t3); }
.ask-samples { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ask-samples .zy-ask-q { min-height: var(--tap); }
/* The shared Ask box: a field edge and placeholder that pass on both themes (the shared default edge is a hairline). */
.zy-ask-input { border-color: var(--field); }
.zy-ask-input:focus { border-color: var(--a-text); }
.zy-ask-input::placeholder { color: var(--t3); opacity: 1; }
.ask-card { display: flex; flex-direction: column; padding: 14px; margin-bottom: 0; height: calc(100vh - 60px - var(--bar-h) - 44px - var(--safe-b)); height: calc(100dvh - 60px - var(--bar-h) - 44px - var(--safe-b)); min-height: 380px; }
@media (min-width: 1024px) { .ask-card { height: calc(100vh - 60px - 64px); height: calc(100dvh - 60px - 64px); min-height: 440px; } }

/* ---------- Pro locks ---------- */
.lock-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 18px; }
.lock-icon { width: 56px; height: 56px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--a1) 16%, transparent); color: var(--a-text); }
.lock-title { font-size: 21px; }
.lock-text { color: var(--t2); max-width: 520px; }
.lock-list { text-align: left; color: var(--t2); max-width: 520px; padding-left: 20px; margin: 0; font-size: 14px; }
.lock-list li { margin: 4px 0; }
.lock-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.lock-teaser { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border-style: dashed; color: var(--t1); }
.lock-teaser:hover { border-color: var(--a1); }
.lock-teaser-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; background: color-mix(in srgb, var(--a1) 14%, transparent); color: var(--a-text); }
.lock-teaser-text { min-width: 0; }
.lock-teaser-sub { display: block; color: var(--t2); font-size: 13.5px; margin-top: 2px; }
.more-locked { margin-top: 10px; }
.more-locked .lock-teaser { margin: 0; }
.older-note { display: flex; align-items: center; gap: 10px; width: 100%; min-height: var(--tap); margin: 8px 0; padding: 10px 12px; border-radius: var(--r); border: 1px dashed var(--border2); background: none; color: var(--t2); text-align: left; font-size: 13.5px; }
.older-note svg { color: var(--a-text); }
.older-note b { color: var(--t1); }

/* ---------- settings, data, about ---------- */
.set-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-top: 1px solid var(--border); }
.card-head + .set-row { border-top: 0; }
.set-row > div:first-child { display: flex; flex-direction: column; flex: 1 1 200px; min-width: 0; }
.set-row .input { width: auto; flex: 1 1 180px; max-width: 280px; }
.set-row .seg { flex: 0 1 auto; }
.form-actions { display: flex; justify-content: flex-end; padding-top: 10px; }
.danger-card { border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.about h3 { font-size: 16px; margin: 14px 0 6px; } .about h3:first-child { margin-top: 0; }
.about p, .howto { color: var(--t2); }
.howto { padding-left: 20px; margin: 0 0 8px; display: flex; flex-direction: column; gap: 4px; }
.about-links a { display: inline-flex; align-items: center; min-height: var(--tap); min-width: var(--tap); justify-content: center; padding: 0 2px; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; border: 0; margin: 0; padding: 0; }
.field-lbl { font-size: 13px; font-weight: 700; color: var(--t2); }
.field-hint { font-size: 12.5px; color: var(--t3); }
.input { width: 100%; min-height: var(--tap); padding: 8px 12px; border-radius: var(--r-sm); border: 1px solid var(--field); background: var(--bg2); color: var(--t1); font-size: 15.5px; outline: none; min-width: 0; }
.input:focus { border-color: var(--a-text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--a1) 22%, transparent); }
.textarea { resize: vertical; min-height: 72px; line-height: 1.5; }
select.input { appearance: none; -webkit-appearance: none; padding-right: 34px; background-image: linear-gradient(45deg, transparent 50%, var(--t2) 50%), linear-gradient(135deg, var(--t2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input[type="date"].input { min-width: 0; }
.form-2, .form-3 { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 520px) { .form-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .form-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 360px) and (max-width: 519px) { .form-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg-opt { position: relative; flex: 1 1 auto; min-width: var(--tap); }
.seg-opt input { position: absolute; opacity: 0; pointer-events: none; }
.seg-opt > span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--tap); padding: 0 12px; border-radius: var(--r-sm); border: 1px solid var(--border2); background: var(--bg2); color: var(--t2); font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; }
.seg-opt input:checked + span { background: color-mix(in srgb, var(--a1) 20%, transparent); border-color: var(--a1); color: var(--t1); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--a1); outline-offset: 2px; }
.seg-4 .seg-opt { flex: 1 1 calc(50% - 6px); } @media (min-width: 480px) { .seg-4 .seg-opt { flex-basis: 0; } }
.seg-3 .seg-opt { flex: 1 1 0; } .seg-3 .seg-opt > span { padding: 0 8px; }
.seg-list { flex-direction: column; } .seg-list .seg-opt > span { justify-content: flex-start; white-space: normal; text-align: left; padding: 8px 12px; }
.seg-inline { flex-wrap: nowrap; } .seg-inline .seg-opt > span { padding: 0 10px; font-size: 13.5px; }
.seg-swatches .seg-opt { flex: 0 0 auto; }
.seg-swatches .seg-opt > span { width: var(--tap); padding: 0; }
.seg-view { flex-wrap: nowrap; }
.swatch { width: 22px; height: 22px; border-radius: 50%; display: inline-block; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: var(--tap); font-weight: 600; font-size: 14.5px; cursor: pointer; }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; border-radius: var(--r-full); background: var(--surface2); border: 1px solid var(--field); transition: background .15s; }
.switch i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--t2); transition: transform .15s, background .15s; }
.switch input:checked + i { background: var(--a1); border-color: var(--a1); }
.switch input:checked + i::after { transform: translateX(20px); background: var(--on-accent); }
.switch input:focus-visible + i { outline: 2px solid var(--a1); outline-offset: 2px; }
.dyn { display: flex; flex-direction: column; gap: 6px; }
.dyn:empty { display: none; }
.dyn-row { display: flex; align-items: center; gap: 6px; }
.dyn-row .input { flex: 1; }
.dyn-2 { flex-wrap: wrap; } .dyn-2 .input { flex: 1 1 130px; }
.pick { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }
.pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.pick > i { width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--field); display: inline-flex; align-items: center; justify-content: center; color: transparent; flex: none; }
.pick input:checked + i { background: var(--a1); border-color: var(--a1); color: var(--on-accent); }
.pick input:not(:checked) + i svg { visibility: hidden; } /* the tick shows only when ticked */
.pick input:focus-visible + i { outline: 2px solid var(--a1); outline-offset: 2px; }
.pick-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r-sm); padding: 2px 10px; }
.pick .ptag { font-size: 14.5px; color: var(--t1); }
.live-count { margin: -6px 0 0; font-family: var(--mono); }
.link-list { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.link-list a { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); overflow-wrap: anywhere; }

/* ---------- sheets, confirm, toasts ---------- */
body.modal-open { overflow: hidden; }
.modal-overlay, .confirm-overlay { position: fixed; inset: 0; z-index: 200; background: var(--overlay); display: none; align-items: flex-end; justify-content: center; }
.modal-overlay.open, .confirm-overlay.open { display: flex; }
.confirm-overlay { z-index: 260; align-items: center; padding: 16px; }
.sheet { width: 100%; max-height: 100%; height: 100%; background: var(--bg2); display: flex; flex-direction: column; animation: sheet-in .2s ease; }
.sheet-small { height: auto; max-height: 85vh; border-radius: 20px 20px 0 0; }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 18px; padding-top: max(8px, env(safe-area-inset-top)); border-bottom: 1px solid var(--border); }
.sheet-small .sheet-head { padding-top: 8px; }
.sheet-head h3 { flex: 1; min-width: 0; font-size: 18px; overflow-wrap: anywhere; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px 18px 24px; overscroll-behavior: contain; }
.sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 10px 14px; padding-bottom: max(10px, var(--safe-b)); border-top: 1px solid var(--border); background: var(--bg2); }
.foot-right { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }
@media (min-width: 700px) {
  .modal-overlay { align-items: center; padding: 24px; }
  .sheet { height: auto; max-height: min(88vh, 900px); max-width: 620px; border-radius: 20px; border: 1px solid var(--border2); box-shadow: var(--shadow-2); }
  .sheet-wide { max-width: 780px; }
  .sheet-small { max-width: 460px; border-radius: 20px; }
}
.action-list { display: flex; flex-direction: column; gap: 4px; }
.action-item { display: flex; align-items: center; gap: 14px; min-height: 52px; padding: 0 12px; border-radius: var(--r-sm); border: 0; background: none; text-align: left; color: var(--t1); font-weight: 600; font-size: 15px; }
.action-item:hover { background: var(--hover); }
.action-item svg { color: var(--a-text); }
.action-item.danger, .action-item.danger svg { color: var(--bad-t); }
.confirm-box { width: 100%; max-width: 420px; background: var(--bg2); border: 1px solid var(--border2); border-radius: 20px; padding: 20px; }
.confirm-box h3 { font-size: 18px; margin-bottom: 6px; }
.confirm-box p { color: var(--t2); overflow-wrap: anywhere; }
.confirm-box .row { background: none; border: 0; justify-content: flex-end; gap: 8px; padding: 8px 0 0; min-height: 0; flex-wrap: wrap; }
.toast-stack { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--bar-h) + 14px + var(--safe-b)); z-index: 300; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 1024px) { .toast-stack { bottom: 24px; } }
.toast { padding: 12px 16px; border-radius: var(--r); background: var(--surface2); border: 1px solid var(--border2); color: var(--t1); font-size: 14.5px; box-shadow: var(--shadow-2); animation: toast-in .2s ease; overflow-wrap: anywhere; }
.toast-good { border-color: color-mix(in srgb, var(--good) 55%, transparent); }
.toast-err { border-color: color-mix(in srgb, var(--bad) 60%, transparent); }
.toast.leaving { opacity: 0; transform: translateY(6px); transition: opacity .25s, transform .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- first run ---------- */
.onboarding { position: fixed; inset: 0; z-index: 350; background: var(--glow), var(--bg); overflow-y: auto; display: flex; justify-content: center; padding: 24px 16px; }
.ob-card { width: 100%; max-width: 460px; margin: auto; display: flex; flex-direction: column; gap: 14px; }
.ob-mark { color: var(--a-text); align-self: center; }
.ob-card h1 { text-align: center; font-size: 30px; letter-spacing: .02em; }
.ob-sub { text-align: center; margin: -10px 0 0; color: var(--a-text); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: 12.5px; }
.ob-desc { text-align: center; color: var(--t2); }
.ob-demo { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: var(--r); border: 1px solid var(--border2); background: var(--surface); cursor: pointer; }
.ob-demo input { width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--a1); flex: none; }
.ob-signin, .ob-brand { text-align: center; font-size: 13.5px; color: var(--t2); margin: 0; }
.ob-signin .link { min-height: var(--tap); }

/* ---------- printing ---------- */
@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .bottom-nav, .toast-stack, .page-actions, .modal-overlay, .confirm-overlay, .loader { display: none !important; }
  main { padding: 0; }
  .card, .stat { border-color: #ccc; background: #fff; break-inside: avoid; }
}

/* ==========================================================================
   Prompt Studio's own pieces
   ========================================================================== */
.mono { font-family: var(--mono); }
.ptag i.sq { border-radius: 3px; }
.hero .btn-primary { flex: none; }
.center-row { justify-content: center; }

/* ---------- topics ---------- */
.topic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 640px) { .topic-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .topic-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.topic-btn { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; border-radius: var(--r); border: 1px solid var(--border); border-left: 3px solid var(--c); background: var(--surface2); color: var(--t1); font-weight: 600; font-size: 13.5px; text-align: left; min-width: 0; }
.topic-btn svg { color: color-mix(in srgb, var(--c) var(--mix-p), var(--mix)); } /* the category colour, made readable on this theme */
.topic-btn span:first-of-type { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.topic-btn:hover { border-color: var(--c); }

/* ---------- the Generator ---------- */
.gen-layout { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 1024px) { .gen-layout { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .gen-out { position: sticky; top: 76px; max-height: calc(100vh - 92px); overflow-y: auto; } }
.gen-form, .gen-out { margin-bottom: 0; }
.more-opts { border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 0 0 2px; }
.more-opts[open] { padding-bottom: 14px; }
.more-opts summary { padding: 0 2px; }
.gen-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.gen-actions .btn { flex: 1 1 auto; }
.gen-more .btn { flex: 1 1 calc(50% - 8px); padding: 0 10px; }
@media (min-width: 520px) { .gen-more .btn { flex-basis: 0; } }
.btn.locked { color: var(--t2); }
.gen-clear { align-self: flex-start; min-height: var(--tap); display: inline-flex; align-items: center; color: var(--t2); }
.output { margin: 0; padding: 14px; border-radius: var(--r); border: 1px solid var(--border2); background: var(--bg2); font: 13.5px/1.6 var(--mono); color: var(--t1); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 60vh; overflow-y: auto; }
.output.small-out { max-height: 30vh; font-size: 12.5px; }
.output-edit { font: 13.5px/1.6 var(--mono); min-height: 260px; }
.blank-note { display: flex; align-items: flex-start; gap: 8px; margin: 10px 0 0; padding: 8px 12px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--a1) 10%, transparent); border: 1px solid color-mix(in srgb, var(--a1) 30%, transparent); font-size: 13.5px; color: var(--t1); overflow-wrap: anywhere; }
.blank-note svg { color: var(--a-text); margin-top: 2px; }
.out-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.out-actions .btn { flex: 1 1 auto; }
.version { padding: 10px 0 14px; border-top: 1px solid var(--border); }
.version:first-of-type { border-top: 0; padding-top: 0; }
.version-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 8px; }
.version .output { max-height: 32vh; }
.fill-preview { display: flex; flex-direction: column; gap: 6px; }

/* ---------- the Vault ---------- */
.v-card { position: relative; }
.v-card .v-bar { display: block; height: 4px; width: 44px; border-radius: var(--r-full); background: var(--c); }
.v-card.selected { border-color: var(--a1); box-shadow: 0 0 0 2px color-mix(in srgb, var(--a1) 35%, transparent); }
.v-pick { position: absolute; top: 4px; right: 4px; z-index: 1; width: var(--tap); justify-content: center; }
.v-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.tag-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 0 8px; border-radius: var(--r-full); border: 1px solid var(--border); background: var(--surface2); color: var(--t2); font-size: 12.5px; font-weight: 600; }
button.tag-chip { min-height: var(--tap); }
.chip.on { background: color-mix(in srgb, var(--a1) 20%, transparent); border-color: var(--a1); color: var(--t1); }
.chip .count { margin-left: 4px; }
.tag-row { margin-top: -4px; }
.bulk-bar { position: fixed; left: 0; right: 0; bottom: calc(var(--bar-h) + var(--safe-b)); z-index: 75; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 12px;
  background: color-mix(in srgb, var(--bg2) 96%, transparent); border-top: 1px solid var(--border2); box-shadow: var(--shadow-2); }
.bulk-n { flex: 1 0 100%; font-weight: 700; font-size: 13.5px; }
.bulk-bar .btn { flex: 1 1 auto; padding: 0 10px; }
@media (min-width: 640px) { .bulk-n { flex: 0 0 auto; margin-right: 6px; } }
@media (min-width: 1024px) { .bulk-bar { left: 272px; bottom: 0; padding: 10px 28px; } }
body[data-page="vault"] main { padding-bottom: calc(var(--bar-h) + 140px + var(--safe-b)); }
.add-row { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
.add-row .input { flex: 1 1 200px; }
@media (max-width: 759px) {
  .tag-row { flex-wrap: nowrap; overflow-x: auto; margin-left: -14px; margin-right: -14px; padding: 0 14px 4px; scrollbar-width: none; }
  .tag-row::-webkit-scrollbar { display: none; }
  .tag-row .chip { flex: none; }
  .toolbar .input { flex: 1 1 calc(50% - 8px); }
}
