.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.logo {
  width: 22px; height: 22px; border-radius: 4px; background: var(--stamp); position: relative; flex: none;
}
.logo::after { content: ""; position: absolute; left: 5px; right: 5px; top: 6px; height: 3px; background: var(--sheet); border-radius: 2px; }

/* --- вход */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; padding: 28px; display: grid; gap: 14px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 22px; margin-top: 6px; }
.form-error { color: var(--seal); min-height: 1em; margin: 0; font-size: 13px; }

/* --- каркас */
.shell { display: grid; grid-template-columns: 216px 1fr; min-height: 100vh; }
.side { border-right: 1px solid var(--rule); background: var(--sheet); padding: 20px 12px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 0; height: 100vh; }
.side .brand { padding: 0 10px 18px; }
.side > a { padding: 8px 10px; border-radius: 6px; color: var(--ink-2); text-decoration: none; font-weight: 500; }
.side > a:hover { background: var(--rule-2); color: var(--ink); }
.side > a[aria-current="page"] { background: var(--stamp-soft); color: var(--stamp); }
.side-foot { margin-top: auto; display: grid; gap: 4px; justify-items: start; padding: 0 6px; font-size: 14px; }
.side-foot a { text-decoration: none; padding: 2px 4px; }
main { padding: 28px 32px 64px; max-width: 1280px; width: 100%; min-width: 0; }
main:focus { outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--ink-2); max-width: 70ch; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; }
.panel > h2 { font-size: 16px; margin-bottom: 12px; }
.panel.flush { padding: 0; overflow: hidden; }
.panel.flush > h2 { padding: 16px 20px 0; }
.scroll-x { overflow-x: auto; }

/* --- обзор: крупные цифры в строку, а не карточками */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 18px; }
.figure { padding: 16px 20px; border-right: 1px solid var(--rule-2); }
.figure:last-child { border-right: 0; }
.figure b { display: block; font-size: 26px; font-weight: 600; letter-spacing: -.01em; }
.figure span { color: var(--ink-3); font-size: 13px; }
.figure.seal b { color: var(--seal); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > .panel { margin-bottom: 0; }
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--ink-3); }
dl.kv dd { margin: 0; text-align: right; }

/* --- загрузка */
.drop {
  border: 2px dashed var(--rule); border-radius: 10px; padding: 28px; text-align: center; background: var(--sheet);
  display: grid; gap: 8px; justify-items: center; transition: border-color .15s, background .15s;
}
.drop.over { border-color: var(--stamp); background: var(--stamp-soft); }
.drop strong { font-size: 16px; }
.drop input { display: none; }
.upload-list { display: grid; gap: 8px; margin-top: 14px; text-align: left; width: min(560px, 100%); }
.bar { height: 6px; background: var(--rule-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--stamp); border-radius: 99px; transition: width .4s; }
.bar.done > i { background: var(--ok); }
.bar.failed > i { background: var(--seal); }
.imp-row td { vertical-align: middle; }
.imp-progress { min-width: 140px; display: grid; gap: 4px; font-size: 12px; color: var(--ink-3); }
details.errors summary { cursor: pointer; color: var(--seal); font-size: 13px; }
details.errors pre { white-space: pre-wrap; font-size: 12px; background: var(--seal-soft); padding: 8px 10px; border-radius: 6px; max-height: 240px; overflow: auto; }

/* --- проводник */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: end; }
.filters .wide { grid-column: span 2; }
.filters .check { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--ink-2); padding-bottom: 8px; }
.filters .check input { width: auto; }
.api-url { margin-top: 12px; font-size: 13px; color: var(--ink-3); word-break: break-all; }
.api-url code { color: var(--ink-2); }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 20px; flex-wrap: wrap; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: var(--rule-2); }
tr.clickable.active td { background: var(--stamp-soft); }
.pager { display: flex; gap: 8px; align-items: center; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }

.explorer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 18px; align-items: start; }
.explorer.no-detail { grid-template-columns: minmax(0, 1fr); }

/* --- протокол как документ: строки протокола действительно пронумерованы */
.protocol { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow: auto; }
.protocol-head { padding: 18px 20px 14px; border-bottom: 1px solid var(--rule); display: grid; gap: 6px; }
.protocol-head h2 { font-size: 22px; }
.protocol-head .ids { font-size: 12px; color: var(--ink-3); word-break: break-all; }
.tabs { display: flex; gap: 4px; padding: 10px 20px 0; border-bottom: 1px solid var(--rule); }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; padding: 8px 10px; color: var(--ink-2); }
.tabs button[aria-selected="true"] { color: var(--stamp); border-bottom-color: var(--stamp); }
.protocol-body { padding: 14px 20px 20px; }
ol.lines { list-style: none; padding: 0; margin: 0; counter-reset: line; }
ol.lines li { counter-increment: line; display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; padding: 7px 0; border-bottom: 1px dotted var(--rule); align-items: baseline; }
ol.lines li::before { content: counter(line); color: var(--ink-3); font-size: 12px; }
ol.lines li b { font-weight: 600; }
.votes { margin-top: 14px; display: grid; gap: 10px; }
.vote { display: grid; gap: 3px; }
.vote-top { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }
.vote-top span:last-child { white-space: nowrap; color: var(--ink-2); }
.vote .bar > i { background: color-mix(in srgb, var(--stamp) 55%, transparent); }
.vote.lead .bar > i { background: var(--stamp); }
.seal-note { margin: 12px 0 0; padding: 10px 12px; border-left: 3px solid var(--seal); background: var(--seal-soft); border-radius: 0 6px 6px 0; font-size: 13px; }
.versions { margin-top: 18px; display: grid; gap: 10px; }
.version { border: 1px solid var(--rule); border-radius: 6px; padding: 10px 12px; font-size: 13px; }
.version.current { border-color: var(--stamp); }
.version .diff { margin-top: 6px; color: var(--seal); }
.version .obs { color: var(--ink-3); margin-top: 4px; }

/* --- округа */
.okrug-table input { padding: 5px 8px; }
.okrug-table td { vertical-align: middle; }
.okrug-table tr.dirty td { background: var(--warn-soft); }

/* --- диалог и тост */
dialog { border: 1px solid var(--rule); border-radius: 12px; padding: 0; background: var(--sheet); color: var(--ink); width: min(460px, calc(100vw - 32px)); box-shadow: 0 12px 40px rgba(0, 0, 0, .2); }
dialog::backdrop { background: rgba(17, 20, 28, .45); }
dialog form { padding: 22px; display: grid; gap: 14px; }
dialog p { margin: 0; color: var(--ink-2); }
dialog .actions { justify-content: flex-end; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 8px; font-size: 14px; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); z-index: 10; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: var(--seal); color: #fff; }

@media (max-width: 1100px) {
  .explorer { grid-template-columns: minmax(0, 1fr); }
  .protocol { position: static; max-height: none; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; gap: 4px; border-right: 0; border-bottom: 1px solid var(--rule); }
  .side .brand { padding: 0 8px 0 0; width: 100%; margin-bottom: 4px; }
  .side-foot { margin: 0; display: flex; flex-wrap: wrap; width: 100%; padding: 0; }
  main { padding: 20px 16px 48px; }
  .grid-2 { grid-template-columns: 1fr; }
  .filters .wide { grid-column: auto; }
  .figure { border-right: 0; border-bottom: 1px solid var(--rule-2); }
}

td.num { white-space: nowrap; }
td.leader { max-width: 280px; }
td.leader span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
