/* Раздел «Эксплуатация» (staff/ops.js, docs/UI.md §6.3). Основа — плитки, карточки и таблицы дашборда (dash.css, классы ds-);
   своё — с приставкой op-: выбор месяца, сетка «дата × контейнер», погрузчик, ПУХТО, загрузка таблиц. */
.op { --op-own: #c3cad6; --op-neg: #dc2626; }
[data-theme="dark"] .op { --op-own: #4a5160; --op-neg: #ff7a7a; }

/* ---------- шапка ---------- */
.op-month { display: inline-flex; align-items: center; gap: 4px; }
.op-month .op-next .ic { transform: rotate(180deg); }
.op-month .icon-btn:disabled { opacity: .35; cursor: default; }
.op-mdd { position: relative; }
.op-mdd .dd { width: 190px; }
.op-mdd .dd-btn { border-radius: 999px; height: var(--h); font-weight: 700; color: var(--text); }
.op-mdd .dd-pop { min-width: 220px; }
.op-ro { background: var(--surface-2); color: var(--muted); }
.op-reps { left: auto; right: 0; width: 360px; }
.op-reps .anav-i { width: 100%; text-align: left; background: none; border: 0; cursor: pointer; }
.op-reps .anav-i:hover { background: var(--surface-2); }
.op-tabs { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; padding-bottom: 2px; }
.op-tabs::-webkit-scrollbar { display: none; }
.op-tabs a { height: 34px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); display: inline-flex; align-items: center;
  font-size: 14px; font-weight: 600; color: var(--muted); white-space: nowrap; text-decoration: none; flex: none; }
.op-tabs a:hover { color: var(--text); }
.op-tabs a.is-on { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.op-body { display: grid; gap: 14px; min-width: 0; }
.op-body > * { min-width: 0; }

/* ---------- плитки и карточки ---------- */
.op .ds-tile { cursor: default; }
.op .ds-tile:hover { transform: none; border-color: transparent; }
.op .ds-tile .v small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.op .ds-tile.t-main .v small { color: #b4bccb; }
.op-g2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; }
.op-g3 { display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 14px; }
.op-g2b { display: grid; grid-template-columns: 1fr 1.8fr; gap: 14px; }
.op-g2r { display: grid; grid-template-columns: 1.7fr 1fr; gap: 14px; }
.op-g2 > *, .op-g3 > *, .op-g2b > *, .op-g2r > * { min-width: 0; }
.op-side { display: grid; gap: 14px; align-content: start; min-width: 0; }
.op-chart .op-chartbox { flex: 1; display: flex; min-height: 230px; }
.op-sseg { align-self: flex-start; margin-bottom: 8px; max-width: 100%; flex-wrap: wrap; border-radius: 18px; }
.op-sseg button { height: 30px; font-size: 13px; }
.op-cbox { min-height: 230px; }
.chart .op-neg { fill: var(--op-neg); }
.chart .bar.op-sel { opacity: 1; }
.chart .ax.op-axsel { fill: var(--text); font-weight: 700; }
.chart .hit[data-goto] { cursor: pointer; }
.op-foot { font-size: 12px; margin-top: 6px; }
.op-econ { list-style: none; margin: 0; padding: 0; display: grid; font-size: 14px; }
.op-econ li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.op-econ li:last-child { border-bottom: 0; }
.op-econ li > span { color: var(--muted); } .op-econ li.op-eh > span { color: var(--text); }
.op-econ li.op-eh { padding-top: 9px; }
.op-econ li.op-res b { font-size: 18px; }
.op-econ small { font-weight: 500; }
.op-adj { font-style: normal; font-size: 12px; color: var(--st-work); font-weight: 600; }
.op-bad { color: var(--danger); } .op-good { color: var(--st-done); }
.op-note { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--muted); margin: 10px 0 0; line-height: 1.35; }
.op-note .ic { width: 16px; height: 16px; flex: none; margin-top: 1px; }
.op-note.is-warn { color: var(--st-work); font-weight: 600; }
.op-kv { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; font-size: 13.5px; }
.op-kv li { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.op-kv li > span { color: var(--muted); } .op-kv b { text-align: right; font-weight: 600; }
.op-kv .link { font: inherit; font-weight: 600; background: none; border: 0; padding: 0; cursor: pointer; }
.op-warnli b, .op-warnli span { color: var(--st-work) !important; }
.op-tank .op-tbar, .op-split .op-sbar { height: 14px; border-radius: 7px; background: var(--surface-2); overflow: hidden; }
.op-tank .op-tbar i { display: block; height: 100%; background: var(--ch-2); border-radius: 7px; transition: width .4s; }
.op-tank.is-warn .op-tbar i { background: var(--st-work); }
.op-tnum { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.op-tnum b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; } .op-tnum span { font-size: 13px; }
.op-split .op-sbar { background: var(--op-own); }
.op-split .op-sbar i { display: block; height: 100%; background: var(--ch-2); }
.op-split .legend { margin-top: 8px; } .op-lg-own { background: var(--op-own); }
.op-ten .ds-tbl td { padding: 6px 6px; }
.op-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- сетка «дата × контейнер» ---------- */
.op-gridcard { padding: 14px 16px; }
.op-gh { display: grid; gap: 2px; min-width: 0; }
.op-gh .small { font-size: 12.5px; }
.op-scroll { overflow: auto; min-width: 0; max-width: 100%; }
.op-grid { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; }
.op-grid th, .op-grid td { border-bottom: 1px solid var(--border); padding: 0 4px; height: 28px; text-align: center; white-space: nowrap; }
.op-grid thead th { position: sticky; top: 0; background: var(--surface); z-index: 2; vertical-align: bottom; font-weight: 600; color: var(--muted); font-size: 12px; }
.op-grid th.op-v { height: 148px; padding: 6px 2px; min-width: 34px; position: sticky; }
.op-grid th.op-v span { writing-mode: vertical-rl; transform: rotate(180deg); display: inline-block; max-height: 136px; overflow: hidden; text-overflow: ellipsis; text-align: left; line-height: 1.15; }
.op-grid.is-time th.op-v { min-width: 44px; }
.op-nomap { display: block; color: var(--st-work); font-style: normal; font-size: 16px; line-height: .5; margin-top: 4px; }
.op-grid .op-d { position: sticky; left: 0; background: var(--surface); z-index: 1; text-align: left; padding: 0 10px 0 2px; min-width: 104px; color: var(--text); font-weight: 500; }
.op-grid thead .op-d { z-index: 3; }
.op-grid .op-t { font-weight: 700; background: color-mix(in srgb, var(--surface-2) 60%, var(--surface)); min-width: 52px; }
.op-grid .op-pk { color: var(--ch-2); font-weight: 700; }
.op-wd { color: var(--muted); font-size: 11.5px; display: inline-block; width: 18px; }
.op-grid tr.op-we td { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.op-grid tr.op-we td.op-d { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.op-grid tr.op-out td { color: var(--muted); }
.op-grid tr.op-out .op-cell { color: var(--muted); border-style: dashed; }
.op-to { font-style: normal; font-size: 11px; font-weight: 700; color: var(--st-work); margin-left: 6px; }
.op-carry td { font-style: italic; color: var(--muted); background: color-mix(in srgb, var(--ch-2) 7%, var(--surface)); }
.op-carry td.op-d { background: color-mix(in srgb, var(--ch-2) 7%, var(--surface)); }
.op-cell { min-width: 26px; height: 22px; padding: 0 5px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--ch-2) 45%, transparent);
  background: color-mix(in srgb, var(--ch-2) 12%, transparent); color: var(--text); font-weight: 700; font-size: 12.5px; cursor: pointer; font-variant-numeric: tabular-nums; }
.op-cell:hover { border-color: var(--ch-2); }
.op-grid tfoot td { position: sticky; bottom: 0; background: var(--surface); z-index: 1; border-top: 1px solid var(--border); }
.op-grid tfoot .op-adjrow td { bottom: 29px; font-size: 12.5px; color: var(--st-work); }
.op-grid tfoot .op-adjrow:not(:last-child) td { bottom: 29px; }
.op-reason { text-align: left !important; white-space: normal !important; color: var(--muted); max-width: 400px; }
.op-reason .link { font-size: 12.5px; background: none; border: 0; padding: 0; cursor: pointer; }
.op-total td { font-weight: 800; }
.op-oplist { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.op-oplist li { padding: 12px; border-radius: var(--radius-sm); background: var(--surface-2); display: grid; gap: 8px; }
.op-oplist small { display: block; margin-top: 3px; }
.op-opacts { display: flex; gap: 6px; flex-wrap: wrap; }
.op-danger { color: var(--danger); }
.sheet .btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ---------- погрузчик ---------- */
.op-fl { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 14px; }
.op-days td { padding: 5px 6px; }
.op-days tr.op-we td { color: var(--muted); }
.op-days tr.op-click { cursor: pointer; } .op-days tr.op-click:hover td { background: color-mix(in srgb, var(--text) 3%, transparent); }
.op-days tr.op-rep td { background: color-mix(in srgb, var(--st-work) 6%, transparent); }
.op-src { font-style: normal; font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.op-src.is-est { font-style: italic; font-weight: 500; }
.op-src.is-man { background: var(--primary-soft); color: var(--primary); }
.op-chip-rep { min-height: 20px; font-size: 11.5px; background: color-mix(in srgb, var(--st-work) 15%, transparent); color: var(--st-work); }
.op-note-c { white-space: normal !important; color: var(--muted); font-size: 12.5px; max-width: 220px; }
.op-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 2px; font-size: 13.5px; }
.op-list li { display: grid; grid-template-columns: minmax(80px, auto) 1fr auto auto; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.op-list li:last-child { border-bottom: 0; }
.op-list li > span { color: var(--muted); white-space: nowrap; }
.op-list li > b { font-weight: 600; text-align: right; } .op-list li > small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.op-list li.op-old { opacity: .6; }
.op-list li.muted { display: block; color: var(--muted); }
.op-imps li { grid-template-columns: auto 1fr auto auto; }
.op-x { width: 28px; height: 28px; } .op-x .ic { width: 14px; height: 14px; }
.ds-ch .btn-sm { height: 30px; }

/* ---------- формы в шторке ---------- */
.op-form .op-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.op-seg { flex-wrap: wrap; border-radius: 18px; }
.op-seg button { height: 32px; }
.op-mins { align-items: center; } .op-mins .chip-opt { min-height: 34px; padding: 4px 14px; } .op-mins .chip-opt.is-on { border-color: var(--primary); color: var(--primary); }
.op-mins input { width: 110px; min-height: 34px; padding: 6px 10px; border: 1px solid var(--field-border); border-radius: var(--radius-sm); background: var(--field); }
.op-form .dd { width: 100%; }

/* ---------- справочники и загрузка ---------- */
.op-names td { vertical-align: middle; }
.op-orgdd .dd { width: 300px; max-width: 100%; }
.op-orgdd .dd-pop { min-width: 340px; }
.op-sug { font-size: 12px; background: none; border: 0; padding: 0; margin-top: 3px; cursor: pointer; display: block; }
.op-sugg { color: var(--ch-2); font-weight: 600; }
.op-up-in { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.op-up-in p { margin: 0 0 8px; line-height: 1.45; }
.op-ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; line-height: 1.4; }
.op-drop { display: grid; gap: 10px; padding: 16px; border-radius: var(--radius-sm); border: 2px dashed var(--field-border); background: var(--surface-2); transition: border-color .2s; }
.op-drop.is-over { border-color: var(--primary); }
.op-file { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.op-file .ic { width: 28px; height: 28px; color: var(--primary); flex: none; }
.op-file span { display: grid; } .op-file input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.op-file:focus-within { outline: 2px solid var(--primary); outline-offset: 4px; border-radius: 8px; }
.op-files:empty { display: none; }
.op-drop .btn { justify-self: start; }
.op-warns { display: grid; gap: 4px; margin-bottom: 10px; } .op-warns .op-note { margin: 0; }
.op-pv td { white-space: nowrap; }
.op-ok .ic { width: 15px; height: 15px; color: var(--st-done); vertical-align: -3px; }
.op-warn, .op-warn .ic { color: var(--st-work); } .op-warn .ic { width: 15px; height: 15px; vertical-align: -3px; }
.op-chk { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.op-h3 { font-size: 15px; margin: 18px 0 6px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.op-h3 small { font-weight: 500; font-size: 12.5px; }
.op-apply { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; flex-wrap: wrap; }

/* ---------- компьютер: сетки и таблицы — во весь экран, прокрутка внутри карточки ---------- */
@media (min-width: 1101px) and (min-height: 640px) {
  .main:has(> .op) { padding-top: 16px; padding-bottom: 16px; }
  .op:has(.op-gridcard) { height: calc(100dvh - 76px - 32px); grid-template-rows: auto auto minmax(0, 1fr); }
  .op:has(.op-gridcard) .op-body { min-height: 0; grid-template-rows: minmax(0, 1fr); }
  .op:has(.op-gridcard) .op-body > .op-gridcard,
  .op:has(.op-gridcard) .op-body > div > .op-gridcard { min-height: 0; overflow: hidden; }
  .op:has(.op-gridcard) .op-body > div { min-height: 0; }
  .op:has(.op-gridcard) .op-side { overflow: auto; min-height: 0; max-height: 100%; }
  .op-gridcard .op-scroll { flex: 1; min-height: 0; }
  .op:has(.op-up) { height: auto; }
}

/* ---------- планшет и телефон ---------- */
@media (max-width: 1100px) {
  .op-g2, .op-g3, .op-g2b, .op-g2r, .op-fl, .op-up-in { grid-template-columns: minmax(0, 1fr); }
  .op .ds-tiles.n5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .op .ds-tiles.n5 .t-main { grid-column: 1 / -1; }
  .op-gridcard .op-scroll { max-height: 70vh; }
}
@media (max-width: 640px) {
  .op .ds-head .toolbar { width: 100%; }
  .op-month { width: 100%; } .op-mdd { flex: 1; } .op-mdd .dd { width: 100%; }
  .op-reps { width: calc(100vw - 32px); right: auto; left: 0; }
  .op .ds-tile .v { font-size: 24px; }
  .op-form .op-2 { grid-template-columns: 1fr; }
  .op-orgdd .dd { width: 220px; }
  .op-grid .op-d { min-width: 88px; }
}
