/* Дизайн-система из макета «Документы самозанятых» */
@font-face { font-family: 'Golos Text'; src: local('Golos Text'); }

:root {
  color-scheme: light;
  --bg: #fafafa; --panel: #ffffff; --panel2: #f4f4f5;
  --line: #e7e7ea; --line2: #d6d6db;
  --text: #18181b; --dim: #71717a; --dim2: #a1a1aa;
  --brand: #5bc501; --brand-ink: #3f8a00; --brand-soft: #f0fbe2;
  --on-brand: #0f2b00;
  --danger: #c8342a; --danger-soft: #fdf2f1;
  --warn: #8a5300; --warn-soft: #fdf6e7;
  --shadow: 0 1px 2px rgba(24, 24, 27, .05);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0f11; --panel: #18181b; --panel2: #232327;
  --line: #292930; --line2: #3a3a42;
  --text: #f1f1f3; --dim: #a1a1aa; --dim2: #71717a;
  --brand: #6fdb12; --brand-ink: #a5ef5c; --brand-soft: #1b2a10;
  --on-brand: #0f2b00;
  --danger: #ff7a70; --danger-soft: #2a1614;
  --warn: #f0b45a; --warn-soft: #2a2010;
  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
}
/* Публичная анкета переключателя тем не имеет — идём за системной.
   В админке data-theme выставлен всегда и это правило не срабатывает. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    color-scheme: dark;
    --bg: #0f0f11; --panel: #18181b; --panel2: #232327;
    --line: #292930; --line2: #3a3a42;
    --text: #f1f1f3; --dim: #a1a1aa; --dim2: #71717a;
    --brand: #6fdb12; --brand-ink: #a5ef5c; --brand-soft: #1b2a10;
    --on-brand: #0f2b00;
    --danger: #ff7a70; --danger-soft: #2a1614;
    --warn: #f0b45a; --warn-soft: #2a2010;
    --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  }
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-size: 14px;
  font-family: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  text-wrap: pretty; -webkit-font-smoothing: antialiased;
}
input, textarea, button, select { font-family: inherit; color: inherit; font-size: inherit; }
a { color: var(--brand-ink); text-decoration: none; }
a:hover { color: var(--text); text-decoration: underline; }
::placeholder { color: var(--dim2); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 8px; border: 3px solid var(--bg); }
.mono { font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ── каркас ──────────────────────────────────────────────────────────── */
.app { min-height: 100vh; display: flex; background: var(--bg); }
aside {
  width: 236px; flex: none; display: flex; flex-direction: column; gap: 3px;
  padding: 16px 12px 12px; border-right: 1px solid var(--line);
  background: var(--panel); height: 100vh; position: sticky; top: 0;
}
.brand { display: flex; align-items: center; gap: 8px; padding: 2px 8px 16px; }
.brand .mark { font-size: 15px; font-weight: 700; letter-spacing: -.02em; }
.brand .mark span { color: var(--brand); }
.brand .ver {
  margin-left: auto; font-size: 10px; color: var(--dim2);
  border: 1px solid var(--line); border-radius: 5px; padding: 2px 5px;
}
.nav {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px;
  border: none; border-radius: 7px; background: transparent; color: var(--dim);
  font-size: 13.5px; font-weight: 500; cursor: pointer; text-align: left; width: 100%;
}
.nav:hover { background: var(--panel2); }
.nav .dot { width: 6px; height: 6px; border-radius: 2px; background: var(--line2); flex: none; }
.nav.on { background: var(--brand-soft); color: var(--text); }
.nav.on .dot { background: var(--brand); }
.nav .n { margin-left: auto; font-size: 11px; color: var(--dim2); }
.nav .n.hot {
  font-weight: 600; color: var(--on-brand); background: var(--brand);
  border-radius: 20px; padding: 1px 6px;
}
.spacer { flex: 1; }
.keys { padding: 0 10px 12px; font-size: 10.5px; line-height: 1.7; color: var(--dim2); }
.pub {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px; margin-bottom: 6px;
  border: 1px dashed var(--line2); border-radius: 7px; background: transparent;
  color: var(--dim); font-size: 12.5px; cursor: pointer; text-align: left;
}
.pub:hover { color: var(--text); border-color: var(--brand); }
.me { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-top: 1px solid var(--line); }
.me .av {
  width: 26px; height: 26px; border-radius: 50%; background: var(--panel2);
  border: 1px solid var(--line); display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 600;
}
.me .nm { font-size: 12.5px; font-weight: 600; }
.me .sub { font-size: 11px; color: var(--dim2); }
.me .th {
  width: 28px; height: 28px; flex: none; border: 1px solid var(--line);
  border-radius: 7px; background: var(--panel); cursor: pointer; font-size: 13px;
  line-height: 1; color: var(--dim);
}
.me .th:hover { color: var(--text); border-color: var(--line2); }

main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.screen { display: flex; flex-direction: column; height: 100vh; }
.screen[hidden] { display: none; }
.pad { padding: 44px 44px 60px; max-width: 1080px; width: 100%; }
header.bar {
  display: flex; align-items: center; gap: 12px; padding: 13px 22px;
  border-bottom: 1px solid var(--line); background: var(--panel); flex: none;
}
header.bar h1 { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -.01em; }
header.bar .sub { font-size: 12px; color: var(--dim2); }

/* ── дашборд ─────────────────────────────────────────────────────────── */
.today { font-size: 12px; color: var(--dim2); letter-spacing: .02em; text-transform: uppercase; }
h1.big { font-size: 26px; font-weight: 600; letter-spacing: -.02em; margin: 8px 0 28px; }
.hero { display: grid; grid-template-columns: 1.35fr 1fr; gap: 16px; align-items: stretch; }
.card {
  border: 1px solid var(--line); border-radius: 12px; background: var(--panel);
  box-shadow: var(--shadow);
}
button.card { text-align: left; padding: 22px; cursor: pointer; display: flex; flex-direction: column; gap: 10px; }
button.card:hover { border-color: var(--brand); }
.card .h { display: flex; align-items: center; gap: 10px; }
.card .h .sq { width: 9px; height: 9px; border-radius: 3px; background: var(--brand); }
.card .h b { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.card .d { font-size: 13px; color: var(--dim); line-height: 1.5; max-width: 44ch; }
.tags { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.tag {
  font-size: 11px; color: var(--dim); border: 1px solid var(--line);
  border-radius: 5px; padding: 3px 7px;
}
.cap {
  font-size: 11px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--dim); font-weight: 600;
}
.alerts { padding: 18px 20px; }
.alerts .cap { margin-bottom: 12px; }
.alert {
  display: flex; align-items: center; gap: 10px; padding: 9px 8px; border: none;
  border-radius: 7px; background: transparent; cursor: pointer; text-align: left; width: 100%;
}
.alert:hover { background: var(--panel2); }
.alert .b { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--brand); }
.alert.warn .b { background: var(--warn); }
.alert.bad .b { background: var(--danger); }
.alert .t { font-size: 13px; flex: 1; }
.alert .ar { font-size: 12px; color: var(--dim2); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.stats button { text-align: left; padding: 18px 20px; cursor: pointer; }
.stats button:hover { border-color: var(--line2); }
.stats .t { font-size: 14px; font-weight: 650; margin-bottom: 6px; }
.stats .d { font-size: 12.5px; color: var(--dim); line-height: 1.5; }
.stats .v { margin-top: 14px; font-size: 20px; }
.stats .v small { font-size: 12px; color: var(--dim2); }

/* ── мастер ──────────────────────────────────────────────────────────── */
.wizard { flex: 1; min-height: 0; display: flex; }
.wizard .col { flex: 1; min-width: 0; overflow: auto; padding: 24px 24px 80px; }
.wizard .col > div { max-width: 840px; display: flex; flex-direction: column; gap: 18px; }
section.blk { border: 1px solid var(--line); border-radius: 11px; background: var(--panel); box-shadow: var(--shadow); }
section.blk > .hd {
  display: flex; align-items: center; gap: 10px; padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}
.step {
  width: 20px; height: 20px; border-radius: 6px; background: var(--panel2);
  border: 1px solid var(--line); display: flex; align-items: center;
  justify-content: center; font-size: 11px; font-weight: 700; flex: none;
}
.hd .t { font-size: 13.5px; font-weight: 650; }
.hd .n { font-size: 12px; color: var(--dim2); }
.hd .sp { flex: 1; }
.pane { padding: 16px 18px; border-bottom: 1px solid var(--line); }
.pane:last-child { border-bottom: none; }
.pane .cap { margin-bottom: 12px; }

.g { display: grid; gap: 12px; }
/* Кнопка сохранения не должна убегать под низ длинной формы. */
.kbd {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  border: 1px solid var(--line2); border-radius: 4px; padding: 1px 4px;
}
.saverow {
  position: sticky; bottom: 0; z-index: 5; display: flex; gap: 10px;
  align-items: center; margin: 4px -24px -24px; padding: 13px 24px;
  background: var(--bg); border-top: 1px solid var(--line);
}
/* Подписи бывают в одну и в две строки. Прижимаем содержимое ячейки к низу —
   тогда сами поля стоят на одной линии, а не скачут вслед за подписями. */
label.f { display: flex; flex-direction: column; gap: 5px; justify-content: flex-end; }
label.f > span { font-size: 12px; color: var(--dim); }
label.f.up > span { font-size: 11px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.i, input.i, select.i, textarea.i {
  padding: 7px 9px; font-size: 13px; background: var(--panel);
  border: 1px solid var(--line2); border-radius: 6px; outline: none; width: 100%;
}
/* Дата и выпадающий список по умолчанию на пару пикселей ниже обычного поля —
   при выравнивании по нижнему краю это видно. Задаём всем одну высоту. */
.i:not(textarea) { height: 32px; }
input[type=date].i { padding: 6px 9px; }
textarea.i { line-height: 1.5; resize: vertical; }
.i:focus { border-color: var(--brand); }
.i.bad { border-color: var(--danger); }
select.i { cursor: pointer; }
.fe { font-size: 11.5px; color: var(--danger); }

.search {
  padding: 8px 10px; font-size: 13px; background: var(--panel2);
  border: 1px solid var(--line); border-radius: 7px; outline: none; width: 100%;
}
.search:focus { border-color: var(--brand); background: var(--panel); }

.plist { display: flex; flex-direction: column; gap: 4px; }
.prow {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--panel);
  cursor: pointer; text-align: left; width: 100%;
}
.prow:hover { border-color: var(--line2); }
.prow.on { border-color: var(--brand); background: var(--brand-soft); }
.prow .rad {
  width: 14px; height: 14px; flex: none; border-radius: 50%;
  border: 1px solid var(--line2); display: flex; align-items: center; justify-content: center;
}
.prow.on .rad { border-color: var(--brand); }
.prow .rad i { width: 7px; height: 7px; border-radius: 50%; background: transparent; display: block; }
.prow.on .rad i { background: var(--brand); }
.prow .fio { font-size: 13.5px; font-weight: 500; flex: 1; min-width: 120px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow .inn { font-size: 12px; color: var(--dim2); }

.se { font-size: 11px; font-weight: 600; border-radius: 20px; padding: 3px 8px; white-space: nowrap;
  background: var(--panel2); color: var(--dim); }
.se.ok { background: var(--brand-soft); color: var(--brand-ink); }
.se.no { background: var(--danger-soft); color: var(--danger); }
.se.warn { background: var(--warn-soft); color: var(--warn); }

.banner { margin: 0 18px 16px; border-radius: 9px; padding: 13px 15px; animation: fade .2s ease;
  border: 1px solid var(--danger); background: var(--danger-soft); }
.banner.warn { border-color: var(--warn); background: var(--warn-soft); }
.banner .row { display: flex; align-items: flex-start; gap: 10px; }
.banner .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; border-radius: 50%;
  background: var(--danger); color: var(--panel); font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; }
.banner.warn .ic { background: var(--warn); }
.banner .ttl { font-size: 13px; font-weight: 650; color: var(--danger); }
.banner.warn .ttl { color: var(--warn); }
.banner .txt { font-size: 12.5px; color: var(--dim); line-height: 1.5; margin-top: 3px; }

.docrow { display: flex; gap: 11px; padding: 11px 8px; border-radius: 8px; cursor: pointer; }
.docrow:hover { background: var(--panel2); }
.docrow input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--brand); cursor: pointer; flex: none; }
.docrow .t { font-size: 13.5px; font-weight: 600; display: block; }
.docrow .d { font-size: 12.5px; color: var(--dim); display: block; margin-top: 3px; }
.docrow .n { font-size: 11px; color: var(--dim2); white-space: nowrap; }

/* таблица ТЗ */
.tz { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.tzg { display: grid; grid-template-columns: 1fr 74px 66px 92px 118px 112px 32px; }
.tz .head { background: var(--panel2); border-bottom: 1px solid var(--line);
  font-size: 11px; font-weight: 600; color: var(--dim); letter-spacing: .02em; }
.tz .head > div { padding: 8px 10px; }
.tz .head .r { text-align: right; padding: 8px 6px; }
.tz .row { align-items: center; border-bottom: 1px solid var(--line); }
.tz .row input { padding: 9px 10px; font-size: 13px; background: transparent;
  border: none; outline: none; width: 100%; }
.tz .row input.num { padding: 9px 6px; text-align: right; }
.tz .row input:focus { background: var(--panel2); }
.tz .cost { padding: 9px 10px; text-align: right; font-size: 13px; color: var(--dim); }
.tz .del { width: 32px; height: 32px; border: none; background: transparent;
  color: var(--dim2); cursor: pointer; font-size: 15px; line-height: 1; }
.tz .del:hover { color: var(--danger); }
.tz .foot { display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: var(--panel); }
.tz .foot .sum { font-size: 15px; font-weight: 500; min-width: 116px; text-align: right; }
.note { margin-top: 8px; font-size: 12px; color: var(--dim2); line-height: 1.5; }
.dash {
  padding: 5px 10px; border-radius: 6px; border: 1px dashed var(--line2);
  background: transparent; font-size: 12.5px; color: var(--dim); cursor: pointer;
}
.dash:hover { color: var(--text); border-color: var(--brand); }

/* правая колонка */
.rail { width: 322px; flex: none; border-left: 1px solid var(--line); background: var(--panel);
  display: flex; flex-direction: column; height: 100%; }
.rail .in { padding: 18px; display: flex; flex-direction: column; height: 100%; }
.rail .in[hidden] { display: none; }
.checks { display: flex; flex-direction: column; gap: 9px; flex: 1; overflow: auto; }
.chk { display: flex; gap: 9px; align-items: flex-start; }
.chk .ic { width: 15px; height: 15px; flex: none; margin-top: 1px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700;
  background: var(--panel2); color: var(--dim); }
.chk.ok .ic { background: var(--brand); color: var(--on-brand); }
.chk.bad .ic { background: var(--danger); color: #fff; }
.chk.warn .ic { background: var(--warn); color: #fff; }
.chk .l { font-size: 12.5px; line-height: 1.35; }
.chk.bad .l { color: var(--danger); }
.chk .n { font-size: 11.5px; color: var(--dim2); margin-top: 2px; line-height: 1.35; }
.rail .foot { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.rail .tot { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px;
  font-size: 12.5px; color: var(--dim); }
.rail .tot b { font-size: 14px; font-weight: 400; color: var(--text); }
.rail .hint { margin-top: 8px; text-align: center; font-size: 11.5px; color: var(--dim2); line-height: 1.4; }

/* ── кнопки ──────────────────────────────────────────────────────────── */
.btn { padding: 7px 12px; border-radius: 7px; border: 1px solid transparent;
  background: var(--brand); color: var(--on-brand); font-size: 13px; font-weight: 650; cursor: pointer; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn.big { width: 100%; padding: 11px 14px; border-radius: 8px; font-size: 13.5px; }
.btn.g { background: var(--panel); border-color: var(--line2); color: var(--text); font-weight: 500; }
.btn.g:hover { border-color: var(--text); filter: none; }
.btn.s { padding: 5px 10px; font-size: 12.5px; }

.spin { width: 14px; height: 14px; border: 2px solid var(--line2); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .7s linear infinite; display: block; flex: none; }
.bar2 { height: 3px; border-radius: 2px; background: var(--panel2); margin-top: 18px; overflow: hidden; }
.bar2 i { display: block; height: 100%; background: var(--brand); transition: width .3s ease; }

/* ── таблицы разделов ────────────────────────────────────────────────── */
.tbl { flex: 1; overflow: auto; }
.trow { display: grid; padding: 0 22px; border-bottom: 1px solid var(--line);
  background: var(--panel); align-items: center; }
.thead { position: sticky; top: 0; z-index: 1; font-size: 11px; font-weight: 600;
  color: var(--dim); letter-spacing: .03em; text-transform: uppercase; }
.thead > div { padding: 9px 8px; }
.trow.click { cursor: pointer; }
.trow.click:hover { background: var(--panel2); }
.trow > div { padding: 11px 8px; }
.people-g { grid-template-columns: 1.5fr 150px 210px 1.1fr 150px; }
.docs-g { grid-template-columns: 1.1fr 80px 105px 1.3fr 105px 1fr 140px; }
.sub2 { font-size: 11.5px; color: var(--dim2); margin-top: 2px; }
.blank { padding: 90px 20px; text-align: center; }
.blank .sq { width: 38px; height: 38px; border-radius: 10px; border: 1px dashed var(--line2); margin: 0 auto 14px; }
.blank .t { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.blank .d { font-size: 13px; color: var(--dim); line-height: 1.5; max-width: 38ch; margin: 0 auto; }

/* ── анкеты ──────────────────────────────────────────────────────────── */
.forms { padding: 24px; display: flex; flex-direction: column; gap: 14px; max-width: 900px; }
.diff { width: 100%; border-collapse: collapse; font-size: 13px; }
.diff td { padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.diff td:first-child { color: var(--dim); width: 200px; }
.was { color: var(--dim2); text-decoration: line-through; }
.now { color: var(--brand-ink); font-weight: 600; }

/* ── модалка ─────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center;
  justify-content: center; padding: 20px; background: rgba(10, 11, 13, .55); }
.modal[hidden] { display: none; }
.modal .box { background: var(--panel); border-radius: 12px; padding: 22px; max-width: 420px;
  width: 100%; text-align: center; box-shadow: 0 20px 60px rgba(0, 0, 0, .3); }
.modal h3 { margin: 0 0 6px; font-size: 16px; font-weight: 650; }
.modal p { color: var(--dim); font-size: 13px; margin: 0 0 14px; line-height: 1.5; }
.modal.wide .box { max-width: 560px; text-align: left; max-height: 86vh; overflow: auto; }
.modal .g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.qr { background: #fff; padding: 12px; border-radius: 10px; display: inline-block; }
.qr svg { display: block; width: 190px; height: 190px; }
.linkrow { display: flex; gap: 8px; margin: 14px 0 4px; }
.linkrow input { font-size: 12px; }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px;
  font-size: 13px; z-index: 60; animation: fade .2s ease; box-shadow: var(--shadow); }
.toast[hidden] { display: none; }

@media (max-width: 900px) {
  aside { display: none; }
  .hero, .stats { grid-template-columns: 1fr; }
  .wizard { flex-direction: column; }
  .rail { width: auto; border-left: none; border-top: 1px solid var(--line); }
  .pad { padding: 24px 18px 60px; }
}

/* ── выплаты и чеки ───────────────────────────────────────────────────── */
.pay-g { grid-template-columns: 92px 1.6fr 130px 150px 1.4fr 90px; }
.paysum {
  display: flex; gap: 18px; flex-wrap: wrap; padding: 12px 14px;
  margin-bottom: 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; font-size: 12.5px; color: var(--dim);
}
.paysum b { color: var(--text); font-weight: 600; }
.paysum .mono { color: var(--text); }
.paysum .bad { color: var(--danger); }
