* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: #1c2530; background: #f4f6f9; font-size: 14px; }
.hidden { display: none !important; }
.muted { color: #7a8698; font-size: 12px; }
.err { color: #c0392b; margin-top: 8px; min-height: 16px; font-size: 13px; }

/* вход */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card { background: #fff; padding: 32px; border-radius: 14px; width: 320px;
  box-shadow: 0 8px 30px rgba(0,0,0,.08); display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 20px; margin: 0; }
.login-card p { margin: 0 0 8px; }
.login-card input { padding: 11px 12px; border: 1px solid #d3dae3; border-radius: 8px; font-size: 14px; }
.login-card button { padding: 11px; border: 0; border-radius: 8px; background: #2d6cdf;
  color: #fff; font-size: 15px; cursor: pointer; }
.login-card button:hover { background: #2559bd; }

/* верхняя панель */
.topbar { display: flex; align-items: center; justify-content: space-between;
  background: #fff; padding: 12px 20px; border-bottom: 1px solid #e6eaf0; position: sticky; top: 0; z-index: 5; }
.brand { font-weight: 600; font-size: 16px; }
.topbar-left { display: flex; align-items: center; gap: 14px; }
.tabs { display: inline-flex; gap: 4px; }
.tab { border: 1px solid #d3dae3; background: #fff; border-radius: 7px; padding: 5px 12px;
  cursor: pointer; color: #4a5568; font-size: 13px; }
.tab:hover { border-color: #9fb2cc; }
.tab.on { background: #2d6cdf; color: #fff; border-color: #2d6cdf; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.who { font-weight: 600; }
.link { background: none; border: 0; color: #7a8698; cursor: pointer; text-decoration: underline; }
#btn-refresh { padding: 6px 12px; border: 1px solid #2d6cdf; color: #2d6cdf; background: #fff;
  border-radius: 7px; cursor: pointer; }
#btn-refresh:disabled { opacity: .5; cursor: default; }
.hzpick { display: inline-flex; align-items: center; gap: 4px; }
.hzpick input[type=date] { padding: 4px 6px; border: 1px solid #d3dae3; border-radius: 6px; font-size: 12px; }
.hzpick .dash { color: #7a8698; }

/* диф-плашка */
.diffbar { margin: 14px 20px 0; padding: 10px 14px; border-radius: 9px;
  background: #fff6e5; border: 1px solid #f0d59a; font-size: 13px; }

/* плитки */
.tiles { display: flex; gap: 12px; padding: 16px 20px 4px; flex-wrap: wrap; }
.tile { background: #fff; border-radius: 11px; padding: 14px 18px; min-width: 120px;
  border: 1px solid #e6eaf0; }
.tile .v { font-size: 24px; font-weight: 700; }
.tile .l { font-size: 12px; color: #7a8698; margin-top: 2px; }
.tile.green { border-left: 4px solid #27ae60; }
.tile.yellow { border-left: 4px solid #e0a800; }
.tile.red { border-left: 4px solid #e05a4b; }
.tile.black { border-left: 4px solid #444; }
.tile.demand { border-left: 4px solid #2d6cdf; }

/* панели и таблицы */
.panel { background: #fff; margin: 16px 20px; border-radius: 12px; padding: 14px 18px;
  border: 1px solid #e6eaf0; }
.panel h2 { font-size: 15px; margin: 0 0 10px; }
.scroll { overflow-x: auto; }
.tbl { border-collapse: collapse; width: 100%; font-size: 13px; }
.tbl th, .tbl td { padding: 7px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid #eef1f5; }
.tbl th { color: #63708a; font-weight: 600; cursor: pointer; user-select: none; position: sticky; top: 0; background: #fff; }
.tbl th.l, .tbl td.l { text-align: left; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl tr.grp-row { cursor: pointer; }
.tbl tr.grp-row:hover { background: #eef4ff; }

/* фильтры */
.filters { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.filters select, .filters input[type=text], .filters input[type=date] {
  padding: 7px 9px; border: 1px solid #d3dae3; border-radius: 7px; font-size: 13px; }
.statuses { display: inline-flex; gap: 4px; }
.stbtn { border: 1px solid #d3dae3; background: #fff; border-radius: 7px; padding: 5px 8px;
  cursor: pointer; font-size: 15px; opacity: .35; filter: grayscale(1); }
.stbtn.on { opacity: 1; filter: none; border-color: #9fb2cc; }
.chk { font-size: 13px; color: #4a5568; display: inline-flex; align-items: center; gap: 5px; }

/* пометки дифа и просрочки */
.badge { font-size: 11px; padding: 1px 6px; border-radius: 6px; margin-left: 6px; }
.badge.new { background: #fdecea; color: #c0392b; }
.badge.closed { background: #eafaf1; color: #1e8449; }
.od { color: #c0392b; font-weight: 600; }

/* цепочка полуфабрикатов */
.tbl td.cw, .tbl th.cw { width: 20px; padding-left: 6px; padding-right: 2px; text-align: center; }
.caret { color: #7a8698; font-size: 11px; }
.tbl tr.drow.has-chain { cursor: pointer; }
.tbl tr.drow.has-chain:hover { background: #eef4ff; }
.cbadge { font-size: 11px; padding: 1px 6px; border-radius: 6px; margin-left: 6px; white-space: nowrap; }
.cbadge.warn { background: #fff2e0; color: #b9600a; }
.cbadge.ok { background: #eafaf1; color: #1e8449; }
.crow > td { background: #f8fafc; padding: 6px 10px 10px 30px; }
.ctbl { border-collapse: collapse; font-size: 12px; min-width: 760px; }
.ctbl th, .ctbl td { padding: 5px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid #e9edf3; }
.ctbl th { color: #63708a; font-weight: 600; }
.ctbl th.l, .ctbl td.l { text-align: left; }
.cx { font-size: 11px; padding: 1px 6px; border-radius: 6px; white-space: nowrap; }
.cx.cross { background: #eaf2ff; color: #2559bd; font-weight: 600; }
.cx.intra { color: #97a2b4; }
.cs { font-weight: 600; }
.cs.wait { color: #c0392b; }
.cs.go { color: #b9600a; }
.cs.done { color: #1e8449; }
.cempty { color: #7a8698; font-size: 12px; padding: 4px 0; }
/* покрытие спроса выпуском нарастающим итогом (2.2) */
.covwrap { margin-bottom: 12px; }
.covhead { font-size: 12px; color: #3a4664; font-weight: 600; margin: 0 0 5px 0; }
.covtbl { min-width: 560px; }
.covtbl tr.kd td { background: #fdf6f4; }   /* спрос — тёплый фон */
.covtbl tr.kv td { background: #f2f8ff; }   /* выпуск — холодный фон */
.covtbl tr.ks td { background: #f4f7f2; }   /* склад (открытый остаток) */
/* раскладка складов и план этапов у узла «ждёт» (2 новых пункта Тимура) */
.whplan { font-size: 11px; color: #63708a; margin-top: 2px; line-height: 1.4; }
.whplan.plan { color: #b9600a; }
.whplan.plan.none { color: #97a2b4; }
.whplan .whx { color: #c0392b; }
.whplan .whg { color: #1e8449; }

/* витрина «Мощности» (Слой 3-lite MRP II) */
.cap-legend { margin: -4px 0 10px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.cap-legend .lg { font-size: 11px; padding: 1px 7px; border-radius: 6px; }
.cap-legend .lg.ok { background: #eafaf1; color: #1e8449; }
.cap-legend .lg.warn { background: #fff6e5; color: #b9600a; }
.cap-legend .lg.over { background: #fdecea; color: #c0392b; }
.captbl { min-width: 100%; }
.captbl th, .captbl td { padding: 6px 8px; }
.captbl th.capd, .captbl td.cap { text-align: center; min-width: 40px;
  font-variant-numeric: tabular-nums; }
.captbl th.cexname, .captbl td.cexname { position: sticky; left: 0; background: #fff; z-index: 1;
  min-width: 130px; box-shadow: 1px 0 0 #eef1f5; }
.captbl tbody tr:hover td.cexname { background: #f8fafc; }
.captbl td.ceil { text-align: center; font-weight: 600; color: #3a4664; }
.captbl td.cap.ok { background: #eafaf1; color: #1e8449; }
.captbl td.cap.warn { background: #fff6e5; color: #b9600a; }
.captbl td.cap.over { background: #fdecea; color: #c0392b; font-weight: 700; }
.captbl td.cap.nocap { color: #63708a; }
.captbl td.cap.zero { color: #d7dde5; }
.captbl th.today, .captbl td.today { box-shadow: inset 0 2px 0 #2d6cdf; }
.captbl th.we, .captbl td.we { background: #fafbfc; }
.captbl td.cap.we.zero { background: #fafbfc; }
.ceilinp { width: 52px; padding: 3px 5px; border: 1px solid #d3dae3; border-radius: 6px;
  font-size: 13px; text-align: center; }

/* витрина «К запуску» (Слой 1 MRP) — чипы срочности */
.cx.over { background: #fdecea; color: #c0392b; font-weight: 600; }
.cx.warn { background: #fff6e5; color: #b9600a; }
.cx.okk { background: #eafaf1; color: #1e8449; }
