:root {
  --bg: #eef2f7;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #65748b;
  --line: #d8dee8;
  --dark: #111827;
  --dark-2: #253144;
  --accent: #0f766e;
  --blue: #2563eb;
  --good: #15803d;
  --warn: #b45309;
  --bad: #b91c1c;
  --shadow: 0 18px 42px rgba(15, 23, 42, .08);
  font-family: Inter, Segoe UI, Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, input, select, textarea { font: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 282px 1fr; }
.dispatcher-login { min-height: 100vh; display: grid; align-content: center; justify-content: center; gap: 20px; padding: 28px; }
.login-brand { color: var(--ink); }
.login-card { width: min(420px, calc(100vw - 42px)); }
.sidebar { background: var(--dark); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; gap: 22px; }
.brand { display: grid; grid-template-columns: 42px 1fr; gap: 12px; align-items: center; }
.brand-mark { width: 42px; height: 42px; border-radius: 8px; background: #0f766e; display: grid; place-items: center; font-weight: 800; }
.brand strong, .brand span { display: block; }
.brand span { color: #cbd5e1; font-size: 13px; margin-top: 3px; }
.nav { display: grid; gap: 8px; }
.nav button { min-height: 43px; border: 0; border-radius: 8px; background: transparent; color: #cbd5e1; text-align: left; padding: 10px 12px; cursor: pointer; }
.nav button.active, .nav button:hover { background: var(--dark-2); color: #fff; }
.role-box { margin-top: auto; border: 1px solid #334155; border-radius: 8px; padding: 12px; }

main { padding: 28px; display: grid; align-content: start; gap: 20px; }
.page { display: grid; gap: 18px; }
.hidden { display: none !important; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.eyebrow { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 31px; line-height: 1.1; }
h2 { font-size: 19px; }
.muted { color: var(--muted); line-height: 1.5; }
.head-actions, .button-grid, .form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); border-radius: 8px; min-height: 40px; padding: 9px 12px; background: #fff; color: var(--ink); cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: #fff; border-color: #fecaca; color: var(--bad); }
.btn.danger:hover { background: #fef2f2; }
.btn.secondary:hover { border-color: #94a3b8; }

label { display: grid; gap: 7px; color: #334155; font-size: 13px; font-weight: 700; min-width: 0; }
.check-field { display: inline-flex; align-items: center; gap: 8px; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; background: #fff; }
.check-field input { width: auto; }
.checkbox-row { align-self: end; font-weight: 700; }
.checkbox-row span { color: #334155; }
input, select, textarea { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 10px 11px; background: #fff; color: var(--ink); }
select[multiple] { min-height: 88px; padding: 7px; }
textarea { min-height: 96px; resize: vertical; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 14px; }
.metrics article, .panel { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.metrics article { padding: 16px; display: grid; gap: 6px; }
.metrics span { color: var(--muted); font-size: 13px; }
.metrics strong { font-size: 29px; }
.split { display: grid; grid-template-columns: minmax(320px, 430px) 1fr; gap: 18px; }
.panel { padding: 18px; display: grid; gap: 16px; align-content: start; }
.panel-title { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.stack { display: grid; gap: 10px; }
.exception-list { gap: 12px; }
.exception-card { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: linear-gradient(180deg, #fff, #f8fafc); }
.exception-card.warn { border-color: #fcd34d; background: linear-gradient(180deg, #fffaf0, #fffbeb); }
.exception-card.bad { border-color: #fca5a5; background: linear-gradient(180deg, #fff7f7, #fef2f2); }
.exception-card.good { border-color: #86efac; background: linear-gradient(180deg, #f7fff8, #ecfdf5); }
.exception-main { display: grid; gap: 4px; }
.exception-main strong { font-size: 15px; line-height: 1.25; }
.exception-main small { color: var(--muted); line-height: 1.4; }
.exception-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.exception-toolbar { display: grid; gap: 8px; }
.exception-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.exception-state { justify-self: end; display: grid; gap: 8px; justify-items: end; min-width: 138px; }
.exception-state .btn { width: 100%; }
.dashboard-view-switch { display: inline-flex; width: fit-content; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.dashboard-workspace { display: grid; grid-template-columns: minmax(0, 1.9fr) minmax(360px, .9fr); gap: 14px; height: clamp(520px, calc(100vh - 275px), 720px); min-height: 0; }
.dashboard-workspace[data-view="map"],
.dashboard-workspace[data-view="exceptions"] { grid-template-columns: minmax(0, 1fr); }
.dashboard-workspace[data-view="map"] .dashboard-exception-panel,
.dashboard-workspace[data-view="exceptions"] .dashboard-map-panel { display: none; }
.dashboard-map-panel, .dashboard-exception-panel { min-width: 0; min-height: 0; overflow: hidden; padding: 14px; gap: 10px; }
.dashboard-map-panel { grid-template-rows: auto auto auto minmax(280px, 1fr); }
.dashboard-map-panel .map-board { min-height: 0; height: 100%; }
.dashboard-map-panel .yandex-map { min-height: 0; }
.dashboard-exception-panel { grid-template-rows: auto auto minmax(120px, 1fr) auto; }
.exception-summary { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.dashboard-exception-panel .exception-filters { gap: 4px; }
.dashboard-exception-panel .chip { padding: 4px 8px; font-size: 11px; }
.dashboard-exception-panel .exception-list { min-height: 0; overflow-y: auto; display: grid; align-content: start; gap: 5px; padding-right: 3px; }
.exception-row { width: 100%; display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 9px; align-items: center; min-height: 53px; padding: 7px 8px 7px 0; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.exception-row:hover, .exception-row.selected { border-color: #94a3b8; background: #f8fafc; }
.exception-row.selected { box-shadow: 0 0 0 2px rgba(15, 118, 110, .12); }
.exception-priority { width: 4px; align-self: stretch; border-radius: 4px; background: #f59e0b; }
.exception-row.bad .exception-priority { background: var(--bad); }
.exception-row.warn .exception-priority { background: #f59e0b; }
.exception-row.good .exception-priority { background: var(--good); }
.exception-row-main { min-width: 0; }
.exception-row-main strong, .exception-row-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exception-row-main strong { font-size: 12px; line-height: 1.3; }
.exception-row-main small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.exception-row-side { display: grid; justify-items: end; }
.exception-row-side .badge { font-size: 10px; padding: 4px 6px; }
.exception-details { min-height: 112px; max-height: 190px; overflow-y: auto; display: grid; align-content: start; gap: 7px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; }
.exception-details-head { display: flex; justify-content: space-between; gap: 9px; align-items: start; }
.exception-details-head strong, .exception-details-head small { display: block; }
.exception-details-head strong { font-size: 13px; line-height: 1.3; }
.exception-details-head small, .exception-details p { margin-top: 3px; color: var(--muted); font-size: 11px; line-height: 1.4; }
.exception-details-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.exception-details-actions .compact-btn { min-height: 26px; padding: 4px 7px; font-size: 11px; }
.exception-empty { display: grid; gap: 4px; padding: 14px; border: 1px solid #86efac; border-radius: 6px; background: #f0fdf4; }
.exception-empty small { color: var(--muted); line-height: 1.35; }
.badge.controlled { background: #dbeafe; color: #1d4ed8; }
.pilot-metrics { grid-template-columns: repeat(6, minmax(120px, 1fr)); }
.pilot-scenarios { display: grid; grid-template-columns: repeat(2, minmax(260px, 1fr)); gap: 12px; }
.pilot-card { border: 1px solid var(--line); border-radius: 8px; padding: 14px; background: #fff; display: grid; gap: 8px; }
.pilot-card header { display: flex; justify-content: space-between; gap: 10px; align-items: start; }
.pilot-card strong { font-size: 15px; line-height: 1.25; }
.pilot-card p { margin: 0; color: var(--muted); line-height: 1.45; }
.pilot-card small { color: var(--muted); }
.item { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.item small { display: block; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.item-actions { display: grid; justify-items: end; gap: 8px; }
.badge { border-radius: 999px; padding: 5px 9px; font-size: 12px; font-weight: 800; background: #e2e8f0; color: #334155; white-space: nowrap; }
.badge.confirmed, .badge.good { background: #dcfce7; color: var(--good); }
.badge.review, .badge.warn { background: #fef3c7; color: var(--warn); }
.badge.risk, .badge.bad { background: #fee2e2; color: var(--bad); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 700px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: #475569; background: #f8fafc; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }

.mobile-grid { display: grid; grid-template-columns: minmax(300px, 390px) 1fr; gap: 18px; align-items: start; }
.phone { border: 10px solid #111827; border-radius: 28px; overflow: hidden; background: #f8fafc; box-shadow: 0 24px 55px rgba(15, 23, 42, .18); }
.phone-top { background: #111827; color: #fff; padding: 10px 14px 16px; display: flex; justify-content: space-between; font-size: 13px; }
.phone-body { padding: 16px; display: grid; gap: 13px; }
.proof-box { min-height: 104px; border: 1px dashed #94a3b8; border-radius: 8px; background: #f8fafc; display: grid; align-content: center; gap: 6px; padding: 14px; color: #475569; }
.proof-box strong { color: var(--ink); }
.camera { aspect-ratio: 4 / 3; border-radius: 8px; background: radial-gradient(circle at 50% 34%, #f3c7a4 0 14%, transparent 15%), radial-gradient(circle at 43% 31%, #172033 0 1.2%, transparent 1.5%), radial-gradient(circle at 57% 31%, #172033 0 1.2%, transparent 1.5%), linear-gradient(180deg, #cbd5e1, #94a3b8); display: grid; place-items: end center; padding: 12px; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.35); }
.camera.done { outline: 3px solid #86efac; }
.camera span { background: rgba(15, 23, 42, .72); border-radius: 999px; padding: 6px 10px; font-size: 12px; }
.check-list { display: grid; gap: 10px; }
.check { display: grid; grid-template-columns: 28px 1fr; gap: 10px; align-items: start; padding: 11px; border: 1px solid var(--line); border-radius: 8px; }
.dot { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: #e2e8f0; color: #475569; font-weight: 900; }
.check.done .dot { background: #dcfce7; color: var(--good); }
.notice { border-left: 4px solid var(--blue); background: #eff6ff; color: #1e3a8a; padding: 12px 14px; border-radius: 8px; line-height: 1.45; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)); gap: 12px; }
.form-grid.compact { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
.full-span { grid-column: 1 / -1; }
.coordinate-row { display: grid; grid-template-columns: repeat(2, minmax(160px, 1fr)); gap: 12px; }
.subhead { display: flex; justify-content: space-between; gap: 12px; align-items: center; border-top: 1px solid var(--line); padding-top: 16px; }
.subhead h3 { margin: 0; font-size: 16px; }
.equipment-list, .stage-groups { display: grid; gap: 10px; }
.equipment-row { display: grid; grid-template-columns: repeat(4, minmax(150px, 1fr)); gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.equipment-row-head { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.equipment-row-head strong { font-size: 15px; }
.equipment-row .equipment-wide { grid-column: span 2; }
.stage-group { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.multi-dropdown { position: relative; }
.multi-dropdown-toggle { width: 100%; min-height: 40px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff; color: var(--ink); cursor: pointer; text-align: left; min-width: 0; }
.multi-dropdown-toggle span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.multi-dropdown-toggle strong { color: var(--muted); font-size: 12px; }
.multi-dropdown-menu { position: absolute; z-index: 35; top: calc(100% + 4px); left: 0; right: 0; max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 18px 42px rgba(15, 23, 42, .16); padding: 6px; }
.multi-option { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; padding: 8px; border-radius: 6px; color: var(--ink); font-size: 13px; font-weight: 700; cursor: pointer; }
.multi-option:hover { background: #f8fafc; }
.multi-option input { width: auto; }
.multi-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.multi-empty { padding: 10px; color: var(--muted); font-size: 12px; line-height: 1.35; }
.team-create { border-color: #99f6e4; }
.search-card, .team-card { align-items: center; }
.subsection-switch { display: inline-flex; align-items: center; gap: 6px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: #fff; width: fit-content; }
.subsection-btn { min-height: 30px; padding: 6px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 800; cursor: pointer; }
.subsection-btn.active { background: rgba(13, 148, 136, .12); color: var(--accent); }
.work-type-card { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.work-type-card strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-type-card small { display: block; margin-top: 3px; color: var(--muted); }
.work-type-card .item-actions { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.work-type-total { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid #b7791f; background: #fffaf0; }
.work-type-total.valid { border-left-color: #16836f; background: #f0fbf8; }
.work-type-total span { color: var(--muted); font-size: 12px; }
.work-type-norm-editor { grid-column: 1 / -1; padding: 10px; border: 1px solid var(--line); background: #f8fafc; }
.work-type-norm-editor > span { display: block; margin-bottom: 8px; font-size: 12px; font-weight: 800; color: #334155; }
.work-type-norm-grid { display: grid; grid-template-columns: repeat(5, minmax(84px, 1fr)); gap: 8px; }
.work-type-norm-grid label { font-size: 11px; }
.work-type-norm-grid input { min-width: 0; }
.work-type-card .norm-summary { white-space: normal; }
.schedule-overrun { color: #b42318 !important; font-weight: 800; }
.schedule-site-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.schedule-site-summary span { display: inline-flex; flex-direction: column; gap: 2px; min-width: 150px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.schedule-site-summary em { color: var(--muted); font-size: 10px; font-style: normal; font-weight: 700; text-transform: uppercase; }
.schedule-site-summary strong { color: #172033; font-size: 12px; }
@media (max-width: 760px) {
  .work-type-norm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.stage-percent { display: inline-block; margin-top: 5px; font-weight: 700; color: #126b5f; }
.xlsx-import-result { display: grid; gap: 12px; margin-top: 14px; }
.import-summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-left: 4px solid var(--accent); background: #f5fbfa; }
.import-summary span { color: var(--muted); font-size: 12px; }
.import-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.import-summary-grid span { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); background: #fff; font-size: 12px; }
.import-summary-grid strong { font-size: 15px; color: var(--accent); }
.xlsx-preview-table { min-width: 1120px; }
.xlsx-preview-table td { vertical-align: top; }
.search-card .btn, .team-card .btn, .site-card .btn, .equipment-row .btn, .stage-group .btn { white-space: nowrap; }
.team-card .btn, .search-card .btn, .work-type-card .btn, .warehouse-card .btn { min-height: 24px; padding: 3px 6px; border-radius: 6px; font-size: 11px; }
.team-supervisor-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 10px; align-items: end; }
.team-supervisor-row label { gap: 5px; font-size: 12px; }
.team-supervisor-picker { min-width: 250px; }
.team-search-field { display: block; max-width: 420px; margin: 0 0 12px; }
.site-card .btn { min-height: 24px; padding: 3px 6px; border-radius: 6px; font-size: 11px; }
.site-card.editing { border-color: #5eead4; box-shadow: 0 0 0 3px rgba(15, 118, 110, .10); }
.site-card.saved { border-color: #86efac; background: #f7fff8; }
.inline-save-success { color: var(--good) !important; font-weight: 800; }
.inline-site-editor { grid-column: 1 / -1; display: grid; gap: 14px; margin-top: 4px; padding: 14px; border-top: 1px solid #99f6e4; background: #f8fafc; }
.inline-site-editor-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.inline-site-editor-head > div:first-child { display: grid; gap: 4px; }
.inline-site-editor-head strong { font-size: 16px; }
.inline-site-editor-head small { color: var(--muted); line-height: 1.4; }
.inline-site-editor .equipment-row { background: #fff; }
.inline-site-editor-footer { position: sticky; bottom: 10px; z-index: 5; display: flex; gap: 8px; flex-wrap: wrap; padding: 10px; border: 1px solid #99f6e4; border-radius: 8px; background: rgba(240, 253, 250, .96); box-shadow: 0 8px 24px rgba(15, 23, 42, .12); }
.site-card .inline-site-editor-footer .btn { min-height: 40px; padding: 9px 12px; font-size: 13px; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.compact-btn {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.2;
}
.site-card .table-actions .compact-btn,
.team-card .table-actions .compact-btn,
.search-card .table-actions .compact-btn,
.work-type-card .table-actions .compact-btn,
.warehouse-card .table-actions .compact-btn,
.schedule-stage-row .table-actions .compact-btn,
.exception-actions .compact-btn {
  min-width: 76px;
}
.people-table .table-actions .compact-btn {
  min-width: 116px;
}
.schedule-filters { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.people-filters { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.people-table { min-width: 1080px; }
.people-table tbody tr:hover td { background: #fbfdff; }
.inline-team-select { min-width: 170px; min-height: 30px; padding: 4px 8px; font-size: 12px; border-radius: 6px; }
.link-button { border: 0; background: transparent; padding: 0; color: var(--accent); font-weight: 800; cursor: pointer; text-align: left; }
.link-button:hover { text-decoration: underline; }
.schedule-table { min-width: 940px; table-layout: fixed; font-size: 13px; }
.schedule-table > thead th:nth-child(1) { width: 26%; }
.schedule-table > thead th:nth-child(2) { width: 13%; }
.schedule-table > thead th:nth-child(3) { width: 21%; }
.schedule-table > thead th:nth-child(4) { width: 14%; }
.schedule-table > thead th:nth-child(5) { width: 12%; }
.schedule-table > thead th:nth-child(6) { width: 14%; }
.schedule-table > tbody > .schedule-lift-row > td { padding: 10px 8px; overflow-wrap: anywhere; }
.schedule-site-row td { background: #fff; padding: 0; }
.schedule-site-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: stretch; padding: 0 14px; background: #f8fafc; }
.schedule-site-row.open .schedule-site-head { background: #ecfdf5; }
.schedule-site-toggle { width: 100%; border: 0; background: transparent; color: var(--ink); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: start; text-align: left; padding: 13px 0; cursor: pointer; }
.schedule-site-head .append-stage-btn { align-self: center; min-height: 28px; padding: 4px 8px; border-radius: 6px; font-size: 12px; }
.schedule-site-head .table-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; }
.schedule-site-head .table-actions .btn {
  min-width: 132px;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
}
.schedule-caret { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: #e2e8f0; color: #334155; font-weight: 900; }
.schedule-site-toggle strong, .schedule-site-toggle small { display: block; }
.schedule-site-toggle small { color: var(--muted); margin-top: 3px; line-height: 1.35; }
.schedule-lift-row td { vertical-align: top; background: #fff; }
.schedule-lift-row:hover td, .schedule-lift-row.open td { background: #fbfefd; }
.schedule-lift-toggle { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; align-items: start; color: var(--ink); }
.schedule-lift-toggle:hover { text-decoration: none; }
.registry-actions { display: grid; grid-template-columns: 1fr; align-items: stretch; }
.registry-actions .compact-btn { width: 100%; min-height: 32px; white-space: normal; }
.schedule-lift-toggle small, .registry-subline { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.35; font-weight: 500; }
.schedule-lift-detail-row > td { padding: 0; background: #f8fafc; }
.schedule-lift-detail { display: grid; gap: 10px; padding: 12px 14px 16px 46px; border-bottom: 1px solid var(--line); }
.schedule-lift-detail .gantt-line, .schedule-lift-detail .gantt-empty { padding: 0; background: transparent; }
.schedule-stage-detail-table { min-width: 1180px; table-layout: auto; }
.schedule-stage-detail-table th { background: #eef6f4; }
.schedule-stage-detail-table th:last-child,
.schedule-stage-detail-table td:last-child {
  position: sticky;
  right: 0;
  z-index: 2;
  min-width: 116px;
  background: #fff;
  box-shadow: -7px 0 10px rgba(15, 23, 42, .08);
}
.schedule-stage-detail-table th:last-child {
  z-index: 3;
  background: #eef6f4;
}
.schedule-stage-detail-table td:last-child .table-actions {
  display: grid;
  gap: 5px;
  min-width: 100px;
}
.schedule-stage-detail-table td:last-child .compact-btn {
  width: 100%;
  min-width: 0;
  min-height: 28px;
  padding: 4px 7px;
  font-size: 11px;
  white-space: normal;
}
.schedule-stage-bulkbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.schedule-stage-bulkbar label { display: inline-flex; align-items: center; gap: 7px; margin-right: auto; font-weight: 700; }
.schedule-stage-bulkbar input, .stage-select-label input { width: auto; margin: 0; }
.schedule-stage-bulkbar span { color: var(--muted); font-size: 12px; font-weight: 700; }
.stage-select-label { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: 8px; }
.stage-select-label span, .stage-select-label small { display: block; }
.dispatcher-close-note { display: block; margin-top: 6px; color: #475569; line-height: 1.35; }
.registry-empty { margin: 0; padding: 10px 12px; border: 1px dashed var(--line); background: #fff; }
.checkbox-row { display: flex; flex-direction: row; align-items: center; gap: 9px; align-self: end; min-height: 42px; }
.checkbox-row input { width: auto; margin: 0; }
.checkbox-row span { line-height: 1.3; }
.import-geocode-option { width: fit-content; margin-top: 10px; }
.geocode-progress { margin: 6px 0 0; }
.schedule-worktypes { display: flex; flex-wrap: wrap; justify-content: flex-start; gap: 5px; grid-column: 2; }
.schedule-worktypes em { font-style: normal; border: 1px solid var(--line); border-radius: 999px; padding: 4px 7px; background: #fff; color: #475569; font-size: 11px; font-weight: 800; }
.inline-site-schedule-editor { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 10px; align-items: end; padding: 0 14px 13px 48px; background: #f8fafc; }
.schedule-site-row.open .inline-site-schedule-editor { background: #ecfdf5; }
.inline-site-schedule-summary { display: grid; gap: 4px; min-width: 0; }
.inline-site-schedule-summary strong { font-size: 13px; }
.inline-site-schedule-summary small { color: var(--muted); line-height: 1.35; }
.schedule-stage-row td { background: #fff; }
.schedule-stage-row:hover td { background: #fbfdff; }
.schedule-stage-editor-row td { vertical-align: top; }
.inline-stage-editor { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 10px; align-items: end; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.inline-stage-editor .multi-dropdown { position: relative; }
.inline-stage-editor .multi-dropdown-menu { z-index: 40; }
.shift-stack { display: grid; gap: 10px; align-self: stretch; }
.shift-stack label { min-width: 0; }
.stage-group > .btn { grid-column: 1 / -1; justify-self: end; }
.inline-site-schedule-editor .table-actions { grid-column: 1 / -1; justify-content: flex-end; }
.inline-stage-editor label,
.stage-group label,
.inline-site-schedule-editor label,
.inline-site-schedule-summary { min-width: 0; }
.inline-site-schedule-summary { grid-column: span 2; }
.schedule-stage-editor-row td:last-child { width: 124px; }
.schedule-stage-row td { min-width: 0; }
.schedule-stage-row td:nth-child(1) strong,
.schedule-stage-row td:nth-child(2),
.schedule-stage-row td:nth-child(3),
.schedule-stage-row td:nth-child(4),
.schedule-stage-row td:nth-child(5) { word-break: break-word; }
.report-cell { display: grid; gap: 6px; min-width: 180px; }
.report-line { display: grid; gap: 2px; }
.report-line strong { font-size: 12px; color: var(--ink); }
.report-line a { color: var(--accent); text-decoration: none; }
.report-line a:hover { text-decoration: underline; }
.report-thumb { width: 72px; height: 54px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; background: #f8fafc; }
.report-photo-gallery { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.report-photo-gallery .report-thumb { display: block; }
.report-line small { color: var(--muted); line-height: 1.35; }
.gantt-line { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 0 14px 13px 48px; background: #f8fafc; }
.schedule-site-row.open .gantt-line { background: #ecfdf5; }
.schedule-site-gantt-row > td { padding: 0; background: #ecfdf5; }
.site-gantt { display: grid; gap: 8px; padding: 10px 14px 12px 46px; border-bottom: 1px solid var(--line); background: #ecfdf5; }
.site-gantt-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; color: #164e63; font-size: 12px; }
.site-gantt-head span { color: var(--muted); font-size: 11px; font-weight: 800; }
.site-gantt-row { display: grid; grid-template-columns: minmax(150px, 220px) minmax(240px, 1fr) 86px; gap: 10px; align-items: center; }
.site-gantt-row[data-site-id] { cursor: pointer; border-radius: 6px; padding: 3px 4px; }
.site-gantt-row[data-site-id]:hover { background: rgba(13, 148, 136, .08); }
.site-gantt-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 11px; font-weight: 800; }
.site-gantt-label small { display: block; overflow: hidden; color: var(--muted); font-size: 10px; font-weight: 600; text-overflow: ellipsis; }
.site-gantt-track { height: 18px; }
.site-gantt-track .gantt-bar { top: 3px; bottom: 3px; }
.site-gantt-forecast { position: absolute; top: 0; bottom: 0; width: 2px; background: #b42318; box-shadow: 0 0 0 1px rgba(255,255,255,.7); }
.site-gantt-dates { color: var(--muted); font-size: 10px; font-weight: 800; line-height: 1.25; text-align: right; white-space: nowrap; }
.gantt-date { color: var(--muted); font-size: 11px; font-weight: 800; white-space: nowrap; }
.gantt-track { position: relative; height: 24px; border: 1px solid var(--line); border-radius: 999px; background: repeating-linear-gradient(90deg, #fff 0 28px, #f1f5f9 28px 29px); overflow: hidden; }
.gantt-bar { position: absolute; top: 4px; bottom: 4px; border-radius: 999px; background: #94a3b8; box-shadow: 0 0 0 1px rgba(255,255,255,.65) inset; }
.gantt-bar.good { background: var(--good); }
.gantt-bar.warn { background: var(--warn); }
.gantt-bar.bad { background: var(--bad); }
.gantt-bar.review { background: var(--blue); }
.gantt-empty { padding: 0 14px 13px 48px; background: #f8fafc; color: var(--muted); font-size: 12px; }
@media (max-width: 800px) {
  .site-gantt { padding-left: 14px; }
  .site-gantt-row { grid-template-columns: minmax(110px, 150px) minmax(140px, 1fr) 70px; gap: 6px; }
}
.modal { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 24px; background: rgba(15, 23, 42, .42); }
.modal-card { width: min(980px, 100%); max-height: calc(100vh - 48px); overflow: auto; display: grid; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 24px 70px rgba(15, 23, 42, .24); }
.schedule-action-modal-card { width: min(560px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 14px; }
.history-body { display: grid; gap: 14px; }
.history-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 12px; }
.history-card, .history-item { display: grid; gap: 5px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; padding: 12px; }
.history-card span, .history-item small { color: var(--muted); line-height: 1.35; }
.history-list { display: grid; gap: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.workdays { display: flex; flex-wrap: wrap; gap: 8px; }
.workdays label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.workdays input { width: auto; }
.address-field { position: relative; }
.address-suggestions { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 18px 42px rgba(15, 23, 42, .16); }
.address-suggestion { width: 100%; display: grid; gap: 3px; border: 0; border-bottom: 1px solid var(--line); background: #fff; padding: 10px 12px; text-align: left; cursor: pointer; color: var(--ink); }
.address-suggestion:last-child { border-bottom: 0; }
.address-suggestion:hover, .address-suggestion:focus { background: #f8fafc; outline: none; }
.address-suggestion strong { font-size: 14px; }
.address-suggestion span { color: var(--muted); font-size: 12px; line-height: 1.35; }
.address-status { display: block; margin-top: 6px; font-size: 12px; line-height: 1.35; }
.address-status.muted { color: var(--muted); }
.address-status.ok { color: #166534; }
.address-status.warn { color: #9a3412; }
.address-help { display: grid; gap: 4px; border-left: 4px solid var(--accent); background: #ecfdf5; border-radius: 8px; padding: 12px 14px; color: #14532d; }
.address-help span { color: #166534; line-height: 1.4; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chips span { border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; background: #f8fafc; color: #475569; font-size: 12px; font-weight: 700; }
.chip { border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; background: #fff; color: #475569; font-size: 12px; font-weight: 800; cursor: pointer; transition: .2s ease; }
.chip.active { background: var(--accent-soft); color: var(--accent); border-color: rgba(13,148,136,.25); }
.chip:hover { border-color: rgba(13,148,136,.25); color: var(--accent); }
.item.rich { align-items: start; }
.map-board { position: relative; min-height: 360px; overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: radial-gradient(circle at 34% 38%, rgba(15,118,110,.13) 0 9%, transparent 10%), radial-gradient(circle at 66% 58%, rgba(37,99,235,.12) 0 11%, transparent 12%), linear-gradient(90deg, rgba(15,118,110,.08) 1px, transparent 1px), linear-gradient(rgba(37,99,235,.08) 1px, transparent 1px), #f8fafc; background-size: auto, auto, 42px 42px, 42px 42px; }
.yandex-map { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 360px; z-index: 1; }
.map-board .ymaps-2-1-79-map { width: 100% !important; height: 100% !important; }
.map-marker { position: absolute; transform: translate(-50%, -50%); min-width: 130px; max-width: 210px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; box-shadow: var(--shadow); font-size: 12px; }
.map-marker::before { content: ""; position: absolute; left: 50%; bottom: -7px; width: 12px; height: 12px; transform: translateX(-50%) rotate(45deg); background: inherit; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.map-marker strong, .map-marker span { display: block; position: relative; z-index: 1; }
.map-marker span { color: var(--muted); margin-top: 2px; line-height: 1.25; }
.map-marker.site { border-color: #99f6e4; }
.map-marker.acceptedSite { border-color: #cbd5e1; background: #f1f5f9; }
.map-marker.installer { border-color: #bfdbfe; background: #eff6ff; }
.map-marker.violator { border-color: #fecaca; background: #fef2f2; }
.map-toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.map-toggles label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 9px; background: #fff; }
.map-toggles input { width: auto; }
.map-search { display: grid; gap: 6px; }
.map-search > label { font-size: 12px; font-weight: 800; color: var(--ink); }
.map-search-row { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; gap: 8px; align-items: center; }
.map-search-row input { min-width: 0; }
.map-search-row .btn { min-height: 38px; white-space: nowrap; }
.map-compass { position: absolute; top: 12px; left: 12px; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: #0f766e; color: #fff; font-size: 12px; font-weight: 900; box-shadow: var(--shadow); }
.map-legend { position: absolute; top: 12px; right: 12px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; color: #334155; font-size: 12px; background: rgba(255,255,255,.9); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.map-legend span { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.site-dot { background: #0f766e; }
.accepted-site-dot { background: #64748b; }
.installer-dot { background: #2563eb; }
.violator-dot { background: #dc2626; }
.map-empty { position: absolute; inset: 0; display: grid; place-content: center; gap: 6px; text-align: center; padding: 32px; color: var(--muted); }
.map-empty strong { color: var(--ink); font-size: 16px; }
.map-grid-label { position: absolute; z-index: 3; left: 12px; bottom: 12px; right: 12px; color: var(--muted); font-size: 12px; background: rgba(255,255,255,.86); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.mobile-card { display: grid; gap: 5px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; }
.mobile-card span { color: var(--muted); font-size: 13px; line-height: 1.35; }
.policy { gap: 10px; }
.policy article { display: grid; gap: 5px; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.policy span { color: var(--muted); line-height: 1.45; }
.dispatcher-manual-tools { display: flex; align-items: end; justify-content: space-between; gap: 16px; }
.manual-search-label { flex: 1; max-width: 680px; }
.manual-callout { display: grid; gap: 5px; margin-bottom: 14px; padding: 14px 16px; border: 1px solid #e2a5a5; border-left: 4px solid var(--danger); border-radius: 8px; background: #fff7f7; }
.manual-callout.info { border-color: #a8c9c4; border-left-color: var(--primary); background: #f2f8f7; }
.manual-callout span, .manual-summary small, .manual-section summary small { color: var(--muted); line-height: 1.45; }
.manual-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.manual-summary { display: flex; gap: 10px; align-items: flex-start; padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.manual-summary div { display: grid; gap: 4px; }
.manual-step { display: grid; place-items: center; flex: 0 0 28px; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-weight: 800; }
.manual-sections { display: grid; gap: 9px; }
.manual-section { border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: hidden; }
.manual-section[open] { border-color: #a8c9c4; box-shadow: 0 4px 14px rgba(18, 80, 72, .06); }
.manual-section summary { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(220px, 1fr); gap: 18px; align-items: center; padding: 14px 16px; cursor: pointer; background: #f8fafc; }
.manual-section summary span { font-weight: 800; }
.manual-section[open] summary { border-bottom: 1px solid var(--line); background: #f2f8f7; }
.manual-content { padding: 16px 20px 18px; color: var(--text); line-height: 1.55; }
.manual-content h3 { margin: 4px 0 8px; font-size: 15px; }
.manual-content h3:not(:first-child) { margin-top: 18px; }
.manual-content ol, .manual-content ul { margin: 0; padding-left: 22px; }
.manual-content li + li { margin-top: 7px; }
.manual-note { margin-top: 14px; padding: 11px 13px; border-left: 3px solid var(--primary); background: #f2f8f7; }
.manual-status-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.manual-status-grid span { display: grid; gap: 3px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); }
.manual-status-grid strong { color: var(--text); }
.manual-section.manual-hidden { display: none; }

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 5; padding: 14px; }
  .nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .nav button { text-align: center; padding: 9px 6px; font-size: 13px; }
  .role-box { display: none; }
  main { padding: 18px; }
  .page-head { display: grid; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split, .mobile-grid { grid-template-columns: 1fr; }
  .manual-grid, .manual-status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-workspace { grid-template-columns: 1fr; height: calc(100vh - 170px); min-height: 560px; }
  .dashboard-workspace[data-view="both"] { height: auto; }
  .dashboard-workspace[data-view="both"] .dashboard-map-panel,
  .dashboard-workspace[data-view="both"] .dashboard-exception-panel { min-height: 560px; }
  .dashboard-map-panel, .dashboard-exception-panel { padding: 12px; }
  .dashboard-view-switch { position: sticky; top: 74px; z-index: 4; width: 100%; }
  .dashboard-view-switch .subsection-btn { flex: 1; }
  .form-grid.compact, .coordinate-row, .equipment-row, .stage-group, .inline-stage-editor, .inline-site-schedule-editor { grid-template-columns: 1fr; }
  .equipment-row .equipment-wide { grid-column: auto; }
  .map-search-row { grid-template-columns: 1fr 1fr; }
  .map-search-row input { grid-column: 1 / -1; }
  .subhead { display: grid; }
  .schedule-site-head { grid-template-columns: 1fr; }
  .schedule-site-head .table-actions { justify-content: flex-start; }
  .schedule-worktypes { grid-column: auto; }
  .inline-site-schedule-summary { grid-column: auto; }
}

@media (max-width: 560px) {
  .nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics, .form-grid { grid-template-columns: 1fr; }
  .pilot-metrics, .pilot-scenarios { grid-template-columns: 1fr; }
  .item { grid-template-columns: 1fr; }
  .panel-title { display: grid; }
  .dispatcher-manual-tools, .manual-section summary { grid-template-columns: 1fr; display: grid; }
  .manual-grid, .manual-status-grid { grid-template-columns: 1fr; }
}

@media print {
  .sidebar, .dispatcher-manual-tools, .page:not(#policyPage) { display: none !important; }
  .app-shell { display: block; }
  main { padding: 0; }
  #policyPage { display: block !important; }
  .manual-section { break-inside: avoid; }
  .manual-section > .manual-content { display: block !important; }
}
.schedule-assignment-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin: 10px 0;
  border: 1px solid var(--line);
  background: #f7fbfa;
}
.schedule-assignment-bar strong,
.schedule-assignment-bar small { display: block; }
.bulk-assignment-panel {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(260px, 1fr) auto;
  align-items: end;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid #b8ddd5;
  background: #fff;
}
.bulk-installer-list { display: flex; flex-wrap: wrap; gap: 6px 12px; min-height: 34px; align-items: center; }
.bulk-installer-list label { white-space: nowrap; }
@media (max-width: 900px) {
  .bulk-assignment-panel { grid-template-columns: 1fr; align-items: stretch; }
  .schedule-assignment-bar { align-items: stretch; flex-direction: column; }
}
