[hidden] { display: none !important; }
:root {
  --bg: #f4f6f9; --card: #ffffff; --text: #1d2430; --muted: #5d6878; --line: #dfe4ec;
  --accent: #1f5fbf; --accent-2: #e8f0fc; --focus: #7aa7e8;
  --crit: #9b1c1c; --crit-bg: #fde8e8; --high: #b54708; --high-bg: #fef0e1;
  --med: #8a6d00; --med-bg: #fdf6d8; --low: #2e6b30; --low-bg: #e6f4e6; --none-bg: #eceff3;
  --ok: #2e6b30; --warn: #8a6d00; --bad: #9b1c1c;
  --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 1px 8px rgba(20, 30, 50, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161d; --card: #1a2029; --text: #e3e8ef; --muted: #98a3b3; --line: #2c3440;
    --accent: #6ea2f0; --accent-2: #1f2c40; --focus: #4d7cc4;
    --crit: #ff9c9c; --crit-bg: #3d1a1c; --high: #ffb27a; --high-bg: #3b2616; --med: #f1d36b; --med-bg: #36301a;
    --low: #9bd89d; --low-bg: #1d3320; --none-bg: #262d38; --ok: #9bd89d; --warn: #f1d36b; --bad: #ff9c9c;
    --shadow: none;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
code { font-size: 12px; background: var(--none-bg); padding: 1px 4px; border-radius: 3px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 24px;
  background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 16px; color: var(--accent); }
.brand span { color: var(--text); }
nav { display: flex; gap: 4px; }
.nav-btn { background: none; border: 0; padding: 8px 14px; border-radius: 6px; cursor: pointer; color: var(--muted); font: inherit; }
.nav-btn.active { background: var(--accent-2); color: var(--accent); font-weight: 600; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); margin-left: 4px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.run { background: var(--accent); animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .3; } }
main { max-width: 1280px; margin: 0 auto; padding: 16px 24px 48px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
h2 { margin: 0 0 12px; font-size: 18px; } h3 { margin: 0 0 8px; font-size: 15px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px 14px; }
.grid .wide { grid-column: span 2; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--muted); font-weight: 500; }
input, select { font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; min-width: 0; }
input:focus, select:focus, .tags:focus-within { outline: 2px solid var(--focus); outline-offset: -1px; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; border: 1px solid var(--line); border-radius: 6px; padding: 3px 4px; background: var(--card); min-height: 36px; }
.tags input { border: 0; flex: 1; min-width: 160px; padding: 4px 5px; outline: none; }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--accent-2); color: var(--accent); padding: 2px 4px 2px 8px; border-radius: 12px; font-size: 12.5px; }
.tag button { border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px; line-height: 1; padding: 0 3px; }
.row { display: flex; align-items: flex-start; gap: 18px; margin-top: 14px; flex-wrap: wrap; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; min-width: 0; }
legend { font-size: 12.5px; color: var(--muted); font-weight: 500; float: left; margin-right: 10px; }
fieldset label, .opts-grid label:has(input[type=checkbox]) { flex-direction: row; align-items: center; gap: 6px; color: var(--text); font-weight: 400; font-size: 13.5px; }
.opts { flex: 1; min-width: 260px; }
.opts summary { cursor: pointer; color: var(--accent); font-size: 13.5px; }
.opts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin-top: 10px; }
.actions { display: flex; gap: 8px; margin-left: auto; }
.btn { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 7px 16px; border-radius: 6px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
@media (prefers-color-scheme: dark) { .btn.primary { color: #0e1622; } }
.btn.ghost { background: none; }
.btn.small { padding: 3px 10px; font-size: 12.5px; }
.btn:disabled { opacity: .5; cursor: default; }
.summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.summary .export { display: flex; gap: 6px; align-items: center; color: var(--muted); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 10px; overflow-x: auto; }
.tab { background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 14px; cursor: pointer; font: inherit; color: var(--muted); white-space: nowrap; }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.cnt { background: var(--none-bg); border-radius: 10px; padding: 0 7px; font-size: 12px; margin-left: 4px; color: var(--text); font-weight: 400; }
.list { display: flex; flex-direction: column; gap: 8px; }
.item { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; display: grid; grid-template-columns: 150px 1fr; gap: 4px 14px; }
.item .left { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.vid { font-weight: 600; font-family: ui-monospace, Consolas, monospace; font-size: 13px; cursor: pointer; color: var(--accent); background: none; border: 0; padding: 0; text-align: left; }
.vid:hover { text-decoration: underline; }
.title { font-weight: 500; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 6px; margin-top: 4px; align-items: center; }
.chip { font-size: 11.5px; padding: 1px 7px; border-radius: 10px; background: var(--none-bg); color: var(--muted); white-space: nowrap; }
.chip.ok { color: var(--ok); background: var(--low-bg); } .chip.warn { color: var(--warn); background: var(--med-bg); }
.chip.bad { color: var(--bad); background: var(--crit-bg); } .chip.rel-analog { color: var(--accent); background: var(--accent-2); }
.chip.rel-env { color: var(--high); background: var(--high-bg); }
.sev { font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 4px; background: var(--none-bg); color: var(--muted); }
.sev.critical { background: var(--crit-bg); color: var(--crit); } .sev.high { background: var(--high-bg); color: var(--high); }
.sev.medium { background: var(--med-bg); color: var(--med); } .sev.low { background: var(--low-bg); color: var(--low); }
.prods, .reasons { font-size: 12.5px; color: var(--muted); }
.links { font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 8px; margin-top: 3px; }
.links .lbl { color: var(--muted); }
.links button { font: inherit; font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; }
.links button.missing { color: var(--muted); }
.pager { display: flex; gap: 6px; justify-content: center; margin: 14px 0; align-items: center; color: var(--muted); }
.loading { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 30px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error { background: var(--crit-bg); color: var(--crit); padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; }
.hint p { color: var(--muted); margin: 6px 0; }
.muted { color: var(--muted); font-size: 13px; }
.db-table { width: 100%; border-collapse: collapse; }
.db-table th, .db-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.db-table th { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.db-table td .btn { margin: 0 4px 4px 0; }
.progress { height: 6px; background: var(--none-bg); border-radius: 3px; overflow: hidden; margin-top: 4px; width: 220px; }
.progress div { height: 100%; background: var(--accent); }
.modal { position: fixed; inset: 0; background: rgba(10, 15, 25, .45); display: flex; justify-content: center; align-items: flex-start; padding: 40px 16px; z-index: 20; overflow-y: auto; }
.modal-box { background: var(--card); border-radius: 10px; width: min(980px, 100%); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 600; font-family: ui-monospace, Consolas, monospace; }
.modal-head #modal-close { margin-left: auto; }
.modal-body { padding: 16px 18px 20px; }
.modal-body h3 { margin: 18px 0 6px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.modal-body h2 { font-size: 16px; margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 220px 1fr; gap: 4px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.tbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.tbl th, .tbl td { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: top; }
.tbl th { color: var(--muted); font-weight: 500; }
.cfg { border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; margin-bottom: 8px; }
.cfg .plat { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .opts-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  main { padding: 12px 16px 40px; } .top { padding: 8px 16px; }
  .grid { grid-template-columns: 1fr; } .grid .wide { grid-column: span 1; }
  .item { grid-template-columns: 1fr; } .kv { grid-template-columns: 1fr; }
  .actions { margin-left: 0; width: 100%; } .actions .btn { flex: 1; }
}

/* вход и пользователи */
.user-box { display: flex; align-items: center; gap: 6px; margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--line); }
nav { align-items: center; flex-wrap: wrap; }
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrap { width: 100%; max-width: 380px; padding: 16px; }
.login-card { display: flex; flex-direction: column; gap: 14px; padding: 24px; }
.login-card .brand { margin-bottom: 4px; }
.login-card .btn { width: 100%; padding: 9px; }
.login-card .error { margin: 0; }
.dialog-form { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.dialog-form .error { margin: 0; }
#user-form .grid { align-items: end; }
@media (max-width: 600px) { .user-box { margin-left: 0; padding-left: 0; border-left: 0; } }
