/*
  КАМ-Финансы — стили по корпоративному стилю ООО «КАМ-Проект» (скилл kam-design).
  Графит + один оранжевый акцент (не более 5 % площади), тёплые серые,
  волосяные линии #3A3A3A, прямые углы (скругление 2px только у кнопок и полей),
  без теней и градиентов (тень — только у всплывающего уведомления).
*/

:root {
  --ground: #1B1B1B; --bg: #232323; --surface: #232323; --surface2: #2A2A2A; --hair: #3A3A3A;
  --line-art: #4E4C49;
  --text: #E8E4E0; --text-soft: #B5B0AB; --muted: #9C9792; --note: #85807B; --dim: #7A7570;
  --accent: #E0762F; --accent-hover: #EC8A45;
  --ok: #8FBF84; --warn: #D2A96B; --warn-bg: #2E2517; --bad: #E38080; --bad-bg: #3A2020; --bad-text: #FFC9C9;
  --font: 'Manrope', 'Montserrat', 'Segoe UI', system-ui, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--text); font-family: var(--font);
  font-size: 13px; font-weight: 400; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--hair); }
a:hover { color: #fff; border-bottom-color: var(--accent); }
.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Каркас ------------------------------------------------------------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 32px; }
.top { border-bottom: 1px solid var(--hair); }
.top .wrap { display: flex; align-items: center; gap: 28px; min-height: 76px; }
.brand { display: flex; align-items: center; gap: 18px; border: 0; }
.brand img { width: 132px; height: auto; display: block; }      /* знак не меньше 120px */
.brand span {
  font-size: 10px; font-weight: 700; letter-spacing: 2.4px; text-transform: uppercase; color: var(--muted);
  padding-left: 18px; border-left: 1px solid var(--hair);
}
.nav { display: flex; gap: 2px; margin-left: auto; align-self: stretch; }
.nav a {
  display: flex; align-items: center; padding: 0 16px; color: var(--muted); border: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13px;
}
.nav a:hover { color: var(--text); }
.nav a.on { color: #fff; border-bottom-color: var(--accent); }
.user { display: flex; align-items: center; gap: 14px; color: var(--dim); font-size: 11.5px; }
.user form { margin: 0; }
.linkbtn { background: none; border: 0; color: var(--muted); font: inherit; font-size: 11.5px; cursor: pointer; padding: 0; }
.linkbtn:hover { color: #fff; }

main { padding: 40px 0 64px; }
.foot { border-top: 1px solid var(--hair); color: var(--dim); font-size: 11px; }
.foot .wrap { display: flex; justify-content: space-between; padding-top: 16px; padding-bottom: 24px; }

/* --- Заголовки -------------------------------------------------------------- */
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 32px; flex-wrap: wrap; }
.eyebrow { font-size: 10px; font-weight: 700; letter-spacing: 2.4px; text-transform: uppercase; color: var(--accent); margin: 0 0 8px; }
h1 { font-size: 30px; line-height: 1.15; font-weight: 300; letter-spacing: -.8px; color: #fff; margin: 0; }
h1 b { font-weight: 300; color: var(--accent); }
.head .aside { color: var(--muted); font-size: 11.5px; text-align: right; max-width: 42ch; }
h2 { font-size: 19px; font-weight: 700; letter-spacing: -.2px; color: #fff; margin: 0 0 12px; }

.rubric {
  display: flex; align-items: center; gap: 20px; margin: 44px 0 16px;
  font-size: 10px; font-weight: 700; letter-spacing: 2.1px; text-transform: uppercase; color: var(--accent);
}
.rubric::after { content: ""; flex: 1; border-top: 1px solid var(--hair); }
.rubric small { color: var(--dim); letter-spacing: 1.3px; font-weight: 700; order: 3; }

/* --- Блок фактов ------------------------------------------------------------- */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); border: 1px solid var(--hair); }
.fact { padding: 18px 20px 20px; border-right: 1px solid var(--hair); }
.fact:last-child { border-right: 0; }
.fact-k { font-size: 9.5px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; color: var(--dim); }
.fact-v { font-size: 26px; font-weight: 300; letter-spacing: -.5px; color: #fff; margin-top: 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fact-v small { font-size: 13px; color: var(--muted); margin-left: 4px; }
.fact-m { font-size: 11px; color: var(--muted); margin-top: 4px; }
.fact-v.accent { color: var(--accent); }

/* --- Таблицы --------------------------------------------------------------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  font-size: 9.5px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; color: var(--dim);
  text-align: left; padding: 0 12px 10px; border-bottom: 1px solid var(--hair); white-space: nowrap;
}
.tbl th.num { text-align: right; }   /* заголовок числовой колонки — по правому краю, как числа */
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--hair); font-size: 12.5px; vertical-align: top; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl tbody tr:hover td { background: var(--surface); }
.tbl tfoot td { border-bottom: 0; color: #fff; font-weight: 600; }
/* Закреплённая шапка (static/kam/sticky.js сдвигает th вслед за прокруткой).
   Пока шапка «едет», у неё фон страницы и линия снизу, чтобы строки под ней не просвечивали. */
.tbl thead th { position: relative; z-index: 2; }
.tbl thead.stuck th { background: var(--ground); box-shadow: inset 0 -1px 0 var(--hair); }
.tbl.bdds thead tr:first-child th:first-child, .pivot thead th:first-child { z-index: 3; }  /* угол над закреплённой первой колонкой */
/* Стрелки прокрутки широких таблиц (static/kam/scroll-arrows.js): тонкий оранжевый шеврон, без теней. */
.hscroll-btn {
  position: fixed; z-index: 20; display: none; align-items: center; justify-content: center;
  width: 34px; height: 56px; padding: 0; cursor: pointer;
  background: rgba(27, 27, 27, .92); border: 1px solid var(--hair); border-radius: 2px; color: var(--accent);
}
.hscroll-btn.on { display: flex; }
.hscroll-btn:hover { border-color: var(--accent); }
.hscroll-btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: miter; }
@media print { .hscroll-btn { display: none !important; } }
.tbl .muted, .muted { color: var(--muted); }
.tbl .dim, .dim { color: var(--dim); }
.tbl .code { color: var(--accent); font-weight: 700; font-size: 11px; letter-spacing: .5px; white-space: nowrap; }
.in { color: var(--ok); }
.out { color: var(--text); }
.neg { color: var(--bad); }
.purpose { color: var(--muted); font-size: 11.5px; max-width: 46ch; }
.empty { color: var(--dim); padding: 22px 0; border-bottom: 1px solid var(--hair); }

/* --- Метки ------------------------------------------------------------------ */
.badge {
  display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  padding: 2px 7px; border: 1px solid var(--hair); color: var(--muted); white-space: nowrap; vertical-align: 1px;
}
.badge.test { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.badge.ok { color: var(--ok); border-color: #3E4F3A; }
.badge.bad { color: var(--bad-text); background: var(--bad-bg); border-color: transparent; }
.badge.acc { color: var(--accent); border-color: var(--accent); }

/* Полоса «получено от суммы договора» — тонкая линия, как разметка */
.bar { height: 2px; background: var(--hair); margin-top: 6px; min-width: 80px; }
.bar i { display: block; height: 2px; background: var(--accent); }

/* --- Кнопки и поля ----------------------------------------------------------- */
.btn {
  display: inline-block; padding: 10px 16px; background: var(--accent); color: #1B1B1B; border: 0; border-radius: 2px;
  font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; line-height: 1.3;
}
.btn:hover { background: var(--accent-hover); color: #1B1B1B; }
.btn.sec { background: none; color: var(--text); border: 1px solid var(--hair); font-weight: 600; }
.btn.sec:hover { background: var(--surface); border-color: var(--dim); }
.btn.sm { padding: 6px 11px; font-size: 11.5px; }
.btn[disabled] { opacity: .55; cursor: wait; }
a.btn { border-bottom: 0; }

input[type=text], input[type=number], input[type=password], input[type=file], input[type=email],
input[type=date], input[type=url], select, textarea {
  color-scheme: dark;   /* календарь и стрелки браузера — в тёмной теме */
  width: 100%; padding: 9px 11px; background: var(--surface); color: var(--text);
  border: 1px solid var(--hair); border-radius: 2px; font: inherit; font-size: 13px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
input[type=file] { padding: 7px; color: var(--muted); }
input[type=file]::file-selector-button {
  background: none; color: var(--text); border: 1px solid var(--hair); border-radius: 2px;
  padding: 5px 10px; margin-right: 10px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
input[type=file]::file-selector-button:hover { border-color: var(--dim); background: var(--surface2); }
label { display: block; font-size: 9.5px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.field { margin-bottom: 16px; }
.errorlist { list-style: none; margin: 6px 0 0; padding: 0; color: var(--bad); font-size: 11.5px; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin: 0; min-width: 220px; flex: 1; }
.inline-form select { min-width: 180px; }
/* Маленькая форма прямо в ячейке таблицы: выбор и кнопка в одну строку */
.cell-form { display: flex; gap: 8px; align-items: center; margin: -5px 0; }
.cell-form select { width: auto; min-width: 170px; padding: 6px 9px; font-size: 12px; }

/* --- Сетки --------------------------------------------------------------- */
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 0 44px; }
.side { display: grid; grid-template-columns: 330px 1fr; gap: 44px; align-items: start; }
.panel { border: 1px solid var(--hair); padding: 20px; }
/* Колонки сетки могут сжиматься уже своего содержимого (иначе широкая таблица раздвигает страницу) */
.grid2 > *, .side > * { min-width: 0; }

/* --- Вкладки -------------------------------------------------------------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--hair); margin-bottom: 20px; }
.tabs a {
  padding: 11px 18px; font-size: 13px; color: var(--muted); border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a.on { color: #fff; border-bottom-color: var(--accent); }
.tabs a .cnt { color: var(--accent); font-weight: 700; margin-left: 6px; font-size: 11px; }

/* --- Примечание с рантом ---------------------------------------------------- */
.note { border-left: 2px solid var(--accent); padding: 2px 0 2px 15px; font-size: 12.5px; line-height: 1.7; color: var(--dim); margin: 16px 0; }
.warn-list { list-style: none; margin: 0; padding: 0; }
.warn-list li { padding: 10px 0 10px 15px; border-bottom: 1px solid var(--hair); border-left: 2px solid var(--warn); color: var(--text-soft); font-size: 12.5px; }

/* --- Справочники -------------------------------------------------------------- */
.crumb { color: var(--accent); border: 0; }
.crumb:hover { color: var(--accent-hover); }
.ref-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 0 44px; }
.ref-list li { padding: 14px 0; border-bottom: 1px solid var(--hair); }
.ref-list li a { font-size: 15px; font-weight: 600; color: #fff; border-bottom-color: var(--hair); }
.ref-list li .cnt { color: var(--accent); font-weight: 700; font-size: 11px; margin-left: 8px; }
.ref-list li p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.search { display: flex; gap: 10px; align-items: center; max-width: 520px; margin-bottom: 20px; }
.ref-form { max-width: 640px; }
.help { color: var(--dim); font-size: 11px; margin-top: 5px; }
.actions { display: flex; gap: 10px; margin-top: 24px; }
.delete-form { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--hair); max-width: 640px; }
.linkbtn.danger { color: var(--bad); }
.linkbtn.danger:hover { color: var(--bad-text); }
/* Флажки: фирменный оранжевый, подпись в строку */
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; margin: 0 8px 0 0; vertical-align: -2px; }
.field.check label, .field div label {
  display: inline-flex; align-items: center; font-size: 13px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text);
  margin: 0; cursor: pointer;
}
.field div div { padding: 3px 0; }   /* список флажков (роли пользователя) */
input:disabled, select:disabled, textarea:disabled { color: var(--muted); background: var(--ground); }
textarea { min-height: 84px; resize: vertical; }

/* --- Дашборды ---------------------------------------------------------------- */
/* Цвета рядов графика: проверены валидатором палитры на фоне #1B1B1B (CVD ΔE 26,8). */
:root { --series-in: #3987E5; --series-out: #D95926; --series-balance: #E8E4E0; }
.mode-tabs { margin: 0; border-bottom: 0; }
.filters { border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); padding: 18px 0 16px; margin-top: 8px; }
.tl-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.tl-label { color: #fff; font-size: 14px; margin-left: 12px; }
.tl-tools { display: flex; gap: 12px; flex-wrap: wrap; }
.seg { display: inline-flex; border: 1px solid var(--hair); border-radius: 2px; }
.seg button { background: none; border: 0; border-right: 1px solid var(--hair); color: var(--muted); font: inherit; font-size: 11.5px; padding: 6px 11px; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button:hover { color: #fff; }
.seg button.on { color: #fff; background: var(--surface2); }
/* Временная шкала: годы сверху, месяцы строкой; выбранный диапазон — оранжевая «разметка» снизу */
.timeline { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 4px; user-select: none; touch-action: pan-x; }
.tl-year { flex: 0 0 auto; }
.tl-ycap { font-size: 9.5px; font-weight: 700; letter-spacing: 1.3px; color: var(--dim); margin-bottom: 4px; }
.tl-row { display: flex; }
.tl-m {
  width: 52px; padding: 9px 0 8px; background: var(--surface); border: 0; border-right: 1px solid var(--ground);
  border-bottom: 3px solid var(--hair); color: var(--muted); font: inherit; font-size: 12px; cursor: pointer;
}
.tl-m:hover { color: #fff; }
.tl-m.sel { color: #fff; background: var(--surface2); border-bottom-color: var(--accent); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.chip {
  background: none; border: 1px solid var(--hair); border-radius: 2px; color: var(--muted); font: inherit; font-size: 12px;
  padding: 5px 11px; cursor: pointer;
}
.chip:hover { color: #fff; border-color: var(--dim); }
.chip.on { color: #fff; border-color: var(--accent); }
.art-pick { margin-top: 10px; }
.art-pick summary, .table-view summary { cursor: pointer; color: var(--muted); font-size: 12px; }
.art-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px 32px; padding: 14px 0 4px; }
.art-group label {
  display: flex; align-items: center; font-size: 12.5px; font-weight: 400; letter-spacing: 0; text-transform: none;
  color: var(--text); margin: 6px 0 0; cursor: pointer;
}
.fact-v.hero { font-size: 32px; }
.chart-card { border: 1px solid var(--hair); padding: 20px 20px 16px; margin-top: 28px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.chart-head h2 { margin: 0; }
.legend { list-style: none; margin: 0; padding: 0; display: flex; gap: 18px; flex-wrap: wrap; font-size: 12px; color: var(--text-soft); }
.legend li { display: flex; align-items: center; gap: 7px; }
.key.rect { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.key.line { width: 16px; height: 2px; display: inline-block; }
.chart-box { position: relative; height: 340px; }
.table-view { margin-top: 18px; }
.table-view summary { margin-bottom: 12px; }
.pivot td:first-child, .pivot th:first-child { position: sticky; left: 0; background: var(--ground); min-width: 220px; }
.pivot tr.sec td { color: var(--dim); font-size: 9.5px; font-weight: 700; letter-spacing: 1.3px; text-transform: uppercase; padding-top: 18px; }
.pivot td.strong { color: #fff; }
.pivot tfoot td { border-top: 1px solid var(--hair); }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); border-top: 1px solid var(--hair); border-left: 1px solid var(--hair); }
.kpi { border-right: 1px solid var(--hair); border-bottom: 1px solid var(--hair); padding: 16px 18px 40px; position: relative; }
.kpi-v { font-size: 22px; font-weight: 300; color: #fff; margin-top: 6px; letter-spacing: -.3px; }
.kpi.empty .kpi-v { color: var(--dim); }
.kpi .src { position: absolute; left: 18px; bottom: 14px; }
/* План на шкале и в графике (этап 6): месяцы после текущего — пунктир снизу и курсив, текущий — «факт + план». */
.tl-m.plan { font-style: italic; color: var(--dim); border-bottom-style: dashed; }
.tl-m.plan.sel { color: var(--text-soft); background: var(--surface2); border-bottom-color: var(--accent); }
.tl-m.now { box-shadow: inset 0 2px 0 var(--text-soft); }
.key.rect.plan { opacity: .45; }
.key.line.dash { background: repeating-linear-gradient(90deg, var(--series-balance) 0 4px, transparent 4px 7px) !important; }
.pivot th.plan, .pivot td.plan { font-style: italic; color: var(--text-soft); }
.proj-chart { height: 260px; }

/* --- Касса ---------------------------------------------------------------------- */
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.btn-row form { margin: 0; }
.month-nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13px; color: #fff; }
.month-nav .dim { font-size: 11.5px; }
@media (max-width: 720px) { .btn-row { justify-content: flex-start; } .month-nav .dim { margin-left: 0 !important; width: 100%; } }

/* --- План ------------------------------------------------------------------------- */
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text); cursor: pointer;
          text-transform: none; letter-spacing: 0; font-weight: 400; margin: 0; }
.badge.src-pipeline { color: var(--accent); border-color: var(--accent); }
.badge.src-stage { color: var(--text); }

/* --- Отчёты ---------------------------------------------------------------------- */
.report-filters { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 8px; }
.report-filters .field { margin: 0; }
.report-filters input[type=number] { width: 90px; }
.report-filters .toggle { align-self: center; }
.tbl.bdds { font-size: 12px; }
.tbl.bdds td, .tbl.bdds th { padding: 7px 8px; white-space: nowrap; }
/* Закреплённая колонка «Статья»: ячейки тела и угловая ячейка шапки (во второй строке шапки первая ячейка — «План» месяца, её не трогаем) */
.tbl.bdds td:first-child, .tbl.bdds thead tr:first-child th:first-child { position: sticky; left: 0; background: var(--ground); min-width: 260px; max-width: 320px; white-space: normal; z-index: 1; }
.tbl.bdds th.per { text-align: center; color: var(--text-soft); border-left: 1px solid var(--hair); }
.tbl.bdds th.per.future { color: var(--dim); }
.tbl.bdds tr > td:nth-child(3n+2) { border-left: 1px solid var(--hair); }
.tbl.bdds .dev { color: var(--dim); }
.tbl.bdds .dev.bad { color: var(--bad); }
.tbl.bdds tr.r-balance td { color: #fff; font-weight: 600; }
.tbl.bdds tr.r-summary td { color: var(--text); font-weight: 600; }
.tbl.bdds tr.r-section td { color: var(--accent); font-weight: 700; padding-top: 16px; }
.tbl.bdds tr.r-section td:first-child { font-size: 10px; letter-spacing: 1.3px; text-transform: uppercase; }
.tbl.bdds tr.r-group td { color: var(--muted); font-style: italic; }
.tbl.bdds tr.r-article td:first-child { padding-left: 14px; }
.tbl.bdds thead tr + tr th:first-child { padding-left: 12px; }
.tbl.bdds thead tr:first-child th:first-child { z-index: 3; }  /* угол шапки — над закреплённой колонкой и над ячейками шапки */
.tbl.bdds tr.r-spacer td { border: 0; padding: 10px; }

/* --- Контроль 115-ФЗ ---------------------------------------------------------------- */
.badge.zone-green { color: var(--ok); border-color: #3E4F3A; }
.badge.zone-yellow { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.badge.zone-red { color: var(--bad-text); background: var(--bad-bg); border-color: transparent; }
.badge.zone-none { color: var(--dim); }
.badge.sig { color: var(--warn); border-color: #5A4A2E; margin-left: 4px; }
.tbl.aml td { vertical-align: top; }
.tbl.aml .aml-advice { font-size: 12px; max-width: 360px; min-width: 220px; }
.aml-ops { margin-top: 6px; font-size: 11.5px; }
.aml-ops summary { cursor: pointer; color: var(--muted); }
.aml-ops div { padding: 3px 0; }
.btn.btn-sm { display: inline-block; width: auto; padding: 6px 12px; font-size: 12px; }
/* Изменение статьи в карточке операции */
.edit-art { margin-top: 6px; }
.edit-art summary { cursor: pointer; color: var(--accent); font-size: 12px; list-style: none; display: inline-block; }
.edit-art summary::-webkit-details-marker { display: none; }
.edit-art-form { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.edit-art-form select { max-width: 360px; min-width: 220px; }
.stmt-check { padding: 10px 0; border-bottom: 1px solid var(--hair); font-size: 12px; }

/* --- Уведомления (единственная тень в стиле) ------------------------------------ */
.toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 10; max-width: 440px; }
.toast {
  background: var(--surface2); border-left: 2px solid var(--accent); padding: 12px 16px; font-size: 12.5px;
  box-shadow: 0 6px 26px rgba(0, 0, 0, .45); color: var(--text);
}
.toast.error { border-left-color: var(--bad); }

/* --- Вход ------------------------------------------------------------------- */
.login { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); } /* фон как у картинки города */
.login .box { width: 100%; max-width: 380px; margin: 12vh auto 40px; padding: 0 18px; }
.login .box img { width: 200px; height: auto; display: block; margin-bottom: 36px; }
.login .city { margin-top: auto; width: 100%; height: auto; display: block; opacity: .9; }

/* --- БДР проекта ---------------------------------------------------------------- */
input[type=month] {
  color-scheme: dark; width: 100%; padding: 9px 11px; background: var(--surface); color: var(--text);
  border: 1px solid var(--hair); border-radius: 2px; font: inherit; font-size: 13px;
}
.bdr td.num, .bdr th.num { white-space: nowrap; min-width: 92px; }
.bdr th.cur { color: var(--accent); }
.bdr-plan { display: block; color: var(--dim); font-size: 10.5px; margin-top: 2px; }   /* план под фактом */
.bdr-h { display: block; color: var(--note); font-size: 10px; margin-top: 2px; }        /* часы под суммой */
.bdr tr.subtotal td { color: var(--text-soft); border-top: 1px solid var(--hair); }
.bdr tr.margin td { color: #fff; font-weight: 600; border-top: 1px solid var(--line-art); border-bottom: 1px solid var(--line-art); }
.bdr tr.margin td:first-child { color: var(--accent); }
.bdr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 18px; max-width: 980px; }

/* --- Табель часов ----------------------------------------------------------------- */
.hours-grid input.h {
  width: 58px; padding: 6px 6px; text-align: right; background: var(--surface); color: var(--text);
  border: 1px solid var(--hair); border-radius: 2px; font: inherit; font-size: 13px;
}
.hours-grid input.h:focus { outline: none; border-color: var(--accent); }
.hours-grid input.h:disabled { opacity: .35; }
.hours-grid input.h.saving { border-color: var(--warn); }
.hours-grid input.h.err { border-color: var(--bad); color: var(--bad-text); }
.hours-grid th.wknd { color: var(--dim); }
.hours-grid th.cur { color: var(--accent); }
.hours-grid tr.cat td:first-child { color: var(--muted); }
.hours-grid td:first-child { min-width: 240px; }

/* --- «Мой месяц»: полоса дней ------------------------------------------------------- */
.day-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 4px; }
.day-strip .day {
  display: flex; flex-direction: column; align-items: center; padding: 6px 2px; border: 1px solid var(--hair);
  border-radius: 2px; color: var(--text); background: var(--surface);
}
.day-strip .day:hover { border-color: var(--accent); }
.day-strip .dn { font-size: 13px; font-weight: 600; }
.day-strip .dw { font-size: 9px; color: var(--dim); text-transform: uppercase; letter-spacing: 1px; }
.day-strip .dh { font-size: 11px; margin-top: 4px; color: var(--text-soft); }
.day-strip .day.wknd { background: none; color: var(--dim); }
.day-strip .day.future, .day-strip .day.off { opacity: .45; }
.day-strip .day.short { border-color: var(--accent); }
.day-strip .day.short .dh { color: var(--accent); }

/* --- Бюджет фирмы: таблица «статья × месяц» (этап 7) ------------------------------------ */
.budget-grid { font-size: 12px; }
.budget-grid td, .budget-grid th { padding: 6px 6px; white-space: nowrap; vertical-align: top; }
.budget-grid td:first-child, .budget-grid thead th:first-child { position: sticky; left: 0; background: var(--ground);
  min-width: 230px; max-width: 280px; white-space: normal; z-index: 1; }
.budget-grid thead th:first-child { z-index: 3; }
.budget-grid th.past { color: var(--dim); }
.budget-grid input.b {
  width: 92px; padding: 4px 6px; text-align: right; background: var(--surface); color: var(--text);
  border: 1px solid var(--hair); border-radius: 2px; font: inherit; font-size: 12px;
}
.budget-grid input.b.day { width: 44px; }
.budget-grid input.b:focus { outline: none; border-color: var(--accent); }
.budget-grid input.b:disabled { background: none; border-color: transparent; color: var(--text-soft); }
.budget-grid input.b.saving { border-color: var(--warn); }
.budget-grid input.b.err { border-color: var(--bad); color: var(--bad-text); }
.budget-grid .auto { display: block; color: var(--note); font-size: 10.5px; text-align: right; margin-top: 2px; min-height: 15px; }
.budget-grid tr.sec td { color: var(--accent); font-weight: 700; font-size: 10px; letter-spacing: 1.3px;
  text-transform: uppercase; padding-top: 16px; }
.budget-grid tr.tot td { color: var(--text); font-weight: 600; border-top: 1px solid var(--line-art); }
.budget-grid tr.bal td { color: #fff; font-weight: 600; }
.budget-grid tr.sales td { background: var(--surface2); }
.budget-grid .fill { background: none; border: 0; color: var(--dim); cursor: pointer; font: inherit; font-size: 11px; padding: 0 2px; }
.budget-grid .fill:hover { color: var(--accent); }
.budget-legend { display: flex; gap: 22px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 10px 0 14px; }
.budget-legend b { color: var(--text); font-weight: 600; }
/* БДДС 12 месяцев: месяц-факт / текущий / план */
.tbl.bdds th.per.past { color: var(--text-soft); }
.tbl.bdds th.per.current { color: var(--accent); }
.tbl.bdds td.num a { border: 0; color: inherit; }
.tbl.bdds td.num a:hover { color: var(--accent); }

/* --- Телефон ------------------------------------------------------------------ */
@media (max-width: 940px) {
  .side { grid-template-columns: 1fr; }
  .grid2 { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .wrap { padding: 0 18px; }
  .top .wrap { flex-wrap: wrap; gap: 10px 20px; padding-top: 14px; }
  .brand span { display: none; }
  .nav { margin-left: 0; order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }  /* меню листается пальцем, полоса прокрутки не нужна */
  .tabs { overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }  /* вкладки листаются пальцем */
  .tabs a { white-space: nowrap; flex: none; }
  .nav a { padding: 12px 12px; }
  .user { margin-left: auto; }
  h1 { font-size: 24px; }
  .fact { border-right: 0; border-bottom: 1px solid var(--hair); }
  .head .aside { text-align: left; }
  /* Широкие таблицы прокручиваются внутри себя, страница по горизонтали не едет */
  .tbl { display: block; overflow-x: auto; }
  .tbl.bdds td:first-child, .tbl.bdds thead tr:first-child th:first-child { min-width: 150px; max-width: 170px; }  /* на телефоне колонка статей уже */
  .cell-form select { min-width: 140px; }
}
