@import url("/static/fonts/fonts.css");
/* Портал РСС. Токены те же, что у «РСС Запчасти» */
:root {
  --plate: #EEF0EE;      /* фон: светлая сталь */
  --paper: #FFFFFF;
  --ink: #20282D;        /* графит */
  --steel: #5F6B72;      /* вторичный текст */
  --rule: #CBD1D3;       /* линии таблиц */
  --sign: #F2B705;       /* шильдик — только главная кнопка */
  --sign-dark: #C99600;
  --stock: #2F7D4E;      /* «активен», «есть доступ» */
  --stop: #B3261E;       /* «заблокирован» */
  --link: #1E5AA8;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --sans: "Golos Text", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--plate); color: var(--ink); font: 400 16px/1.5 var(--sans); }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
.code { font-family: var(--mono); font-weight: 500; letter-spacing: .01em; }
.muted { color: var(--steel); }

/* Шапка */
.top { background: var(--ink); color: #DDE2E4; font-size: 14px; }
.top .wrap { display: flex; gap: 24px; align-items: center; min-height: 36px; }
.top .grow { flex: 1; }
.top a { color: #fff; text-decoration: none; }
.top a:hover { text-decoration: underline; }
.head { background: var(--paper); border-bottom: 1px solid var(--rule); }
.head .wrap { display: flex; align-items: center; gap: 32px; min-height: 64px; }
.logo { font-weight: 800; font-size: 22px; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.logo span { font-weight: 500; color: var(--steel); }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; padding: 20px 12px 18px; border-bottom: 3px solid transparent; }
.nav a:hover { border-bottom-color: var(--rule); }
.nav a[aria-current] { border-bottom-color: var(--sign); font-weight: 600; }
.me { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.ava { width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }

/* Кнопки */
.btn { display: inline-block; border: 0; border-radius: 4px; padding: 11px 18px; font: 600 15px/1.2 var(--sans);
  cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn-main { background: var(--sign); color: var(--ink); }
.btn-main:hover { background: var(--sign-dark); color: var(--ink); }
.btn-line { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); padding: 9.5px 16.5px; }
.btn-line:hover { background: var(--ink); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn-line.btn-sm { padding: 4.5px 10.5px; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--link); text-decoration: underline; cursor: pointer; }
.link-btn.danger { color: var(--stop); }

/* Страница */
.page { padding: 32px 0 48px; }
.page-top { display: flex; align-items: end; gap: 24px; margin-bottom: 24px; flex-wrap: wrap; }
.page-top .grow { flex: 1; }
.page-h { font-size: 32px; line-height: 1.15; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.lead { color: var(--steel); margin: 6px 0 0; }
.sec-h { font-size: 20px; margin: 36px 0 14px; padding-bottom: 6px; border-bottom: 2px solid var(--ink); }

/* Плитки сервисов */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tile { position: relative; display: flex; flex-direction: column; gap: 10px; background: var(--paper); border: 1px solid var(--rule);
  border-radius: 6px; padding: 22px 22px 18px; color: var(--ink); text-decoration: none; min-height: 190px; }
.tile:hover { border-color: var(--ink); box-shadow: 0 2px 0 var(--ink); color: var(--ink); }
.tile .ico { width: 48px; height: 48px; border-radius: 6px; background: var(--sign); display: grid; place-items: center;
  box-shadow: inset 0 0 0 2px var(--sign-dark); }
.tile .ico svg { width: 26px; height: 26px; stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tile h3 { margin: 4px 0 0; font-size: 19px; }
.tile p { margin: 0; color: var(--steel); font-size: 15px; flex: 1; }
.tile .addr { font-family: var(--mono); font-size: 13px; color: var(--steel); }
.tile.soon { background: transparent; border-style: dashed; pointer-events: none; }
.tile.soon .ico { background: #DDE1DF; box-shadow: none; }
.tile.soon .ico svg { stroke: var(--steel); }
.tile .tag { position: absolute; top: 18px; right: 18px; }

/* Метки */
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 3px; background: #E3E7E5; color: var(--ink); white-space: nowrap; }
.tag.admin { background: var(--ink); color: #fff; }
.tag.soon { background: #FFF1BF; color: #6B5200; }
.st { font-weight: 500; white-space: nowrap; }
.st::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.st.on { color: var(--stock); } .st.on::before { background: var(--stock); }
.st.off { color: var(--stop); } .st.off::before { background: var(--stop); }
.st.wait { color: var(--steel); } .st.wait::before { background: var(--rule); }

/* Вход */
.login-page { min-height: 100vh; display: grid; grid-template-rows: auto 1fr auto; }
.login { display: grid; place-items: center; padding: 40px 16px; }
.nameplate { position: relative; width: 100%; max-width: 420px; background: var(--sign); border-radius: 6px; padding: 30px 36px 28px;
  box-shadow: inset 0 0 0 2px var(--sign-dark), inset 0 0 0 7px var(--sign), inset 0 0 0 8px rgba(0,0,0,.18); }
.nameplate::before, .nameplate::after, .nameplate .r1, .nameplate .r2 { content: ""; position: absolute; width: 10px; height: 10px;
  border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff6 0 2px, #8a6a00 3px 5px); }
.nameplate::before { top: 12px; left: 12px; } .nameplate::after { top: 12px; right: 12px; }
.nameplate .r1 { bottom: 12px; left: 12px; } .nameplate .r2 { bottom: 12px; right: 12px; }
.nameplate h1 { margin: 0 0 4px; font-size: 26px; font-weight: 800; letter-spacing: -.01em; }
.nameplate p { margin: 0 0 20px; font-size: 15px; }
.nameplate label { display: block; font-weight: 700; font-size: 14px; margin: 0 0 6px; }
.nameplate .field { border: 2px solid var(--ink); background: #FFFDF5; padding: 12px 14px; font: 500 18px/1.2 var(--sans); margin-bottom: 14px; }
.nameplate .field.code { font-family: var(--mono); }
.nameplate .btn { width: 100%; background: var(--ink); color: #fff; padding: 14px; font-size: 17px; margin-top: 4px; }
.nameplate .btn:hover { background: #000; }
.nameplate .hint { margin: 14px 0 0; font-size: 14px; }

/* Формы */
.field { display: block; width: 100%; border: 1px solid #9aa3a7; border-radius: 4px; padding: 10px 12px; font: 16px var(--sans); background: #fff; color: var(--ink); }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 20px; }
.form > * { min-width: 0; }
.form .full { grid-column: 1 / -1; }
.form label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 5px; }
.form small { display: block; color: var(--steel); font-size: 13px; margin-top: 4px; }
.checks { display: flex; gap: 8px 20px; flex-wrap: wrap; }
.checks label { font-weight: 400; display: flex; align-items: center; gap: 6px; margin: 0; }
.checks input, .table input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--ink); }

/* Панель */
.panel { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; }
.panel-h { display: flex; align-items: center; gap: 16px; padding: 16px 20px; border-bottom: 1px solid var(--rule); }
.panel-h h2 { margin: 0; font-size: 18px; flex: 1; }
.panel-b { padding: 20px; }
.panel-f { display: flex; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--rule); background: #F7F8F7; border-radius: 0 0 6px 6px; }

/* Вкладки админки */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tabs a { border: 1px solid #9aa3a7; background: var(--paper); border-radius: 4px; padding: 8px 14px; font-size: 15px; color: var(--ink); text-decoration: none; font-weight: 500; }
.tabs a:hover { border-color: var(--ink); }
.tabs a[aria-current] { background: var(--ink); color: #fff; border-color: var(--ink); }
.tabs a span { color: var(--steel); margin-left: 4px; font-weight: 400; }
.tabs a[aria-current] span { color: #AEB8BC; }

/* Сводка */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-bottom: 24px; }
.stat { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 14px 18px; }
.stat b { display: block; font-size: 26px; font-weight: 800; }
.stat span { color: var(--steel); font-size: 14px; }

/* Таблицы */
.table { width: 100%; border-collapse: collapse; background: var(--paper); font-size: 15px; }
.table th { text-align: left; font-weight: 600; font-size: 13px; color: var(--steel); padding: 10px 14px; border-bottom: 2px solid var(--ink); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #F7F8F7; }
.table .who { display: flex; align-items: center; gap: 10px; }
.table .who .ava { width: 30px; height: 30px; font-size: 12px; }
.table .who small { display: block; color: var(--steel); font-family: var(--mono); font-size: 13px; }
.tile-ico { width: 32px; height: 32px; flex: none; border-radius: 5px; background: var(--sign); display: grid; place-items: center; box-shadow: inset 0 0 0 1.5px var(--sign-dark); }
.tile-ico svg { width: 18px; height: 18px; stroke: var(--ink); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.table .acts { text-align: right; white-space: nowrap; }
.table .acts > * + * { margin-left: 14px; }
.table.matrix th.c, .table.matrix td.c { text-align: center; width: 120px; }
.table.matrix tr.grp td { background: #F2F3F2; font-weight: 700; font-size: 14px; }
.yes { color: var(--stock); font-weight: 700; }
.no { color: #A9B1B4; }

.note { background: #FFF7D6; border-left: 4px solid var(--sign); padding: 14px 18px; border-radius: 0 4px 4px 0; margin: 20px 0 0; font-size: 15px; }
.note b { display: block; margin-bottom: 2px; }

.foot { border-top: 1px solid var(--rule); padding: 18px 0; font-size: 14px; color: var(--steel); background: var(--paper); }
.foot .wrap { display: flex; gap: 24px; flex-wrap: wrap; }
.foot .grow { flex: 1; }

/* Модалка (в макете — статично) */
.modal-bg { background: rgba(32,40,45,.55); padding: 40px 16px; }
.modal { max-width: 640px; margin: 0 auto; }

@media (max-width: 900px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .page-h { font-size: 26px; }
  .hide-m { display: none; }
}
@media (max-width: 640px) {
  .tiles { grid-template-columns: 1fr; }
  .head .wrap { gap: 12px; flex-wrap: wrap; min-height: 0; padding-top: 10px; }
  .nav { order: 3; flex-basis: 100%; overflow-x: auto; }
  .nav a { padding: 10px 10px 8px; }
  .me .name { display: none; }
  .me { margin-left: auto; }
  .top .grow { display: none; }
  .form { grid-template-columns: 1fr; }
  .table.resp thead { display: none; }
  .table.resp, .table.resp tbody, .table.resp tr, .table.resp td { display: block; }
  .table.resp tr { padding: 12px 14px; border-bottom: 1px solid var(--rule); }
  .table.resp td { padding: 2px 0; border: 0; }
  .table.resp .acts { text-align: left; margin-top: 6px; }
  .panel-h { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* --- Рабочий портал: дополнения к макету --- */
.top form { margin: 0; }
.top .link-btn { color: #fff; text-decoration: none; font-size: 14px; }
.top .link-btn:hover { text-decoration: underline; }
.top .top-pw { color: #DDE2E4; }
.small-addr { font-family: var(--mono); font-size: 13px; color: var(--steel); }
.flash { background: #E6F2EA; border-left: 4px solid var(--stock); padding: 12px 16px; border-radius: 0 4px 4px 0; margin: 0 0 20px; }
.errors { background: #FBE9E7; border-left: 4px solid var(--stop); padding: 12px 16px; border-radius: 0 4px 4px 0; margin: 0 0 18px; }
.errors p { margin: 0; }
.nameplate .errors { background: #FFFDF5; margin-bottom: 16px; font-size: 15px; }
.secret { font-family: var(--mono); font-size: 24px; font-weight: 600; background: #FFFDF5; border: 2px solid var(--ink);
  border-radius: 4px; padding: 14px 18px; margin: 6px 0 16px; user-select: all; word-break: break-all; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 0 0 8px; }
.kv dt { color: var(--steel); } .kv dd { margin: 0; }
.table tr.is-hidden td { color: var(--steel); background: #F7F8F7; }
.table .acts form { display: inline; }
.empty { background: var(--paper); border: 1px dashed var(--rule); border-radius: 6px; padding: 28px; color: var(--steel); }
.radio-row { display: flex; gap: 8px 20px; flex-wrap: wrap; }
.radio-row label { font-weight: 400; display: flex; align-items: center; gap: 6px; margin: 0; }
.radio-row input { width: 18px; height: 18px; accent-color: var(--ink); }
.icon-pick { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-pick label { margin: 0; cursor: pointer; }
.icon-pick input { position: absolute; opacity: 0; }
.icon-pick .tile-ico { width: 44px; height: 44px; background: #E3E7E5; box-shadow: none; }
.icon-pick .tile-ico svg { width: 22px; height: 22px; }
.icon-pick input:checked + .tile-ico { background: var(--sign); box-shadow: inset 0 0 0 2px var(--ink); }
.icon-pick input:focus-visible + .tile-ico { outline: 3px solid var(--link); outline-offset: 2px; }
.back { display: inline-block; margin-bottom: 12px; font-size: 15px; }
.denied { max-width: 560px; margin: 0 auto; text-align: center; }
.mt { margin-top: 20px; }
@media (max-width: 640px) { .page-top .grow { flex-basis: 100%; } }

/* --- Генератор договоров --- */
.next-num { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 10px 16px; text-align: right; }
.next-num span { display: block; color: var(--steel); font-size: 13px; }
.next-num b { font-size: 22px; }
.dg .sub-h { font-weight: 700; font-size: 17px; padding-top: 10px; border-top: 1px solid var(--rule); margin-top: 6px; }
.dg textarea.field { resize: vertical; font-family: var(--mono); font-size: 14px; }
.card-upload { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.card-upload label, .card-upload small { flex-basis: 100%; }
.card-upload input[type=file] { flex: 1 1 260px; min-width: 0; }
.radio-row.col { flex-direction: column; }
.radio-row label { align-items: flex-start; }
.radio-row input { flex: none; margin-top: 3px; }
.dg .form:has(#k-org:checked) .ip-only, .dg .form:has(#k-ip:checked) .org-only,
.dg .form:has(#p-std:checked) .pay-only { display: none; }
.small { font-size: 14px; align-self: center; }
.blanks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.blank { background: var(--paper); border: 1px solid var(--rule); border-radius: 6px; padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.row-copy { margin-top: 10px; white-space: pre; overflow-x: auto; font-size: 14px; user-select: all; }
@media (max-width: 900px) { .blanks { grid-template-columns: 1fr; } }

/* Узкие экраны: таблицы читаются как карточки, без горизонтальной прокрутки страницы. */
@media (max-width: 640px) {
  .wrap { padding: 0 16px; }
  .page { padding: 24px 0 40px; }
  .page-h { font-size: 25px; overflow-wrap: anywhere; }
  .top .wrap { justify-content: flex-end; gap: 18px; }
  .top a, .top .link-btn { display: inline-flex; align-items: center; min-height: 44px; }
  .head .wrap { gap: 4px 12px; }
  .logo { font-size: 20px; }
  .nav { flex-basis: 100%; overflow: visible; }
  .nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 12px; }
  .me .tag { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
  .page-top > .btn { width: 100%; text-align: center; }
  .tiles { gap: 12px; }
  .tile { min-height: 0; padding: 18px; }
  .tile .addr, .small-addr, .table .who small { overflow-wrap: anywhere; }
  .stats { gap: 10px; }
  .stat { padding: 12px; }
  .stat b { font-size: 23px; }
  .panel-h, .panel-b, .panel-f { padding-left: 16px; padding-right: 16px; }
  .panel-h > .btn, .panel-h > button { width: 100%; text-align: center; }
  .panel-f { flex-wrap: wrap; }
  .panel-f > .btn, .panel-f > button { flex: 1 1 100%; text-align: center; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .radio-row label { min-width: 0; }
  .nameplate { padding: 28px 24px 24px; }
  .table.resp tr { margin: 0; }
  .table.resp td.hide-m { display: none; }
  .table.resp td[data-label] { position: relative; padding-left: 100px; min-height: 30px; overflow-wrap: anywhere; }
  .table.resp td[data-label]::before, .table.matrix td[data-label]::before {
    content: attr(data-label); position: absolute; left: 0; top: 2px; width: 90px;
    color: var(--steel); font-size: 13px; font-weight: 600;
  }
  .table.resp .who { min-width: 0; }
  .table.resp .who > div { min-width: 0; overflow-wrap: anywhere; }
  .table.resp .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding-top: 8px; white-space: normal; }
  .table.resp .acts > * + * { margin-left: 0; }
  .table.resp .acts a, .table.resp .acts button { display: inline-flex; align-items: center; min-height: 44px; }
  .table.matrix thead { display: none; }
  .table.matrix, .table.matrix tbody, .table.matrix tr, .table.matrix td { display: block; }
  .table.matrix { padding: 12px; }
  .table.matrix tr { border: 1px solid var(--rule); border-radius: 6px; margin-bottom: 12px; padding: 12px; }
  .table.matrix tr:last-child { margin-bottom: 0; }
  .table.matrix td { border: 0; padding: 4px 0; overflow-wrap: anywhere; }
  .table.matrix td:first-child { padding-bottom: 8px; border-bottom: 1px solid var(--rule); margin-bottom: 6px; }
  .table.matrix td.c { width: auto; text-align: left; }
  .table.matrix td[data-label] { position: relative; padding-left: 100px; min-height: 36px; }
  .table.matrix td[data-label]::before { top: 5px; }
  .table.matrix input[type=checkbox] { width: 24px; height: 24px; }
  .next-num { text-align: left; }
  .foot .wrap { gap: 4px; }
}
