/* «Управленческая отчетность логистика». Один набор стилей, два вида: .view-pc и .view-mobile */
@font-face { font-family: "Plex"; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-sans-cyrillic-400-normal.woff2") format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Plex"; font-weight: 400; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+20BD, U+2212; }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap;
  src: url("fonts/ibm-plex-sans-cyrillic-500-normal.woff2") format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Plex"; font-weight: 500; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+20BD, U+2212; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap;
  src: url("fonts/ibm-plex-sans-cyrillic-600-normal.woff2") format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Plex"; font-weight: 600; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+20BD, U+2212; }
@font-face { font-family: "Plex"; font-weight: 700; font-display: swap;
  src: url("fonts/ibm-plex-sans-cyrillic-700-normal.woff2") format("woff2"); unicode-range: U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: "Plex"; font-weight: 700; font-display: swap;
  src: url("fonts/ibm-plex-sans-latin-700-normal.woff2") format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+20BD, U+2212; }

:root {
  --ink: #18212b;
  --ink-2: #4d5866;
  --ink-3: #7b8592;
  --paper: #eef1f4;
  --surface: #ffffff;
  --rule: #dbe0e6;
  --petrol: #0d6c7a;
  --petrol-dark: #0a5560;
  --petrol-soft: #e1f0f2;
  --red: #b83227;
  --red-soft: #fbeae8;
  --amber: #a8660b;
  --amber-soft: #fcf1de;
  --green: #2a7a4b;
  --green-soft: #e4f3ea;
  --info: #52637a;
  --info-soft: #edf1f6;
  --radius: 10px;
  --radius-s: 6px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: "Plex", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 15px; line-height: 1.45;
  font-variant-numeric: tabular-nums;
}
a { color: var(--petrol); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 3px solid #7fc3cc; outline-offset: 2px; border-radius: 4px; }
h1 { font-size: 28px; line-height: 1.15; font-weight: 600; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 19px; line-height: 1.25; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; }
hr { border: 0; border-top: 1px solid var(--rule); margin: 20px 0; }

/* ---------- каркас ПК ---------- */
.shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh;
  background: linear-gradient(90deg, var(--surface) 0 223px, var(--rule) 223px 224px, transparent 224px); }
.side {
  padding: 22px 14px;
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 2px;
}
.brand { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 2px 8px 18px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .logo { display: block; width: 128px; height: auto; }
.app-name { font-weight: 600; font-size: 14px; line-height: 1.2; color: var(--ink); }
.app-name span { display: block; font-weight: 400; color: var(--ink-3); }

/* ---------- переключатель вида ПК / смартфон ---------- */
.vswitch { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--paper);
  border: 1px solid var(--rule); border-radius: 12px; margin: 0 0 18px; }
.vswitch a { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 10px;
  border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 15px; white-space: nowrap; }
.vswitch a:hover { text-decoration: none; background: var(--surface); color: var(--ink); }
.vswitch a.on { background: var(--ink); color: #fff; }
.vswitch a.on:hover { background: var(--ink); color: #fff; }
.nav a {
  display: block; padding: 8px 10px; border-radius: var(--radius-s); color: var(--ink-2); font-weight: 500;
}
.nav a:hover { background: var(--paper); text-decoration: none; color: var(--ink); }
.nav a.on { background: var(--petrol-soft); color: var(--petrol-dark); }
.side-foot { margin-top: auto; font-size: 13px; color: var(--ink-3); padding: 0 10px; }
.side-foot a { color: var(--ink-2); }
.main { padding: 26px 34px 60px; max-width: 1320px; width: 100%; }

.top { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.top .sub { margin-top: 6px; color: var(--ink-2); }
.fresh { font-size: 13px; color: var(--ink-2); text-align: right; }
.fresh.stale { color: var(--red); font-weight: 500; }

/* ---------- переключатель периода ---------- */
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--rule); border-radius: 999px; padding: 3px; gap: 2px; }
.seg a { padding: 6px 14px; border-radius: 999px; color: var(--ink-2); font-weight: 500; font-size: 14px; white-space: nowrap; }
.seg a:hover { text-decoration: none; background: var(--paper); }
.seg a.on { background: var(--ink); color: #fff; }
.periodbar { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-bottom: 22px; }
.custom { display: inline-flex; gap: 6px; align-items: center; }

/* ---------- панели ---------- */
.panel { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 20px; }
.panel-h { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.panel-h h2 { margin: 0; }
.cols { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.cols2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.cols > *, .cols2 > * { min-width: 0; }

/* ---------- проблемы: ярлыки ---------- */
.tickets { display: flex; flex-direction: column; gap: 8px; }
.ticket {
  display: grid; grid-template-columns: 6px 1fr; background: var(--surface);
  border: 1px solid var(--rule); border-radius: var(--radius-s); overflow: hidden;
}
.ticket .bar { background: var(--info); }
.ticket.red .bar { background: var(--red); }
.ticket.amber .bar { background: var(--amber); }
.ticket .body { padding: 10px 14px; }
.ticket .t { font-weight: 600; }
.ticket.red .t { color: var(--red); }
.ticket.amber .t { color: var(--amber); }
.ticket .x { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.ticket details { margin-top: 8px; }
.ticket summary { cursor: pointer; color: var(--petrol); font-size: 14px; font-weight: 500; list-style: none; }
.ticket summary::-webkit-details-marker { display: none; }
.ticket summary::before { content: "▸ "; }
.ticket details[open] summary::before { content: "▾ "; }
.calm { padding: 18px; border: 1px dashed var(--rule); border-radius: var(--radius-s); color: var(--green); font-weight: 500; background: var(--green-soft); }

/* ---------- показатели ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--rule); }
.kpi { padding: 14px 16px 14px 0; border-bottom: 1px solid var(--rule); }
.kpi:not(:nth-child(3n+1)) { padding-left: 16px; border-left: 1px solid var(--rule); }
.kpi .l { font-size: 13px; color: var(--ink-2); }
.kpi .v { font-size: 28px; font-weight: 600; line-height: 1.15; margin-top: 4px; letter-spacing: -0.01em; }
.kpi .v.warn { color: var(--red); }
.kpi .s { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.kpi .c { font-size: 13px; margin-top: 2px; }
.vs { font-size: 13px; color: var(--ink-3); font-weight: 400; white-space: nowrap; }
.d { font-size: 13px; font-weight: 500; white-space: nowrap; }
.d.good { color: var(--green); }
.d.bad { color: var(--red); }
.d.flat { color: var(--ink-3); }

/* ---------- таблицы ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--ink-2); font-size: 13px; padding: 7px 10px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.tbl td { padding: 7px 10px; border-bottom: 1px solid #edf0f3; vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.total td { font-weight: 600; border-top: 1px solid var(--rule); background: #f7f9fa; }
.tbl th.num, .tbl td.num { text-align: right; }
.tbl-wrap { overflow-x: auto; }
#rev td { vertical-align: middle; }
.tbl .note { color: var(--ink-3); font-size: 12px; }
.bar-in { position: relative; }
.bar-in i { position: absolute; left: 0; top: 50%; height: 6px; margin-top: -3px; background: var(--petrol-soft); border-radius: 3px; z-index: 0; }
.bar-in span { position: relative; z-index: 1; }

.chip { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--info-soft); color: var(--info); font-weight: 500; white-space: nowrap; }
.chip.red { background: var(--red-soft); color: var(--red); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.green { background: var(--green-soft); color: var(--green); }

/* ---------- формы и кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--petrol); background: var(--petrol); color: #fff;
  font: inherit; font-weight: 500; font-size: 14px; padding: 8px 16px; border-radius: var(--radius-s); cursor: pointer;
}
.btn:hover { background: var(--petrol-dark); text-decoration: none; }
.btn.ghost { background: var(--surface); color: var(--petrol); }
.btn.ghost:hover { background: var(--petrol-soft); }
.btn.danger { background: var(--surface); color: var(--red); border-color: #e3b3ae; }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input[type=text], input[type=password], input[type=date], input[type=number], select {
  font: inherit; font-size: 14px; padding: 7px 10px; border: 1px solid var(--rule); border-radius: var(--radius-s); background: #fff; color: var(--ink);
}
input:focus, select:focus { border-color: var(--petrol); outline: none; box-shadow: 0 0 0 3px var(--petrol-soft); }
label { font-size: 13px; color: var(--ink-2); display: block; margin-bottom: 4px; }
.field { margin-bottom: 12px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.drop {
  border: 2px dashed #b9c9cf; border-radius: var(--radius); padding: 18px; text-align: center; background: #f8fbfb; cursor: pointer;
}
.drop.over { border-color: var(--petrol); background: var(--petrol-soft); }
.drop input { display: none; }
.drop b { color: var(--petrol); }

.flash { padding: 10px 14px; border-radius: var(--radius-s); margin-bottom: 14px; font-size: 14px; }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.error { background: var(--red-soft); color: var(--red); }
.flash.info { background: var(--info-soft); color: var(--info); }

.monthnav { display: inline-flex; align-items: center; gap: 4px; }
.monthnav a, .monthnav span { padding: 6px 10px; border-radius: var(--radius-s); }
.monthnav span { font-weight: 600; font-size: 16px; }
.monthnav a { border: 1px solid var(--rule); background: var(--surface); }

.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 280px; }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--ink-2); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.job { display: flex; gap: 12px; align-items: center; padding: 12px 16px; background: var(--petrol-soft); color: var(--petrol-dark); border-radius: var(--radius-s); margin-bottom: 16px; font-weight: 500; }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp 0.8s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* ---------- вход и выбор вида ---------- */
.gate { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.gate-box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 28px; }
.gate-box h1 { font-size: 22px; margin-bottom: 4px; }
.gate-box .brand { padding: 0 0 22px; }
.gate-box .brand .logo { width: 150px; }
.gate-box input { width: 100%; }
.choose { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.choose a {
  border: 1px solid var(--rule); border-radius: 12px; padding: 18px 14px; text-align: center; color: var(--ink); background: var(--surface);
}
.choose a:hover { border-color: var(--petrol); background: var(--petrol-soft); text-decoration: none; }
.choose svg { display: block; margin: 0 auto 10px; }
.choose b { display: block; font-size: 16px; }
.choose span { font-size: 13px; color: var(--ink-2); }

/* ---------- мобильный вид ---------- */
.mtop { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--rule); padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mtop { padding: 8px 12px 8px 16px; }
.mtop .brand { padding: 0; flex-shrink: 0; }
.mtop .brand .logo { width: 78px; }
.mtop .vswitch { margin: 0; flex: 0 1 236px; }
.mtop .vswitch a { min-height: 42px; font-size: 15px; padding: 0 8px; }
.mmain { padding: 14px 14px 92px; }
.mnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--surface); border-top: 1px solid var(--rule);
  display: grid; grid-template-columns: repeat(5, 1fr); padding-bottom: env(safe-area-inset-bottom);
}
.mnav a { text-align: center; padding: 8px 2px 9px; font-size: 11px; color: var(--ink-3); font-weight: 500; }
.mnav a svg { display: block; margin: 0 auto 2px; }
.mnav a.on { color: var(--petrol); }
.mnav a:hover { text-decoration: none; }

.view-mobile h1 { font-size: 22px; }
.view-mobile h2 { font-size: 17px; }
.view-mobile .top { margin-bottom: 12px; }
.view-mobile .fresh { text-align: left; }
.view-mobile .periodbar { margin: 0 -14px 14px; padding: 0 14px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
.view-mobile .periodbar::-webkit-scrollbar { display: none; }
.view-mobile .seg a { padding: 7px 12px; }
.view-mobile .panel { padding: 14px; border-radius: 12px; margin-bottom: 14px; }
.view-mobile .cols, .view-mobile .cols2 { grid-template-columns: 1fr; gap: 0; }
.view-mobile .kpis { grid-template-columns: 1fr 1fr; }
.view-mobile .kpi { padding: 12px 10px 12px 0; }
.view-mobile .kpi:not(:nth-child(3n+1)) { padding-left: 0; border-left: 0; }
.view-mobile .kpi:nth-child(2n) { padding-left: 12px; border-left: 1px solid var(--rule); }
.view-mobile .kpi .v { font-size: 22px; }
.view-mobile .chart-box { height: 210px; }
.view-mobile .chart-box.tall { height: 240px; }
.view-mobile .btn { padding: 10px 16px; }
.view-mobile input[type=text], .view-mobile input[type=password], .view-mobile input[type=date], .view-mobile select { font-size: 16px; }
.view-mobile .hide-m { display: none !important; }
.view-pc .hide-pc { display: none !important; }

/* карточки вместо таблиц на телефоне */
.cards { display: flex; flex-direction: column; }
.card-row { padding: 10px 0; border-bottom: 1px solid #edf0f3; }
.card-row:last-child { border-bottom: 0; }
.card-row .a { display: flex; justify-content: space-between; gap: 10px; font-weight: 500; }
.card-row .b { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-2); margin-top: 2px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .view-pc .shell { grid-template-columns: 1fr; background: none; }
  .view-pc .side { background: var(--surface); border-bottom: 1px solid var(--rule); }
  .view-pc .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 10px; }
  .view-pc .side .brand { padding: 0 12px 0 0; flex-direction: row; align-items: center; }
  .view-pc .side .brand .logo { width: 84px; }
  .view-pc .side .vswitch { margin: 0 12px 0 0; min-width: 240px; }
  .view-pc .side-foot { display: none; }
  .view-pc .main { padding: 18px 16px 40px; }
  .view-pc .cols, .view-pc .cols2 { grid-template-columns: 1fr; }
  .view-pc .kpis { grid-template-columns: 1fr 1fr; }
}
@media print {
  .side, .mnav, .mtop, .periodbar form, .btn { display: none !important; }
  .shell { display: block; }
  body { background: #fff; }
}
