:root {
  /* Neutral dark base — no purple/blue tint */
  --bg:       #0c0c0e;
  --bg2:      #141416;
  --bg3:      #1f1f23;
  --bg4:      #2a2a30;
  /* Cards sit above bg */
  --surface:  #19191c;
  /* Solid borders — alpha borders are invisible on dark */
  --border:   #252528;
  --border2:  #35353a;
  /* Text — high contrast for readability */
  --text:     #eeeeef;
  --text2:    #94949e;
  --text3:    #73737e;
  /* Accent — warm coral, sharp against neutral dark */
  --ember:    #e96449;
  --ember2:   #f0785f;
  --ember-bg: #1f1412;
  /* Semantic */
  --gold:     #d6b04e;
  --gold-bg:  #1c1a12;
  --jade:     #3cd490;
  --jade-bg:  #111c16;
  --rose:     #e85888;
  --switch-off: #303036;
  --switch-thumb: #a3a3ac;
  --r: 10px;
  --r-lg: 16px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.3);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.4);
  --modal-bg: rgba(0,0,0,0.7);
  --grain-opacity: 0.025;
  /* Inputs sit a step below the card, not in a pure-black hole. */
  --field-bg: #111113;
  --ring: rgba(233,100,73,0.28);
  /* Gallery-surface chips: two hues distinct from `published` green. */
  --sky: #4fc3e0;
  --sky-bg: rgba(60,180,212,0.15);
  --violet: #8f9bff;
  --violet-bg: rgba(126,138,246,0.16);
  /* Inset panels inside a card (pack cards, totals strip). */
  --inset-bg: var(--bg3);
  /* Fonts and easing — shared across themes; without these the dark theme
     falls back to browser-default serif fonts, causing layout shifts on
     theme toggle. */
  --font-display: 'Syne', sans-serif;
  --font-body: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* Icons drawn as data URIs can't read CSS vars, so each theme ships its own
     stroke colour here instead of hardcoding one that only reads on dark. */
  --select-arrow: url("data:image/svg+xml,%3Csvg width='10' height='7' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5l4 4 4-4' fill='none' stroke='%2394949e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --search-icon: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%2373737e' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='6.8' cy='6.8' r='4.5'/%3E%3Cpath d='M10.2 10.2L14 14'/%3E%3C/g%3E%3C/svg%3E");
}

[data-theme="light"] {
  --bg:       #f0f0f3;
  --bg2:      #e8e8ec;
  --bg3:      #dddde2;
  --bg4:      #d2d2d8;
  --surface:  #ffffff;
  --border:   #d0d0d6;
  --border2:  #b8b8c0;
  --text:     #1a1a1e;
  --text2:    #55555f;
  --text3:    #6e6e7a;
  --ember:    #d04828;
  --ember2:   #dc5c3e;
  --ember-bg: #fceee8;
  --gold:     #a08020;
  --gold-bg:  #f8f4e6;
  --jade:     #1a9a5e;
  --jade-bg:  #e8f6ef;
  --rose:     #c83868;
  --switch-off: #dddde3;
  --switch-thumb: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --modal-bg: rgba(0,0,0,0.25);
  --grain-opacity: 0;
  --field-bg: #fafafb;
  --ring: rgba(208,72,40,0.2);
  --sky: #0d7f9f;
  --sky-bg: #e2f3f8;
  --violet: #5058c4;
  --violet-bg: #ebedfd;
  --inset-bg: #f4f4f6;
  --select-arrow: url("data:image/svg+xml,%3Csvg width='10' height='7' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5l4 4 4-4' fill='none' stroke='%235c5c68' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  --search-icon: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 16 16' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' stroke='%237b7b88' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='6.8' cy='6.8' r='4.5'/%3E%3Cpath d='M10.2 10.2L14 14'/%3E%3C/g%3E%3C/svg%3E");
}

* { margin: 0; padding: 0; box-sizing: border-box; }
*, *::before, *::after {
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
  text-rendering: geometricPrecision !important;
}
.theme-transitioning, .theme-transitioning *, .theme-transitioning *::before, .theme-transitioning *::after {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease !important;
}

body {
  font-family: var(--font-body); background: var(--bg); color: var(--text);
  height: 100vh; overflow: hidden; font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: geometricPrecision;
}

/* Grain overlay */
body::after {
  content: ''; position: fixed; inset: 0; z-index: 9998; pointer-events: none;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px;
}

button { cursor: pointer; font-family: var(--font-body); transition: all 0.2s var(--ease); }
input, textarea, select { font-family: var(--font-body); transition: border-color 0.2s, box-shadow 0.2s; }
input[type="checkbox"] { accent-color: var(--ember); }
/* Borderless buttons had no visible keyboard focus at all on the dark theme. */
:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
kbd {
  display: inline-block; font-family: var(--font-mono); font-size: 10.5px; line-height: 1.5;
  padding: 0 6px; border-radius: 5px; color: var(--text3);
  background: var(--bg3); border: 1px solid var(--border2); box-shadow: inset 0 -1px 0 var(--border2);
}

/* ---- Auth ---- */
#auth-overlay {
  position: fixed; inset: 0; z-index: 1000; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
#auth-overlay::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(233,100,73,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(214,176,78,0.03) 0%, transparent 50%);
}
#auth-box {
  position: relative; background: var(--surface); border: 1px solid var(--border2);
  border-radius: 24px; padding: 52px 44px; text-align: center;
  max-width: 380px; width: 90%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.04);
  animation: authIn 0.6s var(--ease);
}
@keyframes authIn { from { opacity: 0; transform: translateY(20px) scale(0.96); } }
#auth-box h1 {
  font-family: var(--font-display); font-size: 26px; font-weight: 800;
  letter-spacing: -0.5px; margin-bottom: 6px;
  background: linear-gradient(135deg, var(--text) 0%, var(--ember) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
#auth-box p { color: var(--text3); font-size: 13px; margin-bottom: 32px; font-weight: 400; letter-spacing: 2px; text-transform: uppercase; }
#auth-box input {
  width: 100%; padding: 13px 18px; background: var(--field-bg); border: 1px solid var(--border2);
  border-radius: var(--r); color: var(--text); font-size: 14px; margin-bottom: 16px;
  font-family: var(--font-mono); letter-spacing: 0.5px;
}
#auth-box input::placeholder { color: var(--text3); font-family: var(--font-body); letter-spacing: 0; }
#auth-box input:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px var(--ember-bg), 0 0 20px rgba(232,96,76,0.1); }
#auth-box button {
  width: 100%; padding: 13px; background: var(--ember); color: #fff;
  border: none; border-radius: var(--r); font-size: 14px; font-weight: 600;
  letter-spacing: 0.3px;
}
#auth-box button:hover { background: var(--ember2); transform: translateY(-2px); box-shadow: 0 8px 24px rgba(232,96,76,0.3); }
#auth-error { color: var(--ember); font-size: 13px; margin-top: 12px; display: none; font-weight: 500; }

/* ---- Layout ---- */
#app { display: none; height: 100vh; animation: fadeIn 0.4s var(--ease); }

@keyframes fadeIn { from { opacity: 0; } }

.sidebar-menu, .action-menu { position: relative; min-width: 0; }
.sidebar-menu > summary,
.action-menu > summary {
  list-style: none; user-select: none;
}
.sidebar-menu > summary::-webkit-details-marker,
.action-menu > summary::-webkit-details-marker { display: none; }
.menu-chevron {
  display: inline-flex; align-items: center; justify-content: center;
  width: 12px; height: 12px; color: var(--text3);
  transition: transform 0.15s var(--ease);
}
.menu-chevron::before {
  content: ''; width: 5px; height: 5px; margin-top: -3px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
}
.sidebar-menu[open] > summary .menu-chevron,
.action-menu[open] > summary .menu-chevron { transform: rotate(180deg); }
.sidebar-menu-popover,
.action-menu-popover {
  position: absolute; z-index: 1300; top: calc(100% + 7px); left: 0;
  min-width: 224px; padding: 6px; border: 1px solid var(--border2);
  border-radius: 12px; background: var(--surface); box-shadow: var(--shadow-lg);
}
.sidebar-menu-popover button,
.action-menu-popover button {
  display: flex; width: 100%; min-height: 38px; border: none; border-radius: 8px;
  padding: 9px 11px; background: transparent; color: var(--text2);
  align-items: flex-start; justify-content: center; flex-direction: column;
  font-size: 13px; font-weight: 600; text-align: left;
}
.sidebar-menu-popover button:hover,
.action-menu-popover button:hover { color: var(--text); background: var(--bg3); }
.sidebar-menu-popover button small {
  margin-top: 2px; color: var(--text3); font-size: 10px; font-weight: 400;
}
.search-wrap {
  position: relative;
}
.search-wrap::before {
  content: ''; position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; pointer-events: none;
  background: var(--search-icon) no-repeat center / 16px 16px;
}
.search-input {
  width: 100%; padding: 10px 32px 10px 40px; background: var(--field-bg); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-size: 13px;
}
.search-input:hover { border-color: var(--border2); }
.search-input:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px var(--ring); }
/* Slash hint: shown while the box is idle, gone as soon as it is used. */
.search-kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.search-wrap.has-value .search-kbd, .search-wrap:focus-within .search-kbd { display: none; }
.search-input::placeholder { color: var(--text3); }
.search-clear {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 22px; height: 22px; border: none; border-radius: 50%;
  background: var(--bg4); color: var(--text2); font-size: 12px; line-height: 1;
  display: none; align-items: center; justify-content: center; padding: 0;
}
.search-wrap.has-value .search-clear { display: inline-flex; }
.search-clear:hover { background: var(--rose); color: #fff; }

/* Buttons */
.btn {
  min-height: 36px; padding: 0 15px; border: none; border-radius: 9px; font-size: 13px;
  font-weight: 600; display: inline-flex; align-items: center; gap: 6px; letter-spacing: 0.2px;
  justify-content: center; white-space: nowrap; line-height: 1;
}
.btn-primary {
  background: linear-gradient(180deg, var(--ember2) 0%, var(--ember) 100%); color: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2), 0 2px 8px rgba(233,100,73,0.2), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:hover {
  background: var(--ember2); transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(233,100,73,0.28), inset 0 1px 0 rgba(255,255,255,0.18);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.btn-sm { min-height: 30px; padding: 0 11px; font-size: 12px; }
.btn-danger { background: var(--bg3); color: var(--rose); border: 1px solid var(--border); }
[data-theme="light"] .btn-danger { background: #fdf0f4; }
.btn-danger:hover { background: var(--rose); color: #fff; border-color: var(--rose); }
.btn-ghost {
  background: var(--surface); color: var(--text2); border: 1px solid var(--border2);
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.btn-ghost:hover { color: var(--text); background: var(--bg3); border-color: var(--border2); }

.pagination { display: flex; gap: 10px; align-items: center; justify-content: center; }
.pagination span {
  font-family: var(--font-mono); font-size: 11.5px; font-weight: 500; color: var(--text2);
  padding: 4px 11px; border-radius: 999px; background: var(--bg3); border: 1px solid var(--border);
}

.account-menu { width: 100%; }
.account-trigger {
  display: flex; align-items: center; width: 100%; min-height: 48px; gap: 10px;
  padding: 6px 9px; border-radius: var(--r); cursor: pointer; list-style: none;
  transition: background 0.15s var(--ease);
}
.account-trigger:hover,
.account-menu[open] > .account-trigger { background: var(--bg3); }
.account-trigger > .menu-chevron { margin-left: auto; flex: none; }

/* ---- Editor ---- */
.editor {
  /* No top padding: the sticky form header owns that space (see .form-header),
     so scrolled sections can't show through above it. */
  flex: 1; overflow-y: auto; padding: 0 48px 36px;
  background:
    radial-gradient(ellipse at 80% 10%, rgba(233,100,73,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 20% 90%, rgba(214,176,78,0.02) 0%, transparent 50%),
    var(--bg);
}

.editor-form { max-width: 1040px; margin: 0 auto; animation: formIn 0.4s var(--ease); }
@keyframes formIn { from { opacity: 0; transform: translateY(12px); } }

.form-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0; flex-wrap: wrap; gap: 10px 16px;
  /* Stays pinned while the long form scrolls so Save / "Unsaved" are always
     reachable. Scroll container is .editor, whose top padding this header
     carries itself — otherwise sections scroll through the uncovered strip
     above it and read as a stray line of text next to the title. */
  position: sticky; top: 0; z-index: 100;
  padding: 36px 0 12px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: box-shadow 0.2s var(--ease);
}

.form-heading { display: flex; align-items: center; gap: 14px; min-width: 0; }
.form-avatar {
  width: 44px; height: 44px; border-radius: 13px; flex: none; overflow: hidden;
  display: grid; place-items: center; background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text3); font-family: var(--font-display); font-size: 16px; font-weight: 700;
}
.form-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.form-heading-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.form-eyebrow {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600; letter-spacing: 1.4px;
  text-transform: uppercase; color: var(--ember);
}
.form-header h2 {
  font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.5px;
  line-height: 1.1; min-width: 0; overflow-wrap: anywhere;
}
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-left: auto; }
.form-actions > .btn,
.form-actions > .action-menu > summary { height: 36px; }
.action-menu-popover { left: auto; right: 0; min-width: 170px; }
.action-menu-popover button { align-items: flex-start; min-height: 36px; }
.btn:disabled {
  opacity: 0.45; cursor: default; transform: none !important; box-shadow: none;
}
.btn-primary:disabled:hover { background: var(--ember); }

/* Tabs */
.tabs {
  display: inline-flex; flex-wrap: wrap; gap: 2px; margin: 16px 0 26px; padding: 4px;
  background: var(--bg2); border: 1px solid var(--border); border-radius: 12px;
}
.tab {
  padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--text3);
  background: none; border: none; border-radius: 9px; cursor: pointer; letter-spacing: 0.1px;
  transition: color 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.tab:hover { color: var(--text2); background: color-mix(in srgb, var(--text) 6%, transparent); }
.tab.active {
  color: var(--ember); background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.22), 0 0 0 1px var(--border2), inset 0 1px 0 rgba(255,255,255,0.05);
}
.tab.active:hover { color: var(--ember); }
.tab.disabled { opacity: 0.35; cursor: default; }
.tab.disabled:hover { color: var(--text3); }
.tab-badge {
  font-size: 9px; font-family: var(--font-mono); font-weight: 600;
  background: var(--bg4); color: var(--text3); padding: 2px 6px; border-radius: 4px;
  margin-left: 8px; text-transform: uppercase; letter-spacing: 0.5px; vertical-align: 1px;
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* Starter editor */
.starter-tabs {
  display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 14px;
  padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.starter-tabs.starter-lang-tabs {
  margin-top: 6px; padding-bottom: 6px; border-bottom: none;
}
.starter-pill {
  padding: 6px 12px; font-size: 12px; font-weight: 500; color: var(--text3);
  background: var(--bg3); border: 1px solid var(--border); border-radius: 99px;
  cursor: pointer; letter-spacing: 0.2px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
  font-family: var(--font-mono); user-select: none;
}
.starter-pill:hover { color: var(--text2); border-color: var(--border2); }
.starter-pill.active {
  color: var(--ember); border-color: var(--ember); background: var(--ember-bg);
}
.starter-pill .pill-count {
  margin-left: 6px; font-size: 10px; opacity: 0.7;
}
/* Group heading inside a wrapping pill row. `flex-basis:100%` forces the
   break, so the poses read as their own block instead of trailing off the
   end of a 20-pill line. */
.starter-tabs-sep {
  flex-basis: 100%; display: flex; align-items: center; gap: 8px;
  margin: 10px 0 2px; font-family: var(--font-mono); font-size: 10px;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text3);
  user-select: none;
}
.starter-tabs-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
/* Mainstream/Adult kind selectors are binary mode switches — render them as
   segmented controls (same look as Personality SFW/NSFW) instead of pills.
   Pills stay for long wrappable lists (fetishes, languages, slots). */
#desc-kind-tabs, #starter-kind-tabs {
  display: inline-flex; flex-wrap: nowrap; gap: 3px; align-self: flex-start;
  padding: 3px; border-bottom: none;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
}
#desc-kind-tabs .starter-pill, #starter-kind-tabs .starter-pill {
  border: none; background: transparent; border-radius: 7px;
  font-family: var(--font-body); font-weight: 600; font-size: 12px;
  padding: 7px 14px; letter-spacing: 0.2px;
}
#desc-kind-tabs .starter-pill:hover, #starter-kind-tabs .starter-pill:hover {
  /* White-on-white is invisible in light mode — tint with the text colour so
     the hover reads in both themes. */
  color: var(--text2); background: color-mix(in srgb, var(--text) 7%, transparent);
}
#desc-kind-tabs .starter-pill.active, #starter-kind-tabs .starter-pill.active {
  background: var(--bg4); color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04);
}
#desc-kind-tabs .pill-count, #starter-kind-tabs .pill-count {
  font-family: var(--font-mono);
}
.starter-msgs-list {
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px;
}
.starter-msg-row {
  display: flex; gap: 8px; align-items: stretch;
}
.starter-msg-row textarea {
  flex: 1; padding: 10px 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-size: 14px; line-height: 1.5;
  min-height: 56px; resize: vertical;
}
.starter-msg-row textarea:focus {
  outline: none; border-color: var(--ember); box-shadow: 0 0 0 2px var(--ember-bg);
}
.starter-msg-row .row-del {
  flex-shrink: 0; width: 36px; padding: 0; font-size: 16px;
  color: var(--text3); background: var(--bg3); border: 1px solid var(--border);
  border-radius: var(--r); cursor: pointer;
}
.starter-msg-row .row-del:hover { color: var(--rose); border-color: var(--rose); }
.starter-empty {
  padding: 20px; text-align: center; color: var(--text3); font-size: 13px;
  background: var(--bg3); border-radius: var(--r); margin-bottom: 14px;
}
.starter-actions {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
}
.starter-imgs-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px; margin-bottom: 14px;
}
.starter-thumb {
  position: relative; aspect-ratio: 3/4; border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--border); background: var(--bg3);
}
.starter-thumb img,
.starter-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
/* Stands in until the presigned URL arrives, and permanently for a key that
   could not be signed — a glyph rather than a broken-image icon. */
.starter-thumb .thumb-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 26px;
}
.starter-thumb .type-badge {
  position: absolute; left: 6px; top: 6px; padding: 2px 7px; border-radius: 99px;
  font-size: 10px; font-family: var(--font-mono); background: rgba(0,0,0,0.65); color: #fff;
}
.starter-thumb .type-badge-warn { background: var(--rose); }
.starter-thumb .thumb-del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  background: rgba(0,0,0,0.6); color: #fff; border: none; border-radius: 50%;
  font-size: 14px; cursor: pointer; line-height: 1;
}
.starter-thumb .thumb-del:hover { background: var(--rose); }

/* Card media (cover + video pairs) */
.card-media-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.card-media-block {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px;
}
.card-media-label {
  font-family: var(--font-mono); font-size: 10px; color: var(--text3);
  font-weight: 600; text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: 12px;
}
.card-media-pair {
  display: grid; grid-template-columns: 1fr; gap: 10px;
}
.card-media-slot {
  position: relative; aspect-ratio: 2/3; border-radius: var(--r); overflow: hidden;
  border: 1px solid var(--border); background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.card-media-slot.card-media-video { aspect-ratio: 9/16; background: #000; }
.card-media-slot img,
.card-media-slot video { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-media-empty {
  color: var(--text3); font-size: 12px; font-family: var(--font-mono);
}
.card-media-clear {
  position: absolute; top: 8px; right: 8px; width: 26px; height: 26px;
  background: rgba(0,0,0,0.65); color: #fff; border: none; border-radius: 50%;
  font-size: 16px; line-height: 1; cursor: pointer; z-index: 2;
}
.card-media-clear:hover { background: var(--rose); }
.card-media-upload { text-align: center; cursor: pointer; }

/* Visibility section */
.visibility-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
@media (max-width: 700px) { .visibility-grid { grid-template-columns: 1fr; } }
.visibility-item {
  display: flex; flex-direction: column; gap: 6px;
  padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg3); cursor: pointer; transition: border-color 0.15s;
  position: relative;
}
.visibility-item:hover { border-color: var(--border2); }
.visibility-item input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--ember); cursor: pointer;
  align-self: flex-start;
}
.visibility-item input[type="checkbox"]:disabled { cursor: not-allowed; }
.visibility-item.disabled {
  opacity: 0.55; cursor: not-allowed; background: var(--bg);
}
.visibility-item.disabled:hover { border-color: var(--border); }
.visibility-label {
  font-size: 13px; font-weight: 600; color: var(--text); letter-spacing: 0.2px;
}
.visibility-hint {
  font-size: 11px; color: var(--text3); line-height: 1.4;
}
.visibility-item.disabled .visibility-hint {
  color: var(--ember); font-weight: 500;
}
/* Manual sync reuses .visibility-item for plain checkbox rows, inside a .field —
   where `.field label { display: block }` outranks the card's own display:flex
   and drops the gap, gluing every box to its label. */
.visibility-list { display: flex; flex-direction: column; gap: 8px; }
.visibility-list .visibility-item {
  display: flex; flex-direction: row; align-items: center; gap: 10px; padding: 11px 14px;
}
.visibility-list .visibility-item input[type="checkbox"] { align-self: center; }
.visibility-list .visibility-item span { font-size: 13px; font-weight: 500; }

.visibility-banner {
  background: rgba(232,96,76,0.08); border: 1px solid rgba(232,96,76,0.2);
  border-radius: var(--r); padding: 12px 16px; margin-bottom: 14px;
  font-size: 13px; color: var(--ember); line-height: 1.5;
}
.visibility-banner strong { font-weight: 700; }
/* Publish checklist: one ✓/✕ list instead of repeating the same blocker text
   in the banner and on every env card. */
.visibility-checklist-card {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r); padding: 12px 16px; margin-bottom: 14px;
}

.visibility-checklist { display: flex; flex-wrap: wrap; gap: 7px 18px; }
.vis-check {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500;
}
.vis-check.ok { color: var(--jade); }
.vis-check.missing { color: var(--ember); }
.vis-check .vis-check-icon {
  width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
}
.vis-check.ok .vis-check-icon { background: var(--jade-bg); }
.vis-check.missing .vis-check-icon { background: var(--ember-bg); }
.vis-check .vis-prod-only {
  font-size: 9px; font-family: var(--font-mono); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.6px; color: var(--text3);
  background: var(--bg3); border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px;
}

/* Dirty indicator (unsaved changes) */
.dirty-indicator {
  font-size: 12px; font-weight: 600; color: var(--ember);
  letter-spacing: 0.3px; align-self: center; white-space: nowrap;
  animation: dirtyPulse 1.6s ease-in-out infinite;
}
@keyframes dirtyPulse { 0%, 100% { opacity: 0.65; } 50% { opacity: 1; } }

/* Tag picker on character page */
.tags-cloud {
  display: flex; flex-wrap: wrap; gap: 8px;
  min-height: 40px;
}
.tag-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; font-size: 12px; font-weight: 500;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 99px;
  color: var(--text2); cursor: pointer; user-select: none;
  font-family: var(--font-mono); letter-spacing: 0.2px;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.tag-chip:hover { color: var(--text); border-color: var(--border2); }
.tag-chip.selected {
  background: var(--ember-bg); border-color: var(--ember); color: var(--ember);
}
/* Hidden from the site: still assignable, but dimmed and struck so nobody
   expects it to show up on the storefront. */
.tag-chip.hidden-tag { opacity: 0.55; border-style: dashed; text-decoration: line-through; }
.tag-chip.hidden-tag.selected { opacity: 0.75; }
.tag-chip-empty { color: var(--text3); font-size: 12px; padding: 6px 0; }

/* Early-access duration, shown only while the "coming soon" chip is on */
.early-access-box {
  margin-top: 16px; padding: 14px 16px;
  background: var(--ember-bg); border: 1px solid var(--ember);
  border-radius: var(--r);
}
.early-access-box .field { margin-bottom: 0; }
.early-access-box input { max-width: 140px; }

/* Tags manager modal */
.tags-manager-overlay {
  position: fixed; inset: 0; background: var(--modal-bg); z-index: 2500;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 60px; backdrop-filter: blur(6px);
}

.tags-manager-list {
  overflow-y: auto; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg);
}
.tags-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.tags-table th {
  text-align: left; padding: 10px 12px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px; color: var(--text3);
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--bg);
}
.tags-table td {
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  color: var(--text);
}
.tags-table tr:last-child td { border-bottom: none; }
.tags-table tr:hover td { background: var(--bg3); }
.tags-table tr.dragging td { opacity: 0.45; background: var(--bg3); }
.tags-table tr.drop-target td { box-shadow: inset 0 2px 0 var(--ember); }
.tag-drag-handle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border: 1px solid var(--border);
  border-radius: 6px; color: var(--text3); cursor: grab;
  font-family: var(--font-mono); font-size: 12px; user-select: none;
}
.tag-drag-handle:active { cursor: grabbing; }
.tags-table .slug { font-family: var(--font-mono); font-size: 12px; color: var(--text3); }
.tags-table .filter-chip {
  display: inline-block; padding: 2px 8px; margin-right: 4px; margin-bottom: 2px;
  background: var(--bg3); border-radius: 4px; font-size: 11px;
  font-family: var(--font-mono); color: var(--text2);
}
.tags-table .actions { display: flex; gap: 4px; justify-content: flex-end; }
.tag-action-btn {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  padding: 4px 8px; font-size: 11px; cursor: pointer; color: var(--text2);
}
.tag-action-btn:hover { border-color: var(--border2); color: var(--text); }
.tag-action-btn.danger:hover { color: var(--rose); border-color: var(--rose); }
.tags-table tr.tag-hidden td { color: var(--text3); }
.tag-hidden-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.3px;
  background: var(--bg3); border: 1px dashed var(--border2); color: var(--text3);
  vertical-align: middle;
}

.tag-form {
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; display: flex; flex-direction: column; gap: 12px;
}
.tag-form-row { display: flex; gap: 10px; }
.tag-form-row .field { flex: 1; margin-bottom: 0; }
.tag-form-checkboxes {
  display: flex; flex-wrap: wrap; gap: 14px; padding-top: 4px;
}
.tag-form-checkbox {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text2); cursor: pointer;
}
.tag-form-checkbox input { width: 14px; height: 14px; accent-color: var(--ember); }

/* LoRA tab */
.lora-runs-row {
  display: flex; align-items: center; gap: 8px;
}
.lora-runs-row select {
  flex: 1; padding: 9px 30px 9px 14px; background-color: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r);
  color: var(--text); font-size: 13px; cursor: pointer;
  appearance: none; -webkit-appearance: none; text-overflow: ellipsis;
  background-image: var(--select-arrow);
  background-repeat: no-repeat; background-position: right 12px center;
}
.lora-runs-row select:focus {
  outline: none; border-color: var(--ember); box-shadow: 0 0 0 2px var(--ember-bg);
}
.lora-history-panel {
  margin-top: 12px; padding: 14px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r);
}
.lora-stage-block {
  margin-bottom: 14px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--r); overflow: hidden;
}
.lora-stage-block > summary {
  position: relative; display: flex; align-items: center; min-height: 56px;
  padding: 11px 44px 11px 14px; cursor: pointer; list-style: none;
  color: var(--text2);
}
.lora-stage-block > summary::-webkit-details-marker { display: none; }
.lora-stage-block > summary::after {
  content: '+'; position: absolute; right: 16px; top: 50%; transform: translateY(-50%);
  color: var(--text3); font-family: var(--font-mono); font-size: 18px;
}
.lora-stage-block[open] > summary::after { content: '−'; }
.lora-stage-block > summary span { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.lora-stage-block > summary strong { color: var(--text); font-size: 13px; }
.lora-stage-block > summary small {
  color: var(--text3); font-size: 11px; font-weight: 400;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lora-stage-block-body { padding: 14px; border-top: 1px solid var(--border); }
.lora-dataset-review, .lora-training-status { margin: 16px 0; }
.lora-stage-heading {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.lora-stage-heading .section-title { margin-bottom: 3px; }
.lora-stage-footer { display: flex; justify-content: flex-end; margin-top: 16px; }
.lora-inline-empty {
  padding: 14px; color: var(--text3); font-size: 12px; line-height: 1.5;
  background: var(--bg3); border: 1px dashed var(--border); border-radius: var(--r);
}
.lora-artifact-card {
  padding: 14px; margin-bottom: 14px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--r);
  font-family: var(--font-mono); font-size: 12px; word-break: break-all;
}
.lora-artifact-card .field-hint { margin-bottom: 6px; font-family: var(--font-body); }
.lora-stage-card {
  margin-bottom: 14px; padding: 14px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: var(--r);
}
details.lora-stage-card { padding: 0; overflow: hidden; }
.lora-stage-card > summary {
  display: flex; justify-content: space-between; gap: 12px; padding: 14px;
  cursor: pointer; list-style: none; font-weight: 600; color: var(--text2);
}
.lora-stage-card > summary::-webkit-details-marker { display: none; }
.lora-stage-card-body { padding: 0 14px 14px; }
.lora-stage-card-body .field-hint { margin-bottom: 10px; }
.lora-stage-card-title { margin-bottom: 12px; color: var(--text2); font-weight: 600; }
.lora-stage-state {
  font-family: var(--font-mono); font-size: 10px; color: var(--text3);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.lora-test-fields {
  display: grid; grid-template-columns: minmax(0, 1fr) 140px 180px; gap: 12px;
}
.lora-test-fields .field { margin: 0; }
.lora-test-fields textarea { min-height: 72px; resize: vertical; }
.lora-test-fields input, .lora-test-fields textarea {
  width: 100%; padding: 9px 10px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r);
}
.lora-test-fields input:focus, .lora-test-fields textarea:focus {
  outline: none; border-color: var(--ember); box-shadow: 0 0 0 2px var(--ember-bg);
}
.lora-test-actions {
  display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 12px;
}
.lora-progress {
  height: 5px; margin-top: 12px; overflow: hidden; background: var(--bg);
  border-radius: 99px;
}
.lora-progress > div {
  width: 0; height: 100%; background: var(--ember); transition: width 180ms ease;
}
.lora-test-gallery {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px; margin-top: 14px;
}
.lora-test-result {
  position: relative; overflow: hidden; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--r);
}
.lora-test-result img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.lora-test-result-meta { padding: 8px; font-size: 10px; color: var(--text3); }
.lora-test-result.failed { border-color: rgba(232,88,136,0.35); }
.lora-test-result.failed .lora-test-result-meta { color: var(--rose); }
.lora-test-remove {
  position: absolute; z-index: 2; top: 7px; right: 7px; width: 28px; height: 28px;
  display: grid; place-items: center; padding: 0; border: 1px solid rgba(255,255,255,0.24);
  border-radius: 50%; color: #fff; background: rgba(14,14,17,0.72); cursor: pointer;
  font-size: 19px; line-height: 1; backdrop-filter: blur(5px);
}
.lora-test-remove:hover { background: var(--rose); border-color: var(--rose); }
.lora-test-log-details {
  margin-top: 12px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg2);
}
.lora-test-log-details > summary {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 12px; cursor: pointer; list-style: none; color: var(--text3); font-size: 12px;
}
.lora-test-log-details > summary::-webkit-details-marker { display: none; }
.lora-test-log-details[open] > summary { border-bottom: 1px solid var(--border); }
.lora-test-log-details .lora-log { border: 0; border-radius: 0 0 var(--r) var(--r); }

@media (max-width: 760px) {
  .lora-test-fields { grid-template-columns: 1fr; }
}
.lora-create {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px 16px;
  align-items: start;
}
.lora-create-ref {
  display: flex; flex-direction: column; gap: 8px;
}
.lora-create-fields .field { margin-bottom: 0; }
.lora-create-fields .field label {
  margin-bottom: 4px; font-size: 11px; letter-spacing: 0.2px;
}
.lora-create-fields input,
.lora-create-fields select {
  padding: 7px 26px 7px 10px; font-size: 12px;
}
.lora-opt-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 10px;
  margin-top: 10px;
}
.lora-run-opts {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-top: 10px;
  border-top: 1px solid var(--border);
  margin-top: 12px;
}
@media (max-width: 900px) {
  .lora-create { grid-template-columns: 1fr; }
  .lora-opt-grid, .lora-run-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.lora-ref-area {
  display: flex; gap: 14px; align-items: flex-start;
}
.lora-ref-area > .btn { flex-shrink: 0; }
.lora-ref-preview {
  width: 120px; aspect-ratio: 3/4; background: var(--bg3);
  border: 1px dashed var(--border2); border-radius: var(--r); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.lora-ref-preview img { width: 100%; height: 100%; object-fit: cover; }
.lora-ref-empty { color: var(--text3); font-size: 11px; text-align: center; padding: 0 12px; line-height: 1.5; }
.lora-progress-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px;
}
.lora-progress-bar {
  width: 100%; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden;
  margin-bottom: 8px;
}
.lora-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--ember) 0%, var(--ember2) 100%);
  transition: width 0.3s ease-out;
}
.lora-progress-stats {
  font-size: 11px; color: var(--text3); font-family: var(--font-mono);
  letter-spacing: 0.4px; margin-bottom: 16px;
}
.lora-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px;
}
.lora-cell {
  position: relative; aspect-ratio: 1; border-radius: var(--r); overflow: hidden;
  background: var(--bg3); border: 1px solid var(--border);
}
.lora-cell.pending::before, .lora-cell.generating::before {
  /* Shimmer wave: bright sliver scrubs across the cell while waiting. */
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(110deg, transparent 30%, rgba(232,96,76,0.18) 50%, transparent 70%);
  background-size: 200% 100%; animation: loraShimmer 1.4s linear infinite;
}
@keyframes loraShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.lora-cell img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: opacity 0.3s;
}
.lora-cell.deleted img { opacity: 0.25; filter: grayscale(0.8); }
.lora-cell.failed {
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--rose); font-size: 11px; font-family: var(--font-mono);
  padding: 8px; text-align: center;
}
.lora-cell .lora-score {
  position: absolute; left: 6px; top: 6px;
  padding: 2px 7px; border-radius: 99px; font-size: 10px;
  font-family: var(--font-mono); font-weight: 600; letter-spacing: 0.3px;
  background: rgba(0,0,0,0.65); color: #fff;
}
.lora-cell .lora-score.low { background: rgba(232,96,76,0.85); }
.lora-cell .lora-del {
  position: absolute; right: 6px; top: 6px; width: 24px; height: 24px;
  border: none; border-radius: 50%; cursor: pointer;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 14px; line-height: 1;
}
.lora-cell .lora-del:hover { background: var(--rose); }
.lora-cell.deleted .lora-del { background: rgba(60,212,144,0.85); }
.lora-cell.deleted .lora-del::before { content: '↻'; }
.lora-cell.deleted .lora-del span { display: none; }
.lora-cell img { cursor: zoom-in; }

/* Retry sits opposite the drop button so the two cannot be misclicked for each
   other — one is cheap and reversible, the other spends an API call. */
.lora-cell .lora-retry {
  position: absolute; right: 6px; bottom: 6px; width: 24px; height: 24px;
  border: none; border-radius: 50%; cursor: pointer;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 13px; line-height: 1;
  opacity: 0; transition: opacity 0.15s;
}
.lora-cell:hover .lora-retry { opacity: 1; }
.lora-cell .lora-retry:hover { background: var(--ember); }
.lora-cell.failed .lora-retry { opacity: 1; }

.lora-steps { flex-wrap: wrap; }

.lora-bulkbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; margin: 12px 0;
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r);
}
.lora-bulk-sep { width: 1px; height: 20px; background: var(--border2); }
.lora-bulk-label { font-size: 12px; color: var(--text2); }
.lora-bulkbar input[type="number"] {
  width: 64px; padding: 5px 8px; font-size: 12px; font-family: var(--font-mono);
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text);
}
.lora-bulkbar input[type="number"]:focus {
  outline: none; border-color: var(--ember); box-shadow: 0 0 0 2px var(--ember-bg);
}
.lora-bulk-hint {
  font-size: 11px; color: var(--text3); flex: 1 1 240px; line-height: 1.5;
}

/* Full-size review. Fixed rather than absolute so the overlay is not clipped by
   the panel's own scroll container. */
.lora-lightbox {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.82);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
/* One opaque panel, not floating chrome: at 82% backdrop the page behind still
   shows through translucent controls and the overlay stops reading as modal. */
.lora-lightbox-inner {
  display: flex; flex-direction: column;
  max-width: min(900px, 92vw); max-height: 92vh;
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: var(--r); overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
}
.lora-lightbox-inner img {
  max-width: 100%; max-height: 66vh; object-fit: contain;
  background: var(--bg3); display: block;
}
.lora-lightbox-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--border);
}
.lora-lightbox-meta {
  font-family: var(--font-mono); font-size: 12px; color: var(--text2);
}
.lora-lightbox-actions { display: flex; gap: 6px; }
.lora-lightbox-caption {
  font-family: var(--font-mono); font-size: 11px; line-height: 1.6;
  color: var(--text3); max-height: 96px; overflow-y: auto;
  background: var(--bg); padding: 8px 12px; border-top: 1px solid var(--border);
}
.lora-lightbox-caption:empty { display: none; }

.lora-caption-preview {
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg); padding: 4px 0; max-height: 260px; overflow-y: auto;
}
.lora-caption-row {
  display: flex; gap: 10px; padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.lora-caption-row:last-child { border-bottom: none; }
.lora-caption-idx {
  font-family: var(--font-mono); font-size: 11px; color: var(--text3);
  flex-shrink: 0; padding-top: 1px;
}
.lora-caption-texts { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.lora-caption-before {
  font-family: var(--font-mono); font-size: 11px; line-height: 1.5;
  color: var(--text3); text-decoration: line-through; word-break: break-word;
}
.lora-caption-after {
  font-family: var(--font-mono); font-size: 11px; line-height: 1.5;
  color: var(--text); word-break: break-word;
}

.lora-train-summary {
  padding: 12px 14px; margin: 14px 0;
  background: var(--bg3); border: 1px solid var(--border); border-radius: var(--r);
  font-size: 13px; color: var(--text2);
}
.lora-train-summary code {
  font-family: var(--font-mono); font-size: 12px; color: var(--ember);
}
.lora-summary-warn { color: var(--ember); }

.lora-advanced {
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px 14px; background: var(--bg);
}
.lora-advanced > summary {
  cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text2);
}
.lora-adv-group { margin-top: 14px; }
.lora-adv-group-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text3); margin-bottom: 8px;
}
.lora-adv-fields {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px;
}
.lora-adv-field label {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 12px; color: var(--text2); margin-bottom: 4px;
}
.lora-adv-range {
  font-family: var(--font-mono); font-size: 10px; color: var(--text3);
}
.lora-adv-field input[type="number"], .lora-adv-field select {
  width: 100%; padding: 7px 10px; font-size: 12px; font-family: var(--font-mono);
  background: var(--bg2); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text);
}
.lora-adv-field input:focus, .lora-adv-field select:focus {
  outline: none; border-color: var(--ember); box-shadow: 0 0 0 2px var(--ember-bg);
}
/* An overridden value is the one thing worth spotting at a glance in a form
   of thirty defaults. */
.lora-adv-field.changed label { color: var(--ember); }
.lora-adv-field.changed input[type="number"],
.lora-adv-field.changed select { border-color: var(--ember); }

.lora-lease {
  font-family: var(--font-mono); font-size: 12px; padding: 4px 10px;
  border-radius: 99px; background: var(--bg3); color: var(--text2);
}
.lora-lease.warn { background: var(--ember-bg); color: var(--ember); font-weight: 600; }

.lora-sample-strip {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 6px;
}
.lora-sample-strip .lora-cell { width: 140px; flex-shrink: 0; }

.lora-log {
  margin: 0; padding: 10px 12px; max-height: 180px; overflow: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--r);
  font-family: var(--font-mono); font-size: 11px; line-height: 1.5;
  color: var(--text2); white-space: pre-wrap; word-break: break-word;
}
.lora-log.has-error { color: var(--rose); border-color: rgba(232,88,136,0.35); }

.lora-job-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--r);
  margin-bottom: 8px; cursor: pointer; background: var(--bg);
}
.lora-job-row:hover { border-color: var(--border2); }
.lora-job-row.active { border-color: var(--ember); background: var(--ember-bg); }
.lora-job-status {
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
  padding: 3px 8px; border-radius: 99px; flex-shrink: 0;
  background: var(--bg3); color: var(--text2);
}
.lora-job-status.s-trained { background: var(--jade-bg); color: var(--jade); }
.lora-job-status.s-finished { background: var(--jade-bg); color: var(--jade); }
.lora-job-status.s-failed,
.lora-job-status.s-cancelled { background: rgba(232,88,136,0.15); color: var(--rose); }
.lora-job-status.s-rejected { background: var(--ember-bg); color: var(--ember); }
.lora-job-status.s-expired { background: var(--ember-bg); color: var(--ember); }
.lora-job-main { flex: 1; min-width: 0; }
.lora-job-name { font-size: 13px; color: var(--text); }
.lora-job-name code { font-family: var(--font-mono); font-size: 12px; color: var(--ember); }
.lora-job-sub { font-size: 11px; color: var(--text3); margin-top: 2px; }
.lora-job-artifact {
  font-family: var(--font-mono); font-size: 11px; color: var(--text3);
  max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Making a rented GPU visible is half of not leaking one. */
.lora-gpu-banner {
  padding: 12px 14px; margin-bottom: 14px; border-radius: var(--r);
  background: var(--bg3); border: 1px solid var(--border);
  font-size: 13px; color: var(--text2);
}
.lora-gpu-banner.danger { background: rgba(232,88,136,0.10); border-color: var(--rose); }
.lora-gpu-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lora-gpu-chip {
  font-family: var(--font-mono); font-size: 11px; padding: 3px 8px;
  border-radius: 99px; background: var(--bg); border: 1px solid var(--border);
}
.lora-gpu-chip.orphan { border-color: var(--rose); color: var(--rose); }

/* Marks a field owned by work that has not landed yet — see the WD14 slot. */
.field-badge {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 99px; font-size: 9px; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; vertical-align: middle;
  background: var(--ember-bg); color: var(--ember);
}

@media (max-width: 800px) {
  .card-media-grid { grid-template-columns: 1fr; }
}

/* Media library + packs */
.media-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.media-toolbar .spacer { flex: 1; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; }
.media-cell {
  position: relative; aspect-ratio: 3/4; border-radius: var(--r); overflow: hidden;
  background: var(--bg3); border: 1px solid var(--border); cursor: pointer;
}
.media-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.media-cell.archived img { opacity: 0.3; filter: grayscale(0.8); }
.media-cell.selected { outline: 2px solid var(--rose); outline-offset: -2px; }
.media-cell .video-ph {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 26px;
}
.media-cell .sel-badge {
  position: absolute; left: 6px; top: 6px; min-width: 22px; height: 22px; border-radius: 99px;
  background: var(--rose); color: #fff; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; padding: 0 6px; z-index: 2;
}
.media-cell .type-badge {
  position: absolute; right: 6px; top: 6px; padding: 2px 7px; border-radius: 99px;
  font-size: 10px; font-family: var(--font-mono); background: rgba(0,0,0,0.65); color: #fff;
}
.media-cell .flag-badge {
  position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 99px;
  font-size: 10px; font-family: var(--font-mono); background: rgba(0,0,0,0.55); color: #fff;
}
.media-cell .cell-actions { position: absolute; right: 6px; bottom: 6px; display: none; gap: 4px; z-index: 2; }
.media-cell:hover .cell-actions { display: flex; }
.media-cell .cell-btn {
  min-width: 24px; height: 24px; border: none; border-radius: 99px; cursor: pointer;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 12px; line-height: 1; padding: 0 6px;
}
.media-cell .cell-btn:hover { background: var(--rose); }
.pack-card { border: 1px solid var(--border); border-radius: var(--r); padding: 12px; margin-bottom: 10px; background: var(--inset-bg); }
.pack-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.pack-card-head .pack-title { font-weight: 600; }
.pack-card-head .spacer { flex: 1; }
.pack-thumbs { display: flex; gap: 6px; flex-wrap: wrap; }
.pack-thumb {
  width: 54px; height: 72px; border-radius: 6px; object-fit: cover;
  background: var(--bg); border: 1px solid var(--border);
}
.pack-thumb-ph {
  width: 54px; height: 72px; border-radius: 6px; background: var(--bg);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 16px;
}
.pack-sel-item { position: relative; }
.pack-sel-item .pack-sel-rm {
  position: absolute; right: -5px; top: -5px; width: 18px; height: 18px; border: none;
  border-radius: 50%; cursor: pointer; background: var(--rose); color: #fff; font-size: 10px; line-height: 1;
}
.pack-status { padding: 2px 8px; border-radius: 99px; font-size: 11px; font-family: var(--font-mono); font-weight: 600; }
.pack-status.draft { background: var(--bg4); color: var(--text2); }
.pack-status.published { background: var(--jade-bg); color: var(--jade); }
.pack-status.archived { background: rgba(232,96,76,0.12); color: var(--rose); }
/* Gallery packs carry several chips, not one status: visibility (`published` /
   `draft`, shared with chat packs above, plus `nowhere`), whether the consumer
   has our latest contents, and one chip per surface the pack is marked for —
   Media Gallery and the Private Content showcase. */
.pack-status.unsent { background: var(--bg4); color: var(--text2); }
.pack-status.stale { background: var(--gold-bg); color: var(--gold); }
/* Published, but marked for neither surface — live and unreachable. The one
   state that deserves the error colour. */
.pack-status.nowhere { background: rgba(232,96,76,0.12); color: var(--rose); }
/* Deliberately not the green of `published`: a surface is a destination, not
   a stronger degree of being published. Two hues so the pair reads apart. */
.pack-status.gallery { background: var(--sky-bg); color: var(--sky); }
.pack-status.showcase { background: var(--violet-bg); color: var(--violet); }
.pack-card-pending { border-left: 2px solid var(--gold); }
.pack-price { font-family: var(--font-mono); font-size: 12px; color: var(--gold); }
.pack-move { display: flex; gap: 2px; }
.pack-move .btn { padding: 4px 8px; line-height: 1; }
.pack-move .btn[disabled] { opacity: 0.35; cursor: default; }
/* Its own row under the card head: the head is already full, and the switch
   needs room for the sentence explaining what the pack will and will not do.
   The same row is reused in the pack editor, deliberately *outside* a .field —
   `.field label { display: block }` outranks the flex below and
   `.field input { width: 100% }` would stretch the checkbox across the form,
   the trap .visibility-list documents above. */
.pack-showcase-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 2px 0 8px; }
.pack-showcase-row .field-hint { margin-top: 0; }
.pack-showcase { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text2); cursor: pointer; }
.pack-showcase input[type="checkbox"] { width: 16px; height: 16px; flex: none; cursor: pointer; }
.pack-showcase-pos {
  width: 66px; padding: 3px 6px; font-family: var(--font-mono); font-size: 12px;
  border: 1px solid var(--border2); border-radius: 6px; background: var(--bg2); color: var(--text);
}
.pack-sel-item .pack-sel-dur {
  position: absolute; left: 3px; bottom: 3px; padding: 1px 4px; border-radius: 4px;
  background: rgba(0,0,0,0.65); color: #fff; font-family: var(--font-mono); font-size: 9px;
}

/* Every pack this character has, summed — the number an operator is building
   toward, kept next to the list rather than inside a card. */
.gallery-totals:not(:empty) {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 12px;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--inset-bg);
}
.gallery-total-main { font-family: var(--font-mono); font-size: 22px; font-weight: 600; color: var(--gold); }
.gallery-total-main span { font-size: 12px; color: var(--text3); font-weight: 400; }
.gallery-total-meta { display: flex; gap: 12px; flex-wrap: wrap; color: var(--text2); font-size: 12px; }
.gallery-total-pending { color: var(--gold); font-size: 12px; }
.media-modal-overlay {
  /* Above the narrow-window sidebar drawer (1500) and its FAB (1600), which
     used to float on top of this modal. */
  position: fixed; inset: 0; background: var(--modal-bg); z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  backdrop-filter: blur(6px);
}
.media-modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  width: min(1100px, 100%); max-height: 90vh; display: flex; flex-direction: column; overflow: hidden;
}
.media-modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.media-modal-body { padding: 14px 18px; overflow-y: auto; flex: 1; }
.media-modal-foot { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--border); }

/* LoRA placeholder */
.lora-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 40px; text-align: center; color: var(--text3);
  background: var(--surface); border: 1px dashed var(--border2); border-radius: var(--r-lg);
}
.lora-placeholder-icon { font-size: 40px; opacity: 0.3; margin-bottom: 16px; }
.lora-placeholder h3 {
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
  color: var(--text2); margin-bottom: 8px;
}
.lora-placeholder p { font-size: 13px; max-width: 360px; line-height: 1.6; }

/* Section cards */
.section {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: 24px; margin-bottom: 16px;
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255,255,255,0.03);
  transition: border-color 0.3s;
}
[data-theme="light"] .section { box-shadow: var(--shadow-sm); }
.section:hover { border-color: var(--border2); }
.section-title {
  font-family: var(--font-display); font-size: 14px; font-weight: 700;
  letter-spacing: -0.2px; color: var(--text); margin-bottom: 18px;
}
.danger-zone {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  border-color: color-mix(in srgb, var(--rose) 32%, var(--border));
  background: color-mix(in srgb, var(--rose) 4%, var(--surface));
}
.danger-zone:hover { border-color: color-mix(in srgb, var(--rose) 52%, var(--border)); }
.danger-zone-title { font-size: 14px; font-weight: 650; color: var(--text); }
.danger-zone .field-hint { margin-top: 4px; }
.danger-zone .btn { flex: none; }

/* Fields */
.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: block; font-size: 12px; font-weight: 600; margin-bottom: 7px;
  color: var(--text2); letter-spacing: 0.1px;
}
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 14px; background: var(--field-bg); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-size: 14px;
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: var(--border2); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px var(--ring);
}
.field input::placeholder, .field textarea::placeholder { color: var(--text3); }
.field input[readonly] { opacity: 0.6; cursor: not-allowed; }
.field textarea { resize: vertical; min-height: 80px; line-height: 1.65; }
.field textarea.large { min-height: 130px; }
.field select {
  cursor: pointer; appearance: none; -webkit-appearance: none;
  background-image: var(--select-arrow);
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 30px;
  text-overflow: ellipsis;
}
/* Selects outside .field (toolbars, modal and panel headers) used to fall back
   to the raw OS widget next to the styled ones. Same look, smaller metrics. */
.media-toolbar select,
.media-modal-head select,
select.search-input {
  cursor: pointer; appearance: none; -webkit-appearance: none;
  background-color: var(--field-bg); color: var(--text); font-size: 13px;
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 8px 30px 8px 12px;
  background-image: var(--select-arrow);
  background-repeat: no-repeat; background-position: right 11px center;
  text-overflow: ellipsis;
}
.media-toolbar select:focus,
.media-modal-head select:focus,
select.search-input:focus {
  outline: none; border-color: var(--ember); box-shadow: 0 0 0 2px var(--ember-bg);
}
.field-hint { font-size: 11px; color: var(--text3); margin-top: 6px; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }
.field-row.wrap { flex-wrap: wrap; }
.field-row.wrap .field { flex: 1 1 160px; min-width: 140px; }
.field-uuid input { font-family: var(--font-mono); font-size: 13px; letter-spacing: 0.3px; }
.req { color: var(--ember); font-weight: 600; }

/* Style pills */
.style-pills { display: flex; gap: 8px; }
.style-pill {
  flex: 1; padding: 10px; text-align: center; border-radius: var(--r);
  background: var(--field-bg); border: 1px solid var(--border); cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text2); transition: all 0.15s var(--ease);
}
.style-pill:hover { border-color: var(--border2); color: var(--text); }
.style-pill.active { border-color: var(--ember); color: var(--ember); background: var(--ember-bg); }

/* Personality inner tabs */
.p-tabs {
  display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 16px;
  background: var(--bg); border-radius: var(--r); padding: 3px;
  border: 1px solid var(--border);
}
.p-tab {
  flex: 1; padding: 9px 12px; text-align: center; border-radius: 7px;
  font-size: 12px; font-weight: 600; color: var(--text3); cursor: pointer;
  border: none; background: none; transition: all 0.2s var(--ease);
  letter-spacing: 0.2px; white-space: nowrap;
}
.p-tab:hover { color: var(--text2); background: color-mix(in srgb, var(--text) 7%, transparent); }
.p-tab.active {
  background: var(--bg4); color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04);
}
.personality-header {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  margin-bottom: 18px;
}
.personality-header .section-title { margin-bottom: 0; }
.personality-mode {
  display: inline-flex; gap: 3px; padding: 3px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r);
}
.personality-mode button {
  border: none; background: transparent; color: var(--text3); border-radius: 7px;
  font-size: 11px; font-weight: 700; padding: 7px 12px; letter-spacing: 0.8px;
}
.personality-mode button.active {
  background: var(--bg4); color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04);
}
.personality-mode-hidden { display: none !important; }
.p-panel { display: none; }
.p-panel.active { display: block; }
.p-panel textarea {
  width: 100%; padding: 11px 16px; background: var(--field-bg); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-size: 14px; resize: vertical; line-height: 1.65;
}
.p-panel textarea:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px var(--ring); }
.p-panel textarea::placeholder { color: var(--text3); }

/* Compact setting rail: one stable baseline for all boolean controls. */
.settings-toggle-grid {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 1px;
  margin-bottom: 20px; overflow: hidden; border: 1px solid var(--border);
  border-radius: 10px; background: var(--border);
}
.setting-toggle {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-width: 0; min-height: 52px; padding: 0 12px; background: var(--bg);
  color: var(--text2); cursor: pointer; font-size: 12px; font-weight: 550;
  user-select: none; transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.setting-toggle:hover { background: var(--bg3); color: var(--text); }
.setting-toggle > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toggles-row { display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 20px; }
.toggles-row:last-child { margin-bottom: 0; }
.toggle-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.toggles-row .toggle-row { margin-bottom: 0; }
.lora-dataset-toggles {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 32px; align-items: center; margin: 16px 0 0;
}
.lora-dataset-toggles .toggle-row { min-width: 0; }
.lora-dataset-actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px;
}
.toggle-row > label:not(.switch) {
  color: var(--text2); cursor: pointer; font-size: 13px; user-select: none;
}

/* Toggle */
.switch { position: relative; width: 34px; height: 18px; flex: none; }
.switch input {
  position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%;
  margin: 0; opacity: 0; cursor: pointer;
}
.switch .sl {
  position: absolute; inset: 0; background: var(--switch-off); border-radius: 999px;
  cursor: pointer; transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
  border: 1px solid color-mix(in srgb, var(--text3) 34%, var(--border)); overflow: hidden;
}
.switch .sl::before {
  content: ''; position: absolute; width: 12px; height: 12px;
  left: 2px; top: 2px; background: var(--switch-thumb); border-radius: 50%;
  transition: transform 0.2s var(--ease), background 0.2s var(--ease);
}
.switch input:checked + .sl { background: var(--ember); border-color: var(--ember); }
.switch input:checked + .sl::before { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .sl { box-shadow: 0 0 0 3px var(--ember-bg), 0 0 0 1px var(--ember); }
@media (max-width: 1180px) {
  .settings-toggle-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .lora-dataset-toggles { grid-template-columns: 1fr; gap: 12px; }
  .lora-dataset-actions .btn { width: 100%; justify-content: center; }
}

/* Slider */
.slider-row { display: flex; align-items: center; gap: 16px; }
.slider-row input[type="range"] {
  flex: 1; -webkit-appearance: none; height: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--bg4) 0%, var(--bg4) 100%);
  outline: none;
}
.slider-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: var(--ember); cursor: pointer;
  box-shadow: 0 2px 8px rgba(232,96,76,0.4), inset 0 1px 0 rgba(255,255,255,0.2);
  transition: transform 0.15s var(--ease), box-shadow 0.15s;
}
.slider-row input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15); box-shadow: 0 4px 16px rgba(232,96,76,0.5);
}
.slider-val {
  min-width: 44px; text-align: center; font-family: var(--font-mono);
  font-size: 14px; font-weight: 500; color: var(--ember);
  background: var(--ember-bg); padding: 5px 12px; border-radius: 8px;
  border: 1px solid var(--border);
}

/* Enhance card */
.enhance-card {
  position: relative; overflow: hidden;
  background: linear-gradient(135deg, var(--ember-bg), var(--gold-bg));
  border: 1px solid var(--border2); border-radius: var(--r-lg);
  padding: 20px; margin-bottom: 24px;
}
.enhance-card::before {
  content: ''; position: absolute; top: -1px; left: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--ember), var(--gold));
  opacity: 0.6;
}
.enhance-label {
  font-family: var(--font-display); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1.5px; color: var(--ember);
  margin-bottom: 12px; display: flex; align-items: center; gap: 8px;
}
.enhance-card textarea {
  width: 100%; padding: 12px 16px; background: rgba(0,0,0,0.3); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-size: 14px; min-height: 56px;
  resize: vertical; line-height: 1.5; margin-bottom: 12px;
}
.enhance-card textarea::placeholder { color: var(--text3); }
.enhance-card textarea:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px var(--ring); }
.enhance-btn {
  padding: 10px 24px;
  background: linear-gradient(135deg, var(--ember) 0%, #d44a38 100%);
  color: #fff; border: none; border-radius: var(--r); font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(232,96,76,0.3), inset 0 1px 0 rgba(255,255,255,0.15);
  letter-spacing: 0.3px;
}
.enhance-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(232,96,76,0.4); }
.enhance-btn:disabled { opacity: 0.5; cursor: wait; transform: none; box-shadow: none; }

/* Chat */
.chat-container {
  display: flex; flex-direction: column; height: calc(100vh - 200px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  overflow: hidden;
}
.chat-messages {
  flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 12px;
}
.chat-empty {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--text3); font-size: 13px;
}
.chat-msg {
  max-width: 75%; padding: 10px 16px; border-radius: 14px;
  font-size: 14px; line-height: 1.55; animation: msgIn 0.2s var(--ease);
  word-wrap: break-word;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } }
.chat-msg.user {
  align-self: flex-end; background: var(--ember); color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.assistant {
  align-self: flex-start; background: var(--bg3); color: var(--text);
  border-bottom-left-radius: 4px;
}
.chat-msg.typing {
  align-self: flex-start; background: var(--bg3); color: var(--text3);
  font-style: italic;
}
.chat-input-row {
  display: flex; gap: 10px; padding: 16px; border-top: 1px solid var(--border);
  background: var(--bg2);
}
.chat-input-row textarea {
  flex: 1; padding: 10px 16px; background: var(--field-bg); border: 1px solid var(--border);
  border-radius: var(--r); color: var(--text); font-size: 14px; font-family: var(--font-body);
  resize: none; line-height: 1.5; max-height: 120px;
}
.chat-input-row textarea:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px var(--ring); }
.chat-input-row textarea::placeholder { color: var(--text3); }
.chat-controls {
  display: flex; align-items: center; gap: 16px; padding: 8px 16px 12px;
  background: var(--bg2); font-size: 12px;
}
.chat-control-label { display: flex; align-items: center; gap: 6px; color: var(--text3); cursor: pointer; }
.chat-control-label input { accent-color: var(--ember); }

/* History panel */
.history-overlay {
  position: fixed; inset: 0; z-index: 2000; display: flex; justify-content: flex-end;
  background: var(--modal-bg); backdrop-filter: blur(4px); animation: fadeIn 0.15s;
}
.history-panel {
  width: 480px; max-width: 90vw; background: var(--bg2); border-left: 1px solid var(--border);
  display: flex; flex-direction: column; animation: slideLeft 0.25s var(--ease);
  box-shadow: -8px 0 32px rgba(0,0,0,0.3);
}
@keyframes slideLeft { from { transform: translateX(100%); } }
.history-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.history-header h3 { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.history-list { flex: 1; overflow-y: auto; padding: 12px; }
.history-item {
  padding: 14px 16px; border-radius: var(--r); margin-bottom: 6px;
  background: var(--surface); border: 1px solid var(--border); cursor: pointer;
  transition: all 0.15s;
}
.history-item:hover { border-color: var(--border2); background: var(--bg3); }
.history-date { font-family: var(--font-mono); font-size: 11px; color: var(--text3); margin-bottom: 6px; }
.history-fields { font-size: 12px; color: var(--text2); }
.history-actions { padding: 16px 24px; border-top: 1px solid var(--border); }

/* Reference image */
.ref-image-area { display: flex; gap: 20px; align-items: flex-start; }
.ref-image-preview {
  width: 140px; height: 180px; border-radius: var(--r); overflow: hidden;
  background: var(--bg); border: 1px solid var(--border); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.ref-image-preview img {
  width: 100%; height: 100%; object-fit: cover;
}
.ref-image-empty { color: var(--text3); font-size: 12px; text-align: center; padding: 12px; }
.ref-image-controls { flex: 1; display: flex; flex-direction: column; gap: 8px; }

/* Info grid */
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info-item { background: var(--bg); padding: 14px 16px; border-radius: var(--r); border: 1px solid var(--border); }
.info-label {
  font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-bottom: 6px;
  font-weight: 500; text-transform: uppercase; letter-spacing: 1px;
}
.info-value { font-size: 13px; font-weight: 500; }
.vision-ok { color: var(--jade); }
.vision-warning { color: var(--gold); font-size: 12px; }

.missing-banner {
  background: rgba(232,96,76,0.08); border: 1px solid rgba(232,96,76,0.2);
  border-radius: var(--r); padding: 12px 16px; margin-bottom: 16px;
  font-size: 13px; color: var(--ember); display: none;
}
.missing-banner strong { font-weight: 700; }

/* ---- Toast ---- */
.toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 18px 12px 14px; border-radius: 12px; font-size: 13px; font-weight: 500;
  animation: toastIn 0.35s var(--ease); min-width: 280px; max-width: 440px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border2);
  box-shadow: var(--shadow-lg);
}
.toast::before {
  content: ''; flex: none; width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 700; line-height: 1;
}
.toast-success::before { content: '\2713'; background: var(--jade-bg); color: var(--jade); box-shadow: 0 0 0 1px color-mix(in srgb, var(--jade) 40%, transparent); }
.toast-error::before { content: '!'; background: var(--ember-bg); color: var(--ember); box-shadow: 0 0 0 1px color-mix(in srgb, var(--ember) 40%, transparent); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0; background: var(--modal-bg); z-index: 2000;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(6px); animation: fadeIn 0.15s;
}
.modal-box {
  background: var(--surface); border: 1px solid var(--border2); border-radius: 20px;
  padding: 36px; max-width: 420px; width: 90%; text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5); animation: modalIn 0.25s var(--ease);
}
.modal-box h3 { font-family: var(--font-display); font-size: 18px; font-weight: 700; margin-bottom: 10px; }
.modal-box p { color: var(--text2); font-size: 14px; margin-bottom: 28px; line-height: 1.6; }
.modal-actions { display: flex; gap: 10px; justify-content: center; }
@keyframes modalIn { from { opacity: 0; transform: scale(0.9) translateY(10px); } }

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border2); }

/* Light mode: chat bubbles */
[data-theme="light"] .chat-msg.user { background: var(--ember); color: #fff; }
[data-theme="light"] .chat-msg.assistant { background: var(--bg3); }
[data-theme="light"] .enhance-card textarea { background: var(--bg); }
[data-theme="light"] .p-panel textarea { background: var(--bg); }

/* Theme toggle */
.theme-toggle {
  flex-direction: row !important; justify-content: flex-start !important; gap: 9px;
}
.theme-toggle > span:first-child {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; font-size: 14px; line-height: 1;
}

/* User badge */
.user-badge {
  display: flex; align-items: center; gap: 9px; min-width: 0; flex: 1;
  font-size: 11px; color: var(--text3);
}
.user-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 30px; height: 30px; border-radius: 9px; background: var(--ember-bg);
  border: 1px solid color-mix(in srgb, var(--ember) 38%, var(--border));
  color: var(--ember); font-family: var(--font-mono); font-size: 10px; font-weight: 700;
}
.user-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.user-email {
  display: block; font-family: var(--font-mono); color: var(--text2); min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-roles {
  display: block; font-family: var(--font-mono); font-size: 9px;
  color: var(--text3); letter-spacing: 0.4px; text-transform: uppercase;
}

#auth-status { color: var(--text3); font-size: 13px; margin-bottom: 16px; }
#auth-error { margin-top: 12px; color: var(--ember); font-size: 12px; }
#auth-login-btn {
  margin-top: 8px; padding: 11px 22px; font-size: 14px; font-weight: 600;
  background: var(--ember); color: #fff; border: none; border-radius: var(--r);
  cursor: pointer;
}
#auth-login-btn:hover { background: var(--ember2); }

/* Crop modal */
.crop-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.78); z-index: 3000;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.crop-modal {
  background: var(--surface); border: 1px solid var(--border2); border-radius: 16px;
  padding: 20px; max-width: 760px; width: 92%; max-height: 92vh;
  display: flex; flex-direction: column; gap: 14px;
}
.crop-modal-header {
  display: flex; align-items: center; justify-content: space-between;
}
.crop-modal-header h3 {
  font-family: var(--font-display); font-size: 16px; font-weight: 700;
}
.crop-modal-hint {
  font-size: 12px; color: var(--text3); line-height: 1.5;
}
.crop-canvas-wrap {
  position: relative; max-height: 60vh; min-height: 320px;
  background: #000; border-radius: var(--r); overflow: hidden;
}
.crop-canvas-wrap img,
.crop-canvas-wrap video { display: block; max-width: 100%; }
/* Blur-zone overlay sits inside Cropper's view box and shows where the site
   will paint a frosted-glass blur over the description text. 90/441 ≈ 20.41%
   of card height. We use real backdrop-filter so contributors see the actual
   blur, not just a darkening — matches how the user-facing card renders. */
.crop-blur-overlay {
  position: absolute; pointer-events: none; z-index: 5;
  background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0.15) 100%);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  border-top: 2px solid var(--ember);
  box-shadow: 0 -10px 24px rgba(0,0,0,0.35);
}
.crop-blur-label {
  position: absolute; pointer-events: none; z-index: 6;
  font-size: 11px; font-family: var(--font-mono); font-weight: 700;
  color: #fff; letter-spacing: 0.6px; text-transform: uppercase;
  padding: 5px 10px; border-radius: 4px;
  background: var(--ember);
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}
.crop-modal-actions {
  display: flex; justify-content: flex-end; gap: 10px;
}

.dramas-layout { display: flex; gap: 16px; flex: 1; min-height: 0; }
.drama-list {
  width: 300px; flex: none; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--bg);
}
.drama-item {
  display: flex; gap: 10px; align-items: center; padding: 10px;
  border-bottom: 1px solid var(--border); cursor: pointer;
}
.drama-item:last-child { border-bottom: none; }
.drama-item:hover { background: var(--bg3); }
.drama-item.active { background: var(--bg3); box-shadow: inset 2px 0 0 var(--ember); }
.drama-item.deleted { opacity: 0.5; }
.drama-item-body { flex: 1; min-width: 0; }
.drama-item-title { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drama-item-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 3px; font-size: 11px; color: var(--text3); }
.drama-cover, .chapter-thumb {
  width: 40px; height: 60px; flex: none; border-radius: 6px; object-fit: cover;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--text3); font-size: 14px;
}
.drama-cover-lg {
  width: 120px; height: 180px; flex: none; border-radius: var(--r); object-fit: cover;
  background: var(--bg3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; color: var(--text3);
}
.drama-editor { flex: 1; min-width: 0; overflow-y: auto; padding-right: 4px; }
.drama-editor-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.drama-editor-head h4 {
  flex: 1; min-width: 120px; font-family: var(--font-display); font-size: 16px; font-weight: 700;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.drama-meta { display: flex; gap: 16px; align-items: flex-start; margin-bottom: 16px; }
.drama-meta .drama-fields { flex: 1; min-width: 0; }
.drama-chapters-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 8px; }
.drama-chapters-head .section-title { margin: 0; flex: 1; }
.chapter-input {
  width: 100%; padding: 5px 8px; font-size: 13px; color: var(--text);
  border: 1px solid var(--border2); border-radius: 6px; background: var(--bg2);
}
.chapter-input:focus { outline: none; border-color: var(--ember); }
.chapter-input { min-width: 160px; }
.chapter-input.price { width: 84px; min-width: 0; font-family: var(--font-mono); }
.chapter-info { font-family: var(--font-mono); font-size: 11px; color: var(--text3); white-space: nowrap; }
.chapter-free { color: var(--jade); }
.drama-upload { margin-top: 8px; }
.drama-upload-bar { height: 6px; border-radius: 3px; background: var(--bg4); overflow: hidden; margin-top: 6px; }
.drama-upload-bar i { display: block; height: 100%; width: 0; background: var(--ember); transition: width 0.2s var(--ease); }
@media (max-width: 900px) {
  .dramas-layout { flex-direction: column; }
  .drama-list { width: auto; max-height: 220px; }
  .drama-meta { flex-direction: column; align-items: stretch; }
  .drama-meta .drama-fields { width: 100%; }
}

/* Mini drama editor: typed but not saved yet. Text fields save on blur; the
   outline disappears once the server has them. */
.drama-editor .is-draft { border-color: var(--gold) !important; box-shadow: 0 0 0 1px var(--gold); }

/* ==========================================================================
   Top bar + Lineup (the main view) + dock
   Flat surfaces, hairlines and small radii: portraits carry the colour, the
   chrome stays out of their way.
   ========================================================================== */
#app { flex-direction: column; }
.editor { min-height: 0; }

.topbar {
  flex: none; display: flex; align-items: center; gap: 24px; height: 52px; padding: 0 20px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.topbar-brand { font-family: var(--font-display); font-weight: 800; font-size: 17px; letter-spacing: -0.3px; }
.topbar-nav { display: flex; align-self: stretch; gap: 20px; }
.topbar-nav > button, .topbar-nav > a {
  display: flex; align-items: center; padding: 0; border: none; background: none;
  color: var(--text2); font-size: 13px; font-weight: 500; text-decoration: none;
}
.topbar-nav > button:hover, .topbar-nav > a:hover { color: var(--text); }
.topbar-nav > .active { color: var(--text); box-shadow: inset 0 -2px 0 var(--ember); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar .search-wrap { width: 240px; }
.topbar .search-input { padding-top: 7px; padding-bottom: 7px; }
.topbar .account-menu { width: auto; }
.topbar .account-trigger { min-height: 36px; padding: 3px 6px; }
.topbar .user-copy { max-width: 170px; }
.topbar .sidebar-menu-popover { left: auto; right: 0; }

.back-link {
  flex: none; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 0;
  border: none; border-right: 1px solid var(--border); border-radius: 0; background: none;
  color: var(--text2); font-size: 12.5px; font-weight: 500;
}
.back-link:hover { color: var(--text); }

.seg {
  display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border);
  border-radius: 7px; background: var(--field-bg);
}
.seg > button {
  height: 26px; padding: 0 10px; border: none; border-radius: 5px; background: none;
  color: var(--text2); font-size: 12px; font-weight: 500;
}
.seg > button.active { background: var(--bg4); color: var(--text); font-weight: 600; }

.lineup-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lineup-view[hidden] { display: none; }
.lineup-controls {
  flex: none; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 20px; border-bottom: 1px solid var(--border);
}
.lineup-scope { display: flex; align-items: center; gap: 8px; }
.lineup-scope > span {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.1px; text-transform: uppercase; color: var(--text3);
}
.lineup-controls select {
  height: 30px; padding: 0 28px 0 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--field-bg) var(--select-arrow) no-repeat right 10px center; color: var(--text);
  font-size: 12.5px; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.lineup-scope select { font-weight: 600; min-width: 150px; }
.lineup-filters { display: flex; gap: 6px; }
.lineup-count { font-family: var(--font-mono); font-size: 11px; color: var(--text3); }
.lineup-orderbar { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.lineup-orderbar[hidden] { display: none; }
.lineup-orderbar > span { font-size: 12.5px; font-weight: 500; color: var(--gold); }

.lineup-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 20px 28px; }
.lineup-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 18px 14px;
  border-radius: 4px; min-height: 120px;
}
.lineup-grid.drag-over { outline: 1px dashed var(--border2); outline-offset: 6px; }
.lineup-empty { grid-column: 1 / -1; padding: 60px 0; text-align: center; color: var(--text3); font-size: 13px; }

.lineup-tile { position: relative; display: flex; flex-direction: column; gap: 7px; min-width: 0; cursor: pointer; }
.lineup-tile.dragging { opacity: 0.35; }
.lineup-tile.drop-target::before {
  content: ''; position: absolute; left: -9px; top: 0; width: 3px; height: 100%; border-radius: 2px;
  background: var(--ember); box-shadow: 0 0 10px color-mix(in srgb, var(--ember) 55%, transparent);
}
.lineup-cover, .dock-portrait {
  position: relative; aspect-ratio: 2 / 3; overflow: hidden; border-radius: 3px; background: var(--bg3);
}
.lineup-cover > img, .dock-portrait > img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.portrait-initial {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-family: var(--font-display); font-size: 34px; font-weight: 700; color: var(--text3);
}
.lineup-tile:hover .lineup-cover { box-shadow: 0 0 0 1px var(--border2); }
.lineup-tile.selected .lineup-cover { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--ember); }
.lineup-rank {
  position: absolute; top: 7px; left: 7px; width: 42px; height: 22px; padding: 0 5px;
  border: none; border-radius: 3px; background: rgba(10,10,11,0.78); color: #eeeeef;
  font-family: var(--font-mono); font-size: 11px; font-weight: 600; text-align: center;
  -moz-appearance: textfield;
}
.lineup-rank::-webkit-outer-spin-button, .lineup-rank::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lineup-rank:focus { outline: 2px solid var(--ember); }
.lineup-tile.moved .lineup-rank { background: var(--ember); color: #fff; }
.lineup-pips {
  position: absolute; top: 7px; right: 7px; display: flex; gap: 3px; padding: 7px 6px;
  border-radius: 3px; background: rgba(10,10,11,0.72);
}
.env-pip { width: 7px; height: 7px; border-radius: 2px; box-sizing: border-box; }
.env-pip-on { background: #d9d9de; }
.env-pip-off { border: 1px solid rgba(238,238,239,0.35); }
.env-pip-blocked { border: 1px solid var(--rose); }
.tile-badges { position: absolute; left: 7px; bottom: 7px; display: flex; gap: 4px; }
.tile-badge {
  font-family: var(--font-mono); font-size: 9.5px; font-weight: 700; letter-spacing: 0.6px;
  padding: 2px 5px; border-radius: 3px; color: #0c0c0e;
}
.tile-badge-soon { background: var(--gold); }
.tile-badge-new { background: var(--rose); }
.lineup-name {
  padding: 0; border: none; background: none; color: var(--text); text-align: left;
  font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lineup-tile.selected .lineup-name { color: var(--ember2); }
.lineup-meta {
  margin-top: -4px; font-family: var(--font-mono); font-size: 10.5px; color: var(--text3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lineup-meta-blocked { color: var(--gold); }
.lineup-meta-incomplete { color: var(--rose); }

.lineup-dock {
  flex: none; display: grid; grid-template-columns: minmax(330px, 380px) 290px 240px minmax(300px, 1fr);
  border-top: 1px solid var(--border2); background: var(--bg2);
  box-shadow: 0 -18px 40px rgba(0,0,0,0.25); max-height: 46vh; overflow: auto;
}
.lineup-dock[hidden] { display: none; }
.lineup-dock > * { padding: 18px 20px; border-right: 1px solid var(--border); min-width: 0; }
.lineup-dock > :last-child { border-right: none; }
.dock-identity { display: flex; gap: 16px; }
.dock-portrait { width: 118px; flex: none; align-self: flex-start; box-shadow: 0 0 0 2px var(--ember); }
.dock-id { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.dock-eyebrow { font-family: var(--font-mono); font-size: 10.5px; color: var(--text3); }
.dock-name { margin: 0; font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.05; }
.dock-line { margin: 0; font-size: 12.5px; color: var(--text2); line-height: 1.45; }
.dock-model {
  margin: 0; font-family: var(--font-mono); font-size: 10.5px; color: var(--text2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dock-model b { color: var(--text); font-weight: 600; margin-right: 4px; }
.dock-model-none { color: var(--gold); }
.dock-actions { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 8px; }
.dock-label {
  margin: 0 0 8px; font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: 1.1px; text-transform: uppercase; color: var(--text3);
}
.dock-count { margin-left: 6px; }
.dock-count-ready { color: var(--jade); }
.dock-count-blocked { color: var(--gold); }
.dock-count-incomplete { color: var(--rose); }
.dock-env { display: flex; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid var(--border); }
.dock-env > div:first-child { flex: 1; min-width: 0; }
.dock-env-name { font-size: 13px; font-weight: 600; }
.dock-env-domain {
  font-family: var(--font-mono); font-size: 10.5px; color: var(--text3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dock-note { font-size: 12px; color: var(--text3); white-space: nowrap; }
.dock-note.ok { color: var(--jade); }
.dock-note.bad { color: var(--rose); }
.switch-btn {
  position: relative; flex: none; width: 34px; height: 20px; padding: 0; border-radius: 10px;
  border: 1px solid var(--border2); background: var(--switch-off);
}
.switch-btn > span {
  position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--switch-thumb); transition: left 0.15s var(--ease);
}
.switch-btn.on { background: var(--ember); border-color: var(--ember); }
.switch-btn.on > span { left: 16px; background: #fff; }
.switch-btn[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.dock-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.dock-checks li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text2); }
.dock-checks li.bad { color: var(--text); }
.check-mark { width: 12px; font-size: 11px; font-weight: 700; text-align: center; }
.dock-checks li.ok .check-mark { color: var(--jade); }
.dock-checks li.bad .check-mark { color: var(--rose); }
.dock-edit { display: flex; flex-direction: column; gap: 12px; }
.dock-edit-head { display: flex; align-items: flex-start; justify-content: space-between; }
.dock-edit-head .dock-label { margin: 0; }
.dock-close {
  width: 26px; height: 26px; margin: -6px -6px 0 0; border: none; border-radius: 6px;
  background: none; color: var(--text3); font-size: 12px;
}
.dock-close:hover { background: var(--bg3); color: var(--text); }
.dock-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dock-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 11.5px; color: var(--text2); }
.dock-fields select, .dock-tag-add {
  height: 32px; padding: 0 28px 0 10px; border: 1px solid var(--border2); border-radius: 6px;
  background: var(--field-bg) var(--select-arrow) no-repeat right 10px center; color: var(--text);
  font-size: 13px; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.dock-toggles { display: flex; gap: 20px; }
.dock-toggles label { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text2); cursor: pointer; }
.dock-toggles input { accent-color: var(--ember); width: 14px; height: 14px; margin: 0; }
.dock-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.dock-tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px 2px 7px; border-radius: 3px;
  background: var(--bg3); color: var(--text2); font-family: var(--font-mono); font-size: 11px;
}
.dock-tag button { border: none; background: none; padding: 0 2px; color: var(--text3); font-size: 10px; }
.dock-tag button:hover { color: var(--rose); }
.dock-tag-add { height: 24px; font-family: var(--font-mono); font-size: 11px; padding-right: 24px; }
.dock-save { display: flex; align-items: center; gap: 8px; margin-top: auto; }
.dock-save[hidden] { display: none; }
.dock-save > span { margin-right: auto; font-size: 12.5px; font-weight: 500; color: var(--ember2); }

@media (max-width: 1200px) {
  .lineup-dock { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lineup-dock > * { border-bottom: 1px solid var(--border); }
}
@media (max-width: 760px) {
  .topbar { gap: 12px; overflow-x: auto; }
  .topbar .search-wrap { width: 160px; }
  .lineup-dock { grid-template-columns: minmax(0, 1fr); }
}

/* ---- Table: the secondary list view for bulk work ---- */
.topbar > .seg { margin-left: -8px; }
.table-views {
  flex: none; display: flex; gap: 22px; padding: 0 20px; border-bottom: 1px solid var(--border);
}
.table-views[hidden] { display: none; }
.table-views button {
  height: 40px; padding: 0; border: none; background: none; color: var(--text2);
  font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 7px;
}
.table-views button span { font-family: var(--font-mono); font-size: 11px; color: var(--text3); }
.table-views button.active { color: var(--text); box-shadow: inset 0 -2px 0 var(--ember); }
.lineup-grid[hidden], .char-table[hidden] { display: none; }

.char-table { display: flex; flex-direction: column; margin: -16px -8px 0; }
.ct-row {
  display: grid; align-items: center; min-height: 44px; padding: 0 8px;
  grid-template-columns: 34px minmax(220px, 1.6fr) 130px 100px minmax(150px, 1.2fr) 88px 80px 124px 70px;
  border-bottom: 1px solid var(--border); font-size: 13px; cursor: pointer;
}
.ct-row > * { min-width: 0; padding-right: 10px; }
.ct-row:hover:not(.ct-head) { background: var(--bg2); }
.ct-row.checked { background: color-mix(in srgb, var(--ember) 5%, transparent); }
.ct-row.selected { background: var(--bg3); }
.ct-head {
  position: sticky; top: -16px; z-index: 2; min-height: 34px; cursor: default; background: var(--bg);
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 1px; text-transform: uppercase; color: var(--text3);
}
.ct-check { display: flex; align-items: center; height: 100%; cursor: pointer; }
.ct-check input { accent-color: var(--ember); width: 14px; height: 14px; margin: 0; cursor: pointer; }
.ct-char { display: flex; align-items: center; gap: 10px; }
.ct-avatar {
  position: relative; flex: none; width: 28px; height: 28px; overflow: hidden; border-radius: 50%;
  display: grid; place-items: center; background: var(--bg4); color: var(--text3);
  font-family: var(--font-display); font-size: 12px; font-weight: 700;
}
.ct-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ct-row.selected .ct-avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--ember); }
.ct-name {
  padding: 0; border: none; background: none; color: var(--text); font-size: 13.5px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ct-row.selected .ct-name, .ct-name:hover { color: var(--ember2); }
.ct-soon {
  flex: none; font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.6px;
  color: var(--gold); border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent); border-radius: 3px; padding: 1px 5px;
}
.ct-id { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--text3); }
.ct-muted { color: var(--text2); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ct-muted b { color: var(--text); font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.ct-num { color: var(--text); font-variant-numeric: tabular-nums; }
.ct-tags { display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden; }
.ct-tags span { font-family: var(--font-mono); font-size: 10.5px; color: var(--text2); background: var(--bg3); border-radius: 3px; padding: 2px 6px; }
.ct-tags em { font-style: normal; font-family: var(--font-mono); font-size: 10.5px; color: var(--text3); }
.ct-envs { display: flex; gap: 3px; }
.ct-env {
  width: 20px; height: 20px; display: grid; place-items: center; box-sizing: border-box; border-radius: 4px;
  font-family: var(--font-mono); font-size: 10px; font-weight: 600;
}
.ct-env-on { background: var(--text); color: var(--bg); }
.ct-env-off { border: 1px solid var(--border2); color: var(--text3); }
.ct-env-blocked { border: 1px dashed var(--rose); color: var(--rose); }
.ct-status { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.ct-status span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ct-status-ready { color: var(--jade); }
.ct-status-blocked { color: var(--gold); }
.ct-status-incomplete { color: var(--rose); }
.ct-updated { text-align: right; }

.bulk-bar {
  position: sticky; bottom: 16px; z-index: 5; width: max-content; max-width: 100%; margin: 18px auto 0;
  display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 16px;
  background: var(--bg3); border: 1px solid var(--border2); border-radius: 8px; box-shadow: var(--shadow-lg);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar.busy { opacity: 0.6; pointer-events: none; }
.bulk-count { margin-right: 10px; font-size: 13px; color: var(--text2); white-space: nowrap; }
.bulk-count b { color: var(--text); font-family: var(--font-mono); }
.bulk-bar select {
  height: 30px; padding: 0 26px 0 10px; border: 1px solid var(--border2); border-radius: 6px;
  background: var(--surface) var(--select-arrow) no-repeat right 9px center; color: var(--text);
  font-size: 12px; font-weight: 600; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.bulk-bar .action-menu-popover { top: auto; bottom: calc(100% + 7px); }
.bulk-bar .action-menu-popover button { min-height: 32px; padding: 7px 11px; }
.bulk-clear { border-color: transparent; }

/* ==========================================================================
   Editor layout: header, portrait column, editor, Release rail
   The editor is a view of its own. Three columns scroll independently so the
   portrait and the Release rail stay put while a long section scrolls.
   ========================================================================== */
.editor { display: flex; flex-direction: column; overflow: hidden; padding: 0; background: var(--bg); }
.editor-form { max-width: none; margin: 0; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.editor .form-header {
  position: static; flex: none; padding: 12px 24px; gap: 14px; flex-wrap: nowrap;
  background: var(--bg); backdrop-filter: none; border-bottom: 1px solid var(--border);
}
.editor .form-heading { gap: 12px; }
.editor .form-avatar { width: 30px; height: 45px; border-radius: 3px; font-size: 13px; }
.editor .form-header h2 { font-size: 20px; letter-spacing: -0.4px; }
.editor-status { display: flex; gap: 6px; flex-wrap: wrap; min-width: 0; }
.status-chip {
  font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; color: var(--text2);
  border: 1px solid var(--border2); border-radius: 3px; padding: 2px 7px; white-space: nowrap;
}
.status-chip-ok { color: var(--jade); border-color: color-mix(in srgb, var(--jade) 40%, transparent); }
.status-chip-warn { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.status-chip-bad { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 40%, transparent); }
.editor .dirty-indicator { white-space: nowrap; }

.editor-body {
  flex: 1; min-height: 0; display: grid; grid-template-columns: 280px minmax(0, 1fr) 320px;
}
.editor-body.wide { grid-template-columns: minmax(0, 1fr); }
.editor-body.wide .editor-spine, .editor-body.wide .editor-rail { display: none; }
.editor-spine, .editor-main, .editor-rail { min-height: 0; overflow-y: auto; }

.editor-spine {
  display: flex; flex-direction: column; gap: 14px; padding: 18px 20px 24px; border-right: 1px solid var(--border);
}
.editor-spine > .seg { align-self: flex-start; }
.spine-cover {
  position: relative; width: 100%; aspect-ratio: 2 / 3; padding: 0; overflow: hidden; flex: none;
  border: none; border-radius: 3px; background: var(--bg3); cursor: pointer;
}
.spine-cover > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.spine-cover-label {
  position: absolute; top: 8px; left: 8px; font-family: var(--font-mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.4px; text-transform: uppercase; padding: 2px 6px; border-radius: 3px;
  background: rgba(10,10,11,0.78); color: #eeeeef;
}
.spine-blur {
  position: absolute; left: 0; right: 0; bottom: 0; height: 20.4%; box-sizing: border-box;
  display: flex; align-items: flex-end; padding: 0 8px 6px;
  border-top: 1px dashed rgba(238,238,239,0.45); font-family: var(--font-mono); font-size: 10px; color: rgba(238,238,239,0.8);
}
.spine-videos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.spine-video {
  display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px dashed var(--border2);
  border-radius: 4px; background: none; color: var(--text3); font-size: 11.5px; text-align: left;
}
.spine-video.filled { border-style: solid; border-color: var(--border); color: var(--text2); }
.spine-video-thumb {
  width: 22px; height: 33px; flex: none; display: grid; place-items: center; border-radius: 2px;
  background: var(--bg3); font-size: 10px;
}
.spine-video:hover { border-color: var(--border2); color: var(--text); }
.spine-block { display: flex; flex-direction: column; gap: 8px; }
.spine-label, .rail-label {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--text3);
}
.editor-spine .ref-image-area { gap: 12px; }
.editor-spine .ref-image-preview { width: 72px; height: 108px; min-height: 0; flex: none; border-radius: 3px; }
.editor-spine .ref-image-controls { min-width: 0; }
.editor-spine .ref-image-controls .btn { align-self: flex-start; }

.editor-main { padding: 0 32px 40px; }
.editor-main .tabs.editor-tabs {
  position: sticky; top: 0; z-index: 5; display: flex; gap: 24px; margin: 0 -32px 8px; padding: 0 32px;
  border: none; border-bottom: 1px solid var(--border); border-radius: 0; background: var(--bg);
}
.editor-main .editor-tabs .tab {
  height: 44px; padding: 0; border-radius: 0; background: none; box-shadow: none;
  color: var(--text2); font-size: 13px; font-weight: 500;
}
.editor-main .editor-tabs .tab:hover { background: none; color: var(--text); }
.editor-main .editor-tabs .tab.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ember); }
/* Sections read as a spec sheet: hairlines between them, no card chrome. */
.editor-main .section {
  margin: 0; padding: 22px 0; border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; background: none; box-shadow: none;
}
.editor-main .section:hover { border-color: var(--border); }
.editor-main .section:last-child { border-bottom: none; }
.editor-main .section-title { font-size: 16px; }
.editor-main .missing-banner { margin: 12px 0 0; }

.editor-rail {
  display: flex; flex-direction: column; border-left: 1px solid var(--border); background: var(--bg2);
}
.rail-head { display: flex; align-items: baseline; justify-content: space-between; padding: 18px 20px 6px; }
.rail-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.rail-status { font-size: 12px; font-weight: 600; }
.rail-status.ok { color: var(--jade); }
.rail-status.warn { color: var(--gold); }
.rail-status.bad { color: var(--rose); }
.rail-block { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.rail-block[hidden] { display: none; }
.rail-block .rail-label { margin-bottom: 8px; }
.editor-rail .visibility-grid { display: flex; flex-direction: column; gap: 0; margin: 0; }
.editor-rail .visibility-item {
  display: grid; grid-template-columns: 16px minmax(0, 1fr); column-gap: 10px; align-items: center;
  padding: 10px 0; border: none; border-bottom: 1px solid var(--border); border-radius: 0; background: none;
}
.editor-rail .visibility-item:last-child { border-bottom: none; }
.editor-rail .visibility-item input[type="checkbox"] { grid-row: span 2; margin: 0; }
.editor-rail .visibility-label { font-size: 13px; font-weight: 600; }
.editor-rail .visibility-hint { font-family: var(--font-mono); font-size: 10.5px; }
.editor-rail .visibility-item.disabled .visibility-hint { font-family: var(--font-body); font-size: 11.5px; }
.editor-rail .visibility-checklist-card { margin: 10px 0 0; padding: 0; border: none; background: none; }
.editor-rail .visibility-checklist { flex-direction: column; gap: 7px; }
.editor-rail .vis-check { font-size: 12.5px; }
.editor-rail .vis-check.ok { color: var(--text2); }
.editor-rail .vis-check.missing { color: var(--text); }
.unsaved-list { display: flex; flex-direction: column; gap: 2px; }
.unsaved-item { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; font-size: 12.5px; }
.unsaved-item > span:first-child { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.unsaved-item > span:last-child {
  font-family: var(--font-mono); font-size: 11px; color: var(--text2); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 55%;
}
.rail-note { margin: 8px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--text3); }
.editor-rail .info-grid { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.editor-rail .info-item { display: flex; justify-content: space-between; padding: 0; border: none; background: none; }
.editor-rail .info-label { margin: 0; }
.rail-link { padding: 0; border: none; background: none; color: var(--ember2); font-size: 12.5px; font-weight: 600; }
.rail-link:hover { text-decoration: underline; }
.editor-rail .rail-danger {
  margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  border: none; border-top: 1px solid var(--border); border-radius: 0; background: none;
}
.editor-rail .rail-danger:hover { border-color: var(--border); }

@media (max-width: 1180px) {
  .editor-body { grid-template-columns: minmax(0, 1fr) 300px; }
  .editor-spine { display: none; }
}
@media (max-width: 860px) {
  .editor-body { grid-template-columns: minmax(0, 1fr); overflow-y: auto; }
  .editor-rail { border-left: none; border-top: 1px solid var(--border); }
  .editor .form-header { flex-wrap: wrap; }
}

/* ---- Card: descriptions grid ---- */
.desc-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.desc-head .section-title { margin: 0; }
.desc-head .pill-count { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-left: 4px; }
.desc-legend { margin-left: auto; display: flex; gap: 14px; font-size: 11.5px; color: var(--text3); }
.desc-legend span { display: flex; align-items: center; gap: 6px; }
.desc-legend b { font-family: var(--font-mono); color: var(--rose); }
.desc-grid {
  display: grid; grid-template-columns: 150px repeat(var(--desc-langs, 9), minmax(0, 1fr)); gap: 6px; align-items: center;
}
.desc-lang { font-family: var(--font-mono); font-size: 10.5px; color: var(--text3); text-align: center; }
.desc-slot { display: flex; flex-direction: column; font-size: 13px; font-weight: 500; }
.desc-slot small { font-family: var(--font-mono); font-size: 10px; color: var(--text3); font-weight: 400; }
.desc-cell {
  height: 34px; padding: 0; display: grid; place-items: center; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--border); background: var(--field-bg);
}
.desc-cell.empty { border-style: dashed; background: none; }
.desc-cell.over { border-color: color-mix(in srgb, var(--rose) 45%, var(--border)); background: color-mix(in srgb, var(--rose) 8%, transparent); }
.desc-cell.over b { font-family: var(--font-mono); font-size: 11px; color: var(--rose); }
.desc-cell:hover { border-color: var(--border2); }
.desc-cell.selected { border: 1px solid var(--ember); background: var(--ember-bg); box-shadow: 0 0 0 3px var(--ring); }
.desc-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; border: 1px solid var(--text3); box-sizing: border-box; }
.desc-dot.filled { border: none; background: var(--text2); }
.desc-editor { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.desc-editor-head { display: flex; align-items: baseline; justify-content: space-between; }
.desc-cell-label { font-family: var(--font-mono); font-size: 11px; color: var(--ember2); }
.desc-charcount { font-family: var(--font-mono); font-size: 11px; color: var(--text2); }
.desc-editor textarea {
  width: 100%; min-height: 110px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--field-bg); color: var(--text); font-size: 14px; line-height: 1.55; resize: vertical;
}
.desc-editor textarea:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px var(--ring); }
.desc-actions { align-items: center; gap: 14px; }
.desc-only-missing { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text2); cursor: pointer; }
.desc-only-missing input { accent-color: var(--ember); margin: 0; }

/* ---- Card: cover and video side by side, at a size you can judge, not fill ---- */
.editor-main .card-media-grid { display: flex; flex-wrap: wrap; gap: 20px 48px; margin-bottom: 12px; }
.editor-main .card-media-block { padding: 0; border: none; background: none; }
.editor-main .card-media-label { margin-bottom: 10px; }
.editor-main .card-media-pair {
  grid-template-columns: repeat(2, 132px); grid-template-rows: auto auto; grid-auto-flow: column; gap: 8px 10px;
}
.editor-main .card-media-slot, .editor-main .card-media-slot.card-media-video { aspect-ratio: 2 / 3; border-radius: 3px; }
.editor-main .card-media-upload { height: 28px; font-size: 12px; }
.create-checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.create-checks li { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); }
.create-checks li.ok { color: var(--text2); }
.create-checks li.ok .check-mark { color: var(--jade); }
.create-checks li.todo .check-mark { color: var(--text3); }
.editor-rail .rail-note .tile-badge { position: static; display: inline-block; }

/* ---- Media: packs on the left, the library they are built from on the right ---- */
.editor-body.media-mode .editor-main { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.editor-body.media-mode .editor-tabs { margin: 0; }
.editor-body.media-mode .missing-banner { margin: 12px 32px 0; }
.editor-body.media-mode #tab-media.active { flex: 1; min-height: 0; display: flex; }
.media-workspace { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(380px, 460px) minmax(0, 1fr); }
.media-packs-pane { min-height: 0; overflow-y: auto; padding: 0 20px 28px; border-right: 1px solid var(--border); }
.media-library-pane { min-height: 0; overflow-y: auto; padding: 0 24px 28px; }
.media-workspace .section { padding: 14px 0; border-bottom: none; }
.media-workspace .section[hidden] { display: none; }
.media-pack-tabs {
  position: sticky; top: 0; z-index: 3; display: flex; gap: 20px; margin: 0 -20px; padding: 0 20px;
  border-bottom: 1px solid var(--border); background: var(--bg);
}
.media-pack-tabs button {
  height: 46px; padding: 0; border: none; background: none; color: var(--text2); font-size: 13px; font-weight: 500;
}
.media-pack-tabs button span { font-family: var(--font-mono); font-size: 10.5px; color: var(--text3); margin-left: 4px; }
.media-pack-tabs button.active { color: var(--text); font-weight: 600; box-shadow: inset 0 -2px 0 var(--ember); }
.media-packs-pane .section-title { display: none; }
.media-library-pane .section-title { margin-bottom: 12px; }
.media-library-pane .section { padding-top: 16px; }
.media-packs-pane .pack-card {
  margin: 0; padding: 12px 0; border: none; border-bottom: 1px solid var(--border); border-radius: 0; background: none;
}
.media-packs-pane .pack-card-pending { border-left: none; }
.media-packs-pane #pack-editor, .media-packs-pane #gpack-editor {
  border: none !important; border-radius: 0 !important; padding: 14px 0 !important;
  border-top: 1px solid var(--border2) !important; background: none;
}
.media-library-pane .media-grid { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); }
.media-packs-pane .pack-card .pack-thumbs { gap: 3px; flex-wrap: nowrap; overflow: hidden; }
.media-packs-pane .pack-card .pack-thumb, .media-packs-pane .pack-card .pack-thumb-ph {
  width: 30px; height: 45px; flex: none; border-radius: 2px;
}
.media-packs-pane .pack-card-head { margin-bottom: 6px; }

/* ---- Personality: one field list beside one editor ---- */
.pers-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.pers-head .section-title { margin: 0; }
.pers-summary { font-size: 12px; color: var(--text3); }
.pers-head .btn { margin-left: auto; }
#personality-section .enhance-card { margin-bottom: 18px; padding: 14px 16px; border-radius: 6px; }
#personality-section .enhance-card[hidden] { display: none; }
#personality-section .enhance-card::before { display: none; }
#personality-section .enhance-label { font-family: var(--font-body); font-size: 13px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text); }
#personality-section .enhance-label span { font-weight: 400; font-size: 12px; color: var(--text3); margin-left: 8px; }
#personality-section .enhance-card textarea { min-height: 64px; }
.enhance-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }
.pers-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.pers-fields.p-tabs {
  display: flex; flex-direction: column; gap: 1px; margin: 0; padding: 0; border: none; background: none; border-radius: 0;
  position: sticky; top: 56px;
}
.pers-group {
  padding: 12px 10px 6px; font-family: var(--font-mono); font-size: 10px; letter-spacing: 1.1px;
  text-transform: uppercase; color: var(--text3);
}
.pers-group:first-child { padding-top: 0; }
.pers-fields .p-tab {
  flex: none; display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border-radius: 5px;
  text-align: left; font-size: 13px; font-weight: 500; color: var(--text2); white-space: nowrap;
}
.pers-fields .p-tab span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.pers-fields .p-tab em { font-style: normal; font-family: var(--font-mono); font-size: 10.5px; color: var(--text3); }
.pers-fields .p-tab.active { background: var(--bg3); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--border2); }
.pers-dot { flex: none; width: 7px; height: 7px; border-radius: 50%; box-sizing: border-box; border: 1px solid var(--text3); }
.pers-fields .p-tab.filled .pers-dot { border: none; background: var(--text2); }
.pers-panels .p-panel { display: none; flex-direction: column; gap: 8px; }
.pers-panels .p-panel.active { display: flex; }
.pers-panel-head { display: flex; align-items: baseline; justify-content: space-between; }
.pers-panel-title { font-size: 14px; font-weight: 600; }
.pers-count { font-family: var(--font-mono); font-size: 11px; color: var(--text3); }
.pers-panels textarea {
  width: 100%; min-height: 340px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--field-bg); color: var(--text); font-size: 14px; line-height: 1.65; resize: vertical;
}
.pers-panels textarea:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px var(--ring); }

/* ---- Starter: scenario first; messages, suggestions and media follow it ---- */
#tab-starter.active { display: block; margin: 0 -32px; }
.starter-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); min-height: 100%; }
.starter-scenarios {
  display: flex; flex-direction: column; gap: 1px; padding: 16px 12px; border-right: 1px solid var(--border);
  align-self: stretch;
}
.starter-scenarios > .seg { align-self: flex-start; margin-bottom: 10px; }
.starter-scenarios .pers-group span { text-transform: none; letter-spacing: 0; margin-left: 4px; }
.starter-filter {
  height: 30px; padding: 0 10px; margin-bottom: 4px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--field-bg); color: var(--text); font-size: 12.5px;
}
.starter-filter:focus { outline: none; border-color: var(--ember); }
.starter-scenario-list { display: flex; flex-direction: column; gap: 1px; }
.starter-scenario-list .p-tab {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border: none; border-radius: 5px;
  background: none; text-align: left; font-size: 13px; color: var(--text2); cursor: pointer;
}
.starter-scenario-list .p-tab span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.starter-scenario-list .p-tab em { font-style: normal; font-family: var(--font-mono); font-size: 10px; color: var(--text3); }
.starter-scenario-list .p-tab:hover { background: var(--bg2); color: var(--text); }
.starter-scenario-list .p-tab.active { background: var(--bg3); color: var(--text); font-weight: 600; box-shadow: inset 0 0 0 1px var(--border2); }
.starter-scenario-list .p-tab.filled .pers-dot { border: none; background: var(--text2); }
.starter-main { display: flex; flex-direction: column; gap: 18px; padding: 18px 32px 40px; min-width: 0; }
.starter-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.starter-title { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.starter-langs { align-self: flex-start; flex-wrap: wrap; }
.starter-langs .pill-count { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-left: 5px; }
.starter-block { display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }
.starter-block-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.starter-block-head span { font-size: 14px; font-weight: 600; }
.starter-block-head small { font-size: 12px; color: var(--text3); }
#tab-starter .starter-kind-tabs .pill-count, .starter-scenarios .seg .pill-count { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-left: 5px; }
.starter-scenario-list .p-tab { flex: none; }
.starter-block .starter-actions { margin-top: 0; }
.starter-block .starter-msgs-list:empty { display: none; }

/* ---- Test chat: a focused conversation column ---- */
#tab-chat .chat-container {
  max-width: 720px; margin: 16px auto 0; height: calc(100vh - 240px); min-height: 420px;
  border: none; border-radius: 0; background: none;
}
.chat-notice {
  flex: none; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg2); font-size: 12.5px; color: var(--text2);
}
.chat-notice-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--text3); flex: none; }
.chat-notice.warn { border-color: color-mix(in srgb, var(--gold) 40%, var(--border)); background: var(--gold-bg); color: var(--text); }
.chat-notice.warn .chat-notice-dot { background: var(--gold); }
.chat-notice .btn { margin-left: auto; }
.chat-notice .btn[hidden] { display: none; }
#tab-chat .chat-messages { padding: 18px 0; }
.chat-meta { align-self: center; font-family: var(--font-mono); font-size: 10.5px; color: var(--text3); }
.chat-suggestions { flex: none; display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 10px; }
.chat-suggestions:empty { display: none; }
.chat-chip {
  height: 32px; padding: 0 12px; border: 1px solid var(--border2); border-radius: 16px; background: none;
  color: var(--text2); font-size: 12.5px; cursor: pointer;
}
.chat-chip:hover { color: var(--text); border-color: var(--ember); }
.chat-opener { margin-left: auto; }
#tab-chat .chat-input-row { padding: 0 0 12px; border-top: none; background: none; }

/* ---- LoRA: runs beside a three-step track ---- */
#tab-lora.active { display: block; margin: 0 -32px; }
.lora-workspace { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100%; }
.lora-runs {
  display: flex; flex-direction: column; gap: 4px; padding: 16px 12px; border-right: 1px solid var(--border);
  position: sticky; top: 45px; align-self: start; max-height: calc(100vh - 220px); overflow-y: auto;
}
.lora-runs-head { display: flex; align-items: center; padding: 0 4px 8px; }
.lora-runs-head > span { font-family: var(--font-display); font-size: 15px; font-weight: 700; }
.lora-runs-head .btn { margin-left: auto; }
.lora-runs-list { display: flex; flex-direction: column; gap: 2px; }
.lora-runs-empty { padding: 10px 8px; font-size: 12px; color: var(--text3); line-height: 1.5; }
.lora-run {
  display: flex; flex-direction: column; gap: 3px; padding: 9px 10px; border: none; border-radius: 5px;
  background: none; text-align: left; cursor: pointer;
}
.lora-run:hover { background: var(--bg2); }
.lora-run.active { background: var(--bg3); box-shadow: inset 0 0 0 1px var(--border2); }
.lora-run-top { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.lora-run-status { margin-left: auto; font-size: 11.5px; font-weight: 500; }
.lora-run-status.ok { color: var(--jade); }
.lora-run-status.warn { color: var(--gold); }
.lora-run-status.bad { color: var(--rose); }
.lora-run-status.muted { color: var(--text3); }
.lora-run-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lora-runs-foot { display: flex; gap: 14px; margin-top: 10px; padding: 10px 6px 0; border-top: 1px solid var(--border); }
.lora-runs-foot .rail-link { font-weight: 500; color: var(--text2); }
.lora-runs-foot .rail-link[aria-expanded="true"] { color: var(--ember2); }
.lora-workspace > .section { padding: 0 32px 40px; border: none; min-width: 0; }
#tab-lora .lora-runs-row { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
#tab-lora .p-tabs.lora-steps {
  display: flex; gap: 0; margin: 0 -32px 20px !important; padding: 0 16px; border: none; border-bottom: 1px solid var(--border);
  border-radius: 0; background: none;
}
#tab-lora .lora-steps .p-tab {
  flex: 1; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 0; background: none;
  box-shadow: none; text-align: left; color: var(--text2);
}
#tab-lora .lora-steps .p-tab.active { box-shadow: inset 0 -2px 0 var(--ember); color: var(--text); }
.lora-step-num {
  width: 26px; height: 26px; flex: none; display: grid; place-items: center; box-sizing: border-box; border-radius: 50%;
  border: 1.5px solid var(--text3); color: var(--text3); font-family: var(--font-mono); font-size: 12px; font-weight: 700;
}
.lora-steps .p-tab.active .lora-step-num { border-color: var(--ember); color: var(--ember); background: var(--ember-bg); }
.lora-steps .p-tab[data-state="done"] .lora-step-num { border-color: var(--jade); color: var(--jade); background: var(--jade-bg); }
.lora-steps .p-tab[data-state="done"] .lora-step-num { font-size: 0; }
.lora-steps .p-tab[data-state="done"] .lora-step-num::before { content: '\2713'; font-size: 12px; }
.lora-step-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lora-step-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.lora-step-sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lora-steps .p-tab[data-state="active"] .lora-step-sub { color: var(--gold); }

/* ==========================================================================
   Pages: Tags, Gifts, Mini dramas, Moderation, Settings
   Same chrome as the Lineup — a head row, then a table or list with an
   optional side panel (.page-drawer) that disappears while empty.
   ========================================================================== */
.app-page { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.app-page[hidden] { display: none; }
.page-head {
  flex: none; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 18px 24px 14px; border-bottom: 1px solid var(--border);
}
.page-title { margin: 0; font-family: var(--font-display); font-size: 22px; font-weight: 700; letter-spacing: -0.5px; }
.page-sub { font-size: 12.5px; color: var(--text3); }
.page-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.page-split { flex: 1; min-height: 0; display: flex; }
.page-main { flex: 1; min-width: 0; overflow-y: auto; padding: 4px 12px 32px; }
.page-drawer {
  width: 420px; flex: none; overflow-y: auto; border-left: 1px solid var(--border); background: var(--bg2);
  display: flex; flex-direction: column;
}
.page-drawer:empty { display: none; }
.page-toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 10px 12px 12px; }
.page-toolbar select {
  height: 30px; padding: 0 28px 0 10px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--field-bg) var(--select-arrow) no-repeat right 10px center; color: var(--text);
  font-size: 12.5px; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.page-toolbar .pill-count, .seg .pill-count { font-family: var(--font-mono); font-size: 10px; color: var(--text3); margin-left: 4px; }
.page-check { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text2); cursor: pointer; white-space: nowrap; }
.page-check input { accent-color: var(--ember); width: 14px; height: 14px; margin: 0; }
.page-hint { font-size: 12px; color: var(--text3); line-height: 1.5; }
.page-toolbar .page-hint { flex: 1; min-width: 200px; }
.page-pager { display: flex; gap: 4px; }
.page-empty { padding: 40px 0; text-align: center; color: var(--text3); font-size: 13px; }
.mono { font-family: var(--font-mono); font-size: 11.5px; color: var(--text2); }

/* Flat, hairline tables for every page. */
.page-table { width: 100%; border-collapse: collapse; }
.page-table th {
  position: sticky; top: 0; z-index: 1; height: 36px; padding: 0 12px; text-align: left; background: var(--bg);
  border-bottom: 1px solid var(--border2); font-family: var(--font-mono); font-size: 10px; font-weight: 500;
  letter-spacing: 1px; text-transform: uppercase; color: var(--text3);
}
.page-table td { height: 46px; padding: 6px 12px; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: middle; }
.page-table tbody tr:hover td { background: var(--bg2); }
.page-table tr.selected td { background: var(--bg3); }
.page-table tr.is-deleted td { opacity: 0.5; }
.page-table tr.is-deleted td:last-child { opacity: 1; }
.tag-locked { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.6px; text-transform: uppercase; color: var(--text3); }

.gift-icon {
  position: relative; width: 40px; height: 40px; border-radius: 8px; overflow: hidden; display: grid; place-items: center;
  background: var(--bg3); color: var(--text3); font-family: var(--font-display); font-weight: 700;
}
.gift-icon img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--bg3); }
.gift-name { font-size: 14px; font-weight: 600; }
.gift-file { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The inline forms of the tag and gift catalogs become the side panel. */
.page-drawer > .tag-form, .page-drawer > form {
  margin: 0; padding: 18px 22px; border: none; border-radius: 0; background: none; flex: 1;
}
.page-drawer .tag-form-row { flex-direction: column; gap: 0; }
.page-drawer .tag-form-row .field { max-width: none !important; }

.drawer-head { display: flex; align-items: baseline; gap: 10px; padding: 18px 22px 12px; border-bottom: 1px solid var(--border); }
.drawer-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.drawer-head .dock-close { margin: 0 0 0 auto; }
.drawer-body { flex: 1; display: flex; flex-direction: column; gap: 12px; padding: 16px 22px; }
.drawer-label { font-size: 12px; color: var(--text2); }
.drawer-foot { display: flex; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); }

/* Mini dramas: the list and editor fill the page instead of a modal. */
.page-dramas-layout { flex: 1; min-height: 0; margin: 0; }
.page-dramas-layout .drama-list { border-right: 1px solid var(--border); overflow-y: auto; }
.page-dramas-layout .drama-editor { overflow-y: auto; padding: 18px 28px 40px; }

/* Moderation */
.mod-stats { flex: none; display: flex; gap: 36px; padding: 14px 24px; border-bottom: 1px solid var(--border); }
.mod-stat { display: flex; flex-direction: column; gap: 2px; }
.mod-stat b { font-family: var(--font-mono); font-size: 20px; font-weight: 600; }
.mod-stat span { font-size: 11.5px; color: var(--text3); }
.mod-stat.warn b { color: var(--gold); }
.mod-stat.bad b { color: var(--rose); }
.mod-table tbody tr { cursor: pointer; }
.mod-msg { max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 12px; color: var(--text2); }
.mod-cats { display: flex; gap: 4px; flex-wrap: wrap; }
.mod-cat, .mod-status {
  font-family: var(--font-mono); font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 2px 6px; border-radius: 3px; border: 1px solid var(--border2); color: var(--text2); white-space: nowrap;
}
.mod-status.pending { color: var(--gold); border-color: color-mix(in srgb, var(--gold) 40%, transparent); }
.mod-status.warned { color: var(--ember2); border-color: color-mix(in srgb, var(--ember) 40%, transparent); }
.mod-status.banned { color: var(--rose); border-color: color-mix(in srgb, var(--rose) 40%, transparent); }
.mod-full { padding: 12px; border: 1px solid var(--border); border-radius: 6px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.55; color: var(--text); white-space: pre-wrap; }
.mod-score { display: grid; grid-template-columns: 150px minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 12px; color: var(--text2); }
.mod-bar { height: 6px; border-radius: 3px; background: var(--bg3); overflow: hidden; }
.mod-bar i { display: block; height: 100%; background: var(--text3); }
.mod-bar i.warn { background: var(--gold); }
.mod-bar i.bad { background: var(--rose); }
.mod-score b { font-family: var(--font-mono); font-size: 11px; font-weight: 500; text-align: right; }
.mod-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin-top: 6px; }
.mod-facts div { display: flex; flex-direction: column; gap: 2px; }
.mod-facts span { font-size: 11px; color: var(--text3); }
.mod-facts b { font-family: var(--font-mono); font-size: 12px; font-weight: 500; word-break: break-all; }

/* Settings */
.settings-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); overflow-y: auto; }
.settings-col { padding: 20px 28px 32px; display: flex; flex-direction: column; gap: 12px; }
.settings-col + .settings-col { border-left: 1px solid var(--border); }
.settings-title { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 700; }
.runtime-row { display: flex; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.runtime-copy { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.runtime-label { font-size: 14px; font-weight: 600; }
.runtime-hint { font-size: 12.5px; color: var(--text2); }
.runtime-meta { font-family: var(--font-mono); font-size: 10.5px; color: var(--text3); }
.runtime-meta.overridden { color: var(--gold); }
.sync-form { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.sync-form .btn { margin-left: auto; }
.sync-summary { display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 13px; }
.sync-log { display: flex; flex-direction: column; }
.sync-line { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; color: var(--text2); }
.sync-line.warn span:last-child { color: var(--gold); }
@media (max-width: 1000px) {
  .settings-grid { grid-template-columns: minmax(0, 1fr); }
  .settings-col + .settings-col { border-left: none; border-top: 1px solid var(--border); }
  .page-drawer { position: fixed; right: 0; top: 52px; bottom: 0; z-index: 40; box-shadow: var(--shadow-lg); }
}
/* A real button for file pickers: the native control speaks the browser's language. */
.file-btn { position: relative; overflow: hidden; cursor: pointer; align-self: flex-start; }
.file-btn input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 0; }
/* ---- Limited sale: its own editor section ---- */
.tab-flag { display: inline-block; width: 6px; height: 6px; margin-left: 5px; border-radius: 50%; background: var(--violet); vertical-align: 2px; }
.tab-flag.bad { background: var(--rose); }
.tab-flag[hidden] { display: none; }
.status-chip-limited { color: var(--violet); border-color: color-mix(in srgb, var(--violet) 45%, transparent); }
.tile-badge-limited { background: var(--violet); }
[data-theme="light"] .tile-badge-limited { color: #fff; }
.ct-limited {
  flex: none; font-family: var(--font-mono); font-size: 9.5px; font-weight: 600; letter-spacing: 0.6px;
  color: var(--violet); border: 1px solid color-mix(in srgb, var(--violet) 40%, transparent); border-radius: 3px; padding: 1px 5px;
}
.limited-head { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.limited-head .section-title { margin: 0; flex: 1; }
.limited-switch {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border: 1px solid var(--border);
  border-radius: var(--r); background: var(--field-bg); font-size: 12.5px; font-weight: 550; color: var(--text2);
  cursor: pointer; user-select: none;
}
.limited-switch select { width: auto; min-width: 130px; }
.limited-lede { margin-bottom: 18px; max-width: 720px; }
.limited-body .field-row { max-width: 460px; margin-bottom: 8px; }
.limited-body .field-row > .field { margin-bottom: 0; }
.limited-body .field-hint { max-width: 720px; }
.limited-req { color: var(--text3); font-weight: 400; }
#tab-limited:not(.limited-off) .limited-req { color: var(--rose); }
#tab-limited .field-missing { border-color: color-mix(in srgb, var(--rose) 55%, var(--border)); }
/* Off: the details stay editable (they are kept for later), just quieter. */
#tab-limited.limited-off .limited-body,
#tab-limited.limited-off #limited-modal-section { opacity: 0.6; }
#tab-limited.limited-off .limited-body:focus-within,
#tab-limited.limited-off #limited-modal-section:focus-within { opacity: 1; }
.limited-modal-hint { margin: 0; }
.limited-block { padding: 16px 0; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 10px; }
.desc-head + .limited-block { border-top: none; padding-top: 0; }
.limited-block-head { display: flex; align-items: center; gap: 10px; min-height: 28px; }
.limited-block-title { flex: 1; font-size: 13.5px; font-weight: 600; }
.limited-count { font-family: var(--font-mono); font-size: 11px; color: var(--text3); font-weight: 400; margin-left: 4px; }
.limited-langs { display: flex; flex-wrap: wrap; gap: 6px; }
.limited-lang {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 4px; cursor: pointer;
  border: 1px solid var(--border); background: var(--field-bg); color: var(--text2);
  font-family: var(--font-mono); font-size: 11px;
}
.limited-lang:hover { border-color: var(--border2); color: var(--text); }
.limited-lang.active { border-color: var(--ember); background: var(--ember-bg); color: var(--text); box-shadow: 0 0 0 3px var(--ring); }
#limited-desc-textarea {
  width: 100%; min-height: 96px; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--field-bg); color: var(--text); font-size: 14px; line-height: 1.55; resize: vertical;
}
#limited-desc-textarea:focus { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px var(--ring); }
.limited-photo-actions { display: flex; gap: 8px; }
.limited-photo-actions .disabled { opacity: 0.45; pointer-events: none; }
.limited-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.limited-photos .limited-empty { grid-column: 1 / -1; margin: 0; }
.limited-photo .type-badge { font-weight: 600; }
.limited-photo.is-locked img { filter: blur(5px); }
.limited-photo.is-overflow { opacity: 0.55; }
.limited-photo-lock {
  position: absolute; bottom: 6px; left: 6px; right: 6px; padding: 5px 3px;
  border: 1px solid rgba(255,255,255,0.35); border-radius: 4px; cursor: pointer;
  background: rgba(0,0,0,0.75); color: #fff; font-size: 11px;
}
.limited-photo-lock[aria-pressed="true"] { background: var(--violet); }
.limited-photo-lock:focus-visible { outline: 2px solid var(--ember); outline-offset: 2px; }
.limited-photo-move {
  position: absolute; left: 6px; right: 6px; bottom: 40px; display: none; justify-content: space-between;
}
.limited-photo:hover .limited-photo-move, .limited-photo:focus-within .limited-photo-move { display: flex; }
.limited-photo-move button {
  width: 26px; height: 24px; border: none; border-radius: 99px; cursor: pointer;
  background: rgba(0,0,0,0.65); color: #fff; font-size: 13px; line-height: 1;
}
.limited-photo-move button:hover:not(:disabled) { background: var(--ember); }
.limited-photo-move button:disabled { opacity: 0.3; cursor: default; }
.limited-stats { display: flex; gap: 10px; }
.limited-stat {
  display: flex; flex-direction: column; gap: 2px; min-width: 120px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: var(--r); background: var(--inset-bg);
}
.limited-stat b { font-family: var(--font-mono); font-size: 18px; font-weight: 600; color: var(--text); }
.limited-stat span { font-size: 11.5px; color: var(--text3); }
.limited-stats.empty .limited-stat b { color: var(--text3); }
.limited-warn { color: var(--gold); }
.limited-rules ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 8px; max-width: 760px; }
.limited-rules li { font-size: 13px; line-height: 1.5; color: var(--text2); }
.limited-rules li b { color: var(--text); font-weight: 600; }
@media (max-width: 640px) {
  .limited-head { flex-wrap: wrap; }
  .limited-block-head { flex-wrap: wrap; }
  .limited-stats { flex-wrap: wrap; }
}
