/* Дорожные карты ГИПов — фирменный стиль Антек */
:root {
  --orange: #CE4B1A;
  --orange-dark: #A63C14;
  --orange-soft: #FBEDE7;
  --ink: #262626;
  --ink-2: #444444;
  --muted: #666666;
  --line: #E3E3E3;
  --line-2: #EEEEEE;
  --line-strong: #C1C1C1;
  --bg: #F5F5F5;
  --white: #FFFFFF;
  --font: 'Helvetica Neue', Inter, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
a { color: var(--orange); }
a:hover { color: var(--orange-dark); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }
.wrap { max-width: 1320px; margin: 0 auto; padding: 0 24px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }

/* шапка */
.topbar { background: var(--white); border-bottom: 1px solid var(--line); }
.topbar-in { display: flex; align-items: center; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-sep { width: 1px; height: 32px; background: var(--line-strong); }
.brand-name { font-weight: 600; font-size: 16px; }

/* кнопки и поля */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  border: 1px solid var(--line-strong); border-radius: 999px; background: var(--white); font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--orange); border-color: var(--orange); color: var(--white); }
.btn-primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.btn-sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-icon { width: 36px; height: 36px; min-height: 36px; padding: 0; border-radius: 50%; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { border-color: var(--line-strong); }
.btn-danger:hover { border-color: var(--orange); color: var(--orange-dark); }
input, select, textarea { min-height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 0; background: var(--white); width: 100%; }
input:focus, select:focus { outline: 2px solid var(--orange); outline-offset: -1px; border-color: var(--orange); }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label > input, label > select { color: var(--ink); font-size: 15px; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }

/* страница */
.page { padding-top: 28px; padding-bottom: 64px; display: flex; flex-direction: column; gap: 24px; }
.page-head { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; justify-content: space-between; }
.title { font-size: 34px; font-weight: 300; letter-spacing: -0.01em; line-height: 1.15; }
.subtitle { color: var(--muted); margin-top: 6px; }
.eyebrow { font-size: 13px; color: var(--muted); letter-spacing: 0.04em; }
.panel { background: var(--white); border: 1px solid var(--line); }
.panel-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 18px 24px; border-bottom: 1px solid var(--line); }
.panel-head h2 { font-size: 18px; font-weight: 600; }
.panel-body { padding: 20px 24px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.filters label { min-width: 200px; }

/* сводка */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.kpi { background: var(--white); border: 1px solid var(--line); padding: 18px 20px; }
.kpi-label { font-size: 13px; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 300; margin-top: 6px; }
.kpi-note { font-size: 13px; color: var(--ink-2); margin-top: 4px; }
.kpi.dark { background: var(--ink); border-color: var(--ink); color: var(--white); }
.kpi.dark .kpi-label, .kpi.dark .kpi-note { color: #D6D6D6; }
.accent { color: var(--orange); }

/* главный экран */
.group { display: flex; flex-direction: column; gap: 14px; }
.group-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.group-head h2 { font-size: 19px; font-weight: 600; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--orange-soft); color: var(--orange-dark); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.card { display: flex; flex-direction: column; gap: 16px; padding: 20px; background: var(--white); border: 1px solid var(--line); color: var(--ink); text-decoration: none; }
.card:hover { border-color: var(--ink); color: var(--ink); }
.card-name { font-weight: 600; font-size: 16px; line-height: 1.3; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.bar { height: 8px; background: var(--line-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--orange); }
.bar.thin { height: 6px; }
.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.small-label { font-size: 12px; color: var(--muted); }
.strong { font-weight: 600; }
.tag { align-self: flex-start; display: inline-flex; align-items: center; min-height: 28px; font-size: 13px; font-weight: 600; padding: 0 12px; border-radius: 999px; }
.tone-ok { background: var(--line-2); color: var(--ink); }
.tone-soon { background: var(--orange-soft); color: var(--orange-dark); }
.tone-late { background: var(--orange); color: var(--white); }
.tone-none { background: var(--line-2); color: var(--muted); }
.empty { padding: 40px; text-align: center; color: var(--muted); background: var(--white); border: 1px dashed var(--line-strong); }

/* проект: шапка */
.proj-head { background: var(--white); border-bottom: 1px solid var(--line); }
.proj-head-in { padding-top: 12px; display: flex; flex-direction: column; gap: 14px; }
.back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 14px; font-weight: 500; text-decoration: none; }
.donuts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.donut-card { display: flex; gap: 18px; align-items: center; padding: 16px 20px; border: 1px solid var(--line); }
.donut { width: 88px; height: 88px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.donut-hole { width: 64px; height: 64px; border-radius: 50%; background: var(--white); display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 600; font-size: 15px; line-height: 1.1; }
.donut-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.donut-big { font-size: 21px; font-weight: 300; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.legend b { margin-left: auto; padding-left: 8px; font-weight: 600; white-space: nowrap; }
.sw { width: 10px; height: 10px; flex-shrink: 0; display: inline-block; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab { min-height: 48px; display: inline-flex; align-items: center; padding: 0 18px; border-bottom: 3px solid transparent; color: var(--muted); font-weight: 500; text-decoration: none; }
.tab:hover { color: var(--ink); }
.tab[aria-current="page"] { border-bottom-color: var(--orange); color: var(--ink); font-weight: 600; }

/* паспорт */
.passport { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.passport-col { padding: 8px 24px 16px; border-right: 1px solid var(--line-2); }
.passport-col h3 { margin: 12px 0 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--orange); }
.prow { min-height: 66px; padding: 10px 0; border-bottom: 1px solid var(--line-2); display: flex; flex-direction: column; justify-content: center; gap: 3px; }
.prow dt { font-size: 12px; color: var(--muted); }
.prow dd { margin: 0; font-size: 15px; font-weight: 500; }
.prow input, .prow select { min-height: 36px; }
dl { margin: 0; }
.fire { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.fire-card { border: 1px solid var(--line); padding: 16px 18px; display: flex; flex-direction: column; gap: 6px; }
.fire-k { font-size: 13px; color: var(--muted); min-height: 36px; line-height: 1.35; }
.fire-v { font-size: 30px; font-weight: 300; }
.fire-n { font-size: 13px; color: var(--ink-2); }

/* разделы */
.legend-row { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--muted); }
.legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.tagbox { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line-strong); min-height: 58px; background: var(--white); }
.tagbox:focus-within { outline: 2px solid var(--orange); outline-offset: -1px; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 36px; padding: 0 4px 0 14px; border-radius: 999px; font-size: 14px; font-weight: 600; }
.chip button { width: 28px; height: 28px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.chip button:hover { background: rgba(0,0,0,.15); }
.g-a { background: var(--ink); color: var(--white); }
.g-i { background: var(--orange); color: var(--white); }
.g-o { background: var(--line); color: var(--ink); }
.tagbox input { flex: 1 1 200px; border: 0; min-height: 40px; outline: none; padding: 0 6px; }
.tagbox input:focus { outline: none; }
.sugg { border: 1px solid var(--line); border-top: 0; display: flex; flex-direction: column; background: var(--white); }
.sugg button { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 14px; border: 0; border-bottom: 1px solid var(--line-2); background: var(--white); text-align: left; cursor: pointer; }
.sugg button:hover, .sugg button:focus { background: var(--bg); }
.sugg b { width: 56px; }

/* таблицы */
.table-box { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); background: var(--bg); padding: 10px 14px; white-space: nowrap; }
td { padding: 9px 14px; border-top: 1px solid var(--line-2); vertical-align: middle; }
td.num, th.num { text-align: right; white-space: nowrap; }
td.actions { text-align: right; white-space: nowrap; width: 1%; }
tr.add-row td { background: #FAFAFA; }
tr.add-row input, tr.edit-row input { min-height: 36px; }
tfoot td { font-weight: 600; border-top: 1px solid var(--line); }
.overdue { color: var(--orange-dark); font-weight: 600; }
.ext { display: inline-block; min-width: 42px; padding: 2px 6px; border: 1px solid var(--line-strong); font-size: 11px; font-weight: 600; color: var(--ink-2); text-align: center; margin-right: 10px; }

/* статусы */
.status { min-height: 30px; padding: 0 28px 0 12px; border-radius: 999px; font-size: 13px; font-weight: 600; width: auto; cursor: pointer; }
.st-todo { background: var(--line-2); color: #555555; border-color: var(--line-2); }
.st-work { background: var(--orange); color: var(--white); border-color: var(--orange); }
.st-review { background: var(--white); color: var(--orange-dark); border: 2px solid var(--orange); }
.st-done { background: var(--ink); color: var(--white); border-color: var(--ink); }
.st-excluded { background: var(--white); color: var(--muted); border: 1px dashed var(--line-strong); }
.dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.dot.st-todo { background: #D6D6D6; }

/* дорожная карта */
.stage { background: var(--white); border: 1px solid var(--line); }
.stage.is-excluded { opacity: .75; }
.stage-head { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; padding: 14px 20px; }
.stage-title { flex: 1 1 280px; min-width: 0; display: flex; align-items: center; gap: 12px; }
.stage-num { width: 30px; height: 30px; border-radius: 50%; background: var(--ink); color: var(--white); display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; flex-shrink: 0; }
.stage-title h2 { font-size: 17px; font-weight: 600; }
.stage-meta { font-size: 14px; color: var(--muted); }
.stage-pct { display: flex; align-items: center; gap: 10px; width: 200px; }
.stage-pct .bar { flex: 1; }
.stage-tools { display: flex; gap: 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form input { width: auto; flex: 1 1 260px; }

/* финансы */
.cols { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.cols > .panel { flex: 1 1 100%; min-width: 0; }
.payee { display: flex; align-items: center; gap: 12px; padding: 7px 0; font-size: 14px; }
.payee-name { width: 190px; flex-shrink: 0; }
.payee .bar { flex: 1; }
.payee .bar > span { background: var(--ink); }
.payee-sum { width: 130px; text-align: right; font-weight: 600; white-space: nowrap; }
.warn { padding: 12px 16px; background: var(--orange-soft); color: var(--orange-dark); font-size: 14px; font-weight: 500; }

/* загрузка файлов */
.drop { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 120px; border: 1.5px dashed var(--line-strong); background: var(--bg); cursor: pointer; text-align: center; padding: 16px; color: var(--ink); font-size: 15px; }
.drop.over { border-color: var(--orange); background: var(--orange-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }

/* диалог, тост */
.dialog { border: 0; padding: 0; width: min(720px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(38,38,38,.5); }
.dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog-body h2 { font-size: 22px; font-weight: 300; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.span2 { grid-column: 1 / -1; }
.dialog-actions { display: flex; gap: 10px; justify-content: flex-end; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--white); padding: 12px 20px; font-size: 14px; max-width: calc(100vw - 32px); z-index: 10; }

/* верхнее меню */
.topbar-in { justify-content: space-between; flex-wrap: wrap; gap: 12px; padding-top: 8px; padding-bottom: 8px; }
.topnav { display: flex; flex-wrap: wrap; gap: 4px; }
.topnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; color: var(--ink-2); font-weight: 500; text-decoration: none; transition: background .2s, color .2s; }
.topnav a:hover { background: var(--bg); color: var(--ink); }
.topnav a[aria-current="page"] { background: var(--orange-soft); color: var(--orange-dark); font-weight: 600; }

/* скругления */
:root { --r: 14px; --r-sm: 10px; }
.panel, .kpi, .card, .stage, .donut-card, .fire-card, .empty, .drop, .warn, .dialog { border-radius: var(--r); }
.panel, .stage { overflow: hidden; }
input, select, textarea, .tagbox { border-radius: var(--r-sm); }
.sugg { border-radius: 0 0 var(--r-sm) var(--r-sm); overflow: hidden; }
.bar, .bar > span { border-radius: 999px; }
.ext { border-radius: 6px; }
.status { border-radius: 999px; }

/* движение */
.card, .kpi, .donut-card, .fire-card { transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s, border-color .25s; }
.card:hover { transform: translateY(-4px) scale(1.015); box-shadow: 0 14px 30px rgba(38, 38, 38, .10); border-color: var(--line-strong); }
.kpi:hover, .donut-card:hover, .fire-card:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(38, 38, 38, .07); }
.bar > span { transition: width 1.1s cubic-bezier(.2,.8,.2,1); }
.anim-in { animation: rise .55s cubic-bezier(.2,.8,.2,1) both; animation-delay: calc(var(--i, 0) * 60ms); }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@property --k { syntax: '<number>'; inherits: false; initial-value: 1; }
.donut.anim { animation: donut-fill 1.2s cubic-bezier(.2,.8,.2,1) both; }
@keyframes donut-fill { from { --k: 0; } to { --k: 1; } }
@media (prefers-reduced-motion: reduce) {
  .anim-in, .donut.anim { animation: none; }
  .bar > span, .card, .kpi, .donut-card, .fire-card { transition: none; }
  .card:hover, .kpi:hover, .donut-card:hover, .fire-card:hover { transform: none; }
}

/* движение денег */
[hidden] { display: none !important; }
.btn-dark { background: var(--ink); border-color: var(--ink); color: var(--white); }
.btn-dark:hover { background: #000000; border-color: #000000; color: var(--white); }
.ledger .col-in { background: #F8F8F8; font-weight: 600; }
.ledger .col-out { background: #FDF5F2; color: var(--orange-dark); font-weight: 600; }
.ledger th.col-in { background: #EEEEEE; color: var(--ink); }
.ledger th.col-out { background: var(--orange-soft); color: var(--orange-dark); }
.ledger tfoot .col-in, .ledger tfoot .col-out { font-weight: 700; }

/* справочник */
input.check { width: 20px; height: 20px; min-height: 0; padding: 0; accent-color: var(--orange); cursor: pointer; }
.check-label { flex-direction: row; align-items: center; gap: 8px; white-space: nowrap; color: var(--ink-2); font-size: 14px; cursor: pointer; }
.tpl-list { display: flex; flex-direction: column; gap: 18px; }
.tpl { border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; background: #FAFAFA; }
.tpl-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tpl-name { flex: 1 1 320px; width: auto; font-size: 17px; font-weight: 600; min-height: 44px; }
.tpl-stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tpl-stage { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.tpl-stage-head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.tpl-stage-head > input { flex: 1 1 280px; width: auto; font-weight: 500; }
.tpl-stage .tagbox { min-height: 50px; padding: 6px 8px; }
.tpl-stage .chip { font-weight: 500; }

/* справочник — простые строки */
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 22px; padding: 0 7px; margin-left: 6px; border-radius: 999px; background: var(--line-2); color: var(--muted); font-size: 12px; font-weight: 600; vertical-align: middle; }
.ref-table td { height: 54px; }
.ref-table tr:not(.edit-row):hover td { background: #FAFAFA; }
.ref-table td.desc, .sub-desc { color: var(--ink-2); white-space: pre-line; }
.ref-table tr.edit-row td { background: var(--orange-soft); vertical-align: top; }
.ref-table tr.edit-row input, .ref-table tr.edit-row select { min-height: 36px; }
.muted { color: var(--line-strong); }
textarea { padding: 8px 12px; resize: vertical; min-height: 40px; line-height: 1.4; }
textarea:focus { outline: 2px solid var(--orange); outline-offset: -1px; border-color: var(--orange); }
.sub-desc { font-size: 13px; color: var(--muted); margin-top: 3px; }
form.stage-head { background: var(--orange-soft); }
form.stage-head > input[name="name"] { flex: 1 1 280px; width: auto; }
.page > .back { margin-bottom: -12px; }

/* шапка: пользователь */
.topbar-in { justify-content: flex-start; }
.topnav { margin-left: auto; }
.user-box { position: relative; }
.user-btn { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 14px 4px 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); cursor: pointer; text-align: left; transition: border-color .2s, box-shadow .2s; }
.user-btn:hover { border-color: var(--line-strong); box-shadow: 0 4px 12px rgba(38,38,38,.07); }
.user-btn.is-out { width: 44px; justify-content: center; padding: 0; color: var(--muted); cursor: default; }
.user-name { display: flex; flex-direction: column; font-size: 14px; font-weight: 600; line-height: 1.2; }
.user-name small { font-size: 12px; font-weight: 400; color: var(--muted); }
.user-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 290px; padding: 16px; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); box-shadow: 0 14px 34px rgba(38,38,38,.14); display: flex; flex-direction: column; gap: 12px; }
.user-menu-head { display: flex; gap: 12px; align-items: center; }
.user-menu .btn { align-self: flex-start; }

/* вход */
.login-page { align-items: center; padding-top: 72px; }
.login { width: min(440px, 100%); }
.login-form { display: flex; flex-direction: column; gap: 14px; padding: 32px; }
.login-form .title { font-size: 30px; }
.login-form .btn { margin-top: 6px; }

@media (max-width: 640px) {
  .user-name { display: none; }
  .user-btn { padding: 4px; }
  .wrap { padding: 0 16px; }
  .title { font-size: 26px; }
  .form-grid { grid-template-columns: 1fr; }
  .passport-col { padding: 8px 16px 12px; }
  .stage-pct { width: 100%; }
  .payee-name { width: 120px; }
}

/* выбор этапов в окне «Новый проект» */
.stage-pick { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; margin: 0; }
.stage-pick legend { padding: 0 6px; font-size: 14px; color: var(--muted); }
#new-stages { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
#new-stages .check-label { font-weight: 400; white-space: normal; align-items: flex-start; }
@media (max-width: 640px) { #new-stages { grid-template-columns: 1fr; } }