/* Тазализатор — аналитическая консоль для разбора ТЗ на мониторинг/реагирование.
   Дизайн-система: холодная «бумага», чернила-слейт, единственный акцент — бирюзовый.
   Семейство IBM Plex (Sans/Serif/Mono). Семантические цвета — у подсветки и статусов. */

:root {
  color-scheme: light;
  --paper: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #fbfcfd;
  --ink: #18212c;
  --muted: #5a6673;
  --faint: #8893a0;
  --line: #e5e9ee;
  --line-strong: #d3dae2;
  --accent: #0e7490;
  --accent-ink: #0a5566;
  --accent-soft: #e4f1f4;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 33, 48, .06), 0 1px 1px rgba(16, 33, 48, .04);
  --shadow-lg: 0 18px 48px rgba(16, 33, 48, .22);
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  --font-serif: "IBM Plex Serif", ui-serif, Georgia, "Times New Roman", serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* статусы сравнения / задач */
  --s-match: #64748b; --s-stricter: #c2410c; --s-looser: #1d4ed8;
  --s-none: #94a3b8; --s-conflict: #dc2626; --s-done: #157f52; --s-wait: #b45309;
}
/* Светлое оформление зафиксировано: тёмная авто-тема отключена. */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--font-sans); font-size: 15px; line-height: 1.55;
  font-feature-settings: "ss01", "cv05"; -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 2px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.22rem; } h3 { font-size: 1rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 3px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- App shell: топбар + левый рейл + контент ---- */
.app {
  display: grid; min-height: 100vh;
  grid-template-rows: auto 1fr;
  grid-template-areas: "top" "main";
}
.topbar {
  grid-area: top; display: flex; align-items: center; gap: 14px;
  padding: 0 18px; height: 56px; background: var(--surface);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20;
}
.burger {
  display: grid; place-items: center; width: 38px; height: 38px; margin-left: -6px;
  border-radius: var(--radius-sm); color: var(--muted); cursor: pointer;
}
.burger:hover { background: var(--surface-2); color: var(--ink); }
.burger svg { width: 20px; height: 20px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -.02em; text-decoration: none; color: var(--ink); }
.brand .mark {
  width: 24px; height: 24px; border-radius: 7px; background: var(--accent);
  display: grid; place-items: center; color: #fff; flex: none;
}
.brand .mark svg { width: 15px; height: 15px; }
.topbar .ctx { color: var(--faint); font-size: .85rem; }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--muted); font-size: .85rem; font-weight: 500; }

/* ---- Slide-out drawer ---- */
.drawer-toggle { position: absolute; }
.scrim {
  position: fixed; inset: 0; background: rgba(15, 23, 32, .42); z-index: 40;
  opacity: 0; visibility: hidden; transition: opacity .22s ease; cursor: pointer;
}
.drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: 272px; z-index: 50;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 14px 12px;
  transform: translateX(-100%); transition: transform .24s cubic-bezier(.4,0,.2,1);
  box-shadow: var(--shadow-lg);
}
.drawer-toggle:checked ~ .app .scrim { opacity: 1; visibility: visible; }
.drawer-toggle:checked ~ .app .drawer { transform: translateX(0); }
.drawer-head { display: flex; align-items: center; gap: 10px; padding: 6px 8px 14px; border-bottom: 1px solid var(--line); }
.drawer-head strong { font-weight: 600; letter-spacing: -.02em; }
.drawer-user { color: var(--faint); font-size: .78rem; margin-top: 1px; }
.drawer-close { margin-left: auto; width: 30px; height: 30px; display: grid; place-items: center; border-radius: var(--radius-sm); color: var(--faint); font-size: 1.3rem; cursor: pointer; }
.drawer-close:hover { background: var(--surface-2); color: var(--ink); }
.drawer-nav { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; flex: 1; }
.drawer-nav .group-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); padding: 12px 11px 5px; }
.drawer-nav .group-label:first-child { padding-top: 2px; }
.drawer-nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 500; text-decoration: none; border-left: 2px solid transparent;
}
.drawer-nav a:hover { background: var(--surface-2); color: var(--ink); }
.drawer-nav a.active { color: var(--accent-ink); background: var(--accent-soft); border-left-color: var(--accent); }
.drawer-foot { color: var(--faint); font-size: .75rem; padding: 10px 11px; border-top: 1px solid var(--line); }

.main { grid-area: main; padding: 28px 32px 56px; min-width: 0; }
.container { max-width: 1120px; }

@media (max-width: 860px) {
  .topbar .ctx { display: none; }
  .main { padding: 20px 16px 48px; }
}
@media (prefers-reduced-motion: reduce) {
  .drawer, .scrim { transition: none; }
}

/* ---- Buttons ---- */
.btn, button.btn {
  display: inline-flex; align-items: center; gap: 7px; font: inherit; font-weight: 500;
  padding: 8px 15px; border-radius: var(--radius-sm); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); cursor: pointer; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn-sm { padding: 3px 9px; font-size: .82rem; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }

/* ---- Cards / tiles ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-p { padding: 20px 22px; }
.tiles { display: flex; flex-wrap: wrap; gap: 14px; margin: 4px 0 20px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 13px 16px; min-width: 120px; box-shadow: var(--shadow);
}
.tile .v { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tile .k { color: var(--muted); font-size: .8rem; margin-top: 2px; }
.tile.accent .v { color: var(--accent); }

/* ---- Status pills ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.done { color: var(--s-done); background: color-mix(in srgb, var(--s-done) 12%, transparent); }
.pill.wait { color: var(--s-wait); background: color-mix(in srgb, var(--s-wait) 12%, transparent); }
.pill.fail { color: var(--s-conflict); background: color-mix(in srgb, var(--s-conflict) 12%, transparent); }

/* ---- Tables ---- */
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
thead th { text-align: left; font-weight: 600; color: var(--muted); font-size: .8rem; padding: 8px 12px; border-bottom: 1px solid var(--line-strong); }
tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:hover { background: var(--surface-2); }
.s-match { color: var(--s-match); } .s-stricter { color: var(--s-stricter); font-weight: 600; }
.s-looser { color: var(--s-looser); } .s-none { color: var(--s-none); } .s-conflict { color: var(--s-conflict); font-weight: 600; }

/* ---- Forms ---- */
label { display: block; font-weight: 500; margin-bottom: 6px; }
input, select {
  width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; font: inherit; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); }
table input { padding: 4px 8px; }
.field { margin-bottom: 14px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 620px) { .row-2 { grid-template-columns: 1fr; } }
.hint { color: var(--faint); font-size: .82rem; margin-top: 5px; }
.mono-box { font-family: var(--font-mono); font-size: .85rem; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 9px 11px; word-break: break-all; }

/* ---- Alerts ---- */
.alert { border-radius: var(--radius-sm); padding: 10px 13px; margin: 12px 0; font-size: .9rem; border: 1px solid transparent; }
.alert-err { background: #fdecea; background: color-mix(in srgb, #d64545 12%, var(--surface)); border-color: color-mix(in srgb, #d64545 35%, var(--surface)); color: #a12a2a; }
.alert-ok { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border-color: color-mix(in srgb, var(--accent) 32%, var(--surface)); color: var(--accent-ink); }
.alert-info { background: var(--surface-2); border-color: var(--line); color: var(--muted); }

/* ---- Highlighted document (hero of the report) ---- */
.report { display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
@media (max-width: 1000px) { .report { grid-template-columns: 1fr; } }
.hl-doc {
  font-family: var(--font-serif); font-size: 1rem; line-height: 1.75; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 26px 30px; max-width: 76ch; white-space: pre-wrap; box-shadow: var(--shadow);
}
.hl-doc mark { padding: .5px 2px; border-radius: 3px; cursor: help; }
.rail-right { position: sticky; top: 76px; display: flex; flex-direction: column; gap: 16px; }
.legend { display: flex; flex-direction: column; gap: 7px; }
.legend .row { display: flex; align-items: center; gap: 9px; font-size: .85rem; color: var(--muted); }
.sw { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.panel h3 { margin: 0 0 10px; font-size: .82rem; color: var(--muted); font-weight: 600; }

/* ---- Text blocks (отличия / допзатраты) ---- */
.prose { white-space: pre-wrap; font-family: var(--font-serif); line-height: 1.7; }
.muted { color: var(--muted); } .quote { color: var(--faint); font-size: .85em; }
article[aria-busy] { color: var(--muted); }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: var(--paper); padding: 20px; }
.login-card { width: 100%; max-width: 360px; }
.login-card .brand { margin-bottom: 18px; font-size: 1.15rem; }
.fb button { margin-right: 4px; }
details > summary { cursor: pointer; font-weight: 600; }

/* ---- Category chips (dictionary) ---- */
.cat-chip { display: inline-flex; align-items: center; gap: 7px; font-size: .8rem; font-weight: 500;
  padding: 3px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); }
.cat-chip::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c, var(--accent)); flex: none; }

/* ---- Password requirement checklist ---- */
.pw-reqs { list-style: none; padding: 0; margin: 10px 0 0; display: flex; flex-wrap: wrap; gap: 6px 14px; }
.pw-reqs li { font-size: .8rem; color: var(--faint); padding-left: 18px; position: relative; }
.pw-reqs li::before { content: "○"; position: absolute; left: 0; color: var(--faint); }
.pw-reqs li.ok { color: var(--s-done); }
.pw-reqs li.ok::before { content: "✓"; color: var(--s-done); }

/* ---- Tabs (ТЗ database) ---- */
.tabs .tabbar { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs .tabbar label { padding: 9px 14px; cursor: pointer; color: var(--muted); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: inline-flex; align-items: center; gap: 7px; }
.tabs .tabbar label:hover { color: var(--ink); }
.tabs .tabpane { display: none; }
.tabs .count { font-size: .72rem; font-weight: 600; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 0 7px; color: var(--muted); }
#tab-a:checked ~ .tabbar label[for="tab-a"],
#tab-c:checked ~ .tabbar label[for="tab-c"] { color: var(--accent-ink); border-bottom-color: var(--accent); }
#tab-a:checked ~ .pane-a, #tab-c:checked ~ .pane-c { display: block; }

/* ---- Report v2: linked highlights, key findings, manual marking ---- */
.hl-doc a.hl-link { text-decoration: none; cursor: pointer; border-radius: 3px; padding: .5px 2px; }
.hl-doc a.hl-link:hover { filter: brightness(.94); text-decoration: none; }
.hl-doc mark.hl { cursor: help; }

.findings { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.finding { display: block; padding: 13px 15px; text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.finding:hover { text-decoration: none; border-color: var(--accent); box-shadow: var(--shadow); }
.finding-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.finding-name { font-weight: 600; }
.finding .chip { font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
.finding-vals { font-size: .86rem; margin-top: 5px; }
.finding .quote { display: block; margin-top: 6px; }
.finding-jsoc { margin-top: 9px; padding-top: 9px; border-top: 1px solid var(--line); font-size: .83rem; }

tr:target { animation: flashrow 1.4s ease; }
.panel.flash { animation: flashrow 1.2s ease; }
@keyframes flashrow { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
.row-manual { background: color-mix(in srgb, var(--s-stricter) 7%, transparent); }

.mark-float { position: absolute; z-index: 60; box-shadow: var(--shadow-lg); }
@media (prefers-reduced-motion: reduce) { tr:target, .panel.flash { animation: none; } }

/* ---- JSOC catalog admin ---- */
.catalog { display: flex; flex-direction: column; gap: 10px; }
.catalog-row { display: grid; grid-template-columns: 220px 1fr auto; gap: 16px; align-items: start; }
.catalog-row.is-set { border-left: 3px solid var(--accent); }
.catalog-row .cat-meta { display: flex; flex-direction: column; gap: 4px; }
.catalog-row .cat-fields { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
.catalog-row .cat-actions { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 860px) {
  .catalog-row { grid-template-columns: 1fr; }
  .catalog-row .cat-fields { grid-template-columns: 1fr; }
}
