:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #18263a;
  background: #f6f7fa;
  font-size: 15px;
  line-height: 1.5;
  --muted: #5d6a7e;
  --line: #dce2eb;
  --action: #344fc5;
  --selected: #eef1ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button, select { cursor: pointer; }
button:disabled, select:disabled { opacity: .58; cursor: default; }
a { color: var(--action); text-decoration: none; }
button:focus-visible, a:focus-visible { outline: 3px solid #6e85fc; outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(30px, 3.2vw, 44px); line-height: 1.12; font-weight: 680; letter-spacing: -.045em; }
h2 { font-size: 21px; line-height: 1.3; letter-spacing: -.025em; }
h3 { font-size: 15px; }
button.primary, a.primary, .secondary {
  min-height: 41px; padding: 9px 17px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 9px; border: 1px solid transparent; font-size: 14px; font-weight: 600; line-height: 1.4;
}
.primary { color: white; background: var(--action); }
.primary:hover:not(:disabled) { background: #263da5; }
.secondary { background: white; border-color: var(--line); color: #38465c; }
.secondary:hover { background: #f4f6fa; }
.link { color: var(--action); padding: 4px 0; border: 0; background: none; font-size: 14px; font-weight: 580; }
.link:hover { text-decoration: underline; }
.subtle { color: var(--muted); }
#shell { min-height: 100dvh; display: grid; grid-template-columns: 225px minmax(0, 1fr); }
.rail { display: flex; flex-direction: column; gap: 48px; background: #fff; border-right: 1px solid var(--line); padding: 31px 18px 24px; }
.identity { display: flex; gap: 11px; align-items: center; padding: 0 10px; }
.wordmark { font-size: 36px; font-weight: 780; color: #18263a; letter-spacing: -.09em; line-height: 1; }
.wordmark span { color: var(--action); }
.product { border-left: 1px solid var(--line); padding-left: 12px; color: var(--muted); font-size: 13px; }
nav { display: grid; gap: 5px; }
nav a { border-radius: 8px; padding: 10px 12px; color: #35435a; font-weight: 550; }
nav a:hover { background: #f4f6fa; }
nav a[aria-current="page"] { color: #283fa3; background: var(--selected); }
nav a span { margin-left: 2px; font-size: 13px; color: var(--muted); }
.account { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid var(--line); display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
#login-name { overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
main { width: 100%; max-width: 1260px; margin: 0 auto; padding: clamp(36px, 6vw, 80px) clamp(22px, 4.6vw, 76px); }
.page-header { display: flex; align-items: center; gap: 16px; justify-content: space-between; margin-bottom: 30px; }
.split { display: grid; grid-template-columns: minmax(225px,.82fr) minmax(280px,1.3fr); gap: 20px; align-items: start; }
.panel, dialog, .auth-box { background: white; border: 1px solid var(--line); border-radius: 14px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding: 20px 22px; }
.panel-heading h2, .city-item > span:first-child, .success h2 { overflow-wrap: anywhere; }
.panel-heading .link { white-space: nowrap; }
.count { border-radius: 15px; background: #f0f2f6; padding: 2px 9px; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.count:empty { display: none; }
.city-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; background: white; border: 0; border-bottom: 1px solid #edf0f5; padding: 15px 22px; color: #213047; }
.city-item:last-child { border-bottom: none; border-radius: 0 0 14px 14px; }
.city-item:hover, .city-item[aria-pressed="true"] { background: var(--selected); color: #253d9e; }
.city-item[aria-pressed="true"] { box-shadow: inset 3px 0 0 var(--action); font-weight: 620; }
.city-item .chevron { font-size: 20px; color: #79869c; line-height: 1; }
.empty, .list-error { padding: 22px; color: var(--muted); }
.list-error .link { display: block; margin-top: 6px; }
.district-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 16px 22px 4px; }
.district-search { margin: 10px 22px; }
.boundary-status { padding: 12px 14px; background: #f4f6fa; border-radius: 8px; font-size: 14px; }
.panel > .boundary-status { margin: 17px 22px 0; }
.boundary-status[data-state=ready] { background: #eef6f2; }
.boundary-summary { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 14px; }
.boundary-summary strong { font-weight: 590; }
.boundary-status label, .boundary-status .error { margin-top: 8px; }
.district-list { list-style: none; padding: 0 22px; margin: 8px 0 18px; max-height: 52vh; overflow-y: auto; }
.district-list li { padding: 10px 0; border-bottom: 1px solid #edf0f5; overflow-wrap: anywhere; }
.district-list li:last-child { border: 0; }
.notice { color: #235543; padding: 10px 14px; background: #eaf5ef; margin-bottom: 16px; border-radius: 8px; }
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.auth-box { width: min(100%, 400px); padding: 32px; }
.auth-box .identity { padding: 0; margin-bottom: 36px; }
.auth h1 { font-size: 31px; margin-bottom: 25px; }
.auth form, dialog form { display: grid; gap: 16px; }
.auth #retry-session { margin-top: 12px; }
label { display: block; color: #35435a; font-size: 14px; font-weight: 580; }
input, select {
  display: block; width: 100%; min-height: 43px; margin-top: 5px; padding: 9px 12px;
  border: 1px solid #bdc7d6; border-radius: 8px; background: white; color: #18263a;
  font-size: 15px; font-weight: 400;
}
input:focus, select:focus { outline: 2px solid #758afb; outline-offset: 1px; }
input::placeholder { color: #737e90; }
.field-line { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.optional { color: var(--muted); font-size: 12px; font-weight: 450; margin-left: 4px; }
.hint { color: var(--muted); font-size: 13px; }
.attribution { margin-top: 18px; color: var(--muted); font-size: 12px; }
.error { color: #a63030; font-size: 14px; overflow-wrap: anywhere; }
.source-form, .success { max-width: 735px; }
.source-form { padding: 2px 24px 22px; }
fieldset { margin: 0; padding: 18px 0 20px; border: 0; min-inline-size: 0; display: grid; gap: 13px; }
fieldset + fieldset { border-top: 1px solid var(--line); }
legend { float: left; width: 100%; font-size: 19px; font-weight: 630; letter-spacing: -.02em; }
.field-line + select { margin-top: -9px; }
.form-footer { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: flex-end; }
.form-footer p { flex: 1; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.success { padding: 24px; display: grid; gap: 15px; }
dialog { width: min(450px, calc(100% - 28px)); padding: 26px; color: #18263a; box-shadow: 0 16px 80px #15253b24; }
dialog::backdrop { background: rgb(22 33 54 / 36%); }
dialog .actions { justify-content: flex-end; }
dialog .hint { margin-top: -8px; }
@media (max-width: 900px) {
  #shell { grid-template-columns: 180px minmax(0, 1fr); }
  main { padding-inline: 22px; }
  .split { grid-template-columns: minmax(170px,.8fr) minmax(220px,1.2fr); gap: 12px; }
  .panel-heading { flex-wrap: wrap; }
}
@media (max-width: 680px) {
  #shell { display: block; }
  .rail { padding: 16px; display: grid; grid-template-columns: 1fr auto; gap: 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .identity { padding: 0; }
  .wordmark { font-size: 31px; }
  .account { grid-row: 1; grid-column: 2; padding: 0; margin: auto 0; border: 0; }
  #login-name { max-width: 85px; }
  nav { grid-column: 1 / -1; display: flex; gap: 4px; flex-wrap: wrap; }
  nav a { font-size: 13px; padding: 6px 9px; }
  main { padding: 26px 16px; }
  .page-header { margin-bottom: 20px; }
  .split { grid-template-columns: minmax(0,1fr); }
  .city-list [data-cities] { max-height: 30vh; overflow-y: auto; }
  .source-form { padding-inline: 16px; }
}

.sources-table { width: 100%; border-collapse: collapse; text-align: left; }
.sources-table th { padding: 12px 16px; color: var(--muted); font-weight: 550; font-size: 13px; }
.sources-table td { padding: 16px; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.source-name, .source-actions a { color: var(--action); }
.source-name, .source-status { font-weight: 600; }
.source-actions a { display: block; width: fit-content; font-size: 14px; }
.source-actions a + a { margin-top: 5px; }
.sources-table a:hover, .source-pages a:hover { text-decoration: underline; }
.row-note { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.listing-filters { display: flex; flex-wrap: wrap; align-items: end; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.listing-filters label { flex: 1 1 155px; min-width: 0; }
.listing-filters label:first-child { flex: 2 1 230px; }
.listing-filters .actions { align-items: center; gap: 14px; }
.listings-table { width: 100%; border-collapse: collapse; table-layout: fixed; text-align: left; }
.listings-table th { padding: 12px 14px; background: #f7f8fb; color: var(--muted); font-size: 13px; font-weight: 550; }
.listings-table td { padding: 14px; border-top: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; vertical-align: middle; }
.listings-table th:first-child, .listings-table td:first-child { padding-left: 20px; }
.listings-table th:last-child, .listings-table td:last-child { padding-right: 20px; }
.listings-table [data-detail] { font-weight: 600; }
.listings-table [data-detail]:hover { text-decoration: underline; }
.listings-table time { font-variant-numeric: tabular-nums; }
.listing-date-label { display: none; }
.listing-status { display: inline-block; border-radius: 6px; padding: 3px 8px; background: #f0f2f6; color: #4b586e; font-size: 13px; line-height: 1.4; }
.listing-status[data-status=published] { color: #256044; background: #eaf4ec; }
.listing-status[data-status=review] { color: #77510c; background: #fbf2d9; }
.listing-status[data-status=hidden], .listing-status[data-status=deleted] { color: #8d4144; background: #faedef; }
.listing-metadata { display: flex; flex-wrap: wrap; gap: 16px 40px; padding: 16px 22px; margin: 0 0 18px; }
.listing-metadata dt, .listing-facts dt { color: var(--muted); font-size: 13px; }
.listing-metadata dd { margin: 4px 0 0; font-variant-numeric: tabular-nums; }
.listing-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.listing-status-editor { margin-bottom: 18px; }
.listing-status-editor [data-repeat], .listing-status-editor [data-refresh] { justify-self: start; }
.listing-status-history { margin-top: 18px; }
.listing-status-history [data-more] { margin: 10px 22px 18px; }
.listing-original { grid-column: 1 / -1; }
.listing-section-body { display: grid; gap: 14px; padding: 18px 22px; overflow-wrap: anywhere; }
.listing-text, .listing-facts dd { white-space: pre-wrap; }
.listing-facts { display: grid; grid-template-columns: auto 1fr; align-items: baseline; gap: 7px 16px; margin: 0; }
.listing-facts dd { margin: 0; min-width: 0; }
.listing-items { list-style: none; padding: 0; margin: -7px 0 0; }
.listing-items li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.listing-items li + li { border-top: 1px solid var(--line); }
.listing-items span { color: var(--muted); font-size: 13px; }
.listing-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(145px, 100%), 1fr)); gap: 10px; }
.listing-photos button { display: grid; place-items: center; height: 128px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 9px; background: #f6f7fa; cursor: zoom-in; }
.listing-photos button:hover { border-color: var(--action); }
.listing-photos img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.listing-photo-viewer { width: fit-content; max-width: min(920px, calc(100vw - 32px)); padding: 16px; }
.listing-photo-viewer > div { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 12px; }
.listing-photo-viewer img { display: block; max-width: 100%; max-height: 74dvh; margin: auto; object-fit: contain; }
@media (max-width: 820px) {
  .listing-sections { grid-template-columns: minmax(0, 1fr); }
  .listing-metadata { gap: 12px 20px; }
}
@media (max-width: 760px) {
  .listing-filters { padding: 16px; }
  .listing-filters label, .listing-filters label:first-child { flex: 1 1 220px; }
  .listings-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .listings-table tbody { display: block; }
  .listings-table tr { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); align-items: start; gap: 4px 10px; padding: 14px 16px; }
  .listings-table tr + tr { border-top: 1px solid var(--line); }
  .listings-table td, .listings-table td:first-child, .listings-table td:last-child { border: 0; padding: 0; }
  .listings-table td:nth-child(2) { grid-column: 1 / -1; color: var(--muted); }
  .listings-table td:nth-child(3) { grid-column: 2; grid-row: 1; text-align: right; }
  .listings-table time { display: block; font-size: 13px; }
  .listing-date-label { display: block; color: var(--muted); font-size: 12px; margin-top: 6px; }
}
.source-pages { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; color: var(--muted); }
.source-pages a { color: var(--action); }
@media (max-width: 760px) {
  .sources-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sources-table tbody, .sources-table td { display: block; }
  .sources-table tr { display: grid; gap: 8px; padding: 16px; }
  .sources-table tr + tr { border-top: 1px solid var(--line); }
  .sources-table td { border: 0; padding: 0; }
  .sources-table .source-actions { display: flex; flex-wrap: wrap; gap: 12px; }
  .source-actions a + a { margin: 0; }
  .source-event time::before { content: 'Последнее событие · '; color: var(--muted); }
}

.source-links { margin-top: 16px; }

.source-history { list-style: none; padding: 0; margin: 0; display: grid; gap: 18px; }
.history-entry { min-width: 0; overflow: hidden; overflow-wrap: anywhere; }
.history-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 6px 16px; flex-wrap: wrap; padding: 18px 22px 0; }
.history-heading h2 { font-size: 19px; }
.history-heading time, .history-actor, .history-no-changes { color: var(--muted); font-size: 13px; }
.history-actor { margin: 3px 22px 0; }
.history-reason, .history-no-changes { margin: 14px 22px 18px; white-space: pre-line; }
.history-reason span:first-child { color: var(--muted); margin-right: 6px; }
.history-values { border-collapse: collapse; width: 100%; table-layout: fixed; text-align: left; font-size: 14px; }
.history-values th, .history-values td { padding: 9px 22px; border-top: 1px solid var(--line); vertical-align: top; white-space: pre-line; }
.history-values thead th { background: #f7f8fb; color: var(--muted); font-size: 13px; font-weight: 500; }
.history-values tbody th { font-weight: 570; }
.history-message { margin: 14px 0; color: var(--muted); }
button[data-more] { margin: 18px auto 0; display: flex; }
@media (max-width: 680px) {
  .history-heading { padding: 16px 14px 0; }
  .history-actor, .history-reason, .history-no-changes { margin-inline: 14px; }
  .history-values th, .history-values td { padding: 8px 10px; }
}

.control-header { margin-top: 12px; }
.control-header h1 { margin-bottom: 7px; }
.control-header p { color: var(--muted); overflow-wrap: anywhere; }
.control-header .secondary { flex-shrink: 0; }
.control-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.control-overview, .control-history { grid-column: 1 / -1; }
.control-body { display: grid; gap: 15px; padding: 18px 22px; }
.control-summary, .control-facts { margin: 0; }
.control-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.control-summary dt, .control-facts dt { color: var(--muted); font-size: 13px; }
.control-summary dd { margin: 3px 0 0; font-weight: 600; }
.control-facts { display: grid; grid-template-columns: auto 1fr; gap: 5px 14px; }
.control-facts dd { margin: 0; white-space: pre-line; overflow-wrap: anywhere; }
.control-audit { margin: 0; padding: 0 22px; list-style: none; max-height: 24rem; overflow: auto; }
.control-audit li { padding: 13px 0; overflow-wrap: anywhere; }
.control-audit li + li { border-top: 1px solid var(--line); }
.control-audit strong { font-weight: 600; }
.control-reason { margin-top: 3px; }
dialog fieldset[data-inputs] { padding: 0; }
.control-access-inputs { display: grid; gap: 12px; }
.control-check { display: flex; align-items: baseline; gap: 9px; font-weight: 500; }
.control-check input { width: 16px; min-height: 0; margin: 0; accent-color: var(--action); }
.control-access-inputs textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 12px; font: inherit; font-weight: 400; color: inherit; resize: vertical; border: 1px solid #bdc7d6; border-radius: 8px; }
@media (max-width: 960px) {
  .control-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 680px) {
  .control-header { align-items: flex-start; flex-direction: column; }
  .control-body { padding: 16px; }
  .control-summary { grid-template-columns: 1fr; gap: 9px; }
  .control-summary > div { display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: 16px; }
  .control-summary dd { margin: 0; }
}
