:root{
  --bg:#f4f6f9; --card:#ffffff; --ink:#1b2330; --muted:#6b7686;
  --line:#e7eaf0; --accent:#2f6df6; --ok:#1a8f4c; --warn:#c0392b;
}
*{box-sizing:border-box}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}
header{padding:26px 30px 6px}
h1{margin:0; font-size:27px; letter-spacing:.2px}
.sub{color:var(--muted); margin:8px 0 0; font-size:15px}

#dashboard{
  display:grid; gap:18px; padding:18px 30px;
  grid-template-columns:repeat(auto-fit,minmax(330px,1fr));
}
.block{
  background:var(--card); border:1px solid var(--line);
  border-radius:16px; padding:18px 22px;
}
.block h2{
  margin:0 0 10px; font-size:13px; color:var(--muted);
  text-transform:uppercase; letter-spacing:.06em; font-weight:700;
}
.row{
  display:grid; grid-template-columns:1fr auto 96px; align-items:center;
  gap:12px; padding:12px 0; border-top:1px solid var(--line);
}
.row:first-child{border-top:none}
.name{font-size:16px}
.bal{text-align:right; white-space:nowrap}
.num{font-size:25px; font-weight:800; font-variant-numeric:tabular-nums}
.unit{color:var(--muted); font-size:13px; margin-left:3px}
.add input{
  width:92px; padding:8px 9px; border:1px solid var(--line);
  border-radius:9px; font-size:15px; text-align:right; background:#fbfcfe;
}
.add input:focus{outline:2px solid var(--accent); border-color:var(--accent)}

/* ---- Склад: комплектующие по объёмам (раскрывающиеся группы) ---- */
details.vol-group{border-top:1px solid var(--line)}
details.vol-group:first-child{border-top:none}
details.vol-group summary{
  cursor:pointer; list-style:none; display:flex; align-items:center; gap:8px;
  padding:10px 0; font-size:14px; font-weight:700; user-select:none;
}
details.vol-group summary::-webkit-details-marker{display:none}
details.vol-group summary::before{content:"▸"; color:var(--muted); font-size:12px}
details.vol-group[open] summary::before{content:"▾"}
details.vol-group .row:first-child{border-top:none}

#opening{margin:6px 30px 44px; max-width:900px}
#opening h2{font-size:19px; margin:0 0 6px}
.hint{color:var(--muted); margin:0 0 14px; line-height:1.5}
#save{
  background:var(--accent); color:#fff; border:none; border-radius:11px;
  padding:13px 20px; font-size:16px; font-weight:600; cursor:pointer;
}
#save:hover{filter:brightness(1.05)}
#opening-status{margin-top:12px; min-height:22px; font-size:15px}
#opening-status.ok{color:var(--ok); font-weight:600}
#opening-status.warn{color:var(--warn); font-weight:600}

/* ---- Модуль 2: навигация, формы работы, журнал ---- */
.nav{display:flex; gap:6px; padding:14px 30px 0}
.nav a{padding:8px 14px; border-radius:9px; text-decoration:none; color:var(--muted); font-size:15px}
.nav a:hover{background:#eceff4; color:var(--ink)}
.nav a.active{background:var(--accent); color:#fff}

.panel{background:var(--card); border:1px solid var(--line); border-radius:16px;
  padding:18px 22px; margin:14px 30px; max-width:1040px}
.panel h2{margin:0 0 12px; font-size:17px}
.muted{color:var(--muted)}

.form-grid{display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:12px; margin-bottom:14px}
.form-grid label, .form-row label{display:flex; flex-direction:column; gap:5px; font-size:13px; color:var(--muted)}
.form-row{display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; margin-bottom:6px}
input, select{padding:9px 10px; border:1px solid var(--line); border-radius:9px; font-size:15px; background:#fbfcfe}
input:focus, select:focus{outline:2px solid var(--accent); border-color:var(--accent)}
button{background:var(--accent); color:#fff; border:none; border-radius:10px;
  padding:11px 16px; font-size:15px; font-weight:600; cursor:pointer}
button:hover{filter:brightness(1.05)}
.f-cnt,.c-ret{width:150px}

.chips{display:flex; flex-wrap:wrap; gap:8px; margin-bottom:12px}
.chip{background:#eef2f8; border:1px solid var(--line); border-radius:999px; padding:5px 12px; font-size:14px}

.session-card{border:1px solid var(--line); border-radius:12px; padding:14px 16px; margin-bottom:12px; background:#fbfcfe}
.session-head{font-size:15px; margin-bottom:10px}
.status{min-height:20px; font-size:14px; margin-top:6px}
.status.ok{color:var(--ok); font-weight:600}
.status.warn{color:var(--warn); font-weight:600}

.jour-day{margin-bottom:16px}
.jour-date{font-size:13px; color:var(--muted); font-weight:700; margin-bottom:6px}
.jour-row{display:flex; align-items:center; gap:12px; padding:9px 0; border-top:1px solid var(--line); font-size:16px}
.jour-vol{color:var(--muted)}
.badge{font-size:13px; font-weight:600; padding:3px 10px; border-radius:8px}
.badge.fill{background:#e6f1fb; color:#185fa5}
.badge.assemble{background:#eaf3de; color:#3b6d11}
.badge.opening{background:#f1efe8; color:#5f5e5a}
.badge.movement{background:#eeedfe; color:#3c3489}

/* ---- Модуль ролей: экран входа + навигация (имя/выход) ---- */
.login-wrap{min-height:78vh; display:flex; align-items:center; justify-content:center; padding:40px 16px}
.login-card{background:var(--card); border:1px solid var(--line); border-radius:16px; padding:26px 30px; width:340px; max-width:100%}
.login-card h1{margin:0; font-size:22px}
.login-field{display:flex; flex-direction:column; gap:6px; font-size:13px; color:var(--muted); margin:14px 0}
.login-field input{font-size:16px}
.nav-right{margin-left:auto; display:flex; align-items:center; gap:8px; color:var(--muted); font-size:14px; padding:8px 6px}
.nav .nav-out{color:var(--warn); font-weight:600}

/* ---- Модуль 3: разворот по дням, правка/удаление, инвентаризация ---- */
.days-toggle{background:transparent; color:var(--accent); border:none; padding:2px 4px;
  font-size:13px; font-weight:600; cursor:pointer}
.days-toggle:hover{text-decoration:underline; filter:none}
.day-detail{padding:4px 0 12px 4px}
table.days{border-collapse:collapse; font-size:14px; min-width:340px}
table.days th{text-align:left; color:var(--muted); font-weight:600; font-size:12px; padding:4px 16px 4px 0}
table.days td{padding:4px 16px 4px 0; border-top:1px solid var(--line); font-variant-numeric:tabular-nums}
table.days td.in{color:var(--ok); font-weight:600}
table.days td.out{color:var(--warn); font-weight:600}

.jour-row{display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:9px 0; border-top:1px solid var(--line); font-size:16px}
.jour-left{display:flex; align-items:center; gap:12px; flex-wrap:wrap}
.jour-worker{color:var(--muted); font-size:13px}
.jour-row.reversed{opacity:.55}
.jour-row.reversed .jour-left b{text-decoration:line-through}
.jour-act{display:flex; align-items:center; gap:6px}
.mini{font-size:13px; font-weight:600; padding:6px 11px; border-radius:8px; cursor:pointer;
  background:#eef2f8; color:var(--ink); border:1px solid var(--line)}
.mini:hover{filter:brightness(.97)}
.mini.danger{background:#fcebeb; color:#a32d2d; border-color:#f7c1c1}
.mini:disabled{opacity:.5; cursor:not-allowed}
.edit-inp{width:90px; text-align:right; padding:6px 8px}
.tag{font-size:12px; color:var(--muted); background:#f1efe8; padding:3px 9px; border-radius:8px}

/* ---- Статистика закрытых розливов (недолив/потери) ---- */
.stat-row{border-top:1px solid var(--line); padding:10px 0}
.stat-row:first-child{border-top:none}
.stat-head{font-size:15px}
.stat-body{color:var(--muted); font-size:14px; margin-top:3px}
.stat-under{color:var(--warn); font-weight:600}
.stat-loss{color:#a15c00; font-weight:600}
.stat-ok{color:var(--ok); font-weight:600}

/* ---- Предпросмотр «было → станет» (dry-run) + подсказки ---- */
.preview-box{margin:10px 0 4px; padding:11px 13px; border:1px solid var(--line);
  border-radius:12px; background:#fbfcfe; font-size:15px}
.preview-box .prev-title{color:var(--muted); font-size:12px; text-transform:uppercase;
  letter-spacing:.05em; font-weight:700; margin-bottom:6px}
.prev-row{display:flex; justify-content:space-between; gap:14px; padding:3px 0;
  font-variant-numeric:tabular-nums}
.prev-row .p-name{color:var(--ink)}
.prev-row.produce{color:var(--muted)}
.prev-row b{font-weight:800}
.prev-row.prev-bad b.p-after{color:var(--warn)}
.prev-row.prev-bad .p-name{color:var(--warn); font-weight:600}
.prev-warn{margin-top:8px; padding:8px 10px; border-radius:9px;
  background:#fcebeb; color:#a32d2d; font-size:14px; line-height:1.45}
.prev-hint{margin-top:6px; color:var(--muted); font-size:13px}
.info-hint{margin:6px 0 2px; padding:10px 12px; border-radius:11px;
  background:#eef4ff; border:1px solid #d6e4ff; color:#274b8f; font-size:14px; line-height:1.5}
.info-hint.warn-hint{background:#fff6e6; border-color:#ffe1a8; color:#8a5a00}
.confirm-row{display:flex; align-items:center; gap:8px; margin-top:8px; font-size:15px}
.confirm-row input{width:18px; height:18px}
button:disabled{opacity:.5; cursor:not-allowed}

/* ── Финансовый контур (этап 2, замечание координатора по ширине) ──────────────
   Фин-страницы (/pay, /pay-request, /pay-companies) — во всю ширину окна с
   разумными полями; реестр использует доступное место, статусы не обрезаются
   (перенос разрешён). Правила ТОЛЬКО под body.fin-wide — производственные
   страницы не затронуты. */
body.fin-wide .panel{max-width:none}
body.fin-wide table.days{width:100%}
body.fin-wide table.days td{white-space:normal}
body.fin-wide table.days td:last-child{min-width:170px}  /* «Статус» целиком; запас под длинные статусы этапа 3 */

/* ── Кликабельные строки фин-реестров (финальный пакет, п.2) ─────────────────────
   Курсор + мягкий ховер (~120мс) + серый шеврон справа, темнеющий при наведении.
   Зелёные строки «В оплату» (§17) на ховере темнеют В СВОЁМ зелёном. Только фин. */
body.fin-wide tr.rowlink{cursor:pointer; transition:background .12s ease}
body.fin-wide tr.rowlink:hover{background:#edf1f7}
body.fin-wide tr.rowlink.green{background:#e7f6e7}
body.fin-wide tr.rowlink.green:hover{background:#d6eed6}
body.fin-wide td.chev{color:#c4cad5; text-align:right; font-size:16px; padding-right:6px;
  transition:color .12s ease; width:22px}
body.fin-wide tr.rowlink:hover td.chev{color:#5f6774}
