:root {
  color-scheme: dark;
  --bg: #0d1110;
  --panel: #141a18;
  --panel-raised: #19211e;
  --line: #2b3732;
  --line-strong: #3c4d45;
  --text: #e8eee9;
  --muted: #95a29b;
  --accent: #83d4a5;
  --accent-strong: #b1ecc8;
  --amber: #e4bd72;
  --danger: #ef8f86;
  --shadow: 0 18px 48px rgb(0 0 0 / 24%);
  --radius: 10px;
  --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { min-height: 100%; height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 75% 0%, rgb(64 117 88 / 10%), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
}

button, input, select, textarea { font: inherit; }
button { color: inherit; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgb(13 17 16 / 92%);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand-lockup, .topbar-actions, .record-header, .notes-panel__header {
  display: flex;
  align-items: center;
}

.brand-lockup { gap: 12px; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: linear-gradient(145deg, #223329, #15201b);
  color: var(--accent-strong);
  font: 700 12px/1 var(--font-mono);
  letter-spacing: .12em;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 3%);
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 17px; letter-spacing: -.02em; }
h2 { margin-bottom: 0; font-size: 18px; letter-spacing: -.02em; }
h3 { font-size: 15px; }
.eyebrow {
  margin-bottom: 3px;
  color: var(--accent);
  font: 700 10px/1.2 var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}

.topbar-actions { gap: 9px; }
.editor-field {
  display: grid;
  gap: 3px;
  width: 150px;
}
.editor-field span {
  color: var(--muted);
  font: 600 9px/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.editor-field input { min-height: 31px; padding: 6px 9px; }
.button {
  min-height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 13px;
  background: var(--panel-raised);
  cursor: pointer;
}
.button--primary { background: var(--accent); border-color: var(--accent); color: #0c1610; font-weight: 750; }
.button--ghost { background: transparent; }
.button--danger { border-color: rgb(239 143 134 / 65%); color: var(--danger); background: rgb(239 143 134 / 8%); }
.button--danger:not(:disabled):hover { border-color: var(--danger); background: rgb(239 143 134 / 16%); }
.button--small { min-height: 30px; padding: 0 10px; font-size: 12px; }
.button:disabled { opacity: .48; cursor: not-allowed; }
.button:not(:disabled):hover { border-color: var(--accent); }

kbd, .file-chip {
  font: 600 10px/1 var(--font-mono);
  color: var(--muted);
}
.button kbd { margin-left: 7px; color: currentColor; opacity: .72; }

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}
.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgb(228 189 114 / 10%);
}
.status-pill--online::before { background: var(--accent); box-shadow: 0 0 0 3px rgb(131 212 165 / 10%); }

.workspace {
  display: grid;
  grid-template-columns: minmax(230px, 18vw) minmax(520px, 1fr) minmax(270px, 23vw);
  height: calc(100vh - 72px);
  min-height: 0;
}
body.is-catalog-table .workspace { grid-template-columns: minmax(370px, 31vw) minmax(450px, 1fr) minmax(270px, 23vw); }

.catalog-panel, .record-panel, .notes-panel { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.catalog-panel, .notes-panel { background: rgb(20 26 24 / 68%); }
.catalog-panel { border-right: 1px solid var(--line); padding: 16px; }
.record-panel { padding: 22px clamp(22px, 3vw, 44px) 56px; }
.notes-panel { border-left: 1px solid var(--line); padding: 18px; }

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0f1412;
}
.mode-switch--three { grid-template-columns: repeat(3, 1fr); }
.mode-switch__item, .notes-tab {
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 8px 10px;
  cursor: pointer;
}
.mode-switch__item.is-active, .notes-tab.is-active { background: var(--panel-raised); color: var(--text); }

.search-field {
  display: flex;
  align-items: center;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0f1412;
}
.search-field input {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}
.search-field kbd { padding-right: 9px; }

.catalog-summary {
  display: flex;
  justify-content: space-between;
  margin: 14px 2px 9px;
  color: var(--muted);
  font-size: 11px;
}
.catalog-summary__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 7px 10px; }
.catalog-view-switch {
  display: inline-flex;
  margin: 0 2px 10px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0f1412;
}
.catalog-view-switch__item {
  border: 0;
  border-radius: 5px;
  padding: 5px 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
}
.catalog-view-switch__item.is-active { background: var(--panel-raised); color: var(--text); }
.catalog-filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 9px;
}
.catalog-filters select { min-width: 0; padding: 8px 7px; font-size: 11px; }
.link-button {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  font: inherit;
}
.link-button--danger { color: #ef8f84; }
.link-button:disabled { cursor: wait; opacity: .55; }
.empty-list {
  margin-top: 64px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
}
.empty-list__icon { display: block; margin-bottom: 12px; color: var(--accent); font-size: 26px; }
.empty-list strong { color: var(--text); }
.empty-list p { max-width: 210px; margin: 7px auto 0; font-size: 12px; line-height: 1.55; }

.record-list { display: grid; gap: 6px; }
.catalog-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101614;
}
.catalog-table {
  width: 100%;
  min-width: 610px;
  border-collapse: collapse;
  color: var(--muted);
  font-size: 11px;
  text-align: left;
}
.catalog-table th, .catalog-table td { padding: 8px 7px; border-bottom: 1px solid rgb(43 55 50 / 72%); vertical-align: middle; }
.catalog-table th { color: var(--muted); font-size: 10px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.catalog-table th:first-child, .catalog-table td:first-child { width: 28px; padding-right: 0; }
.catalog-table td:first-child input { width: 14px; height: 14px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.catalog-table tbody tr { transition: background 120ms ease; }
.catalog-table tbody tr:hover { background: var(--panel-raised); }
.catalog-table tbody tr.is-active { background: rgb(131 212 165 / 8%); }
.catalog-table tbody tr:last-child td { border-bottom: 0; }
.catalog-table__open {
  display: grid;
  grid-template-columns: 27px minmax(0, 1fr);
  width: 100%;
  align-items: center;
  gap: 7px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.catalog-table__open > span:last-child { display: grid; min-width: 0; gap: 2px; }
.catalog-table__open strong, .catalog-table__open small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-table__open strong { font-size: 12px; }
.catalog-table__open small { color: var(--muted); font-size: 10px; }
.catalog-table__icon {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111916;
  color: var(--accent);
  font-size: 13px;
}
.catalog-table__icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.catalog-table__icon:not(.is-fallback) > span { display: none; }
.catalog-table__icon.is-fallback img { display: none; }
.catalog-table__status { display: inline-flex; align-items: flex-start; gap: 5px; color: var(--text); line-height: 1.3; }
.catalog-table__status .status-dot { margin-top: 3px; }
.record-list-item {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: stretch;
  gap: 7px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
}
.record-list-item:hover { background: var(--panel-raised); border-color: var(--line); }
.record-list-item.is-active { background: rgb(131 212 165 / 7%); border-color: rgb(131 212 165 / 38%); }
.record-list-item__select { display: grid; place-items: start center; padding-top: 10px; cursor: pointer; }
.record-list-item__select input { width: 14px; height: 14px; accent-color: var(--accent); cursor: pointer; }
.record-list-item__open {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 9px;
  min-width: 0;
  padding: 4px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.record-list-item__icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111916;
  color: var(--accent);
  font-size: 20px;
}
.record-list-item__icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.record-list-item__icon:not(.is-fallback) > span { display: none; }
.record-list-item__icon.is-fallback img { display: none; }
.record-list-item__content { display: grid; min-width: 0; gap: 5px; padding: 1px 0; }
.record-list-item__top { display: flex; justify-content: space-between; gap: 8px; }
.record-list-item__top strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.record-list-item__meta, .record-list-item__date { color: var(--muted); font-size: 10px; line-height: 1.4; }
.status-dot { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--muted); }
.status-dot--positive { background: var(--accent); }
.status-dot--negative { background: var(--danger); }
.status-dot--warning { background: var(--amber); }

.record-header { justify-content: space-between; margin-bottom: 24px; }
.record-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; }
.record-meta { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.save-indicator { color: var(--muted); font-size: 12px; }
.save-dot { width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--amber); }
.save-indicator.is-saving .save-dot { background: var(--amber); animation: pulse 900ms infinite alternate; }
.save-indicator:not(.is-dirty):not(.is-saving) .save-dot { background: var(--accent); }

@keyframes pulse { to { opacity: .35; } }

.welcome-state {
  min-height: calc(100vh - 170px);
  display: grid;
  place-content: center;
  justify-items: start;
  max-width: 470px;
  margin: auto;
}
.welcome-state__mark { color: var(--accent); font-size: 46px; line-height: 1; margin-bottom: 18px; }
.welcome-state h2 { margin-bottom: 9px; font-size: clamp(24px, 3vw, 38px); }
.welcome-state > p:not(.eyebrow) { color: var(--muted); line-height: 1.65; }
.welcome-state .button { margin-top: 12px; }

.conflict-banner {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid rgb(228 189 114 / 42%);
  border-radius: 8px;
  background: rgb(228 189 114 / 8%);
  color: #decba5;
}
.conflict-banner[hidden] { display: none; }
.conflict-banner div { display: grid; gap: 3px; }
.conflict-banner span { font-size: 11px; }
.conflict-banner button { border: 0; background: transparent; color: var(--accent); cursor: pointer; font-weight: 700; }

.record-form { display: grid; gap: 16px; }
.form-section {
  margin: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgb(25 33 30 / 82%), rgb(20 26 24 / 82%));
  box-shadow: var(--shadow);
}
.form-section > legend { padding: 0 7px; color: var(--accent-strong); font-weight: 700; font-size: 12px; }
.form-section > legend span {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  margin-right: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--muted);
  font: 600 9px/1 var(--font-mono);
}
.section-description { margin: -2px 0 17px; color: var(--muted); font-size: 11px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid--2 { grid-template-columns: 1fr 1fr; }
.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field--full { grid-column: 1 / -1; }
.field--compact { margin-top: 18px; }
.field > span { color: #cbd5cf; font-size: 12px; font-weight: 650; }
.field__header { min-height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.field__header > label,
.field__header > span { color: #cbd5cf; font-size: 12px; font-weight: 650; }
.field-na-toggle {
  width: auto;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
}
.field-na-toggle:hover { border-color: var(--line-strong); color: var(--text); }
.field-na-toggle.is-active { border-color: #98784b; background: rgb(190 145 76 / 11%); color: #e3bd82; }
.field--not-applicable > input,
.field--not-applicable > select,
.field--not-applicable > textarea,
.field--not-applicable .division-options { opacity: .38; }
.field--filled {
  position: relative;
  padding: 9px;
  margin: -9px -9px 5px;
  border: 1px solid rgb(131 212 165 / 34%);
  border-radius: 9px;
  background: linear-gradient(110deg, rgb(131 212 165 / 10%), transparent 58%);
}
.field--filled::before {
  content: "preenchido";
  position: absolute;
  top: -8px;
  right: 8px;
  padding: 2px 6px;
  border: 1px solid rgb(131 212 165 / 42%);
  border-radius: 999px;
  background: #17241d;
  color: var(--accent-strong);
  font: 700 8px/1 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.field--not-applicable {
  position: relative;
  padding: 10px;
  margin: -10px -10px 4px;
  border: 1px dashed rgb(228 189 114 / 62%);
  border-radius: 9px;
  background: repeating-linear-gradient(-45deg, rgb(228 189 114 / 10%) 0 8px, rgb(228 189 114 / 4%) 8px 16px);
}
.field--not-applicable::before {
  content: "não aplicável";
  position: absolute;
  top: -9px;
  right: 8px;
  padding: 3px 7px;
  border: 1px solid rgb(228 189 114 / 65%);
  border-radius: 999px;
  background: #292218;
  color: #f0ca8a;
  font: 700 8px/1 var(--font-mono);
  letter-spacing: .06em;
  text-transform: uppercase;
}
.field--not-applicable.field--filled::before { content: "não aplicável · valor preservado"; }
input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; }
.field-control-row { display: flex; align-items: stretch; gap: 7px; }
.field-control-row > input { min-width: 0; }
.metadata-lookup-button {
  flex: 0 0 auto;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgb(131 212 165 / 9%);
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.metadata-lookup-button:hover { background: rgb(131 212 165 / 15%); }
.metadata-lookup-button:disabled { opacity: .55; cursor: wait; }
.field-note { color: var(--muted); font-size: 10px; line-height: 1.4; }

.staging-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgb(131 212 165 / 30%);
  border-radius: var(--radius);
  background: linear-gradient(125deg, rgb(131 212 165 / 10%), rgb(20 26 24 / 86%));
}
.staging-panel h3 { margin-bottom: 7px; }
.jar-metadata { display: grid; gap: 4px; padding: 10px 12px; border-left: 3px solid var(--accent); background: rgb(131 212 165 / 8%); color: var(--muted); font-size: 12px; }
.jar-metadata strong { color: var(--text); }
.jar-metadata code { color: var(--accent-strong); }
.source-indicators { display: flex; flex-wrap: wrap; gap: 9px; }
.source-indicator-wrap { display: grid; grid-template-columns: 1fr auto; align-items: stretch; min-width: 198px; }
.source-indicator { display: grid; grid-template-columns: auto 1fr; gap: 1px 7px; min-width: 152px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: #101513; color: var(--text); text-align: left; }
.source-indicator-wrap .source-indicator { min-width: 0; border-radius: 8px 0 0 8px; }
.source-indicator > span { grid-row: 1 / 3; width: 9px; height: 9px; align-self: center; border-radius: 50%; background: var(--muted); }
.source-indicator small { color: var(--muted); font-size: 10px; }
.source-indicator--exact { border-color: rgb(131 212 165 / 55%); cursor: pointer; }
.source-indicator--exact > span { background: var(--accent); box-shadow: 0 0 0 3px rgb(131 212 165 / 12%); }
.source-indicator--missing > span { background: var(--danger); }
.source-indicator--error > span { background: var(--danger); }
.source-indicator--ambiguous > span, .source-indicator--candidate > span { background: var(--amber); }
.source-indicator:disabled { opacity: .78; cursor: default; }
.source-refresh { padding: 0 8px; border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0; background: #141a17; color: var(--muted); font: 700 9px/1 var(--font-mono); cursor: pointer; }
.source-refresh:hover { color: var(--accent-strong); background: rgb(131 212 165 / 10%); }
.staging-candidates { display: grid; gap: 7px; padding-top: 12px; border-top: 1px solid var(--line); }
.staging-candidates button { padding: 8px; border: 1px solid var(--line); border-radius: 7px; background: #101513; color: var(--accent-strong); text-align: left; cursor: pointer; }

.analysis-state { max-width: 1500px; }
.analysis-state__header { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 20px; }
.analysis-state__header > div > p:not(.eyebrow) { margin: 7px 0 0; color: var(--muted); }
.analysis-controls { display: grid; grid-template-columns: minmax(220px, 1fr) 180px 150px auto; gap: 8px; margin-bottom: 14px; }
.analysis-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.analysis-stats > span, .analysis-pill { display: inline-block; padding: 6px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-raised); color: var(--muted); font-size: 11px; }
.analysis-stats strong { color: var(--text); }
.analysis-pill--suporte { border-color: #427ca5; color: #9bcce9; }
.analysis-pill--qol { border-color: #8f753d; color: #edd08b; }
.analysis-pill--secundario { border-color: #73558f; color: #d2afee; }
.analysis-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.analysis-table { width: 100%; min-width: 1050px; border-collapse: collapse; font-size: 11px; }
.analysis-table th, .analysis-table td { padding: 9px; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; }
.analysis-table th { position: sticky; top: 72px; background: #19211e; }
.analysis-table small { color: var(--muted); }
.analysis-present { color: var(--accent); font-weight: 800; text-align: center !important; }
.analysis-absent { color: #647169; text-align: center !important; }
.analysis-documents { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.analysis-document-links { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 16px; }
.analysis-document-links button { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; }
.analysis-document-links button.is-active { border-color: var(--accent); color: var(--accent-strong); background: rgb(131 212 165 / 8%); }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  background: #101513;
  color: var(--text);
  padding: 10px 11px;
}
textarea { resize: vertical; line-height: 1.5; }
input::placeholder, textarea::placeholder { color: #69766f; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgb(131 212 165 / 8%); }

.division-field {
  margin: 0 0 14px;
  padding: 0;
  border: 0;
}
.division-field > legend { margin-bottom: 7px; padding: 0; color: #cbd5cf; font-size: 12px; font-weight: 650; }
.division-field > .field__header { margin-bottom: 7px; }
.division-options { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.division-options label { cursor: pointer; }
.division-options input { position: absolute; opacity: 0; pointer-events: none; }
.division-options span {
  display: grid;
  place-items: center;
  min-height: 35px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #101513;
  color: var(--muted);
  font-size: 11px;
}
.division-options input:checked + span { border-color: var(--accent); background: rgb(131 212 165 / 9%); color: var(--accent-strong); }

.notes-panel__header { justify-content: space-between; }
.icon-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel-raised);
  color: var(--accent);
  cursor: pointer;
}
.file-chip { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #101513; }
.notes-tabs { display: flex; gap: 3px; margin: 18px 0; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.notes-tab { padding: 6px 9px; font-size: 12px; }
.notes-tab:disabled { opacity: .45; }
.markdown-preview { color: #bec9c2; line-height: 1.65; }
.markdown-preview h3 { color: var(--text); }
.markdown-preview ul { padding-left: 18px; }
.markdown-preview li { margin-bottom: 8px; }
.markdown-preview blockquote {
  margin: 18px 0 0;
  padding: 11px 13px;
  border-left: 2px solid var(--amber);
  background: rgb(228 189 114 / 6%);
  color: #decba5;
}
.markdown-preview pre {
  overflow: auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #0d1210;
  color: #cbd5cf;
  font: 11px/1.55 var(--font-mono);
}
.markdown-preview code { font-family: var(--font-mono); color: var(--accent-strong); }
.markdown-preview a { color: var(--accent); }
.markdown-preview ol { padding-left: 20px; }
.muted-copy { color: var(--muted); }

.note-editor { display: grid; gap: 9px; }
.note-editor textarea { min-height: calc(100vh - 310px); resize: vertical; font-family: var(--font-mono); font-size: 11px; line-height: 1.55; tab-size: 2; }
.note-editor__footer { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); font-size: 10px; }
.code-editor { color: #cce6d6; }

.menu-wrap { position: relative; }
.popover-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  min-width: 230px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: #18201d;
  box-shadow: var(--shadow);
}
.popover-menu button { width: 100%; padding: 9px; border: 0; border-radius: 6px; background: transparent; color: var(--text); text-align: left; cursor: pointer; font-size: 12px; }
.popover-menu button:hover { background: rgb(131 212 165 / 8%); color: var(--accent-strong); }
.popover-menu hr { border: 0; border-top: 1px solid var(--line); }

.dialog {
  width: min(92vw, 510px);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: #151c19;
  color: var(--text);
  box-shadow: 0 28px 90px rgb(0 0 0 / 55%);
}
.dialog::backdrop { background: rgb(4 7 6 / 72%); backdrop-filter: blur(4px); }
.dialog form { display: grid; gap: 13px; }
.dialog header h2 { margin-top: 4px; }
.dialog footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 5px; }
.vault-dialog { width: min(92vw, 560px); }
.vault-state {
  margin: 0;
  padding: 10px 11px;
  border: 1px solid rgb(131 212 165 / 35%);
  border-radius: 8px;
  background: rgb(131 212 165 / 7%);
  color: var(--accent-strong);
  font-size: 12px;
  line-height: 1.45;
}
.vault-section { display: grid; gap: 9px; padding-top: 3px; }
.vault-section + .vault-section { margin-top: 4px; padding-top: 15px; border-top: 1px solid var(--line); }
.vault-section h3 { margin: 0; font-size: 13px; }
.vault-section label { display: grid; gap: 5px; color: #cbd5cf; font-size: 12px; }
.vault-section .muted-copy { margin: 0; font-size: 11px; line-height: 1.5; }
.choice-card { display: flex; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.choice-card:has(input:checked) { border-color: var(--accent); background: rgb(131 212 165 / 7%); }
.choice-card input { width: auto; }
.choice-card span { display: grid; gap: 3px; }
.choice-card small { color: var(--muted); }
.shortcut-list { display: grid; gap: 5px; margin: 0; }
.shortcut-list div { display: grid; grid-template-columns: 110px 1fr; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.shortcut-list dt, .shortcut-list dd { margin: 0; }
.shortcut-list dd { color: var(--muted); }

.remote-search-dialog { width: min(94vw, 980px); max-height: min(86vh, 800px); padding: 20px; }
.remote-search-dialog__header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 16px; }
.remote-search-dialog__header h2 { margin-top: 4px; }
.remote-search-controls { display: grid; grid-template-columns: minmax(220px, 1fr) 170px 130px 135px auto; gap: 8px; }
.remote-search-query input { min-height: 38px; }
.remote-search-source-state { display: flex; flex-wrap: wrap; gap: 7px; min-height: 30px; padding: 10px 0 4px; }
.remote-source-state { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 11px; }
.remote-source-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.remote-source-state--ready::before { background: var(--accent); }
.remote-source-state--error::before { background: var(--danger); }
.remote-source-state--skipped::before { background: var(--muted); }
.remote-search-hint { margin: 10px 0 14px; }
.remote-search-results { display: grid; gap: 8px; min-height: 210px; max-height: min(52vh, 500px); padding-right: 4px; overflow: auto; }
.remote-result { display: grid; grid-template-columns: auto 52px minmax(0, 1fr) auto; gap: 11px; align-items: start; padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #101613; cursor: pointer; }
.remote-result:hover, .remote-result.is-active { border-color: rgb(131 212 165 / 65%); background: rgb(131 212 165 / 7%); }
.remote-result.is-selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgb(131 212 165 / 16%); }
.remote-result__select { display: grid; place-items: center; min-height: 52px; }
.remote-result__select input { width: 16px; height: 16px; accent-color: var(--accent); }
.remote-result__icon { display: grid; width: 52px; height: 52px; place-items: center; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-raised); color: var(--accent); font-size: 18px; }
.remote-result__icon img { display: block; width: 100%; height: 100%; object-fit: cover; }
.remote-result__content { min-width: 0; }
.remote-result__title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 7px; }
.remote-result__title strong { font-size: 15px; }
.remote-result__summary { margin: 5px 0 8px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.remote-result__meta, .remote-result__sources { display: flex; flex-wrap: wrap; gap: 5px; }
.remote-result__meta span, .remote-result__sources span, .remote-result__existing { padding: 3px 6px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 10px; }
.remote-result__sources span { color: var(--accent-strong); }
.remote-result__existing { align-self: start; color: var(--amber); border-color: rgb(228 189 114 / 48%); background: rgb(228 189 114 / 8%); }
.remote-result__open-existing { border: 0; padding: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 11px; }
.remote-search-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 15px; padding-top: 13px; border-top: 1px solid var(--line); }
.remote-search-footer__actions { display: flex; align-items: center; gap: 12px; }
.remote-search-footer kbd { margin: 0 1px; }

.toast-region { position: fixed; right: 18px; bottom: 50px; z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 360px; padding: 11px 13px; border: 1px solid var(--line-strong); border-radius: 8px; background: #1a231f; color: var(--text); box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: 160ms ease; font-size: 12px; }
.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast--success { border-color: rgb(131 212 165 / 52%); }
.toast--warning { border-color: rgb(228 189 114 / 52%); }
.toast--error { border-color: rgb(239 143 134 / 55%); }

.shortcut-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  border-top: 1px solid var(--line);
  background: rgb(13 17 16 / 95%);
  color: var(--muted);
  font-size: 11px;
  backdrop-filter: blur(16px);
}

@media (max-width: 1080px) {
  .workspace { grid-template-columns: 250px minmax(0, 1fr); }
  body.is-catalog-table .workspace { grid-template-columns: minmax(330px, 38vw) minmax(0, 1fr); }
  .notes-panel { display: none; }
}

@media (max-width: 720px) {
  .topbar { height: auto; min-height: 68px; padding: 12px 14px; }
  .status-pill, .button--ghost, .button kbd, .editor-field { display: none; }
  body { overflow: auto; }
  .workspace, body.is-catalog-table .workspace { display: block; height: auto; min-height: calc(100vh - 68px); }
  .catalog-panel, .record-panel, .notes-panel { overflow: visible; }
  .catalog-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .catalog-table { min-width: 560px; }
  .empty-list { margin-top: 18px; }
  .record-panel { padding: 20px 14px 70px; }
  .form-grid--2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .field--full { grid-column: auto; }
  .division-options { grid-template-columns: repeat(2, 1fr); }
  .record-header { align-items: flex-start; gap: 12px; }
  .record-actions { display: grid; justify-items: end; }
  .mode-switch--three { font-size: 11px; }
  .analysis-state__header { display: grid; }
  .analysis-controls { grid-template-columns: 1fr; }
  .remote-search-controls { grid-template-columns: 1fr 1fr; }
  .remote-search-query { grid-column: 1 / -1; }
  .remote-search-footer { align-items: flex-start; flex-direction: column; }
  .source-indicator { flex: 1 1 145px; }
  .shortcut-bar { display: none; }
}
