:root {
  /* Backgrounds */
  --bg-base: #0a0b0f;
  --bg-surface: #111318;
  --bg-card: #16191f;
  --bg-elevated: #1c2028;
  --bg-hover: #1e2230;
  --bg-active: #232838;
  --bg-selected: #1a2035;

  /* Borders */
  --border-subtle: rgba(255,255,255,0.04);
  --border-default: rgba(255,255,255,0.08);
  --border-strong: rgba(255,255,255,0.14);
  --border-focus: rgba(232,160,69,0.5);

  /* Accent — canonical names. alias legacy eliminado: --accent, --blue, --blue-dim */
  --accent-gold: #e8a045;
  --accent-dim: rgba(232,160,69,0.15);
  --accent-gold-dim: rgba(232,160,69,0.25);
  --accent-hover: #f0b05a;
  --accent-blue: #5b8def;
  --accent-blue-dim: rgba(91,141,239,0.15);

  /* Semantic */
  --green: #52b788;
  --green-dim: rgba(82,183,136,0.15);
  --red: #e05252;
  --red-dim: rgba(224,82,82,0.15);
  --purple: #9b72cf;
  --purple-dim: rgba(155,114,207,0.15);

  --success: #52b788;
  --warning: #e8a045;
  --error: #e05252;
  --info: #5b8def;

  /* Tag validation */
  --tag-valid: #52b788;
  --tag-custom: #e8a045;
  --tag-invalid: #e05252;

  /* Text */
  --text-primary: #e8e6e1;
  --text-secondary: #8b8fa8;
  --text-muted: #4a4e63;
  --text-inverse: #0a0b0f;

  /* Fonts */
  --font-ui: 'Inter', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-display: 'Cinzel', serif;

  /* ───── Radius ───── */
  --radius-xs: 3px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 10px;
  --radius-xl: 14px;
  --radius-2xl: 20px;
  --radius-pill: 999px;

  /* ───── Shadows (5 niveles de elevación) ─────
     Sutiles para dark theme: combinamos blur con opacity baja para que
     la elevación se note sin ser plana ni dramática. */
  --shadow-xs:  0 1px 2px rgba(0,0,0,0.18);
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.30), 0 0 1px rgba(0,0,0,0.20);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.35), 0 0 1px rgba(0,0,0,0.25);
  --shadow-lg:  0 12px 28px rgba(0,0,0,0.42), 0 2px 6px rgba(0,0,0,0.20);
  --shadow-xl:  0 24px 56px rgba(0,0,0,0.52), 0 4px 12px rgba(0,0,0,0.25);
  --shadow-glow: 0 0 0 1px var(--accent-emphasis-soft), 0 0 16px rgba(232,160,69,0.25);

  /* ───── Spacing scale (base 4px) ─────
     Escala 4-8-12-16-20-24-32-40-48 — cualquier padding o margen estructural
     debería usar uno de estos para mantener ritmo vertical. */
  --space-0: 0;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-7: 32px;
  --space-8: 40px;
  --space-9: 48px;
  --space-10: 64px;

  /* ───── Typography scale ─────
     Sigue una progresión modular 1.125 (Major Second) que escala bien
     en aplicaciones densas. Line-heights generosos. */
  --text-xs:   11px;
  --text-sm:   12px;
  --text-base: 13px;   /* base de la app — más legible que 12 sin perder densidad */
  --text-md:   14px;
  --text-lg:   16px;
  --text-xl:   19px;
  --text-2xl:  22px;
  --text-3xl:  28px;
  --text-4xl:  36px;
  --text-5xl:  48px;

  --leading-tight: 1.25;
  --leading-snug:  1.4;
  --leading-base:  1.5;
  --leading-relaxed: 1.65;

  --tracking-tight:  -0.01em;
  --tracking-normal: 0;
  --tracking-wide:   0.04em;
  --tracking-wider:  0.08em;
  --tracking-widest: 0.12em;

  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;
  --weight-bold:     700;

  /* ───── Motion / transitions ─────
     Una rampa pequeña para mantener consistencia. La mayoría de UI usa fast (120ms). */
  --motion-instant: 60ms;
  --motion-fast:    120ms;
  --motion-normal:  200ms;
  --motion-slow:    320ms;
  --ease-out:    cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ───── Layout reservado ───── */
  --sidebar-width: 220px;
  --header-height: 48px;
  --breadcrumb-height: 28px;
  --chat-width: 320px;

  /* ───── Semantic tokens (Phase 3.4) ─────
     Estos tokens semánticos abstraen los colores brutos. Componentes
     nuevos deberían usarlos; los existentes pueden migrar gradualmente.
     Permiten redefinir los temas (dark/light/medieval/high-contrast)
     redefiniendo solo estos sin tocar componentes. */

  /* Surfaces — niveles de elevación */
  --surface-0: var(--bg-base);       /* root background */
  --surface-1: var(--bg-surface);    /* primary surface (header, sidebar) */
  --surface-2: var(--bg-card);       /* cards, panels */
  --surface-3: var(--bg-elevated);   /* modals, dropdowns */
  --surface-hover: var(--bg-hover);
  --surface-active: var(--bg-active);
  --surface-selected: var(--bg-selected);

  /* Text */
  --text-on-surface: var(--text-primary);
  --text-on-surface-muted: var(--text-secondary);
  --text-on-surface-subtle: var(--text-muted);
  --text-on-accent: var(--text-inverse);

  /* Accent (emphasis = primary action) */
  --accent-emphasis: var(--accent-gold);
  --accent-emphasis-hover: var(--accent-hover);
  --accent-emphasis-soft: var(--accent-dim);

  /* Borders */
  --border-faint: var(--border-subtle);
  --border-base: var(--border-default);
  --border-emphasis: var(--border-strong);
  --border-focus-ring: var(--border-focus);

  /* Feedback states */
  --feedback-success: var(--success);
  --feedback-success-soft: var(--green-dim);
  --feedback-warning: var(--warning);
  --feedback-warning-soft: var(--accent-dim);
  --feedback-error: var(--error);
  --feedback-error-soft: var(--red-dim);
  --feedback-info: var(--info);
  --feedback-info-soft: var(--accent-blue-dim);

  /* Chart palette — categorical (8 series + grid/tooltip chrome).
     Tokenizar las paletas de Recharts, ECharts, etc. permite cambiar la
     identidad visual sin tocar componentes y mantener accesibilidad de
     contraste. Uso: <Pie fill="var(--chart-1)" /> en lugar de "#a855f7". */
  --chart-1: var(--accent-blue);    /* azul (categoría primaria) */
  --chart-2: var(--accent-gold);    /* dorado */
  --chart-3: var(--success);        /* verde */
  --chart-4: #a855f7;               /* púrpura */
  --chart-5: var(--error);          /* rojo */
  --chart-6: #f0b055;               /* ámbar */
  --chart-7: #6bb3ff;               /* azul claro */
  --chart-8: #34d399;               /* verde menta */
  --chart-purple: #a855f7;
  --chart-cyan: #06b6d4;
  --chart-teal: #14b8a6;
  --chart-grid: #252b3a;
  --chart-tooltip-bg: #1a1e28;
  --chart-tooltip-border: #2e3650;
  --chart-tooltip-label: #e8e6df;
  --chart-tooltip-text: #8a8a9a;

  /* Season colors (cultivos / fishing) — tonos tierra estacionales. */
  --season-spring: #2d5a2d;
  --season-summer: #5a5a2d;
  --season-autumn: #5a3d2d;
  --season-winter: #2d3d5a;

  /* Weather/time/seasonal cond badges (FishingEditor). */
  --cond-weather-fg: #8cd;
  --cond-weather-bg: #2d4a5a;
  --cond-time-fg: #dc8;
  --cond-time-bg: #3d3a2d;
  --cond-season-fg: #8d8;
  --cond-season-bg: #2d5a2d;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body, #root {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-ui);
  background: var(--surface-0);
  color: var(--text-on-surface);
  font-size: var(--text-base);
  line-height: var(--leading-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

/* ─── Headings — escala consistente ─── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ui);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--leading-tight);
  color: var(--text-on-surface);
}
h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }
h6 { font-size: var(--text-base); text-transform: uppercase; letter-spacing: var(--tracking-wider); color: var(--text-on-surface-subtle); }

/* ─── Global inputs (refinados — más respiración, focus ring accesible) ─── */

input, textarea, select, button {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  color: var(--text-on-surface);
}

input, textarea, select {
  background: var(--surface-2);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  outline: none;
  transition: border-color var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out), box-shadow var(--motion-fast) var(--ease-out);
  width: 100%;
  box-sizing: border-box;
  line-height: var(--leading-snug);
}

input:hover, textarea:hover, select:hover {
  border-color: var(--border-emphasis);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent-emphasis);
  background: var(--surface-3);
  box-shadow: 0 0 0 3px var(--accent-emphasis-soft);
}

input:disabled, textarea:disabled, select:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

input::placeholder, textarea::placeholder {
  color: var(--text-on-surface-subtle);
  opacity: 0.85;
}

button {
  cursor: pointer;
  border: none;
  border-radius: var(--radius-md);
  padding: 6px 14px;
  font-weight: var(--weight-medium);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  letter-spacing: 0;
  transition: background var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out);
}

button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-emphasis-soft);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
  transition: color var(--motion-fast) var(--ease-out);
}
a:hover { color: var(--accent-emphasis); }
a:focus-visible {
  outline: none;
  border-radius: 2px;
  box-shadow: 0 0 0 2px var(--accent-emphasis-soft);
}

/* ─── Selección de texto ─── */
::selection {
  background: var(--accent-emphasis-soft);
  color: var(--text-on-surface);
}

/* ─── Scrollbar (más sutil, mejor hover) ─── */

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.06);
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
  transition: background var(--motion-fast) var(--ease-out);
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.18);
  background-clip: padding-box;
}
::-webkit-scrollbar-corner { background: transparent; }

* { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.10) transparent; }

/* ─── Buttons (jerarquía pulida) ─── */

.btn-primary {
  background: var(--accent-emphasis);
  color: var(--text-on-accent);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 7px 16px;
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  letter-spacing: 0;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-emphasis-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) { transform: translateY(0); box-shadow: var(--shadow-xs); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text-on-surface);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 6px 14px;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.btn-secondary:hover:not(:disabled) {
  border-color: var(--border-emphasis);
  background: var(--surface-hover);
}

.btn-danger {
  background: var(--feedback-error-soft);
  color: var(--feedback-error);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 6px 14px;
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(224,82,82,0.20);
  border-color: rgba(224,82,82,0.30);
}

.btn-ghost {
  background: transparent;
  color: var(--text-on-surface-muted);
  padding: 4px var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-on-surface);
}

.btn-icon {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: var(--text-on-surface-muted);
}
.btn-icon:hover:not(:disabled) {
  border-color: var(--border-base);
  color: var(--text-on-surface);
  background: var(--surface-hover);
}
.btn-icon.danger:hover:not(:disabled) {
  border-color: rgba(224,82,82,0.35);
  color: var(--feedback-error);
  background: var(--feedback-error-soft);
}

.btn-icon-sm {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none;
  color: var(--text-on-surface-subtle);
  cursor: pointer;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.btn-icon-sm:hover:not(:disabled) {
  color: var(--feedback-error);
  background: var(--feedback-error-soft);
}

.btn-add-small {
  font-size: 11px; padding: 3px 8px;
  background: var(--bg-active); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer;
}
.btn-add-small:hover { border-color: var(--accent-gold); color: var(--accent-gold); }

/* ─── Badges ─── */

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500;
}
.badge-error   { background: var(--red-dim); color: var(--red); }
.badge-warning { background: var(--accent-dim); color: var(--accent-gold); }
.badge-success { background: var(--green-dim); color: var(--green); }
.badge-info    { background: var(--accent-blue-dim); color: var(--accent-blue); }

/* ─── Animations ─── */

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}
.skeleton { background: var(--bg-hover); border-radius: 4px; animation: skeleton-pulse 1.5s ease-in-out infinite; }

@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes slideOut { from { transform: translateX(0); opacity: 1; } to { transform: translateX(100%); opacity: 0; } }

/* ─── Card ─── */

.card {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg); padding: 16px; transition: border-color 0.15s;
}
.card:hover { border-color: var(--border-default); }

/* ─── Utility ─── */
.mono { font-family: var(--font-mono); font-size: 13px; }
.display { font-family: var(--font-display); }

/* ─── Tooltip ─── */

.tooltip-trigger { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.tooltip-trigger .tooltip-text {
  visibility: hidden; position: absolute; bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: var(--bg-elevated); color: var(--text-primary);
  padding: 6px 10px; border-radius: var(--radius-md); font-size: 12px;
  white-space: nowrap; z-index: 1000; border: 1px solid var(--border-strong);
  pointer-events: none; opacity: 0; transition: opacity 0.1s;
}
.tooltip-trigger:hover .tooltip-text { visibility: visible; opacity: 1; }

/* ─── Tag / Asset / Item Ref Chips ─── */

.tag-chip {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 2px 8px; background: var(--bg-active);
  border: 1px solid var(--border-default); border-radius: 12px;
  font-size: 11px; font-family: var(--font-mono);
  cursor: default; max-width: 100%; word-break: break-all; white-space: normal;
}
.tag-chip .tag-namespace { color: var(--text-muted); }
.tag-chip .tag-name { color: var(--tag-valid); font-weight: 500; }
.tag-chip button { background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 0 2px; font-size: 12px; line-height: 1; }
.tag-chip button:hover { color: var(--red); }

.item-ref-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; background: var(--accent-dim);
  border: 1px solid var(--accent-gold-dim); border-radius: 12px;
  font-size: 12px; color: var(--accent-gold);
}
.item-ref-chip .amount { font-weight: 600; margin-left: 2px; }

.asset-chip { font-size: 11px; color: var(--text-secondary); font-family: var(--font-mono); }

/* ─── Attributes Table ─── */

.attributes-table {
  width: 100%; border-collapse: collapse;
  font-size: 12px; font-family: var(--font-mono);
}
.attributes-table th {
  text-align: left; color: var(--text-muted); padding: 4px 8px;
  border-bottom: 1px solid var(--border-subtle);
  font-weight: 400; font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
}
.attributes-table td {
  padding: 6px 8px; border-bottom: 1px solid var(--border-subtle); color: var(--text-secondary);
}
.attributes-table td:nth-child(2), .attributes-table td:last-child {
  text-align: right; color: var(--accent-gold);
}

/* ═══════════════════════════════════════════════════════════
   QUEST EDITOR — Pipeline Layout
   ═══════════════════════════════════════════════════════════ */

/* Stage Cards (list mode — collapsible) */
.stage-card {
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); margin-bottom: 8px; overflow: hidden;
}
.stage-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg-card);
  cursor: pointer; transition: background 0.1s;
}
.stage-header:hover { background: var(--bg-hover); }
.stage-number {
  font-size: 10px; font-weight: 600; color: var(--accent-gold);
  min-width: 55px; font-family: var(--font-mono);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.stage-name { font-weight: 500; flex: 1; color: var(--text-primary); font-size: 13px; }
.stage-summary { display: flex; gap: 4px; flex-wrap: wrap; }
.expand-icon { color: var(--text-muted); font-size: 10px; flex-shrink: 0; }

/* Stage detail (expanded) */
.stage-detail {
  padding: 16px; background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex; flex-direction: column; gap: 12px;
}

/* Objective & reward chips in stage header */
.obj-chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 10px; padding: 2px 6px;
  background: var(--bg-active); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); color: var(--text-secondary); white-space: nowrap;
}
.optional-badge { font-size: 9px; color: var(--text-muted); margin-left: 2px; font-style: italic; }

.reward-chip {
  font-size: 10px; padding: 2px 6px;
  background: var(--green-dim); border: 1px solid rgba(82,183,136,0.25);
  border-radius: var(--radius-sm); color: var(--green); white-space: nowrap;
}

/* Stage pipeline (grid mode) */
.stage-pipeline {
  display: flex; flex-direction: column; gap: 16px; width: 100%;
}
.pipeline-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: nowrap;
}
.pipeline-arrow {
  color: var(--text-muted); font-size: 18px; font-weight: 300; flex-shrink: 0;
}

/* Stage node (pipeline card) */
.stage-node {
  width: 200px; min-height: 100px;
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: 14px;
  cursor: pointer; transition: all 0.15s;
  display: flex; flex-direction: column; gap: 8px;
  flex-shrink: 0;
}
.stage-node:hover {
  border-color: var(--border-strong); background: var(--bg-elevated);
  transform: translateY(-1px); box-shadow: var(--shadow-md);
}
.stage-node.selected {
  border-color: var(--accent-gold); background: var(--bg-selected);
  box-shadow: 0 0 0 1px var(--accent-gold);
}
.stage-node-header { display: flex; justify-content: space-between; align-items: center; }
.stage-index {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-mono);
}
.reward-indicator { color: var(--accent-gold); font-size: 12px; }
.stage-node-name { font-size: 13px; font-weight: 500; color: var(--text-primary); line-height: 1.3; }
.stage-node-name .placeholder { color: var(--text-muted); font-style: italic; font-weight: 400; }

.stage-obj-pill {
  display: flex; align-items: center; gap: 4px;
  padding: 2px 6px; border: 1px solid; border-radius: var(--radius-sm);
  font-size: 10px; color: var(--text-secondary); background: var(--bg-surface);
}
.obj-title-short { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 110px; }
.optional-dot { color: var(--text-muted); font-size: 8px; }
.more-count { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }

.stage-node-objectives { display: flex; flex-direction: column; gap: 3px; }
.stage-node-rewards { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.reward-pill {
  font-size: 10px; padding: 2px 6px;
  background: var(--green-dim); border: 1px solid rgba(82,183,136,0.25);
  border-radius: var(--radius-sm); color: var(--green);
}

/* Stage row — horizontal list item for pipeline */
.stage-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; background: var(--bg-card);
  border: 1px solid var(--border-default); border-radius: var(--radius-md);
  cursor: pointer; transition: all 0.1s;
  border-left: 3px solid transparent;
}
.stage-row:hover { background: var(--bg-elevated); border-color: var(--border-strong); }
.stage-row.selected { background: var(--bg-selected); border-color: var(--accent-gold); border-left-color: var(--accent-gold); box-shadow: 0 0 0 1px var(--accent-gold); }
.stage-row-num { font-size: 14px; font-weight: 700; color: var(--accent-gold); font-family: var(--font-mono); min-width: 24px; text-align: center; flex-shrink: 0; }
.stage-row-body { flex: 1; min-width: 0; }
.stage-row-name { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.stage-row-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.stage-row-pill { font-size: 10px; padding: 1px 6px; background: var(--bg-active); border-radius: var(--radius-sm); color: var(--text-secondary); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.stage-row-pill.reward { background: var(--green-dim); color: var(--green); border: 1px solid rgba(82,183,136,0.2); }
.stage-row-pill.more { color: var(--text-muted); background: transparent; }
.stage-row-stats { display: flex; gap: 8px; font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); flex-shrink: 0; }

.add-stage-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; background: transparent;
  border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
  color: var(--text-muted); font-size: 13px; cursor: pointer;
  transition: all 0.15s; width: fit-content;
}
.add-stage-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); background: var(--accent-dim); }

/* Quest flow view — chapter-grouped 2-column layout + optionals section */
.quest-flow-view { display: flex; flex-direction: column; height: 100%; overflow: hidden; background: var(--bg-base); }
.qfv-header { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border-default); background: var(--bg-surface); flex-shrink: 0; }
.qfv-chapter-filter { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); padding: 6px 10px; font-size: 13px; min-width: 200px; }
.qfv-columns-header { display: grid; grid-template-columns: 220px 1fr 1fr 1fr; border-bottom: 2px solid var(--border-default); background: var(--bg-surface); flex-shrink: 0; }
.qfv-columns-header.two-col { grid-template-columns: 220px 1fr 1fr; }
.qfv-chapter-spacer { border-right: 1px solid var(--border-default); background: var(--bg-elevated); }
.qfv-col-header { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; border-right: 1px solid var(--border-subtle); }
.qfv-col-header.main { color: var(--accent-gold); }
.qfv-col-header.side { color: var(--accent-blue); }
.qfv-col-header.optional { color: var(--green); }
.col-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.col-dot.main { background: var(--accent-gold); }
.col-dot.side { background: var(--accent-blue); }
.col-dot.optional { background: var(--green); }
.qfv-body { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.qfv-chapter-group { border-bottom: 2px solid var(--border-default); }
.qfv-chapter-header { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--bg-elevated); cursor: pointer; user-select: none; transition: background 0.1s; position: sticky; top: 0; z-index: 5; border-bottom: 1px solid var(--border-subtle); }
.qfv-chapter-header:hover { background: var(--bg-hover); }
.qfv-chapter-arrow { font-size: 10px; color: var(--text-muted); width: 12px; }
.qfv-chapter-name { font-size: 13px; font-weight: 600; color: var(--text-primary); flex: 1; font-family: var(--font-display); }
.qfv-chapter-count { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); }
.count-badge { font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 10px; font-family: var(--font-mono); }
.count-badge.main { background: rgba(232,160,69,0.15); color: var(--accent-gold); }
.count-badge.side { background: rgba(91,141,239,0.15); color: var(--accent-blue); }
.count-badge.optional { background: rgba(82,183,136,0.15); color: var(--green); }
.qfv-chapter-content { display: grid; grid-template-columns: 1fr 1fr 1fr; min-height: 80px; margin-left: 220px; }
.qfv-chapter-content.two-col { grid-template-columns: 1fr 1fr; }
.qfv-col { padding: 12px; border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 8px; }
.qfv-col:last-child { border-right: none; }
.qfv-col-empty { color: var(--text-muted); font-size: 13px; padding: 8px 4px; text-align: center; opacity: 0.4; }
.quest-card { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 12px 14px; cursor: pointer; transition: all 0.12s; border-left: 3px solid transparent; position: relative; }
.quest-card:hover { background: var(--bg-elevated); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.quest-card.type-main { border-left-color: var(--accent-gold); }
.quest-card.type-side { border-left-color: var(--accent-blue); }
.quest-card.type-optional { border-left-color: var(--green); }
.qc-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.qc-type-badge { font-size: 9px; font-weight: 700; letter-spacing: 0.08em; padding: 2px 6px; border-radius: var(--radius-sm); }
.qc-type-badge.main { background: rgba(232,160,69,0.15); color: var(--accent-gold); }
.qc-type-badge.side { background: rgba(91,141,239,0.15); color: var(--accent-blue); }
.qc-type-badge.optional { background: rgba(82,183,136,0.15); color: var(--green); }
.qc-stages { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.qc-name { font-size: 13px; font-weight: 500; color: var(--text-primary); line-height: 1.3; margin-bottom: 2px; }
.qc-row-name { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); margin-bottom: 4px; }
.qc-info-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.qc-level { font-size: 11px; font-weight: 600; color: var(--accent-gold); background: var(--accent-dim); padding: 1px 6px; border-radius: 8px; white-space: nowrap; }
.qc-prereqs { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.qfv-level-range { font-size: 11px; font-weight: 600; color: var(--accent-gold); background: var(--accent-dim); padding: 2px 8px; border-radius: 10px; white-space: nowrap; }
.qc-delete { position: absolute; top: 8px; right: 8px; background: none; border: none; cursor: pointer; font-size: 12px; opacity: 0; transition: opacity 0.15s; padding: 2px; }
.quest-card:hover .qc-delete { opacity: 0.4; }
.qc-delete:hover { opacity: 1 !important; }
.qfv-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 60px; gap: 12px; color: var(--text-muted); }
.qfv-chapter-header.invalid { background: rgba(239,68,68,0.08); border-left: 3px solid var(--error); }
.qfv-chapter-header.invalid .qfv-chapter-name { color: var(--error); }
.chapter-invalid-hint { font-size: 11px; color: var(--error); font-style: italic; flex: 1; }
.qc-invalid-chapter { font-size: 10px; color: var(--error); margin-top: 2px; }

/* Optionals section */
.qfv-optionals-section { border-top: 2px solid var(--border-default); margin-top: 8px; }
.qfv-optionals-header { display: flex; align-items: center; gap: 10px; padding: 12px 20px; background: rgba(82,183,136,0.06); border-bottom: 1px solid rgba(82,183,136,0.15); cursor: pointer; user-select: none; transition: background 0.1s; }
.qfv-optionals-header:hover { background: rgba(82,183,136,0.12); }
.qfv-optionals-title { font-size: 13px; font-weight: 600; color: var(--green); font-family: var(--font-display); }
.qfv-optionals-subtitle { font-size: 11px; color: var(--text-muted); font-style: italic; flex: 1; }
.qfv-optionals-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 16px 20px; background: var(--bg-surface); }

/* Unlock selector modal */
.unlock-selector-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--border-default); border-radius: var(--radius-md); scrollbar-width: thin; }
.unlock-selector-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); cursor: pointer; transition: background 0.1s; }
.unlock-selector-row:last-child { border-bottom: none; }
.unlock-selector-row:hover { background: var(--bg-hover); }
.unlock-selector-row.selected { background: var(--bg-selected); border-left: 2px solid var(--accent-gold); }
.usr-info { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.usr-name { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.usr-id { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.usr-category { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.usr-tag { font-size: 10px; color: var(--accent-gold); font-family: var(--font-mono); white-space: nowrap; flex-shrink: 0; }
.unlock-selected-preview { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: var(--green-dim); border: 1px solid rgba(82,183,136,0.3); border-radius: var(--radius-md); font-size: 13px; color: var(--green); }

/* Unlock tree view */
.unlock-tree-view { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.utv-filters { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-default); flex-shrink: 0; flex-wrap: wrap; }
.utv-search { min-width: 200px; flex: 1; }
.utv-grid { display: flex; flex-direction: row; gap: 0; overflow-x: auto; overflow-y: hidden; flex: 1; padding: 20px; scrollbar-width: thin; align-items: flex-start; }
.utv-level-column { display: flex; flex-direction: column; min-width: 160px; max-width: 180px; flex-shrink: 0; border-right: 1px solid var(--border-subtle); padding-right: 16px; margin-right: 16px; }
.utv-level-column:last-child { border-right: none; }
.utv-level-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 2px solid var(--border-default); flex-shrink: 0; }
.utv-level-badge { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-dim); color: var(--accent-gold); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-family: var(--font-mono); }
.utv-level-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); flex: 1; }
.utv-level-count { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.utv-level-cards { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; max-height: calc(100vh - 200px); scrollbar-width: thin; padding-right: 4px; }
.utv-card { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); padding: 10px 12px; cursor: pointer; transition: all 0.12s; position: relative; display: flex; flex-direction: column; gap: 6px; }
.utv-card:hover { background: var(--bg-elevated); border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.utv-card.selected { border-color: var(--accent-gold); background: var(--accent-dim); box-shadow: 0 0 0 1px var(--accent-gold); }
.utv-card.default { border-color: var(--green); border-left: 3px solid var(--green); }
.utv-card-icon { font-size: 20px; line-height: 1; }
.utv-card-name { font-size: 12px; font-weight: 500; color: var(--text-primary); line-height: 1.3; word-break: break-word; }
.utv-card-reqs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.utv-req-pill { font-size: 10px; padding: 1px 6px; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.utv-req-pill.default { background: var(--green-dim); color: var(--green); }
.utv-req-pill.level { background: rgba(91,141,239,0.12); color: var(--accent-blue); }
.utv-req-pill.points { background: var(--accent-dim); color: var(--accent-gold); }
.utv-req-pill.deps { background: rgba(168,85,247,0.12); color: #a855f7; }
.utv-req-pill.quest { background: rgba(239,68,68,0.12); color: var(--error); }
.utv-hidden-badge { position: absolute; top: 6px; right: 6px; font-size: 10px; opacity: 0.5; }

/* Audit log */
.audit-layout { display: flex; flex-direction: column; height: 100%; overflow: hidden; background: var(--bg-base); }
.audit-header { padding: 16px 24px 12px; border-bottom: 1px solid var(--border-default); background: var(--bg-surface); flex-shrink: 0; }
.audit-title-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.audit-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 0; font-family: var(--font-display); }
.audit-total { font-size: 12px; color: var(--text-muted); background: var(--bg-card); padding: 2px 8px; border-radius: 10px; border: 1px solid var(--border-subtle); }
.audit-filters { display: flex; align-items: center; gap: 16px; }
.audit-filter-select { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); padding: 6px 10px; font-size: 13px; }
.audit-toggle-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); cursor: pointer; }
.audit-list-header { display: flex; align-items: center; padding: 6px 24px; background: var(--bg-elevated); border-bottom: 1px solid var(--border-default); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); flex-shrink: 0; }
.audit-list { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.audit-entry { border-bottom: 1px solid var(--border-subtle); }
.audit-entry.undone { opacity: 0.4; }
.audit-entry.expanded { background: var(--bg-elevated); }
.audit-row-compact { display: flex; align-items: center; padding: 7px 24px; cursor: pointer; gap: 0; transition: background 0.1s; min-height: 38px; }
.audit-row-compact:hover { background: var(--bg-hover); }
.arc-action { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.arc-action-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.arc-action-label { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; }
.arc-table { flex-shrink: 0; }
.arc-table-badge { font-size: 10px; padding: 2px 7px; background: var(--bg-active); border: 1px solid var(--border-subtle); border-radius: 8px; color: var(--text-secondary); white-space: nowrap; }
.arc-object { display: flex; align-items: baseline; gap: 8px; min-width: 0; overflow: hidden; }
.arc-display-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.arc-row-name { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arc-row-name-solo { font-size: 13px; color: var(--text-primary); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arc-desc { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-secondary); flex-shrink: 0; overflow: hidden; }
.arc-desc span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.arc-changes-pill { font-size: 10px; padding: 1px 6px; background: var(--accent-dim); color: var(--accent-gold); border-radius: 8px; white-space: nowrap; flex-shrink: 0; }
.arc-time { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; flex-shrink: 0; }
.arc-actions { display: flex; justify-content: flex-end; flex-shrink: 0; }
.arc-expand-arrow { font-size: 9px; color: var(--text-muted); margin-left: 8px; flex-shrink: 0; }
.audit-undo-btn { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-secondary); padding: 4px 8px; font-size: 12px; cursor: pointer; white-space: nowrap; flex-shrink: 0; transition: all 0.1s; }
.audit-undo-btn:hover { border-color: var(--accent-gold); color: var(--accent-gold); background: var(--accent-dim); }
.audit-undone-badge { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.audit-row-detail { padding: 12px 24px 16px 104px; border-top: 1px solid var(--border-subtle); background: var(--bg-surface); }
.audit-diff-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.audit-diff-table th { text-align: left; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); padding: 4px 8px 8px; border-bottom: 1px solid var(--border-subtle); }
.audit-diff-table td { padding: 5px 8px; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; }
.audit-diff-table tr:last-child td { border-bottom: none; }
.diff-field { color: var(--text-secondary); font-weight: 500; min-width: 180px; }
.diff-col { font-size: 10px; color: var(--text-muted); font-style: italic; }
.diff-from { color: var(--red); font-family: var(--font-mono); text-decoration: line-through; opacity: 0.7; max-width: 280px; }
.diff-arrow { color: var(--text-muted); padding: 0 4px; }
.diff-to { color: var(--green); font-family: var(--font-mono); max-width: 280px; }
.audit-detail-empty { font-size: 12px; color: var(--text-muted); font-style: italic; padding: 4px 0; }
.audit-pagination { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 16px; font-size: 13px; color: var(--text-secondary); }
.undo-target-info { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--bg-card); border-radius: var(--radius-lg); border: 1px solid var(--border-default); margin-bottom: 16px; }
.undo-action-badge { padding: 4px 10px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; color: white; flex-shrink: 0; }
.undo-target-detail { display: flex; flex-direction: column; gap: 2px; }
.undo-target-detail strong { font-family: var(--font-mono); font-size: 13px; color: var(--text-primary); }
.undo-target-detail span { font-size: 11px; color: var(--text-muted); }
.undo-deps-section { margin-bottom: 16px; }
.undo-deps-warning { padding: 10px 12px; background: rgba(220,170,50,0.1); border: 1px solid rgba(220,170,50,0.3); border-radius: var(--radius-md); font-size: 13px; color: var(--accent-gold); margin-bottom: 10px; }
.undo-deps-list { border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; max-height: 240px; overflow-y: auto; }
.undo-dep-row { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); cursor: pointer; font-size: 12px; transition: background 0.1s; }
.undo-dep-row:hover { background: var(--bg-hover); }
.undo-dep-row:last-child { border-bottom: none; }
.undo-dep-action { font-weight: 700; font-size: 10px; min-width: 55px; }
.undo-dep-name { flex: 1; font-family: var(--font-mono); color: var(--text-primary); }
.undo-dep-table { font-size: 11px; color: var(--text-muted); }
.undo-dep-time { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.undo-no-deps { padding: 12px; background: var(--green-dim); border: 1px solid rgba(82,183,136,0.3); border-radius: var(--radius-md); font-size: 13px; color: var(--green); margin-bottom: 16px; }
.undo-actions { display: flex; gap: 8px; justify-content: flex-end; padding-top: 8px; border-top: 1px solid var(--border-subtle); }

/* DataBrowser detail panel */
.db-detail-panel { display: flex; flex-direction: column; height: 100%; overflow: hidden; background: var(--bg-surface); border-left: 1px solid var(--border-default); flex: 1 1 50%; min-width: 300px; }
.db-detail-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); font-size: 13px; font-style: italic; }
.db-detail-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 14px; border-bottom: 2px solid var(--border-default); flex-shrink: 0; background: var(--bg-elevated); }
.db-detail-title { display: flex; flex-direction: column; gap: 3px; }
.db-detail-row-name { font-size: 15px; font-weight: 700; color: var(--text-primary); font-family: var(--font-mono); line-height: 1.2; }
.db-detail-table { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.db-detail-count { font-size: 11px; color: var(--text-muted); background: var(--bg-card); padding: 3px 8px; border-radius: 10px; border: 1px solid var(--border-subtle); }
.db-detail-fields { flex: 1; overflow-y: auto; scrollbar-width: thin; padding: 8px 0; }
.db-detail-field { padding: 10px 20px; border-bottom: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 6px; transition: background 0.1s; }
.db-detail-field:hover { background: var(--bg-hover); }
.db-detail-field:last-child { border-bottom: none; }
.db-field-name { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.db-field-value { font-size: 13px; color: var(--text-primary); line-height: 1.5; }
.db-val-empty { color: var(--text-muted); font-style: italic; }
.db-val-bool { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 10px; }
.db-val-bool.true { background: var(--green-dim); color: var(--green); }
.db-val-bool.false { background: var(--bg-active); color: var(--text-muted); }
.db-val-number { font-family: var(--font-mono); font-size: 13px; color: var(--accent-blue); font-weight: 500; }
.db-val-text { font-size: 13px; color: var(--text-primary); font-style: italic; }
.db-val-tag { font-family: var(--font-mono); font-size: 12px; color: var(--accent-gold); background: var(--accent-dim); padding: 2px 8px; border-radius: 8px; }
.db-val-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.db-tag-chip { position: relative; font-size: 11px; padding: 2px 8px; background: var(--bg-active); border: 1px solid var(--border-subtle); border-radius: 10px; color: var(--text-secondary); cursor: default; white-space: nowrap; }
.db-tag-full { display: none; position: absolute; bottom: 100%; left: 0; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-sm); padding: 4px 8px; font-size: 10px; font-family: var(--font-mono); color: var(--text-primary); white-space: nowrap; box-shadow: var(--shadow-md); z-index: 100; margin-bottom: 4px; }
.db-tag-chip:hover .db-tag-full { display: block; }
.db-tag-more { font-size: 11px; color: var(--text-muted); padding: 2px 6px; font-style: italic; }
.db-val-plain { font-size: 12px; color: var(--text-secondary); word-break: break-word; }
.db-val-raw { font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); word-break: break-all; }
.db-struct { display: flex; flex-direction: column; gap: 6px; }
.db-struct-fields { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; background: var(--bg-card); }
.db-struct-row { display: flex; align-items: baseline; gap: 10px; padding: 5px 10px; border-bottom: 1px solid var(--border-subtle); font-size: 12px; }
.db-struct-row:last-child { border-bottom: none; }
.db-struct-key { min-width: 140px; flex-shrink: 0; color: var(--text-muted); font-size: 11px; font-weight: 500; }
.db-struct-val { color: var(--text-primary); font-family: var(--font-mono); flex: 1; }
.db-struct-val.number { color: var(--accent-blue); }
.db-struct-val.text { color: var(--text-primary); font-family: var(--font-ui); font-style: italic; }
.db-struct-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.db-struct-expand { background: none; border: none; font-size: 11px; color: var(--accent-gold); cursor: pointer; padding: 2px 0; text-align: left; font-family: var(--font-ui); }
.db-struct-expand:hover { text-decoration: underline; }

/* Vendor & Loot editors */
.vendor-layout { display: flex; height: 100%; overflow: hidden; background: var(--bg-base); }
.vendor-sidebar { display: flex; flex-direction: column; height: 100%; border-right: 1px solid var(--border-default); background: var(--bg-surface); }
.vendor-sidebar-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--border-default); flex-shrink: 0; }
.vendor-search { flex: 1; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); padding: 7px 10px; font-size: 13px; }
.sidebar-title { font-size: 12px; font-weight: 600; color: var(--text-secondary); flex: 1; }
.vendor-list { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.vendor-list-item { padding: 10px 14px; border-bottom: 1px solid var(--border-subtle); cursor: pointer; transition: background 0.1s; }
.vendor-list-item:hover { background: var(--bg-hover); }
.vendor-list-item.selected { background: var(--bg-selected, var(--bg-active)); border-left: 2px solid var(--accent-gold); }
.vli-name { font-size: 13px; font-weight: 500; color: var(--text-primary); display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.vli-icon { font-size: 14px; }
.vli-meta { display: flex; gap: 6px; }
.vli-badge { font-size: 10px; padding: 1px 6px; border-radius: 8px; font-weight: 500; }
.vli-badge.items { background: rgba(91,141,239,0.12); color: var(--accent-blue); }
.vli-badge.cats { background: var(--accent-dim); color: var(--accent-gold); }
.vendor-editor { flex: 1; display: flex; flex-direction: column; height: 100%; overflow: hidden; min-width: 0; }
.vendor-empty { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: 13px; font-style: italic; }
.vendor-editor-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px; border-bottom: 1px solid var(--border-default); background: var(--bg-surface); flex-shrink: 0; }
.vendor-editor-title { font-size: 18px; font-weight: 700; color: var(--text-primary); margin: 0 0 3px; font-family: var(--font-display); }
.vendor-editor-subtitle { font-size: 12px; color: var(--text-muted); }
.vendor-save-area { display: flex; align-items: center; gap: 10px; }
.btn-danger-sm { background: none; border: 1px solid var(--red); color: var(--red); border-radius: var(--radius-md); padding: 7px 12px; font-size: 13px; cursor: pointer; transition: all 0.1s; }
.btn-danger-sm:hover { background: var(--red-dim); }
.vendor-editor-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px 24px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; min-height: 0; }
.vendor-section { border: 1px solid var(--border-default); border-radius: var(--radius-xl, 12px); overflow: hidden; background: var(--bg-surface); }
.vendor-section-header { display: flex; align-items: center; gap: 10px; padding: 13px 18px; cursor: pointer; background: var(--bg-elevated); transition: background 0.1s; user-select: none; }
.vendor-section-header:hover { background: var(--bg-hover); }
.vs-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.vs-count { font-size: 11px; padding: 1px 7px; background: var(--accent-dim); color: var(--accent-gold); border-radius: 10px; font-weight: 600; }
.vs-hint { font-size: 11px; color: var(--text-muted); font-style: italic; flex: 1; margin-left: 8px; }
.vs-arrow { font-size: 10px; color: var(--text-muted); margin-left: auto; }
.vendor-section-body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; border-top: 1px solid var(--border-subtle); }
.vendor-items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.vendor-item-card { border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-card); }
.vendor-item-card.compact { display: flex; align-items: center; }
.vic-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; background: var(--bg-elevated); border-bottom: 1px solid var(--border-subtle); }
.vendor-item-card.compact .vic-header { flex: 1; border-bottom: none; }
.vic-info { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.vic-icon { font-size: 16px; flex-shrink: 0; }
.vic-names { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.vic-display-name { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vic-row-name { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.vic-controls { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.vic-control { display: flex; flex-direction: column; gap: 4px; }
.vic-control label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.vic-control input[type="number"] { background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--text-primary); padding: 5px 8px; font-size: 13px; width: 100%; box-sizing: border-box; }
.vic-prob-row { display: flex; align-items: center; gap: 8px; }
.vic-slider { flex: 1; accent-color: var(--accent-gold); cursor: pointer; }
.vic-prob-val { font-size: 13px; font-weight: 600; color: var(--accent-gold); min-width: 36px; text-align: right; font-family: var(--font-mono); }
.vic-control-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.vendor-cats-list { display: flex; flex-direction: column; gap: 8px; }
.vendor-cat-card { border: 1px solid var(--border-default); border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-card); }
.vcc-header { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--bg-elevated); border-bottom: 1px solid var(--border-subtle); }
.vcc-cat-select { flex: 1; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); padding: 6px 8px; font-size: 13px; }
.vcc-controls { padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.vcc-prob { display: flex; flex-direction: column; gap: 4px; }
.vcc-prob label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); }
.vendor-tags-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.vendor-cat-chip { display: flex; align-items: center; gap: 4px; padding: 4px 10px; background: var(--bg-active); border: 1px solid var(--border-default); border-radius: 12px; font-size: 12px; color: var(--text-secondary); }
.vendor-cat-chip.excluded { background: var(--red-dim); border-color: rgba(220,38,38,0.2); color: var(--red); }
.vendor-cat-chip button { background: none; border: none; color: inherit; cursor: pointer; font-size: 12px; padding: 0 2px; opacity: 0.6; }
.vendor-cat-chip button:hover { opacity: 1; }
.vendor-cat-add-select { background: var(--bg-card); border: 1px dashed var(--border-default); border-radius: 12px; color: var(--text-secondary); padding: 4px 10px; font-size: 12px; cursor: pointer; }

/* Equipment filters */
.eq-sidebar { display: flex; flex-direction: column; height: 100%; overflow: hidden; border-right: 1px solid var(--border-default); background: var(--bg-surface); }
.eq-sidebar-top { flex-shrink: 0; border-bottom: 1px solid var(--border-default); overflow-y: auto; max-height: 55vh; scrollbar-width: thin; }
.eq-search-row { display: flex; gap: 8px; padding: 12px 14px 8px; }
.eq-search { flex: 1; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); padding: 7px 10px; font-size: 13px; }
.eq-filters { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 10px; }
.eq-filter-group { display: flex; flex-direction: column; gap: 5px; }
.eq-filter-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.eq-filter-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.eq-filter-chip { font-size: 11px; padding: 3px 8px; border-radius: 10px; border: 1px solid var(--border-default); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; transition: all 0.1s; white-space: nowrap; font-family: var(--font-ui); }
.eq-filter-chip:hover { background: var(--bg-hover); color: var(--text-primary); }
.eq-filter-chip.active { background: var(--accent-dim); border-color: var(--accent-gold); color: var(--accent-gold); font-weight: 600; }
.eq-filter-footer { display: flex; align-items: flex-end; gap: 10px; justify-content: space-between; }
.eq-sort-group { flex: 1; }
.eq-sort-select { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); padding: 5px 8px; font-size: 12px; width: 100%; }
.eq-reset-filters { font-size: 11px; padding: 4px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border-default); background: var(--red-dim); color: var(--red); cursor: pointer; white-space: nowrap; font-family: var(--font-ui); transition: all 0.1s; }
.eq-reset-filters:hover { background: var(--red); color: white; }
.eq-results-count { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-muted); padding: 2px 0; }
.eq-filter-active-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-gold); flex-shrink: 0; }
.eq-list { flex: 1; overflow-y: auto; scrollbar-width: thin; }
.eq-list-item { padding: 9px 14px; border-bottom: 1px solid var(--border-subtle); cursor: pointer; transition: background 0.1s; }
.eq-list-item:hover { background: var(--bg-hover); }
.eq-list-item.selected { background: var(--bg-selected, var(--bg-active)); border-left: 2px solid var(--accent-gold); padding-left: 12px; }
.eq-item-name { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 5px; }
.eq-item-badges { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.eq-cat-badge { font-size: 10px; padding: 1px 5px; background: var(--bg-active); border: 1px solid var(--border-subtle); border-radius: 6px; color: var(--text-muted); }
.eq-dmg-badge { font-size: 10px; padding: 1px 5px; background: var(--red-dim); border-radius: 6px; color: var(--red); font-weight: 600; }
.eq-prop-badge { font-size: 9px; padding: 1px 4px; border-radius: 4px; font-weight: 700; }
.eq-prop-badge.melee { background: rgba(255,100,50,0.15); color: #ff6432; }
.eq-prop-badge.ranged { background: rgba(91,141,239,0.12); color: var(--accent-blue); }
.eq-prop-badge.defend { background: rgba(168,85,247,0.12); color: #a855f7; }
.eq-prop-badge.ammo { background: var(--bg-active); }
.eq-prop-badge.throw { background: var(--bg-active); }
.eq-list-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 20px; color: var(--text-muted); font-size: 13px; font-style: italic; }

/* World Map */
.world-map-layout { display: flex; flex-direction: column; height: calc(100vh - 48px); overflow: hidden; background: var(--bg-base); }
.wm-toolbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--bg-surface); border-bottom: 1px solid var(--border-default); flex-shrink: 0; flex-wrap: wrap; }
.wm-title { font-size: 15px; font-weight: 600; color: var(--text-primary); font-family: var(--font-display); flex-shrink: 0; }
.wm-toolbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; }
.wm-add-dropdown { display: flex; gap: 4px; align-items: center; }
.wm-type-select { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); padding: 6px 10px; font-size: 13px; }
.wm-drawing-controls { display: flex; align-items: center; gap: 8px; background: var(--accent-dim); border: 1px solid var(--accent-gold); border-radius: var(--radius-md); padding: 4px 10px; }
.wm-drawing-hint { font-size: 12px; color: var(--accent-gold); font-weight: 500; }
.wm-mode-hint { width: 100%; font-size: 12px; color: var(--accent-gold); padding: 4px 8px; background: var(--accent-dim); border-radius: var(--radius-sm); border: 1px solid rgba(232,160,69,0.3); }
.wm-upload-btn { cursor: pointer; }
.wm-body { display: flex; flex: 1; overflow: hidden; }
.wm-sidebar { width: 260px; flex-shrink: 0; background: var(--bg-surface); border-right: 1px solid var(--border-default); overflow-y: auto; scrollbar-width: thin; display: flex; flex-direction: column; }
.wm-search { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0; }
.wm-search input { width: 100%; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); padding: 7px 10px; font-size: 12px; box-sizing: border-box; }
.wm-sidebar-actions { display: flex; gap: 4px; padding: 8px 12px; border-bottom: 1px solid var(--border-subtle); }
.wm-sidebar-actions button { flex: 1; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--text-secondary); padding: 4px 8px; font-size: 11px; cursor: pointer; transition: all 0.1s; }
.wm-sidebar-actions button:hover { background: var(--bg-hover); color: var(--text-primary); }
.wm-category-group { border-bottom: 1px solid var(--border-subtle); padding: 4px 0; }
.wm-group-header { padding: 8px 14px 4px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); font-family: var(--font-mono); }
.wm-category-row { display: flex; align-items: center; gap: 8px; padding: 6px 14px; cursor: pointer; transition: background 0.1s; }
.wm-category-row:hover { background: var(--bg-hover); }
.wm-category-row.hidden { opacity: 0.4; }
.wm-cat-icon { font-size: 14px; width: 20px; text-align: center; flex-shrink: 0; }
.wm-cat-label { font-size: 12px; color: var(--text-secondary); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wm-category-row:hover .wm-cat-label { color: var(--text-primary); }
.wm-cat-count { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); min-width: 20px; text-align: right; }
.wm-cat-toggle { font-size: 11px; opacity: 0.6; }
.wm-map-container { flex: 1; position: relative; overflow: hidden; }
.leaflet-container { background: #0a0b0f !important; font-family: var(--font-ui) !important; }
.leaflet-popup-content-wrapper { background: var(--bg-elevated) !important; border: 1px solid var(--border-default) !important; border-radius: var(--radius-lg) !important; box-shadow: var(--shadow-md) !important; color: var(--text-primary) !important; }
.leaflet-popup-tip { background: var(--bg-elevated) !important; }
.leaflet-popup-close-button { color: var(--text-muted) !important; }
.leaflet-control-zoom { border: 1px solid var(--border-default) !important; border-radius: var(--radius-md) !important; overflow: hidden; box-shadow: var(--shadow-sm) !important; }
.leaflet-control-zoom a { background: var(--bg-elevated) !important; color: var(--text-primary) !important; border-color: var(--border-subtle) !important; font-size: 16px !important; }
.leaflet-control-zoom a:hover { background: var(--bg-hover) !important; }
.poi-marker, .npc-marker { background: transparent !important; border: none !important; }
.wm-map-container.edit-mode .leaflet-overlay-pane { pointer-events: none; }
.wm-map-footer { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); background: rgba(10,11,15,0.8); border: 1px solid var(--border-default); border-radius: var(--radius-xl, 12px); padding: 4px 14px; font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); pointer-events: none; z-index: 1000; backdrop-filter: blur(4px); }
.wm-detail-panel { width: 280px; flex-shrink: 0; background: var(--bg-surface); border-left: 1px solid var(--border-default); overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; animation: slideInRight 0.15s ease; position: relative; }
@keyframes slideInRight { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.wm-detail-close { position: absolute; top: 12px; right: 12px; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 16px; padding: 4px; border-radius: var(--radius-sm); transition: all 0.1s; }
.wm-detail-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.wm-detail-header { display: flex; align-items: flex-start; gap: 10px; padding-right: 24px; }
.wm-detail-icon { font-size: 28px; flex-shrink: 0; line-height: 1; }
.wm-detail-header h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); margin: 0 0 4px; font-family: var(--font-display); line-height: 1.2; }
.wm-detail-type { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.wm-detail-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0; }
.wm-detail-notes { font-size: 12px; color: var(--text-muted); background: var(--bg-card); border-radius: var(--radius-md); padding: 8px 10px; border: 1px solid var(--border-subtle); font-style: italic; }
.wm-detail-link { font-size: 12px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; padding: 6px 0; border-bottom: 1px solid var(--border-subtle); }
.wm-detail-link span { font-family: var(--font-mono); color: var(--accent-gold); font-size: 11px; }
.wm-detail-coords { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.wm-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 8px; border-top: 1px solid var(--border-subtle); }
[data-theme="light"] .leaflet-container { background: #e8e4d9 !important; }
[data-theme="light"] .wm-map-footer { background: rgba(244,245,247,0.9); }

/* Readonly field */
.readonly-field { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); opacity: 0.7; }
.readonly-value { font-family: var(--font-mono); font-size: 13px; color: var(--text-primary); }
.readonly-hint { font-size: 10px; color: var(--text-muted); font-style: italic; }

/* Reward type select */
.reward-type-select { flex: 1; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); padding: 7px 10px; font-size: 13px; font-family: var(--font-ui); cursor: pointer; }
.reward-type-select:focus { outline: none; border-color: var(--border-focus); }
.reward-body { padding: 10px 12px; background: var(--bg-elevated); border-radius: var(--radius-md); display: flex; flex-direction: column; gap: 10px; }

/* Readable attribute rows */
.attr-row-readable { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); margin-bottom: 6px; }
.attr-tag-display { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.attr-icon { font-size: 16px; flex-shrink: 0; }
.attr-tag-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.attr-label { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.attr-tag-small { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attr-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.attr-controls label { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.attr-controls input { background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--text-primary); padding: 5px 8px; font-size: 13px; text-align: center; }

/* Add attribute dropdown */
.add-attr-dropdown { position: absolute; top: 100%; left: 0; z-index: 9999; width: 340px; background: var(--bg-surface); border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); overflow: hidden; margin-top: 4px; }
.add-attr-search { width: 100%; box-sizing: border-box; border: none; border-bottom: 1px solid var(--border-subtle); background: var(--bg-elevated); color: var(--text-primary); padding: 10px 12px; font-size: 13px; }
.add-attr-search:focus { outline: none; }
.add-attr-list { max-height: 240px; overflow-y: auto; scrollbar-width: thin; }
.add-attr-option { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--border-subtle); transition: background 0.1s; }
.add-attr-option:hover { background: var(--bg-hover); }
.add-attr-option:last-child { border-bottom: none; }
.add-attr-label { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.add-attr-tag { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.add-attr-empty { padding: 12px; text-align: center; color: var(--text-muted); font-size: 12px; }

/* Quest editor layout — 3-column */
/* Quest detail 3-column layout */
.quest-detail-layout {
  display: flex;
  height: calc(100vh - 48px); overflow: hidden; background: var(--bg-base);
}
.quest-info-panel {
  overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  border-right: 1px solid var(--border-default);
  height: 100%;
}
.quest-pipeline-panel {
  flex: 1; overflow-y: auto; padding: 20px 24px; min-width: 300px;
  display: flex; flex-direction: column; gap: 0;
}
.quest-stage-editor-panel {
  overflow-y: auto; background: var(--bg-surface);
  border-left: 1px solid var(--border-default);
  height: 100%; scrollbar-width: thin;
}

/* Info panel fields */
.quest-info-panel .info-field { display: flex; flex-direction: column; gap: 5px; }
.quest-info-panel .info-field label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.quest-info-panel .info-field input,
.quest-info-panel .info-field textarea,
.quest-info-panel .info-field select {
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-md); color: var(--text-primary);
  padding: 8px 10px; font-size: 13px; width: 100%; box-sizing: border-box;
  font-family: var(--font-ui); resize: vertical;
}
.quest-info-panel .info-field textarea { min-height: 90px; }
.quest-info-panel .info-field input:focus,
.quest-info-panel .info-field textarea:focus { outline: none; border-color: var(--border-focus); background: var(--bg-elevated); }
.info-row-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.info-section-divider { height: 1px; background: var(--border-default); margin: 8px 0; }
.info-field-toggle { display: flex; align-items: center; justify-content: space-between; padding: 4px 0; }
.info-field-toggle label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.panel-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle); }

/* Stage editor content */
.stage-editor-content { padding: 28px; display: flex; flex-direction: column; gap: 24px; }

/* Log cards — narrative style */
.stage-log-group { display: flex; flex-direction: column; gap: 16px; }
.stage-log-card {
  border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--bg-card);
}
.stage-log-card.progress { border-left: 3px solid var(--accent-blue); }
.stage-log-card.completed { border-left: 3px solid var(--green); }
.stage-log-label {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; background: var(--bg-elevated);
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
}
.stage-log-icon { font-size: 14px; }
.stage-log-card textarea {
  width: 100%; box-sizing: border-box; border: none; background: transparent;
  padding: 14px 16px; font-size: 14px; font-family: var(--font-ui);
  color: var(--text-primary); resize: vertical; min-height: 140px;
  line-height: 1.8; outline: none;
}
.stage-log-card textarea:focus { background: var(--bg-elevated); }
.stage-log-card textarea::placeholder { color: var(--text-muted); }

/* Objective blocks — numbered, visually separated */
.objective-list { display: flex; flex-direction: column; gap: 12px; padding: 8px 0; }
.objective-block {
  display: flex; gap: 12px; align-items: flex-start;
}
.objective-block-num {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-blue-dim); color: var(--accent-blue);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; font-family: var(--font-mono);
  flex-shrink: 0; margin-top: 8px;
}
.objective-block-body {
  flex: 1; min-width: 0;
  border: 1px solid var(--border-default); border-radius: var(--radius-lg);
  overflow: hidden;
}
.objective-block-body .objective-card {
  border: none; border-radius: 0; margin: 0;
}
.stage-editor-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 12px; border-bottom: 1px solid var(--border-subtle); }
.stage-editor-label { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--accent-gold); font-family: var(--font-mono); }
.stage-editor-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--text-muted); font-size: 13px; padding: 40px; text-align: center; }
.stage-field { display: flex; flex-direction: column; gap: 6px; }
.stage-field label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); }
.stage-field input, .stage-field textarea { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); padding: 10px 12px; font-size: 13px; width: 100%; box-sizing: border-box; font-family: var(--font-ui); resize: vertical; }
.stage-field textarea { min-height: 120px; line-height: 1.7; }
.stage-field input:focus, .stage-field textarea:focus { outline: none; border-color: var(--border-focus); background: var(--bg-elevated); }

/* Sections in stage editor */
.stage-section { border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); overflow: hidden; }
.stage-section-header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: var(--bg-elevated); font-size: 11px; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.06em; border-bottom: 1px solid var(--border-subtle); }

/* Objective cards */
.objective-card { border-bottom: 1px solid var(--border-subtle); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-card); }
.objective-card:last-child { border-bottom: none; }
.objective-type-row { display: flex; align-items: center; gap: 6px; }
.obj-icon { font-size: 14px; flex-shrink: 0; }
.type-select-inline { flex: 1; background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--text-primary); padding: 4px 8px; font-size: 12px; font-family: var(--font-ui); }
.objective-title-input { background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); color: var(--text-primary); padding: 6px 8px; font-size: 12px; width: 100%; box-sizing: border-box; }
.objective-title-input:focus { outline: none; border-color: var(--border-focus); }
.objective-target { display: flex; flex-direction: column; gap: 4px; }
.objective-target label { font-size: 10px; color: var(--text-muted); }
.target-search-input {
  width: 100%; box-sizing: border-box;
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); color: var(--text-primary);
  padding: 7px 10px; font-size: 12px; font-family: var(--font-mono);
}
.target-search-input:focus { outline: none; border-color: var(--border-focus); background: var(--bg-card); }
.target-info {
  display: flex; flex-direction: column; gap: 2px;
  padding: 4px 8px; background: var(--bg-elevated);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
}
.target-full-tag { font-size: 10px; font-family: var(--font-mono); color: var(--text-muted); word-break: break-all; line-height: 1.4; }
.target-readable { font-size: 12px; color: var(--green); font-weight: 500; }

.objective-target-header { display: flex; align-items: center; justify-content: space-between; }
.toggle-free-mode {
  font-size: 10px; padding: 2px 6px;
  background: var(--bg-active); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); color: var(--text-secondary); cursor: pointer;
}
.toggle-free-mode:hover { border-color: var(--accent-gold); color: var(--accent-gold); }
.target-free-input {
  width: 100%; box-sizing: border-box;
  background: var(--bg-elevated); border: 1px solid var(--accent-gold);
  border-radius: var(--radius-sm); color: var(--text-primary);
  padding: 6px 8px; font-size: 12px; font-family: var(--font-mono);
}
.objective-meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.amount-inline { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-secondary); margin-left: auto; }
.amount-inline input { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--text-primary); padding: 3px 6px; font-size: 12px; text-align: center; }

/* Reward cards */
.reward-card { border-bottom: 1px solid var(--border-subtle); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; background: var(--bg-card); position: relative; }
.reward-card:last-child { border-bottom: none; }
.reward-type-row { display: flex; align-items: center; gap: 6px; }
.reward-icon { font-size: 14px; flex-shrink: 0; }
.reward-item-selector { display: flex; flex-direction: column; gap: 6px; position: relative; }
.item-search-btn { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg-elevated); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); font-size: 12px; cursor: pointer; text-align: left; transition: all 0.1s; width: 100%; }
.item-search-btn:hover { border-color: var(--accent-gold); background: var(--bg-hover); }
.item-search-btn.has-value { border-color: var(--green); }
.item-placeholder { color: var(--text-muted); font-style: italic; }
.item-icon { font-size: 14px; }
.item-name { font-weight: 500; color: var(--text-primary); flex: 1; }
.item-row-small { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.reward-amount-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-secondary); }
.reward-amount-row input { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--text-primary); padding: 4px 8px; font-size: 12px; }
.reward-xp-row { display: flex; flex-direction: column; gap: 8px; }
.btn-full { width: 100%; justify-content: center; }

/* ═══════════════════════════════════════════════════════════
   RECIPE / VENDOR / LOOT EDITORS
   ═══════════════════════════════════════════════════════════ */

/* Crafting layout */
.crafting-layout { display: flex; flex-direction: column; height: calc(100vh - 48px); overflow: hidden; }
.crafting-header { display: flex; align-items: center; gap: 10px; padding: 12px 20px; border-bottom: 1px solid var(--border-default); background: var(--bg-surface); flex-shrink: 0; }
.crafting-title { font-size: 16px; font-weight: 600; color: var(--text-primary); font-family: var(--font-display); }
.crafting-search { flex: 1; max-width: 260px; }
.crafting-filter { max-width: 180px; }
.crafting-body { display: flex; flex: 1; overflow: hidden; }

/* Crafting list */
.crafting-list { height: 100%; overflow-y: auto; scrollbar-width: thin; }
.crafting-list-count { padding: 10px 14px 6px; font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); border-bottom: 1px solid var(--border-subtle); }
.crafting-list-item { padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); cursor: pointer; transition: background 0.1s; }
.crafting-list-item:hover { background: var(--bg-hover); }
.crafting-list-item.selected { background: var(--bg-selected); border-left: 2px solid var(--accent-gold); padding-left: 12px; }
.cli-name { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-bottom: 4px; }
.cli-station { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.cli-recipe-preview { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.cli-ingredients, .cli-outputs { display: flex; gap: 4px; flex-wrap: wrap; }
.cli-ing, .cli-out { font-size: 11px; padding: 1px 6px; border-radius: var(--radius-sm); }
.cli-ing { background: var(--bg-active); color: var(--text-secondary); }
.cli-out { background: var(--green-dim); color: var(--green); border: 1px solid rgba(82,183,136,0.25); }
.cli-ing-more { font-size: 10px; color: var(--text-muted); }
.cli-arrow { font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.cli-meta { display: flex; gap: 8px; align-items: center; }
.cli-time, .cli-xp { font-size: 10px; color: var(--text-muted); }
.cli-locked { font-size: 11px; }
.crafting-empty { padding: 32px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* Crafting editor panel */
.crafting-editor-panel { flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.crafting-editor-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 12px; color: var(--text-muted); }
.crafting-editor-empty p { font-size: 13px; margin: 0; }

.recipe-editor { display: flex; flex-direction: column; height: 100%; }
.recipe-editor-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-default); flex-shrink: 0; background: var(--bg-surface); }
.recipe-editor-title { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 0 0 4px 0; }
.recipe-editor-tag { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.recipe-editor-actions { display: flex; align-items: center; gap: 8px; }
.recipe-editor-scroll { flex: 1; overflow-y: auto; padding: 16px 20px; scrollbar-width: thin; }

/* Ingredient/output rows */
.ingredient-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border-subtle); gap: 10px; }
.ingredient-row:last-of-type { border-bottom: none; }
.ingredient-row.output .ingredient-icon { }
.ingredient-info { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.ingredient-icon { font-size: 16px; flex-shrink: 0; }
.ingredient-details { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ingredient-name { font-size: 13px; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ingredient-tag { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ingredient-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.ingredient-controls input { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--text-primary); padding: 5px 8px; font-size: 13px; text-align: center; }

.btn-add-item { display: flex; align-items: center; gap: 6px; padding: 9px 14px; margin-top: 8px; background: transparent; border: 1px dashed var(--border-strong); border-radius: var(--radius-md); color: var(--text-muted); font-size: 13px; cursor: pointer; width: 100%; justify-content: center; transition: all 0.1s; }
.btn-add-item:hover { border-color: var(--accent-gold); color: var(--accent-gold); background: var(--accent-dim); }

/* Save status */
.save-status { font-size: 12px; }
.save-status.saved { color: var(--green); }
.save-status.saving { color: var(--accent-gold); }
.save-status.error { color: var(--red); }

/* XP row */
.xp-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }

/* ═══════════════════════════════════════════════════════════
   DIALOGUE EDITOR — Tree View
   ═══════════════════════════════════════════════════════════ */

.dialogue-editor-layout { display: flex; height: calc(100vh - 48px); overflow: hidden; }
.dialogue-tree { display: flex; flex-direction: column; flex: 1; overflow: hidden; }
.tree-toolbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); background: var(--bg-surface); flex-shrink: 0; }
.tree-count { font-size: 11px; color: var(--text-muted); font-family: var(--font-mono); }
.tree-content {
  flex: 1; overflow-y: auto; overflow-x: auto; padding: 20px 24px;
  scrollbar-width: thin; scrollbar-color: var(--border-default) transparent;
}
.tree-content::-webkit-scrollbar { width: 4px; height: 4px; }
.tree-content::-webkit-scrollbar-thumb { background: var(--border-default); border-radius: 2px; }
.tree-empty { text-align: center; padding: 40px; color: var(--text-muted); }
.tree-line-down { width: 2px; height: 20px; background: var(--border-default); margin-left: 22px; }
.tree-continuation { position: relative; }

.tree-sentence-node {
  display: flex; flex-direction: column; gap: 8px;
  padding: 12px 16px; margin-bottom: 8px;
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); cursor: pointer;
  transition: all 0.12s; border-left: 3px solid transparent;
}
.tree-sentence-node:hover { background: var(--bg-elevated); border-color: var(--border-strong); }
.tree-sentence-node.selected { background: var(--bg-selected); border-color: var(--accent-gold); border-left-color: var(--accent-gold); box-shadow: 0 0 0 1px var(--accent-gold); }
.tree-sentence-node.npc { border-left-color: var(--purple); }
.tree-sentence-node.player { border-left-color: var(--accent-blue); }
.tree-sentence-node.selected.npc, .tree-sentence-node.selected.player { border-left-color: var(--accent-gold); }

.tsn-header { display: flex; align-items: center; gap: 8px; }
.tsn-speaker { display: flex; align-items: center; gap: 5px; }
.tsn-speaker-dot { width: 7px; height: 7px; border-radius: 50%; }
.tsn-speaker-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-secondary); }
.tsn-badges { display: flex; gap: 4px; margin-left: auto; }
.tsn-badge { font-size: 10px; padding: 2px 6px; border-radius: 4px; font-weight: 600; }
.tsn-badge.pre { background: var(--accent-dim); color: var(--accent-gold); }
.tsn-badge.branch { background: var(--accent-blue-dim); color: var(--accent-blue); }
.tsn-badge.audio { background: var(--green-dim); color: var(--green); }
.tsn-actions { display: flex; gap: 4px; margin-left: auto; opacity: 0; transition: opacity 0.15s; }
.tree-sentence-node:hover .tsn-actions { opacity: 1; }
.tsn-btn {
  width: 24px; height: 24px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-default); background: var(--bg-elevated);
  color: var(--text-secondary); cursor: pointer; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.1s; line-height: 1;
}
.tsn-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-strong); }
.tsn-btn.danger:hover { background: var(--red-dim); color: var(--red); border-color: rgba(224,82,82,0.3); }

.tsn-text { font-size: 13px; color: var(--text-primary); line-height: 1.5; margin: 4px 0; }
.tsn-predefined-label { font-size: 12px; color: var(--accent-gold); font-style: italic; }
.tsn-empty { font-size: 12px; color: var(--text-muted); }
.tsn-id { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); margin-top: 2px; opacity: 0.6; }

.tree-options-group { margin-left: 20px; margin-top: 6px; display: flex; flex-direction: column; gap: 10px; }
.tree-option-branch { border-left: 2px solid var(--border-default); padding-left: 16px; padding-bottom: 4px; margin-left: 8px; }
.tree-option-pill { display: flex; align-items: center; gap: 8px; padding: 7px 12px; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: 20px; margin-bottom: 8px; }
.opt-num { font-size: 11px; font-weight: 700; color: var(--accent-blue); font-family: var(--font-mono); min-width: 14px; }
.opt-text { font-size: 12px; color: var(--text-secondary); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 300px; }
.opt-cond { font-size: 11px; }
.opt-arrow { font-size: 11px; color: var(--text-muted); }
.opt-next { font-size: 11px; color: var(--accent-gold); font-family: var(--font-mono); }

/* Sentence editor panel */
.sentence-editor { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.se-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-default); background: var(--bg-surface); flex-shrink: 0; }
.se-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-muted); }
.se-id-label { font-family: var(--font-mono); font-size: 12px; color: var(--accent-gold); font-weight: 500; }
.sentence-editor-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 12px; padding: 40px; text-align: center; color: var(--text-muted); }
.sentence-editor-empty p { font-size: 13px; margin: 0; }

.se-scroll-area {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.se-scroll-area::-webkit-scrollbar { width: 5px; }
.se-scroll-area::-webkit-scrollbar-track { background: transparent; }
.se-scroll-area::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.se-save-bar { padding: 14px 20px; border-top: 1px solid var(--border-default); background: var(--bg-surface); flex-shrink: 0; }

/* Fields */
.se-field { display: flex; flex-direction: column; gap: 6px; }
.se-field label { font-size: 11px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.se-field input, .se-field textarea, .se-field select { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-primary); font-family: var(--font-ui); font-size: 13px; padding: 9px 11px; width: 100%; box-sizing: border-box; }
.se-field textarea { min-height: 90px; resize: vertical; line-height: 1.6; }
.se-field input:focus, .se-field textarea:focus, .se-field select:focus { outline: none; border-color: var(--border-focus); background: var(--bg-elevated); }
.se-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.se-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; }
.se-toggle-label { font-size: 13px; color: var(--text-secondary); }
.field-hint { font-size: 10px; color: var(--text-muted); font-style: italic; }

/* Sentence ID editor */
.sentence-id-editor { display: flex; flex-direction: column; gap: 4px; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 8px 10px; transition: border-color 0.1s; }
.sentence-id-editor:focus-within { border-color: var(--border-focus); }
.sentence-id-prefix { font-size: 10px; font-family: var(--font-mono); color: var(--text-muted); line-height: 1.4; word-break: break-all; }
.sentence-id-editor input { background: transparent; border: none; padding: 0; font-size: 13px; font-family: var(--font-mono); color: var(--accent-gold); font-weight: 500; width: 100%; }
.sentence-id-editor input:focus { outline: none; }
.collapsible-section-arrow { font-size: 9px; color: var(--text-muted); }

.content-type-toggle { display: flex; border: 1px solid var(--border-default); border-radius: var(--radius-md); overflow: hidden; margin-bottom: 12px; }
.content-type-btn { flex: 1; padding: 8px 12px; font-size: 12px; border: none; background: transparent; color: var(--text-secondary); cursor: pointer; transition: all 0.1s; }
.content-type-btn.active { background: var(--accent-dim); color: var(--accent-gold); font-weight: 500; }

.options-list { display: flex; flex-direction: column; gap: 6px; }
.option-editor { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; }
.oe-header { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--bg-elevated); cursor: pointer; font-size: 12px; transition: background 0.1s; }
.oe-header:hover { background: var(--bg-hover); }
.oe-num { font-weight: 700; color: var(--accent-blue); font-family: var(--font-mono); min-width: 16px; }
.oe-preview { flex: 1; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oe-next { color: var(--accent-gold); font-family: var(--font-mono); white-space: nowrap; font-size: 11px; }
.oe-cond-badge { font-size: 11px; }
.oe-expand { font-size: 10px; color: var(--text-muted); }
.oe-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; background: var(--bg-card); border-top: 1px solid var(--border-subtle); }

/* Dialogue list items */
.dialogue-list-item { display: flex; align-items: stretch; border-bottom: 1px solid var(--border-subtle); position: relative; }
.dialogue-list-content { flex: 1; padding: 10px 14px; cursor: pointer; min-width: 0; }
.dialogue-delete-btn { width: 32px; display: flex; align-items: center; justify-content: center; background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; opacity: 0; transition: opacity 0.1s; flex-shrink: 0; }
.dialogue-list-item:hover .dialogue-delete-btn { opacity: 1; }
.dialogue-delete-btn:hover { color: var(--red); background: var(--red-dim); }

/* Trigger events */
.trigger-events-list { display: flex; flex-direction: column; gap: 10px; }
.trigger-event-row { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); }
.tsn-badge.trigger { background: rgba(232,160,69,0.15); color: var(--accent-gold); }
.tsn-badge.seq { background: var(--purple-dim); color: var(--purple); }

.tsn-triggers { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.tsn-trigger-pill { font-size: 10px; padding: 2px 7px; background: rgba(232,160,69,0.12); border: 1px solid rgba(232,160,69,0.25); border-radius: 10px; color: var(--accent-gold); white-space: nowrap; max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.tsn-trigger-more { font-size: 10px; color: var(--text-muted); padding: 2px 4px; }

.trigger-info-box { display: flex; gap: 12px; padding: 14px; background: var(--accent-blue-dim); border: 1px solid rgba(91,141,239,0.2); border-radius: var(--radius-md); }
.trigger-info-icon { font-size: 20px; flex-shrink: 0; }
.trigger-info-title { font-size: 13px; font-weight: 600; color: var(--text-primary); margin: 0 0 6px 0; }
.trigger-info-desc { font-size: 12px; color: var(--text-secondary); margin: 4px 0 0 0; line-height: 1.5; }

.option-trigger-hint { font-size: 11px; color: var(--text-muted); padding: 6px 8px; background: var(--bg-elevated); border-radius: var(--radius-sm); border-left: 2px solid var(--accent-gold); }
.option-trigger-hint strong { color: var(--accent-gold); }

/* ═══════════════════════════════════════════════════════════
   HELP BUTTON
   ═══════════════════════════════════════════════════════════ */

.help-btn-wrapper { position: relative; display: inline-block; }
.help-btn {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border-default); background: var(--bg-elevated);
  color: var(--text-muted); font-size: 12px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.1s; font-family: var(--font-ui); flex-shrink: 0;
}
.help-btn:hover, .help-btn.active { background: var(--accent-dim); border-color: var(--accent-gold); color: var(--accent-gold); }

.help-panel {
  width: 380px; max-height: 520px;
  background: var(--bg-surface); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
.help-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px; border-bottom: 1px solid var(--border-subtle); flex-shrink: 0;
}
.help-panel-title { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.help-close-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 13px; padding: 2px 4px; }
.help-close-btn:hover { color: var(--text-primary); }

.help-panel-body {
  overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 16px;
  scrollbar-width: thin;
}
.help-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent-gold); margin: 0 0 8px 0;
}
.help-section-content p { font-size: 12px; color: var(--text-secondary); line-height: 1.6; margin: 0 0 6px 0; }

.help-tip {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 6px 8px; background: var(--bg-card); border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent-gold); margin-bottom: 4px;
}
.help-tip-icon { font-size: 13px; flex-shrink: 0; line-height: 1.4; }
.help-tip-text { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* Stage editor panel */
.stage-editor {
  padding: 20px; display: flex; flex-direction: column; gap: 14px;
}
.stage-editor-empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; color: var(--text-muted); font-size: 13px;
  text-align: center; padding: 40px;
}
.stage-editor-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 14px; border-bottom: 1px solid var(--border-subtle);
}
.stage-editor-title {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent-gold); font-family: var(--font-mono);
}

/* Field groups */
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-group label {
  font-size: 11px; font-weight: 500; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}

.section-divider {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0 4px; border-top: 1px solid var(--border-subtle); margin-top: 4px;
}
.section-divider span {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-muted);
}

/* Objective & reward editors */
.objective-editor, .reward-editor {
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md); padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.objective-editor-header, .reward-editor-header {
  display: flex; gap: 6px; align-items: center;
}
.type-select {
  flex: 1; background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-sm); color: var(--text-primary); padding: 5px 8px; font-size: 12px;
}
.objective-title-input {
  width: 100%; background: var(--bg-elevated); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); color: var(--text-primary); padding: 5px 8px; font-size: 12px;
}
.objective-meta {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
}
.checkbox-label {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--text-secondary); cursor: pointer;
}
.amount-field {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-secondary); margin-left: auto;
}
.reward-value { display: flex; gap: 8px; align-items: center; }

/* ═══════════════════════════════════════════════════════════
   DIALOGUE EDITOR — Sentence Nodes
   ═══════════════════════════════════════════════════════════ */

.sentence-node {
  min-width: 220px; max-width: 280px;
  background: var(--bg-card); border: 1px solid var(--border-default);
  border-radius: var(--radius-lg); padding: 0; overflow: hidden;
  transition: all 0.15s;
}
.sentence-node.selected {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 1px var(--accent-gold), var(--shadow-md);
}
.sentence-node.npc .sentence-node-speaker {
  background: var(--purple-dim); border-bottom: 1px solid rgba(155,114,207,0.2);
}
.sentence-node.player .sentence-node-speaker {
  background: var(--accent-blue-dim); border-bottom: 1px solid rgba(91,141,239,0.2);
}
.sentence-node-speaker {
  display: flex; align-items: center; gap: 6px; padding: 8px 12px;
}
.speaker-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.speaker-name {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-secondary);
}
.predefined-badge, .condition-badge {
  margin-left: auto; font-size: 9px; padding: 1px 5px;
  border-radius: 3px; font-weight: 600;
}
.predefined-badge { background: var(--accent-dim); color: var(--accent-gold); }
.condition-badge { background: var(--red-dim); color: var(--red); }
.sentence-node-text {
  padding: 10px 12px; font-size: 12px;
  color: var(--text-primary); line-height: 1.5;
}
.empty-text { color: var(--text-muted); font-style: italic; }

/* Canvas toolbar */
.canvas-toolbar {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-elevated); border: 1px solid var(--border-default);
  border-radius: var(--radius-xl); padding: 6px 12px;
  z-index: 10; box-shadow: var(--shadow-md);
}
.canvas-toolbar button {
  background: none; border: none; color: var(--text-secondary);
  font-size: 12px; cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius-sm); transition: all 0.1s;
}
.canvas-toolbar button:hover { background: var(--bg-hover); color: var(--text-primary); }
.node-count {
  font-size: 11px; color: var(--text-muted); font-family: var(--font-mono);
  border-left: 1px solid var(--border-default); padding-left: 10px; margin-left: 4px;
}

/* ═══════════════════════════════════════════════════════════
   MAP UPLOAD
   ═══════════════════════════════════════════════════════════ */

.map-upload-zone {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 40px;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-xl);
  color: var(--text-muted); cursor: pointer;
  transition: all 0.15s;
}
.map-upload-zone:hover { border-color: var(--accent-gold); color: var(--text-secondary); }
.map-upload-zone .hint { font-size: 12px; color: var(--text-muted); }

/* ═══════════════════════════════════════════════════════════
   HEALTH INDICATOR
   ═══════════════════════════════════════════════════════════ */

.health-score {
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  color: var(--green); padding: 3px 10px;
  background: var(--green-dim); border-radius: 20px;
  border: 1px solid rgba(82,183,136,0.25);
}
.health-score.warning { color: var(--accent-gold); background: var(--accent-dim); border-color: rgba(232,160,69,0.25); }
.health-score.error { color: var(--red); background: var(--red-dim); border-color: rgba(224,82,82,0.25); }

/* ═══════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════ */

.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.7); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}
.modal-header h2 { font-size: 16px; font-weight: 600; color: var(--text-primary); margin: 0; }
.modal-body { overflow-y: auto; padding: 24px; flex: 1; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 16px 24px; border-top: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════
   RESIZE HANDLE
   ═══════════════════════════════════════════════════════════ */

.resize-handle {
  width: 4px; background: transparent; cursor: col-resize;
  transition: background 0.15s; position: absolute; top: 0; bottom: 0; z-index: 10;
}
.resize-handle.left { right: 0; }
.resize-handle.right { left: 0; }
.resize-handle:hover, .resize-handle.active { background: var(--accent-gold); }

/* ═══════════════════════════════════════════════════════════
   SENTENCE OPTIONS (Dialogue branching)
   ═══════════════════════════════════════════════════════════ */

.sentence-options {
  padding: 0 12px 10px; display: flex; flex-direction: column; gap: 3px;
  border-top: 1px solid var(--border-subtle);
}
.sentence-option {
  display: flex; align-items: center; gap: 6px; padding: 3px 0;
  font-size: 11px; color: var(--text-secondary);
}
.option-num {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent-gold);
  font-size: 9px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.option-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option-more { font-size: 10px; color: var(--text-muted); padding-left: 22px; }
.options-badge {
  margin-left: auto; font-size: 9px; padding: 1px 5px;
  border-radius: 3px; font-weight: 600;
  background: var(--accent-dim); color: var(--accent-gold);
}
.timer-badge {
  font-size: 9px; padding: 1px 5px; border-radius: 3px;
  background: var(--red-dim); color: var(--red); font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════
   EDITABLE INLINE VALUES (Balance Viewer)
   ═══════════════════════════════════════════════════════════ */

.editable-value {
  cursor: pointer; padding: 2px 4px; border-radius: var(--radius-sm);
  transition: background 0.1s; position: relative;
}
.editable-value:hover { background: var(--bg-active); }
.editable-value .edit-hint {
  opacity: 0; margin-left: 4px; font-size: 10px; transition: opacity 0.1s;
}
.editable-value:hover .edit-hint { opacity: 0.5; }
.editable-input-row {
  display: flex; align-items: center; gap: 4px;
}
.editable-input-row button {
  width: 22px; height: 22px; font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm); border: none; cursor: pointer;
  background: var(--bg-active); color: var(--text-secondary);
}
.editable-input-row button:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ═══════════════════════════════════════════════════════════
   COMPACT MODE
   ═══════════════════════════════════════════════════════════ */

.compact .field-group { gap: 4px; margin-bottom: 6px; }
.compact .field-group label { font-size: 10px; }
.compact input, .compact textarea, .compact select { padding: 5px 8px; font-size: 12px; }
.compact .stage-node { min-height: 80px; padding: 10px; }
.compact .stage-obj-pill { font-size: 9px; padding: 1px 4px; }

/* ═══════════════════════════════════════════════════════════
   LIGHT THEME
   ═══════════════════════════════════════════════════════════ */

[data-theme="light"] {
  --bg-base: #f4f5f7;
  --bg-surface: #ffffff;
  --bg-card: #f8f9fb;
  --bg-elevated: #ffffff;
  --bg-hover: #eef0f4;
  --bg-active: #e8ebf0;
  --bg-selected: #e8f0fe;

  --border-subtle: rgba(0,0,0,0.05);
  --border-default: rgba(0,0,0,0.10);
  --border-strong: rgba(0,0,0,0.18);
  --border-focus: rgba(180,120,40,0.6);

  --text-primary: #1a1d27;
  --text-secondary: #5a5f7a;
  --text-muted: #9098b1;
  --text-inverse: #ffffff;

  --accent: #c07820;
  --accent-dim: rgba(192,120,32,0.12);
  --accent-hover: #d4891f;
  --accent-gold: #c07820;
  --accent-gold-dim: rgba(192,120,32,0.18);

  --blue: #2563eb;
  --blue-dim: rgba(37,99,235,0.10);
  --green: #16a34a;
  --green-dim: rgba(22,163,74,0.10);
  --red: #dc2626;
  --red-dim: rgba(220,38,38,0.10);
  --purple: #7c3aed;
  --purple-dim: rgba(124,58,237,0.10);

  --success: #16a34a;
  --warning: #c07820;
  --error: #dc2626;
  --info: #2563eb;
  --tag-valid: #16a34a;
  --tag-custom: #c07820;
  --tag-invalid: #dc2626;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* ═══════════════════════════════════════════════════════════
   MEDIEVAL THEME
   ═══════════════════════════════════════════════════════════ */

[data-theme="medieval"] {
  --bg-base: #0e0d0b;
  --bg-surface: #131210;
  --bg-card: #181610;
  --bg-elevated: #1c1a13;
  --bg-hover: #201e16;
  --bg-active: #252318;
  --bg-selected: #2a271a;

  --border-subtle: rgba(160,130,60,0.10);
  --border-default: rgba(160,130,60,0.20);
  --border-strong: rgba(160,130,60,0.35);
  --border-focus: rgba(190,155,70,0.65);

  --accent: #b8943c;
  --accent-dim: rgba(184,148,60,0.12);
  --accent-hover: #c8a84a;
  --accent-gold: #b8943c;
  --accent-gold-dim: rgba(184,148,60,0.20);
  --accent-blue: #6a9ab8;
  --accent-blue-dim: rgba(106,154,184,0.12);

  --text-primary: #ddd5b8;
  --text-secondary: #8a7d5a;
  --text-muted: #4a4535;
  --text-inverse: #0e0d0b;

  --blue: #6a9ab8;
  --blue-dim: rgba(106,154,184,0.15);
  --green: #6aab6a;
  --green-dim: rgba(106,171,106,0.15);
  --red: #c85a3a;
  --red-dim: rgba(200,90,58,0.15);
  --purple: #9a7ab8;
  --purple-dim: rgba(154,122,184,0.15);

  --success: #6aab6a;
  --warning: #b8943c;
  --error: #c85a3a;
  --info: #6a9ab8;
  --tag-valid: #6aab6a;
  --tag-custom: #b8943c;
  --tag-invalid: #c85a3a;

  --shadow-sm: 0 1px 4px rgba(0,0,0,0.6);
  --shadow-md: 0 4px 14px rgba(0,0,0,0.7);
  --shadow-lg: 0 8px 36px rgba(0,0,0,0.8);

  --radius-sm: 2px;
  --radius-md: 3px;
  --radius-lg: 4px;
  --radius-xl: 6px;
}

/* Sidebar — very subtle parchment lines */
[data-theme="medieval"] .app-sidebar {
  background-image: repeating-linear-gradient(0deg, transparent, transparent 24px, rgba(160,130,60,0.03) 24px, rgba(160,130,60,0.03) 25px);
  border-right-color: var(--border-strong);
}
[data-theme="medieval"] .sidebar-logo {
  text-shadow: 0 0 16px rgba(184,148,60,0.2);
  letter-spacing: 0.1em;
}
[data-theme="medieval"] .sidebar-group-label {
  font-family: var(--font-display);
  color: var(--accent-gold);
  opacity: 0.7;
  letter-spacing: 0.15em;
}

/* Buttons — muted gold gradient */
[data-theme="medieval"] .btn-primary {
  background: linear-gradient(135deg, #8a6a22, #b8943c, #8a6a22) !important;
  border: 1px solid #b8943c !important;
  color: #0e0d0b !important;
  text-shadow: none;
}
[data-theme="medieval"] .btn-primary:hover {
  background: linear-gradient(135deg, #9a7a2a, #c8a84a, #9a7a2a) !important;
}

/* Inputs */
[data-theme="medieval"] input:focus,
[data-theme="medieval"] textarea:focus,
[data-theme="medieval"] select:focus {
  border-color: var(--accent-gold) !important;
  box-shadow: 0 0 0 2px var(--accent-dim);
}

/* Table headers */
[data-theme="medieval"] th,
[data-theme="medieval"] .audit-list-header,
[data-theme="medieval"] .db-field-name,
[data-theme="medieval"] .eq-filter-label,
[data-theme="medieval"] .vs-title {
  font-family: var(--font-display);
  letter-spacing: 0.06em;
}

/* Cards — subtle stone inset shadow */
[data-theme="medieval"] .vendor-section,
[data-theme="medieval"] .vendor-item-card,
[data-theme="medieval"] .vendor-cat-card,
[data-theme="medieval"] .quest-card,
[data-theme="medieval"] .utv-card {
  box-shadow: inset 0 0 16px rgba(0,0,0,0.15);
}

/* Scrollbars */
[data-theme="medieval"] ::-webkit-scrollbar-track { background: var(--bg-base); }
[data-theme="medieval"] ::-webkit-scrollbar-thumb { background: rgba(160,130,60,0.2); border-radius: 2px; }
[data-theme="medieval"] ::-webkit-scrollbar-thumb:hover { background: rgba(160,130,60,0.35); }

/* WorldMap */
[data-theme="medieval"] .leaflet-container { background: #131210 !important; }
[data-theme="medieval"] .wm-map-footer { background: rgba(14,13,11,0.9); }

/* Quest cards — desaturated in medieval */
[data-theme="medieval"] .quest-card.type-main { border-left-color: rgba(180,140,60,0.5); background: rgba(180,140,60,0.06); }
[data-theme="medieval"] .quest-card.type-side { border-left-color: rgba(100,140,180,0.5); background: rgba(100,140,180,0.06); }
[data-theme="medieval"] .quest-card.type-optional { border-left-color: rgba(100,160,100,0.5); background: rgba(100,160,100,0.06); }
[data-theme="medieval"] .qc-type-badge.main { background: rgba(180,140,60,0.12); color: #b8943c; }
[data-theme="medieval"] .qc-type-badge.side { background: rgba(100,140,180,0.12); color: #6a9ab8; }
[data-theme="medieval"] .qc-type-badge.optional { background: rgba(100,160,100,0.12); color: #6aab6a; }

/* View titles */
[data-theme="medieval"] .vendor-editor-title,
[data-theme="medieval"] .audit-title,
[data-theme="medieval"] .wm-title,
[data-theme="medieval"] .db-detail-row-name {
  font-family: var(--font-display);
  letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════
   CHAT PANEL
   ═══════════════════════════════════════════════════════════ */

/* Language toggle */
.lang-toggle { display: flex; align-items: center; gap: 2px; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); padding: 2px; }
.lang-btn { padding: 3px 8px; border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text-muted); font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.1s; font-family: var(--font-ui); }
.lang-btn.active { background: var(--bg-elevated); color: var(--text-primary); box-shadow: var(--shadow-sm); }

.chat-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 420px; background: var(--bg-surface); border-left: 1px solid var(--border-default); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; z-index: 10000; animation: slideInRight 0.2s ease; }
@keyframes slideInRight { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.chat-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--border-default); background: var(--bg-elevated); flex-shrink: 0; }
.chat-header-info { display: flex; flex-direction: column; gap: 2px; }
.chat-title { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.chat-subtitle { font-size: 11px; color: var(--text-muted); }
.chat-header-actions { display: flex; gap: 6px; }
.chat-action-btn { width: 28px; height: 28px; border-radius: var(--radius-md); border: 1px solid var(--border-default); background: var(--bg-card); color: var(--text-secondary); cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: all 0.1s; }
.chat-action-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.chat-messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; scrollbar-width: thin; }

.chat-msg.system .system-content { background: var(--accent-dim); border: 1px solid rgba(232,160,69,0.2); border-radius: var(--radius-lg); padding: 12px 14px; font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.system-content p { margin: 2px 0; }

.chat-msg.user { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.user-bubble { background: var(--accent-gold); color: var(--text-inverse); border-radius: 14px 14px 2px 14px; padding: 10px 14px; font-size: 13px; max-width: 85%; line-height: 1.5; word-wrap: break-word; }

.chat-msg.assistant { display: flex; align-items: flex-start; gap: 10px; }
.chat-msg-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--bg-active); border: 1px solid var(--border-default); display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; }
.chat-msg-body { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.assistant-bubble { background: var(--bg-card); border: 1px solid var(--border-default); border-radius: 2px 14px 14px 14px; padding: 12px 14px; font-size: 13px; line-height: 1.6; word-wrap: break-word; }

.formatted-text { display: flex; flex-direction: column; gap: 4px; }
.ft-h2 { font-size: 14px; font-weight: 700; color: var(--text-primary); margin: 4px 0 2px; }
.ft-h3 { font-size: 13px; font-weight: 600; color: var(--accent-gold); margin: 4px 0 2px; }
.ft-bullet { font-size: 13px; color: var(--text-secondary); padding-left: 8px; }
.ft-bullet::before { content: '• '; }
.ft-p { font-size: 13px; color: var(--text-primary); margin: 0; }

.chat-msg.tool-use { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--bg-elevated); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); font-size: 12px; color: var(--text-muted); }
.tool-use-icon { font-size: 13px; }

.chat-msg.error { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: var(--red-dim); border: 1px solid rgba(224,82,82,0.25); border-radius: var(--radius-md); font-size: 13px; color: var(--red); }

.chat-msg-time { font-size: 10px; color: var(--text-muted); }

.chat-thinking { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.thinking-dots { display: flex; gap: 4px; }
.thinking-dots span { width: 6px; height: 6px; background: var(--accent-gold); border-radius: 50%; animation: thinkAnim 1.2s infinite; }
.thinking-dots span:nth-child(2) { animation-delay: 0.2s; }
.thinking-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinkAnim { 0%,60%,100% { opacity: 0.3; transform: scale(0.8); } 30% { opacity: 1; transform: scale(1); } }
.thinking-label { font-size: 12px; color: var(--text-muted); }

.chat-suggestions { padding: 0 12px 12px; display: flex; flex-direction: column; gap: 6px; }
.suggestion-chip { text-align: left; padding: 8px 12px; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-md); color: var(--text-secondary); font-size: 12px; cursor: pointer; transition: all 0.1s; }
.suggestion-chip:hover { border-color: var(--accent-gold); color: var(--accent-gold); background: var(--accent-dim); }

.chat-input-area { padding: 12px; border-top: 1px solid var(--border-default); display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0; background: var(--bg-surface); }
.chat-input { flex: 1; background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius-lg); color: var(--text-primary); font-size: 13px; font-family: var(--font-ui); padding: 10px 14px; resize: none; line-height: 1.5; max-height: 100px; scrollbar-width: thin; }
.chat-input:focus { outline: none; border-color: var(--border-focus); background: var(--bg-elevated); }
.chat-input::placeholder { color: var(--text-muted); }

.chat-send-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--accent-gold); border: none; color: var(--text-inverse); font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.1s; flex-shrink: 0; }
.chat-send-btn:hover:not(:disabled) { background: var(--accent-hover); transform: scale(1.05); }
.chat-send-btn:disabled { background: var(--bg-active); color: var(--text-muted); cursor: not-allowed; }
.chat-send-btn.loading { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

/* ═══════════════════════════════════════════════════════════
   APP SIDEBAR — CSS class-based (replaces inline styles)
   ═══════════════════════════════════════════════════════════ */

.sidebar-backdrop { display: none; }
.app-sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background: var(--surface-1);
  border-right: 1px solid var(--border-faint);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--motion-normal) var(--ease-out),
              min-width var(--motion-normal) var(--ease-out),
              transform var(--motion-normal) var(--ease-out);
}
.app-sidebar.collapsed { width: 0; min-width: 0; overflow: hidden; }

.sidebar-logo {
  padding: var(--space-4) var(--space-4);
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: var(--weight-semibold);
  color: var(--accent-emphasis);
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-faint);
  white-space: nowrap;
  user-select: none;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2) 0;
}

.sidebar-group-label {
  padding: var(--space-4) var(--space-4) var(--space-2);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  letter-spacing: var(--tracking-widest);
  color: var(--text-on-surface-subtle);
  text-transform: uppercase;
  white-space: nowrap;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 7px var(--space-4);
  font-size: var(--text-base);
  color: var(--text-on-surface-muted);
  cursor: pointer;
  border-left-width: 2px;
  border-left-style: solid;
  border-left-color: transparent;
  transition: background var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out),
              border-left-color var(--motion-fast) var(--ease-out);
  white-space: nowrap;
  user-select: none;
  position: relative;
}
.sidebar-nav-item:hover {
  background: var(--surface-hover);
  color: var(--text-on-surface);
}
.sidebar-nav-item.active {
  border-left-color: var(--accent-emphasis);
  background: var(--surface-active);
  color: var(--text-on-surface);
}
.sidebar-nav-item.active .sidebar-nav-icon { color: var(--accent-emphasis); }
.sidebar-nav-item:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--accent-emphasis-soft);
}

.sidebar-nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--text-on-surface-subtle);
  transition: color var(--motion-fast) var(--ease-out);
}
.sidebar-nav-item:hover .sidebar-nav-icon { color: var(--text-on-surface); }

/* RSB mobile wrapper */
.rsb-mobile { display: flex; flex-direction: column; width: 100%; overflow: hidden; }

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (<768px)
   ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* ── ALL view roots: unlock scroll on mobile ── */
  .view-split-layout,
  .vendor-layout, .loot-layout,
  .crafting-layout,
  .quest-flow-view,
  .unlock-tree-view,
  .audit-layout,
  .dialogue-editor-layout,
  .world-map-layout,
  .db-detail-panel {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: calc(100vh - 48px);
  }

  /* Stack horizontal layouts vertically */
  .view-split-layout,
  .vendor-layout, .loot-layout,
  .crafting-layout {
    flex-direction: column !important;
  }
  .crafting-body { flex-direction: column !important; }

  /* World map keeps fixed height (needs it for Leaflet) */
  .world-map-layout {
    height: calc(100vh - 48px) !important;
    min-height: 0;
    overflow: hidden !important;
  }

  /* Inner panels: remove fixed heights, allow natural flow */
  .vendor-editor,
  .vendor-sidebar,
  .eq-sidebar,
  .crafting-list,
  .recipe-editor,
  .crafting-editor-panel {
    height: auto !important;
    overflow-y: auto !important;
    max-height: none !important;
  }

  /* Vendor/Loot sidebar: cap height so editor is visible below */
  .vendor-sidebar { max-height: 40vh !important; }
  .eq-sidebar { max-height: 45vh !important; }

  /* ── Bottom padding so content isn't cut off ── */
  .vendor-editor-body,
  .recipe-editor-scroll,
  .quest-flow-view .qfv-body,
  .audit-list,
  .db-detail-fields,
  .eq-list,
  .unlock-tree-view,
  .vendor-list {
    padding-bottom: 60px !important;
    -webkit-overflow-scrolling: touch;
  }

  /* ── Sidebar drawer ── */
  .sidebar-backdrop { display: block; position: fixed; top: 48px; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); z-index: 199; }
  .app-sidebar {
    position: fixed !important; top: 48px; left: 0; bottom: 0;
    width: 270px !important; min-width: 270px !important;
    z-index: 200; box-shadow: 4px 0 24px rgba(0,0,0,0.6);
    transform: translateX(0);
    overflow-y: auto !important;
    height: auto !important;
  }
  .app-sidebar.collapsed { transform: translateX(-100%); width: 270px !important; min-width: 270px !important; }
  .sidebar-nav { overflow-y: auto !important; -webkit-overflow-scrolling: touch; padding-bottom: 20px; }

  /* Hide desktop sidebar ResizableSidebar wrapper */
  .rsb-mobile { flex-shrink: 0; }

  /* ── iOS zoom prevention ── */
  select, input, textarea { font-size: 16px !important; }

  /* ── Modals ── */
  .modal-content { width: 94vw !important; max-width: 94vw !important; max-height: 85vh; overflow-y: auto; margin: 20px auto; }
  .modal-body { max-height: 65vh; overflow-y: auto; }
  .modal-overlay { padding: 0 !important; align-items: flex-start !important; padding-top: 10vh !important; }

  /* ── All view layouts: force column on mobile ── */
  .vendor-layout, .loot-layout, .crafting-layout,
  .dialogue-editor-layout, .quest-detail-layout { flex-direction: column !important; height: auto !important; min-height: calc(100vh - 48px); overflow-y: auto !important; }

  /* ── Vendor/Loot/Crafting sidebars ── */
  .vendor-sidebar, .crafting-list { max-height: 35vh !important; height: auto !important; border-right: none !important; border-bottom: 1px solid var(--border-default); overflow-y: auto; }
  .vendor-editor, .recipe-editor, .crafting-editor-panel { flex: 1; min-height: 50vh; overflow-y: auto; }
  .vendor-editor-header { flex-direction: column; gap: 8px; padding: 12px; align-items: stretch !important; }
  .vendor-save-area { justify-content: space-between; flex-wrap: wrap; gap: 6px; }
  .vendor-items-grid { grid-template-columns: 1fr !important; }
  .vendor-editor-body { padding: 10px; gap: 10px; }
  .vs-hint { display: none; }
  .crafting-body { flex-direction: column !important; }
  .crafting-header { flex-wrap: wrap; gap: 6px; padding: 10px 12px; }

  /* ── Equipment ── */
  .eq-sidebar { max-height: 40vh !important; }
  .eq-sidebar-top { max-height: 25vh; }
  .eq-filter-chips { gap: 3px; }
  .eq-filter-chip { font-size: 10px; padding: 2px 5px; }

  /* ── Quest flow ── */
  .qfv-header { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
  .qfv-chapter-filter { min-width: 100px; font-size: 12px; flex: 1; }
  .qfv-columns-header { display: none; }
  .qfv-chapter-content, .qfv-chapter-content.two-col { grid-template-columns: 1fr !important; margin-left: 0 !important; }
  .qfv-optionals-grid { grid-template-columns: 1fr !important; }
  .quest-card { padding: 10px; }

  /* ── Quest detail panels ── */
  .quest-info-panel, .quest-pipeline-panel, .quest-stage-editor-panel { width: 100% !important; }

  /* ── DataBrowser ── */
  .db-detail-panel { width: 100% !important; flex: none !important; min-width: 0 !important; max-height: 45vh; border-left: none !important; border-top: 1px solid var(--border-default); }

  /* ── World Map ── */
  .wm-body { flex-direction: column; }
  .wm-sidebar { width: 100% !important; max-height: 25vh; border-right: none !important; border-bottom: 1px solid var(--border-default); }
  .wm-detail-panel { width: 100% !important; max-height: 30vh; border-left: none !important; border-top: 1px solid var(--border-default); animation: none; }
  .wm-toolbar { padding: 6px 8px; gap: 4px; }
  .wm-title { font-size: 13px; }
  .wm-toolbar-actions { width: 100%; gap: 4px; }
  .wm-type-select { font-size: 11px; padding: 4px 6px; }
  .wm-add-dropdown { flex: 1; }
  .wm-mode-hint { font-size: 11px; }
  .wm-map-footer { font-size: 10px; padding: 2px 8px; }

  /* ── Unlock tree ── */
  .utv-grid { padding: 8px; }
  .utv-level-column { min-width: 130px; max-width: 145px; }
  .utv-card { padding: 8px; }
  .utv-card-name { font-size: 11px; }

  /* ── Audit log ── */
  .audit-header { padding: 10px 12px; }
  .audit-title { font-size: 14px; }
  .audit-list-header { display: none; }
  .audit-row-compact { flex-wrap: wrap; gap: 4px; padding: 8px 10px; min-height: auto; }
  .arc-action { width: auto !important; }
  .arc-table { width: auto !important; }
  .arc-object { width: 100% !important; flex: none !important; order: -1; }
  .arc-desc { width: 100% !important; flex: none !important; font-size: 11px; }
  .arc-time { font-size: 10px; }
  .arc-expand-arrow { display: none; }
  .audit-row-detail { padding: 8px 10px; }
  .audit-diff-table { font-size: 10px; }
  .diff-field { min-width: 70px; }
  .diff-from, .diff-to { max-width: 100px !important; }

  /* ── Buttons ── */
  .btn-primary, .btn-secondary, .btn-danger, .btn-danger-sm { font-size: 13px; padding: 8px 12px; min-height: 36px; }
  .btn-icon-only { width: 36px !important; height: 36px !important; }
  .btn-add-small { padding: 8px 12px; font-size: 13px; }

  /* ── Attribute editors ── */
  .attr-row-readable { flex-direction: column; gap: 6px; }
  .attr-controls { width: 100%; }

  /* ── Tag picker ── */
  .add-attr-dropdown { width: 85vw !important; max-width: 320px; }

  /* ── Skill tree grid ── */
  .unlock-selector-list { max-height: 200px; }
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (769-1024px)
   ═══════════════════════════════════════════════════════════ */

@media (min-width: 769px) and (max-width: 1024px) {
  .vendor-items-grid { grid-template-columns: 1fr !important; }
  .qfv-chapter-content, .qfv-chapter-content.two-col { margin-left: 100px !important; }
  .db-detail-panel { flex: 1 1 40% !important; }
  .wm-sidebar { width: 200px !important; }
  .wm-detail-panel { width: 240px !important; }
}

@keyframes skeletonPulse {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}


/* ═══════════════════════════════════════════════════════════
   APP HEADER (Phase 1 refactor — 5 zones)
   Layout: [logo+toggle] [search] [right: ws + health + save + user]
   Plus a secondary breadcrumb strip below.
   ═══════════════════════════════════════════════════════════ */

.app-header {
  height: var(--header-height);
  min-height: var(--header-height);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-faint);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  gap: var(--space-4);
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.header-logo {
  background: transparent;
  border: none;
  font-size: var(--text-2xl);
  color: var(--accent-emphasis);
  cursor: pointer;
  font-family: var(--font-display);
  user-select: none;
  line-height: 1;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-sm);
  transition: background var(--motion-fast) var(--ease-out);
}
.header-logo:hover { background: var(--surface-hover); }

.header-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--text-on-surface-muted);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: background var(--motion-fast) var(--ease-out), color var(--motion-fast) var(--ease-out);
}
.header-icon-btn:hover { background: var(--surface-hover); color: var(--text-on-surface); }

/* Search central — refinado */
.header-search {
  flex: 1;
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  height: 34px;
  background: var(--surface-2);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  cursor: pointer;
  color: var(--text-on-surface-subtle);
  transition: border-color var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-fast) var(--ease-out);
  text-align: left;
  font-family: var(--font-ui);
}
.header-search:hover {
  border-color: var(--border-emphasis);
  background: var(--surface-hover);
  color: var(--text-on-surface-muted);
}
.header-search:focus-visible {
  outline: none;
  border-color: var(--accent-emphasis);
  box-shadow: 0 0 0 3px var(--accent-emphasis-soft);
}
.header-search-placeholder {
  flex: 1;
  font-size: var(--text-base);
  color: var(--text-on-surface-subtle);
}
.header-search-kbd {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
  background: var(--surface-active);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-xs);
  padding: 2px 6px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

/* WebSocket status dot */
.header-ws-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1px solid var(--border-base);
  flex-shrink: 0;
}
.header-ws-dot.connected { background: var(--feedback-success); box-shadow: 0 0 6px var(--feedback-success); }
.header-ws-dot.disconnected { background: var(--feedback-error); box-shadow: 0 0 8px var(--feedback-error); }
.header-ws-dot.pulse { animation: wsPulse 1.2s ease-in-out infinite; }

@keyframes wsPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.75); }
}

/* Consolidated health badge — pill estilo professional */
.header-health {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  background: var(--surface-2);
  border: 1px solid var(--border-base);
  color: var(--text-on-surface);
  transition: border-color var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out);
}
.header-health:hover {
  border-color: var(--border-emphasis);
  background: var(--surface-hover);
}
.header-health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.header-health-score { font-family: var(--font-mono); font-size: var(--text-sm); }
.header-health-sep { color: var(--text-on-surface-subtle); margin: 0 2px; }
.header-health-issues { font-weight: var(--weight-semibold); font-size: var(--text-xs); }
.header-health-issues.error { color: var(--feedback-error); }
.header-health-issues.warn { color: var(--feedback-warning); }

/* Save status (only visible while saving / on error) */
.header-save {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-xs);
  padding: 3px var(--space-2);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
}
.header-save.saving { color: var(--text-on-surface-subtle); background: var(--surface-2); border: 1px solid var(--border-faint); }
.header-save.error { color: var(--feedback-error); background: var(--feedback-error-soft); border: 1px solid rgba(224,82,82,0.3); }
.header-save .spin { animation: spin 0.9s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }

/* User menu — chip avatar style */
.header-user { position: relative; }
.header-user-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface-2);
  border: 1px solid var(--border-base);
  color: var(--text-on-surface-muted);
  padding: 4px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out);
}
.header-user-trigger:hover, .header-user-trigger.active {
  border-color: var(--border-emphasis);
  background: var(--surface-hover);
  color: var(--text-on-surface);
}
.header-user-label { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-user-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  min-width: 260px;
  background: var(--surface-3);
  border: 1px solid var(--border-emphasis);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  overflow: hidden;
  animation: menuOpen var(--motion-normal) var(--ease-out);
}
@keyframes menuOpen {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.header-menu-section {
  padding: var(--space-3) var(--space-3);
  border-bottom: 1px solid var(--border-faint);
}
.header-menu-section:last-child { border-bottom: none; }
.header-menu-label {
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-bottom: var(--space-2);
  font-weight: var(--weight-semibold);
}
.header-menu-row { display: flex; align-items: center; gap: var(--space-1); }
.header-menu-pill {
  background: transparent;
  border: 1px solid var(--border-base);
  color: var(--text-on-surface-muted);
  padding: 4px var(--space-3);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  cursor: pointer;
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.5px;
  transition: all var(--motion-fast) var(--ease-out);
}
.header-menu-pill:hover {
  border-color: var(--border-emphasis);
  color: var(--text-on-surface);
}
.header-menu-pill.active {
  background: var(--accent-emphasis-soft);
  border-color: var(--accent-emphasis);
  color: var(--accent-emphasis);
}
.header-menu-warn { color: var(--feedback-warning); display: inline-flex; align-items: center; }
.header-menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-on-surface);
  padding: var(--space-2) var(--space-2);
  font-size: var(--text-base);
  cursor: pointer;
  text-align: left;
  border-radius: var(--radius-sm);
  transition: background var(--motion-fast) var(--ease-out);
}
.header-menu-item:hover { background: var(--surface-hover); }
.header-menu-item.danger { color: var(--feedback-error); }
.header-menu-item.danger:hover { background: var(--feedback-error-soft); }
.header-menu-hint {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
}

/* Breadcrumb strip below the header */
.app-breadcrumb {
  height: var(--breadcrumb-height);
  min-height: var(--breadcrumb-height);
  background: var(--surface-0);
  border-bottom: 1px solid var(--border-faint);
  display: flex;
  align-items: center;
  padding: 0 var(--space-5);
  gap: var(--space-2);
  font-size: var(--text-sm);
}
.breadcrumb-view {
  color: var(--text-on-surface-muted);
  font-weight: var(--weight-medium);
  letter-spacing: 0.2px;
}
.breadcrumb-sep { color: var(--text-on-surface-subtle); }
.breadcrumb-row {
  color: var(--accent-emphasis);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.breadcrumb-domain {
  color: var(--text-on-surface-subtle);
  text-transform: uppercase;
  font-size: var(--text-xs);
  letter-spacing: 0.8px;
}
/* Vistas hermanas del dominio activo — atajos de un click */
.breadcrumb-siblings {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
}
.breadcrumb-siblings::-webkit-scrollbar { display: none; }
.breadcrumb-sibling {
  background: transparent;
  border: 1px solid var(--border-faint);
  border-radius: 999px;
  color: var(--text-on-surface-subtle);
  font-size: var(--text-xs);
  padding: 1px 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 120ms ease, border-color 120ms ease;
}
.breadcrumb-sibling:hover {
  color: var(--text-on-surface);
  border-color: var(--border-strong);
}
@media (max-width: 768px) {
  .breadcrumb-siblings { display: none; }
}

/* Floating Action Button — Chat */
.chat-fab {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-emphasis);
  color: var(--text-on-accent);
  border: none;
  cursor: pointer;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: background var(--motion-normal) var(--ease-out),
              transform var(--motion-normal) var(--ease-spring),
              box-shadow var(--motion-normal) var(--ease-out);
}
.chat-fab:hover {
  background: var(--accent-emphasis-hover);
  transform: translateY(-2px) scale(1.05);
  box-shadow: var(--shadow-xl);
}
.chat-fab:active { transform: translateY(0) scale(0.98); }
.chat-fab.open {
  background: var(--surface-3);
  color: var(--text-on-surface);
  border: 1px solid var(--border-strong);
}

/* ═══════════════════════════════════════════════════════════
   SIDEBAR — Bloque 3 refactor (jerarquía de 2 niveles)
   ═══════════════════════════════════════════════════════════ */

.sidebar-nav-item.indent {
  padding-left: 36px;
  font-size: var(--text-sm);
  color: var(--text-on-surface-muted);
  border-left-width: 2px;
}
.sidebar-nav-item.indent::before {
  /* línea conectora a la izquierda — guía visual de jerarquía */
  content: '';
  position: absolute;
  left: 24px;
  top: 50%;
  width: 6px;
  height: 1px;
  background: var(--border-faint);
}
.sidebar-nav-item.indent.active::before { background: var(--accent-emphasis); }
.sidebar-nav-item.indent .sidebar-nav-icon { opacity: 0.8; }

.sidebar-subgroup {
  margin-bottom: 2px;
  position: relative;
}
.sidebar-subgroup.expanded::before {
  /* tronco vertical de jerarquía */
  content: '';
  position: absolute;
  left: 24px;
  top: 28px;
  bottom: 6px;
  width: 1px;
  background: var(--border-faint);
}
.sidebar-subgroup-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-4);
  cursor: pointer;
  user-select: none;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-on-surface-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  transition: background var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out);
}
.sidebar-subgroup-header:hover {
  background: var(--surface-hover);
  color: var(--text-on-surface);
}
.sidebar-subgroup-chev {
  color: var(--text-on-surface-subtle);
  flex-shrink: 0;
  transition: transform var(--motion-fast) var(--ease-out);
}
.sidebar-subgroup-name {
  flex: 1;
}
.sidebar-subgroup-items {
  display: flex;
  flex-direction: column;
}
.sidebar-subgroup.collapsed .sidebar-subgroup-items { display: none; }

/* Top-level group block has the existing label style — keep as-is */
.sidebar-group {
  display: flex;
  flex-direction: column;
  padding-bottom: var(--space-2);
}

/* Tighter spacing for the new layout */
.sidebar-nav .sidebar-nav-item {
  padding-top: 6px;
  padding-bottom: 6px;
}

/* ═══════════════════════════════════════════════════════════
   DASHBOARD COMMAND ZONE — hovers e interacciones
   ═══════════════════════════════════════════════════════════ */

.cm-action:hover {
  border-color: var(--accent-emphasis) !important;
  background: var(--surface-hover) !important;
  transform: translateY(-1px);
  box-shadow: var(--shadow-xs);
}
.cm-action:active { transform: translateY(0); }
.cm-action .cm-action-trail {
  margin-left: auto;
  color: var(--text-on-surface-subtle);
  opacity: 0.6;
}

.cm-card:hover {
  border-color: var(--border-base);
  box-shadow: var(--shadow-sm);
}

.cm-feed-item:hover {
  background: var(--surface-hover);
}

.cm-count-row:hover {
  border-color: var(--accent-emphasis) !important;
  background: var(--surface-hover) !important;
  transform: translateY(-1px);
}
.cm-count-row:active { transform: translateY(0); }

/* ═══════════════════════════════════════════════════════════
   CARD ELEVATION — patrón reutilizable
   ═══════════════════════════════════════════════════════════ */

.card-elevated {
  background: var(--surface-2);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-fast) var(--ease-out),
              transform var(--motion-fast) var(--ease-out);
}
.card-elevated:hover {
  border-color: var(--border-base);
  box-shadow: var(--shadow-sm);
}
.card-elevated.interactive { cursor: pointer; }
.card-elevated.interactive:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* ═══════════════════════════════════════════════════════════
   ACCESSIBILITY — focus rings global
   ═══════════════════════════════════════════════════════════ */

*:focus-visible {
  outline: none;
}
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-emphasis-soft);
  border-radius: var(--radius-sm);
}

/* Reduce motion respeto */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ═══════════════════════════════════════════════════════════
   EDITOR SHELL — patrón canónico list+detail+tabs
   ═══════════════════════════════════════════════════════════ */

.es-root {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: var(--surface-0);
  overflow: hidden;
}

/* Toolbar superior */
.es-toolbar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-faint);
  min-height: 44px;
  flex-shrink: 0;
}
.es-toolbar-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface-2);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 0 var(--space-3);
  height: 30px;
  max-width: 360px;
  color: var(--text-on-surface-subtle);
  transition: border-color var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-fast) var(--ease-out);
}
.es-toolbar-search:focus-within {
  border-color: var(--accent-emphasis);
  box-shadow: 0 0 0 3px var(--accent-emphasis-soft);
}
.es-toolbar-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--text-on-surface);
  font-size: var(--text-base);
  outline: none;
  padding: 0;
  height: 100%;
}
.es-toolbar-search input::placeholder { color: var(--text-on-surface-subtle); }
.es-toolbar-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

/* Filter bar (opcional) — chip groups + sort + reset + counter */
.es-filters {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 6px var(--space-4);
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-faint);
  flex-wrap: wrap;
  flex-shrink: 0;
  min-height: 36px;
}
.es-filter-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.es-filter-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--text-on-surface-subtle);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  white-space: nowrap;
}
.es-filter-chips {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.es-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text-on-surface-subtle);
  border: 1px solid var(--border-faint);
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out);
  white-space: nowrap;
}
.es-filter-chip:hover {
  border-color: var(--border-base);
  color: var(--text-on-surface);
}
.es-filter-chip.active {
  background: var(--accent-dim);
  color: var(--accent-emphasis);
  border-color: var(--accent-emphasis);
}
.es-filter-spacer { flex: 1; }
.es-sort {
  background: var(--surface-2);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-md);
  color: var(--text-on-surface);
  font-size: var(--text-xs);
  padding: 4px 8px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--motion-fast) var(--ease-out);
}
.es-sort:hover { border-color: var(--border-base); }
.es-sort:focus-visible { border-color: var(--accent-emphasis); }
.es-filter-reset {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-pill);
  background: var(--feedback-error-dim, rgba(232,85,85,0.15));
  color: var(--feedback-error, var(--error));
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out);
}
.es-filter-reset:hover { background: rgba(232,85,85,0.25); }
.es-filter-count {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
  font-weight: var(--weight-semibold);
  padding-left: var(--space-2);
}

/* Custom list item (lista enriquecida con badges) */
.es-list-item-custom {
  flex-direction: column;
  align-items: stretch;
  padding: 8px var(--space-4);
  gap: 4px;
  text-align: left;
}

/* Body horizontal */
.es-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* List panel */
.es-list {
  background: var(--surface-1);
  border-right: 1px solid var(--border-faint);
  overflow-y: auto;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.es-list-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--text-on-surface-subtle);
  font-size: var(--text-sm);
  padding: var(--space-7);
}
.es-list-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px var(--space-4);
  background: transparent;
  border: none;
  border-left-width: 2px;
  border-left-style: solid;
  border-left-color: transparent;
  text-align: left;
  color: var(--text-on-surface-muted);
  cursor: pointer;
  transition: background var(--motion-fast) var(--ease-out),
              border-left-color var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out);
  font-size: var(--text-base);
  font-family: inherit;
  width: 100%;
  flex-shrink: 0;
}
.es-list-item:hover { background: var(--surface-hover); color: var(--text-on-surface); }
.es-list-item.selected {
  border-left-color: var(--accent-emphasis);
  background: var(--surface-active);
  color: var(--text-on-surface);
}
.es-list-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.es-list-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.es-list-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--weight-medium);
}
.es-list-sublabel {
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
  font-family: var(--font-mono);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Resize handle */
.es-resize {
  width: 4px;
  cursor: col-resize;
  background: transparent;
  flex-shrink: 0;
  transition: background var(--motion-fast) var(--ease-out);
}
.es-resize:hover { background: var(--accent-emphasis-soft); }

/* Detail panel */
.es-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-0);
}
.es-detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--text-on-surface-subtle);
  font-size: var(--text-sm);
}

.es-detail-header {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-6);
  border-bottom: 1px solid var(--border-faint);
  background: var(--surface-1);
  flex-shrink: 0;
}
.es-detail-header-left {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  min-width: 0;
}
.es-detail-title {
  margin: 0;
  font-size: var(--text-xl);
  font-weight: var(--weight-semibold);
  color: var(--text-on-surface);
  font-family: var(--font-display);
  letter-spacing: var(--tracking-tight);
  line-height: 1.3;
  outline: none;
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  margin: -2px -6px;
  transition: background var(--motion-fast) var(--ease-out);
  cursor: default;
}
.es-detail-title.editable {
  cursor: text;
}
.es-detail-title.editable:hover {
  background: var(--surface-hover);
}
.es-detail-title.editing {
  background: var(--surface-2);
  box-shadow: 0 0 0 3px var(--accent-emphasis-soft);
  cursor: text;
}
.es-detail-subtitle {
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
  font-family: var(--font-mono);
}
.es-detail-actions { display: flex; gap: var(--space-2); flex-shrink: 0; }

/* Action buttons by variant */
.es-action {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 5px var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out);
}
.es-action-primary {
  background: var(--accent-emphasis);
  color: var(--text-on-accent);
  font-weight: var(--weight-semibold);
}
.es-action-primary:hover:not(:disabled) {
  background: var(--accent-emphasis-hover);
}
.es-action-secondary {
  background: var(--surface-2);
  color: var(--text-on-surface);
  border-color: var(--border-base);
}
.es-action-secondary:hover:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-emphasis);
}
.es-action-danger {
  background: var(--feedback-error-soft);
  color: var(--feedback-error);
}
.es-action-danger:hover:not(:disabled) { background: rgba(224,82,82,0.20); }
.es-action-ghost {
  background: transparent;
  color: var(--text-on-surface-muted);
}
.es-action-ghost:hover:not(:disabled) {
  background: var(--surface-hover);
  color: var(--text-on-surface);
}

/* Tabs */
.es-tabs {
  display: flex;
  gap: 0;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-faint);
  padding: 0 var(--space-5);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.es-tabs::-webkit-scrollbar { display: none; }
.es-tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 10px var(--space-4);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-on-surface-muted);
  font-size: var(--text-base);
  font-weight: var(--weight-medium);
  font-family: var(--font-ui);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--motion-fast) var(--ease-out),
              border-bottom-color var(--motion-fast) var(--ease-out);
}
.es-tab:hover { color: var(--text-on-surface); }
.es-tab.active {
  color: var(--accent-emphasis);
  border-bottom-color: var(--accent-emphasis);
}

/* Tab body */
.es-tab-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  background: var(--surface-0);
}

/* ═══════════════════════════════════════════════════════════
   ITEM FORGE — componentes compartidos de tabs
   ═══════════════════════════════════════════════════════════ */

/* Toggle switch */
.if-toggle {
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: var(--border-emphasis);
  border: none;
  cursor: pointer;
  position: relative;
  transition: background var(--motion-fast) var(--ease-out);
  padding: 0;
  flex-shrink: 0;
}
.if-toggle.on { background: var(--accent-emphasis); }
.if-toggle:disabled { opacity: 0.4; cursor: not-allowed; }
.if-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  transition: left var(--motion-fast) var(--ease-out);
}
.if-toggle.on .if-toggle-thumb { left: 18px; }

/* Field row */
.if-field {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.if-field-label {
  width: 180px;
  flex-shrink: 0;
  font-size: var(--text-sm);
  color: var(--text-on-surface-muted);
  font-weight: var(--weight-medium);
}
.if-field-control { flex: 1; min-width: 0; }
.if-field-hint {
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
  flex-shrink: 0;
  font-family: var(--font-mono);
}

/* Inputs específicos del editor (variantes locales) */
.if-input {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  padding: 7px var(--space-3);
  font-size: var(--text-base);
  color: var(--text-on-surface);
  outline: none;
  transition: border-color var(--motion-fast) var(--ease-out),
              box-shadow var(--motion-fast) var(--ease-out);
}
.if-input:focus {
  border-color: var(--accent-emphasis);
  box-shadow: 0 0 0 3px var(--accent-emphasis-soft);
}
.if-input.mono { font-family: var(--font-mono); }
.if-input.if-textarea {
  min-height: 72px;
  resize: vertical;
  font-family: inherit;
}
.if-input.if-number { width: 130px; }
.if-input.invalid { border-color: var(--feedback-error); box-shadow: 0 0 0 1px rgba(231,76,60,0.25); }
.if-input.valid { border-color: var(--feedback-success); }

/* Section dentro del tab — heading + bloque de fields, sin colapso */
.if-section {
  margin-bottom: var(--space-6);
  background: var(--surface-2);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.if-section.subtle {
  background: transparent;
  border-style: dashed;
  opacity: 0.92;
}
.if-section-head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--border-faint);
  background: var(--surface-1);
}
.if-section.subtle .if-section-head {
  background: transparent;
  border-bottom-style: dashed;
}
.if-section-title {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  color: var(--accent-emphasis);
}
.if-section-subtitle {
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
  font-style: italic;
}
.if-section-body {
  padding: var(--space-4) var(--space-5);
}

/* Row name input + sugerencias */
.if-rowname {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
}
.if-rowname-ok {
  display: inline-flex;
  align-items: center;
  color: var(--feedback-success);
}
.if-rowname-error {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--text-xs);
  color: var(--feedback-error);
}
.if-rowname-suggest {
  background: transparent;
  border: 1px solid var(--border-base);
  color: var(--accent-blue);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  cursor: pointer;
  font-family: var(--font-mono);
}
.if-rowname-suggest:hover { border-color: var(--accent-blue); }
.if-rowname-warn {
  margin: var(--space-2) 0 var(--space-3) 192px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-xs);
  color: var(--feedback-warning);
}

/* Add attribute button */
.if-add-attr { position: relative; display: inline-block; margin-top: var(--space-2); }
.if-add-attr-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-xs);
  color: var(--accent-emphasis);
  background: transparent;
  border: 1px dashed var(--border-base);
  border-radius: var(--radius-md);
  padding: 5px var(--space-3);
  cursor: pointer;
  font-weight: var(--weight-medium);
  transition: border-color var(--motion-fast) var(--ease-out), background var(--motion-fast) var(--ease-out);
}
.if-add-attr-btn:hover {
  border-color: var(--accent-emphasis);
  border-style: solid;
  background: var(--accent-emphasis-soft);
}

/* Readonly lists (skills, xp) */
.if-readonly-list {
  margin-bottom: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-1);
  border-radius: var(--radius-sm);
}
.if-readonly-label {
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
  margin-bottom: var(--space-1);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}
.if-readonly-row {
  font-size: var(--text-sm);
  color: var(--text-on-surface-muted);
  font-family: var(--font-mono);
}

.if-empty-line {
  font-size: var(--text-sm);
  color: var(--text-on-surface-subtle);
  font-style: italic;
  padding: var(--space-2) 0;
}

/* Raw fields */
.if-raw-field { margin-bottom: var(--space-4); }
.if-raw-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-on-surface-muted);
  margin-bottom: var(--space-1);
  font-family: var(--font-mono);
}
.if-raw-textarea {
  font-family: var(--font-mono) !important;
  font-size: var(--text-xs);
  min-height: 120px;
}

/* ═══════════════════════════════════════════════════════════
   QUEST EDITOR — layout del tab Etapas
   ═══════════════════════════════════════════════════════════ */

.qe-stages-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-5);
  height: 100%;
  min-height: 0;
}
.qe-pipeline {
  background: var(--surface-2);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
.qe-pipeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border-faint);
  background: var(--surface-1);
}
.qe-pipeline-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-on-surface-subtle);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}
.qe-pipeline-count { color: var(--accent-emphasis); font-family: var(--font-mono); }
.qe-pipeline-list {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.qe-pipeline-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  color: var(--text-on-surface-subtle);
  text-align: center;
  padding: var(--space-6);
}

.qe-stage-editor {
  background: var(--surface-2);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-lg);
  overflow: auto;
  min-height: 0;
}
.qe-stage-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  color: var(--text-on-surface-subtle);
  text-align: center;
  padding: var(--space-8);
}

/* ═══════════════════════════════════════════════════════════
   EQUIPMENT EDITOR — extiende if-* y es-* del shell
   ═══════════════════════════════════════════════════════════ */

/* Input variants compartidos para campos compactos / readonly */
.if-input.readonly {
  background: var(--surface-1);
  color: var(--text-on-surface-subtle);
  cursor: default;
  font-family: var(--font-mono);
}
.if-input.if-input-num { width: 130px; }
.if-field-row {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}
.if-field-row > .if-field { flex: 0 0 auto; }

/* Toggle + label horizontal (UX heredada de Section/Toggle del editor antiguo) */
.eq-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 6px 0;
}
.eq-toggle-row.disabled { opacity: 0.5; pointer-events: none; }
.eq-toggle-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.eq-toggle-label {
  font-size: var(--text-base);
  color: var(--text-on-surface);
  font-weight: var(--weight-medium);
}
.eq-toggle-hint {
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
}

/* Linked item field (selector de item de inventario) */
.eq-linked-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.eq-linked-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 7px var(--space-3);
  background: var(--surface-2);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  color: var(--text-on-surface-subtle);
  font-size: var(--text-base);
  cursor: pointer;
  text-align: left;
  transition: border-color var(--motion-fast) var(--ease-out),
              background var(--motion-fast) var(--ease-out);
}
.eq-linked-btn:hover { border-color: var(--border-base); background: var(--surface-hover); }
.eq-linked-btn.has-value { color: var(--text-on-surface); border-color: var(--accent-emphasis); }
.eq-linked-name { font-weight: var(--weight-medium); flex: 1; }
.eq-linked-id {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
}
.eq-linked-placeholder { font-style: italic; }
.eq-linked-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-faint);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  color: var(--text-on-surface-subtle);
  cursor: pointer;
  transition: color var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out);
}
.eq-linked-clear:hover {
  color: var(--feedback-error);
  border-color: var(--feedback-error);
}

/* Tabla de stats de combate (persistent_attrs) */
.eq-attr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.eq-attr-table th {
  text-align: left;
  padding: 6px var(--space-3);
  color: var(--text-on-surface-subtle);
  border-bottom: 1px solid var(--border-faint);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  font-weight: var(--weight-bold);
}
.eq-attr-table th:nth-child(2),
.eq-attr-table th:nth-child(3) { text-align: center; }
.eq-attr-table td {
  padding: 6px var(--space-3);
  color: var(--text-on-surface);
  border-bottom: 1px solid var(--border-faint);
}
.eq-attr-table td.num {
  text-align: center;
  font-family: var(--font-mono);
  color: var(--accent-emphasis);
  font-weight: var(--weight-semibold);
}
.eq-empty-hint {
  font-size: var(--text-sm);
  color: var(--text-on-surface-subtle);
  font-style: italic;
}

/* State effects al equipar */
.eq-state-effects {
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px dashed var(--border-faint);
}
.eq-state-effects-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
  margin-bottom: var(--space-2);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  font-weight: var(--weight-bold);
}
.eq-state-effects-list {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.eq-state-chip {
  font-size: var(--text-xs);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(232,85,85,0.15);
  color: var(--feedback-error, var(--error));
  font-weight: var(--weight-medium);
}

/* Pitch / Yaw / Roll inputs (TabStats > IK) */
.eq-rotation-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.eq-rotation-label {
  font-size: var(--text-xs);
  color: var(--text-on-surface-subtle);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  font-weight: var(--weight-bold);
}

/* Custom list item del shell — row enriquecida con badges */
.eq-list-row-top {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-base);
  color: inherit;
}
.eq-list-row-name {
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.eq-list-row-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
  padding-left: 26px;
}
.eq-cat-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-on-surface-subtle);
  border: 1px solid var(--border-faint);
  font-weight: var(--weight-semibold);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.eq-dmg-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--accent-emphasis);
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
}
.eq-prop-badge {
  font-size: 9px;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: var(--weight-bold);
  letter-spacing: 0;
  color: var(--text-on-accent, #fff);
}
.eq-prop-badge.melee  { background: #c0392b; }
.eq-prop-badge.ranged { background: #2980b9; }
.eq-prop-badge.defend { background: #16a085; }
.eq-prop-badge.ammo   { background: #d35400; }
.eq-prop-badge.throw  { background: #8e44ad; }
.es-list-item.selected .eq-cat-badge { border-color: var(--accent-emphasis); }

/* Loading view */
.eq-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-on-surface-subtle);
  font-size: var(--text-sm);
}

/* New equipment modal */
.eq-newmodal-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.eq-newmodal-cats {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}
.eq-newmodal-loading,
.eq-newmodal-empty {
  padding: var(--space-5);
  text-align: center;
  color: var(--text-on-surface-subtle);
  font-size: var(--text-sm);
  font-style: italic;
}
.eq-newmodal-cat {
  margin-left: auto;
  font-size: var(--text-xs);
  color: var(--accent-emphasis);
  font-weight: var(--weight-semibold);
}
.eq-newmodal-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  padding-top: var(--space-2);
}

/* ═══════════════════════════════════════════════════════════
   AMMO EDITOR — damage type badge + state effects
   ═══════════════════════════════════════════════════════════ */
.ammo-dmg-empty {
  font-size: var(--text-sm);
  color: var(--text-on-surface-subtle);
  font-style: italic;
}
.ammo-dmg-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ammo-dmg-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--accent-dim);
  color: var(--accent-emphasis);
  border: 1px solid var(--accent-emphasis);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  font-family: var(--font-mono);
  width: fit-content;
}
.ammo-dmg-badge.ammo-dmg-feedback-error {
  background: rgba(232,85,85,0.15);
  color: var(--feedback-error);
  border-color: var(--feedback-error);
}
.ammo-dmg-badge.ammo-dmg-feedback-warning {
  background: rgba(245,166,35,0.15);
  color: var(--feedback-warning);
  border-color: var(--feedback-warning);
}
.ammo-dmg-badge.ammo-dmg-chart-purple {
  background: rgba(155,114,207,0.15);
  color: var(--chart-purple);
  border-color: var(--chart-purple);
}
.ammo-dmg-badge.ammo-dmg-text-on-surface-subtle {
  background: var(--surface-2);
  color: var(--text-on-surface-subtle);
  border-color: var(--border-faint);
}
.ammo-dmg-meta {
  font-size: 10px;
  color: var(--text-on-surface-subtle);
}

.ammo-fx-empty {
  font-size: var(--text-sm);
  color: var(--text-on-surface-subtle);
  font-style: italic;
  padding: 4px 0;
}
.ammo-fx-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ammo-fx-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 4px var(--space-2);
  background: var(--surface-1);
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
}
.ammo-fx-name {
  color: var(--accent-emphasis);
  font-weight: var(--weight-semibold);
}
.ammo-fx-tag {
  font-size: 10px;
  color: var(--text-on-surface-subtle);
}

/* ═══════════════════════════════════════════════════════════
   CRAFTING EDITOR — ingredient/output rows + XP rewards
   ═══════════════════════════════════════════════════════════ */
.ce-toggle-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 6px 0;
}
.ce-toggle-label {
  font-size: var(--text-base);
  color: var(--text-on-surface);
  font-weight: var(--weight-medium);
}
.ce-empty-hint {
  font-size: var(--text-sm);
  color: var(--text-on-surface-subtle);
  font-style: italic;
  padding: var(--space-3) 0;
  text-align: center;
}
.ce-row-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: var(--space-2);
}
.ce-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px var(--space-3);
  background: var(--surface-1);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-md);
  transition: border-color var(--motion-fast) var(--ease-out);
}
.ce-row:hover { border-color: var(--border-base); }
.ce-row-output { border-left: 2px solid var(--accent-emphasis); }
.ce-row-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text-on-surface-subtle);
  flex-shrink: 0;
}
.ce-row-output .ce-row-icon { color: var(--accent-emphasis); background: var(--accent-dim); }
.ce-row-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.ce-row-name {
  font-size: var(--text-sm);
  color: var(--text-on-surface);
  font-weight: var(--weight-medium);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ce-row-tag {
  font-size: 10px;
  color: var(--text-on-surface-subtle);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ce-row-amount {
  width: 70px;
  text-align: center;
}
.ce-row-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-sm);
  color: var(--text-on-surface-subtle);
  cursor: pointer;
  transition: color var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out);
}
.ce-row-remove:hover {
  color: var(--feedback-error);
  border-color: var(--feedback-error);
}
.ce-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px var(--space-3);
  background: var(--surface-2);
  border: 1px dashed var(--border-base);
  border-radius: var(--radius-md);
  color: var(--text-on-surface-subtle);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out);
  width: fit-content;
}
.ce-add-btn:hover {
  border-color: var(--accent-emphasis);
  color: var(--accent-emphasis);
  border-style: solid;
}
.ce-xp-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-2);
}
.ce-xp-row {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.ce-xp-row > :first-child { flex: 1; }
.ce-xp-value { width: 80px; }

/* ═══════════════════════════════════════════════════════════
   LOOT / VENDOR — shared (item cards + cat cards + chips)
   ═══════════════════════════════════════════════════════════ */
.lv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.lv-cat-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.lv-item-card,
.lv-cat-card {
  background: var(--surface-1);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-md);
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color var(--motion-fast) var(--ease-out);
}
.lv-item-card:hover,
.lv-cat-card:hover { border-color: var(--border-base); }

.lv-item-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.lv-item-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--accent-emphasis);
  flex-shrink: 0;
}
.lv-item-names {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.lv-item-display {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-on-surface);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lv-item-row {
  font-size: 10px;
  color: var(--text-on-surface-subtle);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.lv-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-sm);
  color: var(--text-on-surface-subtle);
  cursor: pointer;
  flex-shrink: 0;
  transition: color var(--motion-fast) var(--ease-out),
              border-color var(--motion-fast) var(--ease-out);
}
.lv-remove:hover {
  color: var(--feedback-error);
  border-color: var(--feedback-error);
}

.lv-item-controls,
.lv-cat-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}
.lv-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lv-control label {
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: var(--text-on-surface-subtle);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}
.lv-control-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
}
.lv-prob-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.lv-slider {
  flex: 1;
  accent-color: var(--accent-emphasis);
  cursor: pointer;
}
.lv-prob-val {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--accent-emphasis);
  min-width: 36px;
  text-align: right;
}

.lv-cat-head {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}
.lv-cat-select {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border-base);
  border-radius: var(--radius-md);
  color: var(--text-on-surface);
  font-size: var(--text-sm);
  padding: 6px var(--space-2);
  cursor: pointer;
  outline: none;
}
.lv-cat-select:focus-visible { border-color: var(--accent-emphasis); }

.lv-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px var(--space-3);
  background: var(--surface-2);
  border: 1px dashed var(--border-base);
  border-radius: var(--radius-md);
  color: var(--text-on-surface-subtle);
  font-size: var(--text-sm);
  cursor: pointer;
  transition: border-color var(--motion-fast) var(--ease-out),
              color var(--motion-fast) var(--ease-out);
  width: fit-content;
}
.lv-add-btn:hover {
  border-color: var(--accent-emphasis);
  color: var(--accent-emphasis);
  border-style: solid;
}

.lv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.lv-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--surface-2);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-pill);
  font-size: var(--text-xs);
  color: var(--text-on-surface);
}
.lv-chip.excluded {
  background: rgba(232,85,85,0.10);
  color: var(--feedback-error);
  border-color: rgba(232,85,85,0.30);
}
.lv-chip button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  background: transparent;
  border: none;
  color: inherit;
  cursor: pointer;
  opacity: 0.7;
  padding: 0;
}
.lv-chip button:hover { opacity: 1; }
.lv-cat-add-select {
  background: var(--surface-2);
  border: 1px dashed var(--border-base);
  border-radius: var(--radius-pill);
  color: var(--text-on-surface-subtle);
  font-size: var(--text-xs);
  padding: 3px var(--space-2);
  cursor: pointer;
}
.lv-cat-add-select:hover {
  border-color: var(--accent-emphasis);
  color: var(--accent-emphasis);
}

.lv-header-icon {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  color: var(--accent-emphasis);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  font-weight: var(--weight-bold);
}
.lv-header-icon-label { color: var(--text-on-surface-subtle); }

.lv-newmodal {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.lv-newmodal-actions {
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
}

/* ═══════════════════════════════════════════════════════════
   DOC HYPER — prosa del lector (HTML scrapeado de gamesbyhyper
   y markdown de la traducción comparten estas reglas)
   ═══════════════════════════════════════════════════════════ */

.hyperdoc-prose {
  font-size: var(--text-md);
  line-height: var(--leading-relaxed);
  color: var(--text-on-surface);
  max-width: 74ch;
}
.hyperdoc-prose h1, .hyperdoc-prose h2 {
  font-size: var(--text-xl);
  margin: var(--space-7) 0 var(--space-3);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border-faint);
}
.hyperdoc-prose h3 {
  font-size: var(--text-lg);
  margin: var(--space-6) 0 var(--space-2);
}
.hyperdoc-prose h4 { font-size: var(--text-md); margin: var(--space-5) 0 var(--space-2); }
.hyperdoc-prose h1:first-child, .hyperdoc-prose h2:first-child, .hyperdoc-prose h3:first-child { margin-top: 0; }
.hyperdoc-prose p { margin: 0 0 var(--space-3); }
.hyperdoc-prose ul, .hyperdoc-prose ol { margin: 0 0 var(--space-3); padding-left: var(--space-6); }
.hyperdoc-prose li { margin-bottom: var(--space-1); }
.hyperdoc-prose li > ul, .hyperdoc-prose li > ol { margin: var(--space-1) 0 0; }
.hyperdoc-prose strong { font-weight: var(--weight-semibold); color: var(--text-on-surface); }
.hyperdoc-prose a { color: var(--accent-blue); }
.hyperdoc-prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-xs);
  padding: 1px 5px;
}
.hyperdoc-prose pre {
  background: var(--surface-2);
  border: 1px solid var(--border-faint);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  margin: 0 0 var(--space-3);
}
.hyperdoc-prose pre code { background: none; border: none; padding: 0; }
.hyperdoc-prose blockquote {
  border-left: 1px solid var(--border-emphasis);
  padding-left: var(--space-4);
  margin: 0 0 var(--space-3);
  color: var(--text-on-surface-muted);
}
.hyperdoc-prose table {
  border-collapse: collapse;
  margin: 0 0 var(--space-4);
  font-size: var(--text-sm);
  width: 100%;
}
.hyperdoc-prose th, .hyperdoc-prose td {
  border: 1px solid var(--border-base);
  padding: 6px 10px;
  text-align: left;
}
.hyperdoc-prose th {
  background: var(--surface-2);
  font-weight: var(--weight-semibold);
}
.hyperdoc-prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-base);
  margin: var(--space-4) 0;
  display: block;
  box-shadow: var(--shadow-md);
}
.hyperdoc-prose iframe {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: none;
  border-radius: var(--radius-lg);
  margin: var(--space-4) 0;
}
