body { background: #f5f6f8; }
.kpi { min-height: 110px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .75rem; }
.route td, .route th { white-space: nowrap; }
.route .st-confirmed { background: #d1e7dd; }
.route .st-done { background: #fff3cd; }
.route .st-planned { background: #e7f1ff; }
.route .st-rework { background: #f8d7da; }
.heat { background: #e7f1ff; font-weight: 600; }
.ts td, .ts th { padding: .15rem .25rem; }
.items-table .form-control, .items-table .form-select { min-width: 60px; }
@media print { nav, .btn, form { display: none !important; } body { background: #fff; } }
.table td.text-end, .table th.text-end, .table .text-end td { white-space: nowrap; }

.bell { font-size: 1.05rem; }
.bell .cnt { position: absolute; top: 2px; right: -2px; background: #dc3545; color: #fff; border-radius: 10px; font-size: 10px; padding: 0 5px; line-height: 16px; }
.cols-panel { position: absolute; width: 330px; z-index: 1080; }
.cols-item { display: flex; align-items: center; padding: 5px 10px; border-bottom: 1px solid #eee; background: #fff; cursor: grab; font-size: 14px; }
.cols-item.off { color: #999; }
.cols-item .drag { color: #999; margin-right: 6px; }
.cols-item .lock { font-size: 11px; color: #999; margin-left: auto; }
.cols-item.dragging { background: #e7f1ff; }
th.col-draggable { cursor: grab; }
.kind-badge { font-size: 11px; }
.nom-dd { position: absolute; z-index: 1070; background: #fff; border: 1px solid #ccc; border-radius: 6px; box-shadow: 0 6px 24px rgba(0,0,0,.18); max-height: 280px; overflow: auto; width: 460px; }
.nom-dd div { padding: 5px 10px; border-bottom: 1px solid #eee; font-size: 13px; cursor: pointer; }
.nom-dd div:hover, .nom-dd .hl { background: #e7f1ff; }
.wo-card { cursor: grab; }
.wo-card.unapproved { border-left: 4px solid #ffc107; }
.drop-day { outline: 2px dashed #0d6efd; background: #e7f1ff !important; }
.chip { display: flex; justify-content: space-between; align-items: center; border: 1px solid #cfe2ff; background: #f3f8ff; border-radius: 4px; padding: 2px 6px; margin-top: 3px; font-size: 12px; cursor: grab; }
.chip.unapproved { border-color: #ffda6a; background: #fff8e1; }
.carry { background: #fff3cd; border: 1px solid #ffda6a; border-radius: 4px; font-size: 11px; padding: 0 5px; }
.item-row.kind-goods td, .item-row.kind-service td { background: #f8fff9; }

/* ---------------------------------------------------------------- меню в два уровня */
:root { --brand: #0f4a68; --brand-dark: #0b3a52; --brand-hover: #145a7d; --accent: #2a9aa3; --olive: #8a8a3a; }
.app-header { position: sticky; top: 0; z-index: 1030; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.in-tab .app-header, .in-tab .nav-drawer { display: none !important; }
.topbar { background: var(--brand); display: flex; align-items: stretch; height: 58px; color: #d6e4ea; padding-left: 8px; }
.topbar a { color: inherit; text-decoration: none; }
.brand { display: flex; align-items: center; gap: 9px; color: #fff !important; font-weight: 700; font-size: 13px; letter-spacing: .5px; padding: 0 16px 0 6px; white-space: nowrap; }
.cube { width: 22px; height: 22px; background: linear-gradient(135deg, var(--accent) 50%, var(--olive) 50%); transform: rotate(45deg) scale(.8); border-radius: 3px; flex: none; }
.sections { align-items: stretch; }
.sec { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 0 14px; font-size: 12.5px; white-space: nowrap; }
.sec:hover { background: var(--brand-hover); color: #fff; }
.sec.on { background: var(--brand-dark); color: #fff; box-shadow: inset 0 -3px 0 var(--accent); }
.sec-badge, .sub-badge { background: #f0b429; color: #1b2b34; font-size: 10px; border-radius: 8px; padding: 0 5px; font-weight: 600; }
.sec-badge { position: absolute; top: 5px; right: 8px; }
.sec-badge.static { position: static; margin-left: auto; }
.sub-badge { margin-left: 4px; }
.tb-burger { background: none; border: 0; color: #fff; padding: 0 10px; }
.tb-title { color: #fff; font-weight: 600; align-self: center; }
.tb-right { margin-left: auto; display: flex; align-items: center; gap: 16px; padding-right: 14px; }
.tb-bell { position: relative; color: #fff !important; }
.tb-bell .cnt { position: absolute; top: -6px; right: -8px; background: #e5484d; color: #fff; font-size: 10px; border-radius: 8px; padding: 0 4px; }
.tb-user { display: flex; align-items: center; gap: 10px; color: #fff !important; }
.tb-user .who { flex-direction: column; text-align: right; line-height: 1.15; font-size: 13px; }
.tb-user .who small { color: #a9c3cf; font-size: 11px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.caret { margin-left: -6px; font-size: 11px; }
.subbar { background: #fff; border-bottom: 1px solid #dfe5e9; }
.sub { display: flex; align-items: stretch; height: 42px; padding-left: 12px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.sub::-webkit-scrollbar { display: none; }
.subitem { display: flex; align-items: center; padding: 0 13px; font-size: 14px; color: #1b2b34; text-decoration: none; white-space: nowrap; }
.subitem:hover { color: var(--brand); background: #f3f7f9; }
.subitem.on { color: var(--brand); font-weight: 600; box-shadow: inset 0 -3px 0 var(--accent); }
.nav-drawer { background: var(--brand-dark); color: #d6e4ea; width: 280px !important; }
.nav-drawer .offcanvas-header { background: var(--brand); color: #fff; }
.drawer-sec { display: flex; align-items: center; gap: 12px; padding: 12px 18px; color: #d6e4ea; text-decoration: none; font-size: 15px; background: none; border: 0; width: 100%; text-align: left; }
.drawer-sec.on, .drawer-sec:hover { background: var(--brand-hover); color: #fff; }
.drawer-sec.sep { border-top: 1px solid var(--brand-hover); margin-top: 8px; }

/* ---------------------------------------------------------------- вкладки */
body.shell { height: 100vh; display: flex; flex-direction: column; overflow: hidden; background: #fff; }
body.shell .app-header { position: static; }
.tabbar { background: #e3e9ed; display: flex; align-items: flex-end; height: 36px; padding: 0 8px; border-bottom: 1px solid #c9d3d9; flex: none; }
.tabs-scroll { display: flex; gap: 2px; overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; flex: 1; align-items: flex-end; height: 100%; }
.tab { background: #f3f6f8; border: 1px solid #c9d3d9; border-bottom: none; padding: 0 6px 0 12px; height: 29px; font-size: 13px; border-radius: 6px 6px 0 0; display: flex; gap: 6px; align-items: center; color: #334; cursor: pointer; white-space: nowrap; max-width: 240px; user-select: none; }
.tab .t-title { overflow: hidden; text-overflow: ellipsis; }
.tab .t-x { border: 0; background: none; color: #889; font-size: 16px; line-height: 1; padding: 0 3px; border-radius: 3px; }
.tab .t-x:hover { background: #dfe5e9; color: #c62828; }
.tab.on { background: #fff; color: var(--brand); font-weight: 600; box-shadow: inset 0 3px 0 var(--accent); height: 31px; margin-bottom: -1px; }
.tab.dirty .t-title { font-style: italic; }
.tabs-count { font-size: 11px; color: #7a8a93; padding: 0 6px 9px; }
.frames { flex: 1; position: relative; }
.tab-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: none; background: #f4f6f8; }
.tab-frame.on { display: block; }
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.app-toast { background: #1f6f43; color: #fff; padding: 10px 16px; border-radius: 6px; box-shadow: 0 4px 14px rgba(0,0,0,.2); font-size: 14px; max-width: 420px; transition: opacity .6s; }
.app-toast.err { background: #b3261e; } .app-toast.warn { background: #a86200; } .app-toast.hide { opacity: 0; }
.limit-list { max-height: 50vh; overflow: auto; }
.limit-row { display: flex; align-items: center; gap: 10px; padding: 7px 4px; border-bottom: 1px solid #f0f3f5; cursor: pointer; }
.limit-dirty { color: #b26a00; font-size: 12px; white-space: nowrap; }
.ask-body { font-size: 15px; }

/* ---------------------------------------------------------------- списки и документы как в 1С */
.filters { display: flex; gap: 10px; flex-wrap: wrap; }
.filters > div { flex: 1 1 150px; max-width: 220px; }
.filters > div.grow { flex: 2 1 220px; max-width: none; }
.filters label { font-size: 12px; color: #5a6a73; margin-bottom: 1px; }
.toolbar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
table.grid thead th { background: #f1f4f6; font-weight: 600; white-space: nowrap; }
table.grid tbody tr[data-href] { cursor: default; user-select: none; }
table.grid tr.row-sel > td, table tr.row-sel > td { background: #fff6cc !important; }
.dochead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 2px; }
.dochead h4 { font-weight: 500; }
.doclinks { display: flex; gap: 18px; font-size: 13px; margin: 4px 0 8px; flex-wrap: wrap; }
.docbar { background: #fff; padding: 8px 0; top: 0; z-index: 20; }
.docstate { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; margin: 2px 0 10px; }
.doctabs .nav-link { font-size: 13.5px; padding: 6px 14px; color: #334; }
.doctabs .nav-link.active { font-weight: 600; color: var(--brand); }
.doctab-body { background: #fff; border: 1px solid #dee2e6; border-top: 0; padding: 12px; margin-bottom: 12px; }
.ops-checks label { white-space: nowrap; font-size: 14px; }

.tb-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@media (max-width: 991px) { .brand { padding: 0 8px 0 2px; } .tb-right { gap: 12px; padding-right: 10px; } }

.doc-ro span { display: block; font-size: 12px; color: #5a6a73; }
.docstate select { font-size: 13px; }

.drawer-item { display: block; padding: 9px 18px 9px 52px; color: #c2d6df; text-decoration: none; font-size: 14px; }
.drawer-item.on, .drawer-item:hover { color: #fff; background: rgba(255,255,255,.07); }
.drawer-item.on { box-shadow: inset 3px 0 0 var(--accent); }

.vat-line { display: flex; gap: 22px; justify-content: flex-end; font-size: 14px; padding: 8px 4px; border-top: 1px solid #dfe5e9; flex-wrap: wrap; }

/* ---------------------------------------------------------------- кнопки панелей: иконки / подписи */
.tbtn { display: inline-flex; align-items: center; gap: 6px; }
.tbtn svg { flex: none; }
.tb-icon .tbtn .lbl { display: none; }
.tb-icon .tbtn { padding-left: 8px; padding-right: 8px; }
.tb-text .tbtn svg { display: none; }
.tbtn .caret { font-size: 10px; opacity: .7; }
.gear-menu { min-width: 320px; }
.gear-menu label.dropdown-item { cursor: pointer; white-space: normal; }
.gear .btn small { font-size: 10px; }

/* ---------------------------------------------------------------- всплывающие подпункты меню */
.sec-wrap { position: relative; display: flex; }
.sec.open { background: #fff; color: var(--brand) !important; box-shadow: none; }
.fly { position: absolute; top: 100%; left: 0; min-width: 290px; background: #fff; border-radius: 0 0 8px 8px;
  box-shadow: 0 10px 28px rgba(0,0,0,.22); padding: 6px 0; z-index: 1050; }
.fly-item { display: block; padding: 8px 16px; color: #1b2b34 !important; text-decoration: none; white-space: nowrap; }
.fly-item b { display: block; font-weight: 500; font-size: 14px; }
.fly-item small { display: block; color: #7a8a93; font-size: 12px; }
.fly-item:hover { background: #eef5f6; }
.fly-item.on { background: #eef5f6; box-shadow: inset 3px 0 0 var(--accent); }
.fly-item.on b { color: var(--brand); font-weight: 600; }

/* ---------------------------------------------------------------- цветные иконки панелей */
.ic-print, .ic-save { color: #1565c0; }
.ic-post, .ic-edo, .ic-xls { color: #198754; }
.ic-unpost { color: #c62828; }
.ic-copy { color: #e67e22; }
.ic-import { color: #6f42c1; }
.ic-gear { color: #5a6a73; }
.tbtn.btn-outline-secondary, .tbtn.btn-outline-success { background: #fff; color: #1b2b34; border-color: #c9d3d9; }
.tbtn:hover { background: #f1f6f9 !important; color: #1b2b34 !important; }
.tb-text .tbtn[data-c="blue"] .lbl { color: #1565c0; } .tb-text .tbtn[data-c="green"] .lbl { color: #198754; }
.tb-text .tbtn[data-c="red"] .lbl { color: #c62828; } .tb-text .tbtn[data-c="orange"] .lbl { color: #c96a10; }
.tb-text .tbtn[data-c="violet"] .lbl { color: #6f42c1; }
.tool-sep { width: 1px; height: 24px; background: #d5dde2; margin: 0 4px; display: inline-block; align-self: center; }
.tbtn svg { stroke-width: 1.9; }
.tbtn svg { width: 18px; height: 18px; }
.tb-icon .tbtn { min-width: 36px; justify-content: center; }

/* ---------------------------------------------------------------- меню правой кнопки, отбор, пометка на удаление */
.ctx-menu { position: fixed; z-index: 3000; min-width: 330px; background: #fff; border: 1px solid #c9d3d9; border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25); padding: 4px 0; font-size: 13.5px; }
.ctx-item { display: flex; align-items: center; gap: 10px; padding: 6px 14px; cursor: default; color: #1b2b34; text-decoration: none; position: relative; }
.ctx-item:hover { background: #eef5f6; color: #1b2b34; }
.ctx-item .l { flex: 1; white-space: nowrap; } .ctx-item .k { color: #8a979f; font-size: 12px; }
.ctx-item.dis { color: #b0bac0; pointer-events: none; } .ctx-item.dis svg { opacity: .4; }
.ctx-sep { border-top: 1px solid #e3e8ec; margin: 4px 0; }
.ctx-sub { display: none; position: absolute; left: 100%; top: -5px; min-width: 300px; background: #fff; border: 1px solid #c9d3d9;
  border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.2); padding: 4px 0; }
.has-sub:hover > .ctx-sub { display: block; }
.ctx-sub .ctx-item { display: block; } .ctx-sub .ctx-item b { display: block; font-weight: 500; } .ctx-sub .ctx-item small { color: #7a8a93; }
.ctx-filter { display: inline-flex; gap: 6px; align-items: center; background: #fff3c4; border: 1px solid #e8c547; border-radius: 4px; padding: 2px 10px; font-size: 13px; margin-bottom: 6px; }
tr.marked td { text-decoration: line-through; color: #9aa5ab !important; }
tr.marked td:first-child { text-decoration: none; }
.err-1c { border: 1.5px solid #e03131 !important; background-color: #fff5f5 !important; }
.tab-err { color: #e03131; }
.err-bubble { position: absolute; z-index: 2500; background: #fff8db; border: 1px solid #e8c547; border-radius: 4px; padding: 6px 28px 6px 10px;
  font-size: 13px; box-shadow: 0 3px 10px rgba(0,0,0,.18); max-width: 520px; }
.err-bubble b { color: #c62828; font-weight: 600; } .err-bubble i { position: absolute; right: 8px; top: 4px; font-style: normal; color: #c62828; cursor: pointer; }
.err-bubble:before { content: ""; position: absolute; top: -7px; left: 16px; border: 6px solid transparent; border-bottom-color: #e8c547; border-top: 0; }
.doc-msgs { position: sticky; bottom: 0; background: #fff; border-top: 3px solid #198754; margin-top: 12px; box-shadow: 0 -4px 12px rgba(0,0,0,.06); z-index: 30; max-height: 34vh; overflow: auto; }
.doc-msgs .mh { display: flex; justify-content: space-between; font-weight: 600; font-size: 13px; padding: 6px 8px; }
.doc-msgs .mh button { border: 0; background: none; color: #8a979f; font-size: 16px; }
.doc-msgs .mr { padding: 6px 12px; font-size: 13px; border-top: 1px solid #eef1f3; cursor: pointer; }
.doc-msgs .mr.on, .doc-msgs .mr:hover { background: #fff3c4; }

/* ---- склад, материалы, кассеты (этап 2, часть 1) ---- */
.kpi-box{border:1px solid #d5dde2;border-radius:6px;padding:6px 12px;background:#fff;min-width:150px}
.kpi-box small{display:block;color:#6b7b84;font-size:11.5px}.kpi-box b{font-size:16px}
tr.grp-row td{background:#f3f6f8;font-weight:600}
tr.ch-row td:first-child{padding-left:22px}
tr.low-row td{background:#fff1f0!important}
.nom-dd{position:fixed;z-index:1060;background:#fff;border:1px solid #9fb0ba;border-radius:5px;box-shadow:0 8px 22px rgba(0,0,0,.18);max-height:280px;overflow:auto;min-width:380px;font-size:13px}
.nom-dd div{padding:5px 10px;cursor:pointer;display:flex;justify-content:space-between;gap:12px}
.nom-dd div.on,.nom-dd div:hover{background:#d7ebf7}
.nom-dd small{color:#6b7b84}
#nom-panel{position:fixed;left:0;right:0;bottom:0;z-index:1055;background:#f4fafb;border-top:2px solid #2a9aa3;padding:6px 14px 8px;max-height:42vh;overflow:auto;font-size:12.5px;box-shadow:0 -6px 18px rgba(0,0,0,.08);display:none}
#nom-panel table{background:#fff}
#nom-panel .x{float:right;cursor:pointer;color:#6b7b84}

/* вкладки: меню, перетаскивание, закрепление */
.tabbar { position: relative; }
.tab.pinned { max-width: 70px; padding-right: 8px; }
.tab.pinned .t-x { display: none; }
.tab.dragging { opacity: .35; border-style: dashed; }
.tab-drop { position: absolute; top: 3px; width: 3px; height: 28px; background: var(--accent, #2a9aa3); border-radius: 2px; display: none; z-index: 5; pointer-events: none; }
.tab-menu { position: fixed; z-index: 2000; background: #fff; border: 1px solid #9fb0ba; border-radius: 6px; box-shadow: 0 10px 28px rgba(0,0,0,.22); min-width: 260px; padding: 4px 0; font-size: 13.5px; }
.tab-menu .mi { padding: 6px 14px; cursor: pointer; display: flex; justify-content: space-between; gap: 18px; }
.tab-menu .mi:hover { background: #d7ebf7; }
.tab-menu .mi.off { color: #aab4ba; cursor: default; background: none; }
.tab-menu .mi small { color: #8a979e; }
.tab-menu .sep { border-top: 1px solid #e3e8eb; margin: 4px 0; }
.tabs-scroll { scrollbar-width: none; }
