/* ============================================================
   Taxonomy editor — base styles
   Mirrors property module's brand tokens. Will be lifted to
   src/shared/lmvh-tokens.css when a third reuser appears.
   ============================================================ */

:root {
  --lmvh-ink: #151F4A;
  --lmvh-ink-deep: #0D1535;
  --lmvh-tint-50: #F2F3F9;
  --lmvh-tint-100: #EAECF5;
  --lmvh-tint-200: #C8CCE8;
  --lmvh-tint-400: #7A84C4;
  --lmvh-surface: #FAFAF8;
  --lmvh-surface-2: #F3F1EC;
  --lmvh-surface-3: #E8E4DC;
  --lmvh-border: #D8D2C8;
  --lmvh-border-light: #EAE6DF;
  --lmvh-text: #1A1714;
  --lmvh-text-mid: #4A4540;
  --lmvh-text-light: #8A837C;
  --lmvh-success: #2D6A4F;
  --lmvh-success-bg: #E8F5EE;
  --lmvh-warn: #B45309;
  --lmvh-danger: #B42318;
  --lmvh-font-display: 'DM Serif Display', Georgia, serif;
  --lmvh-font-ui: 'Jost', system-ui, -apple-system, sans-serif;
  --lmvh-font-mono: 'DM Mono', 'Courier New', monospace;
  --lmvh-radius: 6px;
  --lmvh-radius-lg: 10px;
  --lmvh-radius-xl: 14px;
  --lmvh-shadow: 0 4px 16px rgba(21, 31, 74, 0.10);
}

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

body {
  font-family: var(--lmvh-font-ui);
  font-size: 14px;
  color: var(--lmvh-text);
  background: var(--lmvh-surface);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* === Header === */
.header {
  background: var(--lmvh-ink);
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  flex-shrink: 0;
}
.header-left, .header-right { display: flex; align-items: center; gap: 16px; }
.header-logo { height: 30px; width: auto; display: block; }
.header-divider { width: 1px; height: 22px; background: rgba(255,255,255,0.2); }
.header-title {
  font-family: var(--lmvh-font-ui);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.7);
}
.header-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: rgba(255,255,255,0.7); letter-spacing: 0.04em;
}
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--lmvh-tint-400); display: inline-block; }
.status-dot.live { background: #4ADE80; }
.status-dot.error { background: #F87171; }
.nav-link {
  font-size: 12px; color: rgba(255,255,255,0.85); text-decoration: none;
  letter-spacing: 0.04em; padding: 6px 10px; border-radius: var(--lmvh-radius);
  transition: background 0.15s ease;
}
.nav-link:hover { background: rgba(255,255,255,0.1); }
.header-icon-btn {
  width: 30px; height: 30px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--lmvh-radius);
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  transition: all 0.15s ease;
}
.header-icon-btn:hover {
  background: rgba(255,255,255,0.1);
  color: white;
}

/* === Toolbar === */
.toolbar {
  background: white;
  border-bottom: 1px solid var(--lmvh-border-light);
  padding: 10px 1.75rem;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  flex-shrink: 0;
}
.toolbar-group { display: flex; align-items: center; gap: 8px; }
.toolbar-right { margin-left: auto; }

/* === Buttons === */
.btn {
  font-family: var(--lmvh-font-ui);
  font-size: 12px; font-weight: 500; letter-spacing: 0.03em;
  padding: 7px 14px; border-radius: var(--lmvh-radius);
  border: 1px solid var(--lmvh-border);
  background: white; color: var(--lmvh-text);
  cursor: pointer; transition: all 0.15s ease;
}
.btn:hover:not(:disabled) { border-color: var(--lmvh-tint-200); background: var(--lmvh-tint-50); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--lmvh-ink); color: white; border-color: var(--lmvh-ink); }
.btn-primary:hover:not(:disabled) { background: var(--lmvh-ink-deep); border-color: var(--lmvh-ink-deep); }
.btn-ghost { background: transparent; border-color: var(--lmvh-border-light); }
.btn-danger { color: var(--lmvh-danger); border-color: var(--lmvh-border-light); }
.btn-danger:hover:not(:disabled) { background: #FEF2F2; border-color: #FECACA; }
.btn-danger-solid { background: var(--lmvh-danger); color: white; border-color: var(--lmvh-danger); }
.btn-danger-solid:hover:not(:disabled) { background: #991B1B; border-color: #991B1B; }
.btn-icon {
  padding: 4px; width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-color: transparent; background: transparent; color: var(--lmvh-text-light);
}
.btn-icon:hover:not(:disabled) {
  color: var(--lmvh-ink); background: var(--lmvh-tint-50); border-color: var(--lmvh-border-light);
}
.btn-icon-danger:hover:not(:disabled) { color: var(--lmvh-danger); background: #FEF2F2; }

/* === Body layout === */
.body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1px;
  background: var(--lmvh-border-light);
  overflow: hidden;
}
.tree-pane {
  background: white;
  overflow: auto;
  padding: 1.25rem 1.5rem;
}
.detail-pane {
  background: var(--lmvh-surface-2);
  overflow: auto;
  padding: 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
}

/* === Empty states === */
.empty-state { text-align: center; padding: 4rem 2rem; color: var(--lmvh-text-light); }
.empty-state-title { font-family: var(--lmvh-font-display); font-size: 20px; color: var(--lmvh-text-mid); margin-bottom: 0.5rem; }
.empty-state-msg { font-size: 13px; color: var(--lmvh-text-light); max-width: 420px; margin: 0 auto 1.25rem; line-height: 1.5; }
.empty-state-btn { margin-top: 0.5rem; }
.detail-empty { text-align: center; padding: 3rem 1rem; }
.detail-empty-msg { font-size: 12px; color: var(--lmvh-text-light); font-style: italic; }

/* === Tree === */
.tree-list {
  list-style: none;
  margin: 0; padding: 0;
}
.tree-root > .tree-node > .tree-row { background: var(--lmvh-tint-50); }
.tree-node {
  font-size: 13px;
}
.tree-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--lmvh-radius);
  cursor: pointer;
  border: 1px solid transparent;
}
.tree-row:hover { background: var(--lmvh-tint-50); border-color: var(--lmvh-border-light); }
.tree-row.selected { background: var(--lmvh-tint-100); border-color: var(--lmvh-tint-200); }
.tree-indent { display: inline-block; flex-shrink: 0; }
.tree-chevron {
  width: 14px; height: 14px; flex-shrink: 0;
  color: var(--lmvh-text-light);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.tree-chevron.no-children { visibility: hidden; }
.tree-tier {
  font-family: var(--lmvh-font-mono);
  font-size: 9px; font-weight: 500;
  color: var(--lmvh-text-light);
  background: white;
  border: 1px solid var(--lmvh-border-light);
  padding: 1px 4px; border-radius: 3px;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.tree-code {
  font-family: var(--lmvh-font-mono);
  font-size: 11px; font-weight: 500;
  color: var(--lmvh-ink);
  background: var(--lmvh-tint-50);
  border: 1px solid var(--lmvh-tint-100);
  padding: 2px 6px; border-radius: 3px;
  flex-shrink: 0;
}
.tree-name {
  font-weight: 400;
  color: var(--lmvh-text);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.tree-actions {
  display: flex; gap: 1px; margin-left: 8px;
  opacity: 0; transition: opacity 0.15s ease; flex-shrink: 0;
}
.tree-row:hover .tree-actions,
.tree-row.selected .tree-actions { opacity: 1; }

.tree-list .tree-list {
  margin-left: 22px;
  border-left: 1px dashed var(--lmvh-border-light);
  padding-left: 4px;
}

/* === Detail panel — forms and view === */
.detail-title {
  font-family: var(--lmvh-font-display);
  font-size: 18px;
  color: var(--lmvh-ink);
  margin-bottom: 4px;
  word-break: break-word;
}
.detail-sub {
  font-size: 11px;
  color: var(--lmvh-text-light);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}
.detail-rows { margin-bottom: 1.25rem; }
.detail-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--lmvh-border-light);
  font-size: 12px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row-label { color: var(--lmvh-text-light); letter-spacing: 0.03em; }
.detail-row-value { color: var(--lmvh-text); word-break: break-word; }
.detail-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding-top: 0.5rem;
  border-top: 1px solid var(--lmvh-border-light);
}

/* Detail panel system-metadata footer (Sort Key reference). */
.detail-foot {
  margin-top: auto;
  padding-top: 1.25rem;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 8pt;
  color: var(--lmvh-text-light);
  white-space: nowrap;
  overflow: hidden;
}
.detail-foot-label {
  font-family: var(--lmvh-font-ui);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 500;
  flex-shrink: 0;
}
.detail-foot-value {
  font-family: var(--lmvh-font-mono);
  letter-spacing: 0.02em;
  color: var(--lmvh-text-mid);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* === Forms === */
.form-row { margin-bottom: 1rem; }
.form-label {
  display: block;
  font-size: 11px; color: var(--lmvh-text-mid);
  font-weight: 500; letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  font-family: var(--lmvh-font-ui);
  font-size: 13px;
  padding: 8px 10px;
  border: 1px solid var(--lmvh-border);
  border-radius: var(--lmvh-radius);
  background: white;
  color: var(--lmvh-text);
}
.form-input:focus {
  outline: none;
  border-color: var(--lmvh-tint-400);
  box-shadow: 0 0 0 2px rgba(122, 132, 196, 0.15);
}
.form-textarea { resize: vertical; min-height: 60px; font-family: var(--lmvh-font-ui); }
.form-static { font-size: 12px; color: var(--lmvh-text-mid); padding: 4px 0; }
.form-error {
  font-size: 12px;
  color: var(--lmvh-danger);
  background: #FEF2F2;
  border: 1px solid #FECACA;
  border-radius: var(--lmvh-radius);
  padding: 8px 10px;
  margin-bottom: 1rem;
}
.form-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* === Code picker === */
.cp-wrap { display: flex; flex-direction: column; gap: 8px; }
.cp-label { font-size: 10px; color: var(--lmvh-text-light); letter-spacing: 0.04em; text-transform: uppercase; font-weight: 500; }
.cp-label-secondary { margin-top: 8px; }
.cp-suggestions { display: flex; flex-direction: column; gap: 4px; }
.cp-suggestion {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--lmvh-border-light);
  border-radius: var(--lmvh-radius);
  background: white;
  font-family: var(--lmvh-font-ui);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.cp-suggestion:hover { background: var(--lmvh-tint-50); border-color: var(--lmvh-tint-200); }
.cp-suggestion.selected { background: var(--lmvh-tint-100); border-color: var(--lmvh-tint-400); }
.cp-suggestion-code {
  font-family: var(--lmvh-font-mono); font-size: 11px; font-weight: 500;
  color: var(--lmvh-ink); background: var(--lmvh-tint-50);
  padding: 1px 5px; border-radius: 3px;
  flex-shrink: 0;
}
.cp-suggestion-name { color: var(--lmvh-text); }
.cp-input {
  width: 70px;
  font-family: var(--lmvh-font-mono);
  font-size: 14px;
  text-align: center;
  letter-spacing: 0.1em;
  padding: 6px 8px;
  border: 1px solid var(--lmvh-border);
  border-radius: var(--lmvh-radius);
  background: white;
}
.cp-radio-row { display: flex; gap: 6px; }
.cp-radio {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--lmvh-border-light);
  border-radius: var(--lmvh-radius);
  background: white;
  font-family: var(--lmvh-font-ui);
  font-size: 12px;
  cursor: pointer;
}
.cp-radio:hover { background: var(--lmvh-tint-50); }
.cp-radio.selected { background: var(--lmvh-tint-100); border-color: var(--lmvh-tint-400); color: var(--lmvh-ink); font-weight: 500; }
.cp-band-list { display: flex; flex-direction: column; gap: 3px; max-height: 240px; overflow: auto; }
.cp-band {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px;
  border: 1px solid var(--lmvh-border-light);
  border-radius: var(--lmvh-radius);
  background: white;
  font-family: var(--lmvh-font-ui);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}
.cp-band:hover { background: var(--lmvh-tint-50); }
.cp-band.selected { background: var(--lmvh-tint-100); border-color: var(--lmvh-tint-400); }
.cp-band-y {
  font-family: var(--lmvh-font-mono); font-weight: 500;
  color: var(--lmvh-ink); width: 16px; text-align: center;
}
.cp-band-name { color: var(--lmvh-text); }
.cp-preview {
  font-size: 11px;
  color: var(--lmvh-text-light);
  font-family: var(--lmvh-font-mono);
  padding: 6px 8px;
  background: var(--lmvh-surface-2);
  border-radius: var(--lmvh-radius);
}

/* === Confirm modal === */
.confirm-ov {
  position: fixed; inset: 0;
  background: rgba(13, 21, 53, 0.45);
  display: none; align-items: center; justify-content: center;
  z-index: 2000;
}
.confirm-ov.show { display: flex; }
.confirm-box {
  background: white;
  border-radius: var(--lmvh-radius-lg);
  box-shadow: var(--lmvh-shadow);
  width: 100%; max-width: 420px;
  padding: 1.5rem;
}
.confirm-box h3 {
  font-family: var(--lmvh-font-display);
  font-size: 18px;
  color: var(--lmvh-ink);
  margin-bottom: 0.5rem;
  font-weight: 400;
}
.confirm-box p {
  font-size: 13px;
  color: var(--lmvh-text-mid);
  line-height: 1.5;
  margin-bottom: 1.25rem;
}
.confirm-acts { display: flex; gap: 6px; justify-content: flex-end; }

/* === Settings overlay === */
.settings-ov {
  position: fixed; inset: 0;
  background: rgba(13, 21, 53, 0.35);
  display: none;
  z-index: 1900;
}
.settings-ov.show { display: block; }
.settings-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 420px;
  max-width: 100vw;
  background: white;
  box-shadow: -4px 0 20px rgba(13, 21, 53, 0.18);
  display: flex;
  flex-direction: column;
  animation: settings-slide-in 0.18s ease-out;
}
@keyframes settings-slide-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.settings-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 1.25rem;
  border-bottom: 1px solid var(--lmvh-border-light);
  flex-shrink: 0;
}
.settings-title {
  font-family: var(--lmvh-font-display);
  font-size: 18px;
  color: var(--lmvh-ink);
}
.settings-close {
  font-size: 22px;
  line-height: 1;
  color: var(--lmvh-text-light);
}
.settings-body {
  flex: 1;
  overflow: auto;
  padding: 1.25rem;
}
.settings-section {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--lmvh-border-light);
}
.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}
.settings-section-title {
  font-family: var(--lmvh-font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lmvh-text-mid);
  margin-bottom: 0.4rem;
}
.settings-section-desc {
  font-size: 12px;
  color: var(--lmvh-text-light);
  line-height: 1.5;
  margin-bottom: 0.75rem;
}
.settings-section-foot {
  font-size: 11px;
  color: var(--lmvh-text-light);
  font-style: italic;
  line-height: 1.5;
  margin-top: 0.75rem;
}
.settings-empty {
  font-size: 12px;
  color: var(--lmvh-text-light);
  font-style: italic;
  padding: 0.5rem 0;
}
.settings-list {
  list-style: none;
  margin: 0 0 0.75rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.settings-list-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--lmvh-surface-2);
  border-radius: var(--lmvh-radius);
  font-size: 12px;
}
.settings-list-code {
  font-family: var(--lmvh-font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--lmvh-ink);
  background: white;
  border: 1px solid var(--lmvh-border-light);
  padding: 1px 5px;
  border-radius: 3px;
  flex-shrink: 0;
}
.settings-list-name { color: var(--lmvh-text); }
.settings-actions { margin-top: 0.5rem; }

/* Tier reference list */
.settings-tier-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
}
.settings-tier-row {
  display: grid;
  grid-template-columns: 26px 32px 1fr 80px 70px;
  gap: 8px;
  align-items: center;
  padding: 4px 6px;
  border-radius: 4px;
}
.settings-tier-row.settings-tier-defined   { background: var(--lmvh-success-bg); }
.settings-tier-row.settings-tier-name-only { background: var(--lmvh-tint-50); }
.settings-tier-row.settings-tier-reserved  { background: transparent; opacity: 0.55; }
.settings-tier-pos {
  font-family: var(--lmvh-font-mono);
  font-size: 10px;
  color: var(--lmvh-text-light);
  text-align: center;
}
.settings-tier-code {
  font-family: var(--lmvh-font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--lmvh-ink);
}
.settings-tier-name {
  font-weight: 400;
  color: var(--lmvh-text);
}
.settings-tier-class,
.settings-tier-status {
  font-size: 10px;
  color: var(--lmvh-text-light);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-align: right;
}

/* === Toast === */
.toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--lmvh-ink); color: white;
  font-size: 12px; padding: 10px 18px;
  border-radius: var(--lmvh-radius);
  box-shadow: var(--lmvh-shadow);
  opacity: 0; pointer-events: none;
  transition: all 0.25s ease;
  z-index: 1000;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--lmvh-danger); }
.toast.success { background: var(--lmvh-success); }
