:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --line: #d8e1ee;
  --ink: #122038;
  --muted: #5b6b84;
  --brand: #0f766e;
  --brand-soft: #e6f6f4;
  --warn-bg: #fef3c7;
  --warn-ink: #92400e;
  --blue: #1d4ed8;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg); color: var(--ink);
}
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 16px 24px; background: #0f172a; color: #f8fafc;
}
.brand { display: flex; align-items: center; gap: 14px; }
.mark {
  width: 42px; height: 42px; border-radius: 10px; display: grid; place-items: center;
  background: #14b8a6; color: #042f2e; font-weight: 900; font-size: 16px;
}
.topbar h1 { margin: 0; font-size: 18px; }
.topbar p { margin: 3px 0 0; font-size: 12px; color: #94a3b8; }
.status-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  padding: 4px 10px; border-radius: 999px; font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,0.12); color: #e2e8f0;
}
.pill.ok { background: #dcfce7; color: #166534; }
.pill.nr { background: var(--warn-bg); color: var(--warn-ink); }

.container { width: min(1280px, calc(100% - 32px)); margin: 18px auto 40px; display: grid; gap: 16px; }
.search-panel, .panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px;
}
.search-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
input[type="text"], select {
  padding: 10px 12px; border-radius: 8px; border: 1px solid #c3d0e4; font: inherit; font-size: 14px;
}
.btn {
  padding: 10px 16px; border-radius: 8px; border: 1px solid #c3d0e4;
  background: #fff; color: var(--ink); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
.btn.primary { background: var(--brand); color: #fff; border: 0; }
.btn.primary:hover { background: #0d625c; }
.btn.small { padding: 6px 10px; font-size: 12px; }
.btn.ghost { background: #f8fafc; }

.presets { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.chip {
  padding: 5px 10px; border-radius: 999px; border: 1px solid #cbd5e1;
  background: #f8fafc; color: #334155; font-size: 12px; cursor: pointer; font-weight: 600;
}
.chip.active { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.filters-row {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 12px;
}
.filters-row label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 600; }
.toggle-lbl { cursor: pointer; color: var(--ink) !important; }
.translated-box {
  margin-top: 12px; padding: 10px 12px; border-radius: 8px;
  background: #f8fafc; border: 1px solid var(--line);
}
.t-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.kicker { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--brand); font-weight: 800; }
.translated-box code {
  display: block; font-family: ui-monospace, monospace; font-size: 12px; color: #0f172a; line-height: 1.45;
}

.workspace { display: grid; grid-template-columns: 420px 1fr; gap: 16px; align-items: start; }
.left-col, .right-col { display: grid; gap: 16px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
h2 { margin: 0; font-size: 15px; }
.muted { color: var(--muted); font-size: 12px; }

.study-list { display: grid; gap: 10px; }
.study-card {
  padding: 12px; border-radius: 10px; border: 1px solid var(--line); cursor: pointer;
  background: #fcfdff; transition: border-color 0.15s;
}
.study-card:hover, .study-card.active { border-color: var(--brand); background: var(--brand-soft); }
.study-card h3 { margin: 0 0 6px; font-size: 13.5px; line-height: 1.35; }
.study-meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: 11px; color: var(--muted); }
.src-tag { padding: 2px 6px; border-radius: 5px; background: #e2e8f0; color: #1e293b; font-weight: 700; }

.anchor-box { font-size: 13px; line-height: 1.55; }
.quote-block {
  margin: 10px 0; padding: 10px 12px; border-left: 3px solid var(--brand);
  background: #f0fdfa; border-radius: 0 8px 8px 0; font-style: italic; color: #134e4a;
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; font-size: 12px; }
.field-item { padding: 8px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--line); }
.field-item span { display: block; color: var(--muted); font-size: 11px; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 7px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: #f8fafc; color: #334155; font-size: 12px; font-weight: 700; cursor: pointer;
}
.tab.active { background: #0f172a; color: #fff; border-color: #0f172a; }
.export-btns { display: flex; gap: 6px; }

.output-area { font-size: 13.5px; line-height: 1.6; }
table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 12px; }
th, td { border: 1px solid var(--line); padding: 8px; text-align: left; vertical-align: top; }
th { background: #f1f5f9; font-weight: 700; }
.cite { color: var(--blue); font-weight: 700; font-size: 11px; }
.nr-tag { display: inline-block; padding: 1px 6px; border-radius: 5px; background: var(--warn-bg); color: var(--warn-ink); font-weight: 700; font-size: 11px; }

.audit-log { display: grid; gap: 6px; max-height: 190px; overflow-y: auto; font-family: ui-monospace, monospace; font-size: 11.5px; }
.audit-row { padding: 7px 9px; border-radius: 7px; background: #f8fafc; border: 1px solid var(--line); }

@media (max-width: 960px) {
  .workspace { grid-template-columns: 1fr; }
  .search-row { grid-template-columns: 1fr; }
}
@media print {
  .topbar, .search-panel, .left-col, .export-btns, .tabs { display: none; }
  .workspace { grid-template-columns: 1fr; }
}
