/* ── Reset ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #EEF2F6;
  color: #1E293B;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-size: 14px;
}

/* Канонический экран экономики */
.finance-canonical-panel { display:flex; flex-direction:column; gap:16px; }
.canonical-head { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; }
.canonical-head h2 { margin:0; font-size:22px; color:#0F172A; }
.canonical-head p { margin:5px 0 0; color:#64748B; font-size:13px; }
.canonical-filters { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.canonical-filters input { border:1px solid #CBD5E1; border-radius:8px; padding:8px 10px; background:#fff; color:#0F172A; }
.economy-basis { align-self:flex-start; padding:7px 11px; border-radius:999px; background:#ECFDF5; color:#047857; font-size:12px; font-weight:650; }
.canonical-kpis { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.canonical-kpi { min-height:92px; padding:15px; border:1px solid #E2E8F0; border-radius:12px; background:#fff; display:flex; flex-direction:column; gap:5px; box-shadow:0 1px 2px rgba(15,23,42,.03); }
.canonical-kpi span { color:#64748B; font-size:12px; }
.canonical-kpi strong { color:#0F172A; font-size:23px; letter-spacing:-.02em; }
.canonical-kpi small { color:#94A3B8; font-size:11px; }
.canonical-kpi.good { border-left:4px solid #10B981; }
.canonical-kpi.bad { border-left:4px solid #EF4444; }
.canonical-kpi.warn { border-left:4px solid #F59E0B; }
.canonical-grid,.agent-grid { display:grid; grid-template-columns:minmax(0,1.25fr) minmax(320px,.75fr); gap:12px; }
.canonical-card { border:1px solid #E2E8F0; border-radius:12px; background:#fff; padding:16px; box-shadow:0 1px 2px rgba(15,23,42,.03); }
.canonical-card-title { display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin-bottom:14px; }
.canonical-card-title h3 { margin:0; color:#0F172A; font-size:15px; }
.canonical-card-title span { color:#94A3B8; font-size:11px; }
.economy-chart { min-height:230px; }
.economy-chart svg { width:100%; height:220px; overflow:visible; }
.economy-chart text { fill:#94A3B8; font:10px system-ui,sans-serif; }
.trend-axis { stroke:#E2E8F0; stroke-width:1; }
.trend-revenue,.trend-profit { fill:none; stroke-width:3; stroke-linecap:round; stroke-linejoin:round; }
.trend-revenue { stroke:#94A3B8; }
.trend-profit { stroke:#2563EB; }
.trend-negative { fill:#EF4444; }
.trend-legend { display:flex; justify-content:center; gap:18px; color:#64748B; font-size:11px; }
.trend-legend span { display:flex; align-items:center; gap:6px; }
.trend-legend i { width:18px; height:3px; border-radius:3px; background:#94A3B8; }
.trend-legend i.profit { background:#2563EB; }
.economy-bridge { display:flex; flex-direction:column; gap:11px; }
.bridge-row { display:grid; grid-template-columns:130px minmax(70px,1fr) 92px; gap:9px; align-items:center; font-size:11px; }
.bridge-row > span { color:#475569; }
.bridge-row strong { text-align:right; color:#047857; font-size:11px; }
.bridge-row strong.negative { color:#B91C1C; }
.bridge-track { height:8px; background:#F1F5F9; border-radius:999px; overflow:hidden; }
.bridge-track i { display:block; height:100%; border-radius:inherit; }
.bridge-track .plus { background:#34D399; }
.bridge-track .minus { background:#FCA5A5; }
.economy-quality { padding:12px 16px; }
.quality-status { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.quality-status > div { display:flex; flex-direction:column; gap:3px; }
.quality-status strong { color:#0F172A; font-size:13px; }
.quality-status span { color:#64748B; font-size:12px; }
.quality-status.ok { border-left:4px solid #10B981; }
.quality-status.attention { border-left:4px solid #F59E0B; }
.agent-notice { display:flex; gap:12px; align-items:center; padding:12px 14px; border:1px solid #BFDBFE; background:#EFF6FF; border-radius:10px; color:#1E3A8A; }
.agent-notice strong { white-space:nowrap; font-size:13px; }
.agent-notice span { font-size:12px; }
.agent-insights { display:flex; flex-direction:column; gap:8px; }
.agent-insight { border-left:3px solid #CBD5E1; padding:8px 10px; background:#F8FAFC; border-radius:0 8px 8px 0; }
.agent-insight.high { border-color:#EF4444; }
.agent-insight.medium { border-color:#F59E0B; }
.agent-insight.ok { border-color:#10B981; }
.agent-insight strong { font-size:12px; color:#0F172A; }
.agent-insight p { margin:3px 0; font-size:12px; color:#475569; }
.agent-insight span { font-size:11px; color:#64748B; }
.control-orders { margin-top:14px; }
.control-orders h4,.agent-draft-form h4 { margin:0 0 8px; font-size:12px; color:#334155; }
.control-orders button { width:100%; border:0; border-top:1px solid #E2E8F0; background:#fff; padding:9px 2px; display:flex; justify-content:space-between; cursor:pointer; color:#334155; }
.control-orders button span { color:#B45309; font-size:11px; }
.agent-draft { display:flex; justify-content:space-between; gap:10px; padding:10px 0; border-bottom:1px solid #E2E8F0; }
.agent-draft p { margin:3px 0 0; color:#64748B; font-size:11px; }
.agent-draft > div:last-child { display:flex; gap:6px; align-items:center; }
.agent-draft-form { margin-top:14px; padding-top:14px; border-top:1px solid #E2E8F0; }
.agent-draft-form > div { display:grid; grid-template-columns:80px 120px 1fr; gap:6px; margin-bottom:8px; }
.agent-draft-form input { min-width:0; border:1px solid #CBD5E1; border-radius:7px; padding:7px 8px; font-size:12px; }
.agent-draft-form small { margin-left:8px; color:#94A3B8; }
.quick-finance-btn.neutral { color:#334155; background:#F8FAFC; border-color:#CBD5E1; }
.finance-widget-drawer.hidden { display:none !important; }
.finance-approval-box { max-width:460px; text-align:left; }
.finance-approval-box h3 { margin:0 0 10px; color:#0F172A; font-size:16px; }
.finance-approval-box p { margin:6px 0; color:#475569; font-size:13px; }
.finance-approval-box .approval-impact { padding:9px 10px; border-radius:8px; background:#FFF7ED; color:#9A3412; }
.finance-approval-box label { display:flex; flex-direction:column; gap:5px; margin-top:12px; color:#475569; font-size:12px; }
.finance-approval-box label strong { color:#0F172A; }
.finance-approval-box input { width:100%; border:1px solid #CBD5E1; border-radius:8px; padding:9px 10px; font-size:13px; }
.finance-approval-box button:disabled { opacity:.45; cursor:not-allowed; }

@media (max-width: 900px) {
  .canonical-head { flex-direction:column; }
  .canonical-filters { width:100%; }
  .canonical-filters input { flex:1; min-width:130px; }
  .canonical-kpis { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .canonical-grid,.agent-grid { grid-template-columns:1fr; }
  .canonical-kpi strong { font-size:20px; }
}
@media (max-width: 560px) {
  .finance-page .header-right { display:none !important; }
  .canonical-kpis { grid-template-columns:1fr; }
  .canonical-filters { display:grid; grid-template-columns:1fr 1fr; }
  .bridge-row { grid-template-columns:110px 1fr; }
  .bridge-row strong { grid-column:2; }
  .agent-notice,.quality-status,.agent-draft { align-items:flex-start; flex-direction:column; }
  .agent-draft-form > div { grid-template-columns:1fr; }
}

/* ── Шапка ── */
.app-header {
  background: #173454;
  color: white;
  padding: 0 20px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
  z-index: 20;
}
.header-left { flex: 1; display: flex; align-items: center; gap: 15px; }
.menu-trigger {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-trigger:hover { color: #3B82F6; }
.header-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 132px;
}
.header-logo-mark {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,0.7);
  background: #F7B32B;
  color: #173454;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
}
.header-logo-copy {
  display: flex;
  flex-direction: column;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.05;
  letter-spacing: 0;
}
.header-logo-copy small {
  margin-top: 3px;
  font-size: 9px;
  font-weight: 600;
  opacity: 0.72;
  text-transform: uppercase;
  letter-spacing: 0;
}
.header-branch { font-size: 12px; opacity: 0.6; }
.header-center { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
.header-right { flex: 1; display: flex; align-items: center; gap: 12px; justify-content: flex-end; }

@media (min-width: 901px) {
  #order-panel > .op-status-bar { display: flex; flex-wrap: wrap; padding: 8px 14px; margin: 0; border: 0; border-bottom: 1px solid var(--aspect-border, #dce5ea); background: var(--aspect-surface, #fff); }
  #order-panel:not(.op-payment-expanded) #op-payment-bar { display: none; }
  #op-documents-menu { display: none; position: absolute; right: 14px; top: 54px; padding: 10px; background: var(--aspect-surface, #fff); border: 1px solid var(--aspect-border, #dce5ea); border-radius: 8px; box-shadow: 0 8px 25px #0002; z-index: 1000; }
  #op-documents-menu.is-open { display: flex; gap: 8px; }
  #order-panel .op-part-row:not(.op-part-details-open) > :is(.op-p-art,.op-rossko-status) { display: none !important; }
  .dashboard-page .app-header {
    position: sticky;
    top: 0;
    display: grid;
    grid-template-columns: minmax(260px, 1fr) auto minmax(260px, 1fr);
  }
  .dashboard-page .header-left,
  .dashboard-page .header-right { min-width: 0; }
  .dashboard-page .header-center {
    display: grid;
    grid-template-columns: 34px 250px 34px 66px 38px;
    align-items: center;
    gap: 8px;
  }
  .dashboard-page .date-nav-button {
    width: 34px;
    height: 32px;
    padding: 0;
    font-size: 22px;
  }
  .dashboard-page .date-display {
    width: 250px;
    min-width: 250px;
  }
  .dashboard-page .today-btn,
  .dashboard-page .calendar-btn { width: 100%; }
}
#op-payment-summary-toggle { border: 0; border-bottom: 1px solid var(--aspect-border, #dce5ea); padding: 9px 14px; background: var(--aspect-surface, #fff); color: var(--aspect-text, #19394c); cursor: pointer; text-align: left; flex-shrink: 0; font-size: 12px; }
.op-part-line-total { font-weight: 700; font-size: 12px; white-space: nowrap; }
.op-part-details-toggle { padding: 5px 8px; border: 0; border-radius: 6px; background: transparent; color: var(--aspect-muted, #64748b); cursor: pointer; }

.nav-btn {
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s;
}
.nav-btn:hover { background: rgba(255,255,255,0.28); }
.today-btn { font-size: 12px; }
.btn-add { background: #27AE60 !important; font-weight: 700; letter-spacing: 0.5px; }
.btn-add:hover { background: #219A52 !important; }

.date-display {
  color: white;
  font-size: 15px;
  font-weight: 600;
  min-width: 250px;
  text-align: center;
  text-transform: capitalize;
}
.calendar-btn {
  font-size: 16px;
  padding: 6px 10px;
}
#date-picker-hidden {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.load-calendar-overlay {
  position: fixed;
  inset: 0;
  z-index: 1800;
  background: rgba(15, 23, 42, 0.28);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 66px;
}
.load-calendar-popover {
  width: min(360px, calc(100vw - 24px));
  background: white;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  box-shadow: 0 18px 45px rgba(15,23,42,0.24);
  padding: 14px;
}
.load-calendar-header {
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.load-calendar-header strong {
  text-align: center;
  color: #1E293B;
  text-transform: capitalize;
  font-size: 15px;
}
.load-calendar-header button {
  height: 34px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #F8FAFC;
  color: #1E3A5F;
  font-size: 22px;
  cursor: pointer;
}
.load-calendar-weekdays,
.load-calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}
.load-calendar-weekdays {
  margin-bottom: 5px;
}
.load-calendar-weekdays span {
  text-align: center;
  font-size: 11px;
  font-weight: 800;
  color: #94A3B8;
}
.load-calendar-day,
.load-calendar-empty {
  aspect-ratio: 1;
  min-width: 0;
}
.load-calendar-day {
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #F8FAFC;
  color: #334155;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-family: inherit;
}
.load-calendar-day span {
  font-size: 13px;
  font-weight: 800;
}
.load-calendar-day em {
  min-height: 12px;
  font-size: 10px;
  font-style: normal;
  color: currentColor;
  opacity: 0.8;
}
.load-calendar-day.load-none { background: #F8FAFC; color: #64748B; }
.load-calendar-day.load-low { background: #DCFCE7; border-color: #86EFAC; color: #166534; }
.load-calendar-day.load-mid { background: #FEF3C7; border-color: #FCD34D; color: #92400E; }
.load-calendar-day.load-high { background: #FEE2E2; border-color: #FCA5A5; color: #991B1B; }
.load-calendar-day.selected {
  outline: 3px solid #1E3A5F;
  outline-offset: 1px;
}
.load-calendar-loading {
  grid-column: 1 / -1;
  padding: 24px 0;
  text-align: center;
  color: #94A3B8;
  font-size: 13px;
}
.load-calendar-legend {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
  font-size: 11px;
  color: #64748B;
}
.load-calendar-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.load-calendar-legend i {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  border: 1px solid #E2E8F0;
}
.load-calendar-legend .load-none { background: #F8FAFC; }
.load-calendar-legend .load-low { background: #DCFCE7; border-color: #86EFAC; }
.load-calendar-legend .load-mid { background: #FEF3C7; border-color: #FCD34D; }
.load-calendar-legend .load-high { background: #FEE2E2; border-color: #FCA5A5; }
.clock {
  font-size: 40px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  opacity: 0.9;
}

.post-header-type { display: none !important; }
.legend > :not(.legend-actions) { display: none !important; }
.legend-actions { flex: 1 1 auto; }
.appt-work { margin-top: 2px; font-size: 10px; line-height: 1.2; opacity: .9; }

/* ── Компактная сводка ── */
.dashboard-summary {
  flex: 0 0 auto;
  background: #FFFFFF;
  border-bottom: 1px solid #D8E0EA;
  padding: 6px 14px;
}

/* Сводка и легенда убраны из расписания: метрики не должны занимать рабочую область. */
#dashboard-summary[hidden], #legend-container[hidden] { display: none !important; }
.dashboard-summary-inner {
  min-height: 40px;
  display: grid;
  grid-template-columns: minmax(150px, 1.4fr) repeat(5, minmax(90px, 1fr));
  align-items: stretch;
  max-width: 1600px;
  margin: 0 auto;
}
.summary-date-block,
.summary-metric,
.summary-air-button {
  min-width: 0;
  padding: 3px 14px;
  border-right: 1px solid #E5EAF0;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.summary-date-block {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.summary-date-block span,
.summary-metric span,
.summary-air-button span {
  color: #6B7788;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}
.summary-date-block strong {
  color: #173454;
  font-size: 14px;
  text-transform: capitalize;
}
.summary-metric strong,
.summary-air-button strong {
  color: #173454;
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}
.summary-metric.warning strong { color: #C66A16; }
.summary-air-button {
  border: 0;
  background: #F1F7FA;
  color: #173454;
  cursor: pointer;
  font-family: inherit;
}
.summary-air-button:hover { background: #E5F0F4; }

/* ── Заголовок постов ── */
.grid-header {
  display: flex;
  background: white;
  border-bottom: 2px solid #CBD5E1;
  flex-shrink: 0;
  z-index: 10;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  overflow: hidden;
}
.time-header {
  width: 64px;
  flex-shrink: 0;
  border-right: 1px solid #E2E8F0;
}
.post-headers { display: flex; flex: 1; }
.post-headers.master-view {
  flex: 1 0 auto;
  min-width: 0;
  will-change: transform;
}
.post-header {
  flex: 1;
  padding: 6px 4px;
  text-align: center;
  border-right: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.post-headers.master-view .post-header {
  flex: 1 1 0;
  min-width: 160px;
}
.post-header.master-header .post-header-name,
.post-header.no-master-header .post-header-name {
  max-width: 178px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.post-header:last-child { border-right: none; }
.post-header-icon { font-size: 20px; line-height: 1; }
.post-header-name {
  font-size: 12px;
  font-weight: 700;
  color: #1E3A5F;
  white-space: nowrap;
}
.post-header-type { font-size: 10px; color: #94A3B8; }

/* ── Основная сетка ── */
.calendar-outer {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  background: #F1F5F9;
}
.calendar-outer.master-calendar-view {
  overflow-x: auto;
}

/* ── Быстрый просмотр другого дня и долгосрочных ЗН ── */
.schedule-companion {
  flex: 0 0 auto;
  margin: 7px 10px 0;
  min-height: 46px;
  max-height: 190px;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 9;
}
.schedule-companion.is-collapsed { display: none; }
.schedule-companion-head {
  min-height: 44px;
  flex: 0 0 44px;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #E2E8F0;
}
.schedule-companion.is-collapsed .schedule-companion-head { border-bottom: 0; }
.schedule-companion-tabs {
  display: inline-flex;
  align-items: center;
  border: 1px solid #C8D3DF;
  border-radius: 5px;
  overflow: hidden;
  background: #F8FAFC;
}
.schedule-companion-tabs button {
  min-height: 31px;
  border: 0;
  border-right: 1px solid #C8D3DF;
  padding: 0 12px;
  background: transparent;
  color: #526174;
  font-family: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.schedule-companion-tabs button:last-child { border-right: 0; }
.schedule-companion-tabs button.active {
  background: #173454;
  color: #FFFFFF;
}
.schedule-companion-controls {
  display: flex;
  align-items: center;
  gap: 5px;
}
.schedule-companion-controls[hidden] { display: none; }
.schedule-companion-controls input {
  height: 32px;
  border: 1px solid #CBD5E1;
  border-radius: 5px;
  padding: 0 8px;
  background: #FFFFFF;
  color: #26374A;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
}
.companion-icon-button,
.companion-open-day {
  height: 32px;
  border: 1px solid #CBD5E1;
  border-radius: 5px;
  background: #F8FAFC;
  color: #173454;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
}
.companion-icon-button { width: 32px; font-size: 20px; line-height: 1; }
.companion-open-day { padding: 0 11px; font-size: 11px; }
.companion-icon-button:hover,
.companion-open-day:hover { background: #E8EEF4; }
#schedule-companion-collapse { margin-left: auto; }
.schedule-companion-body {
  min-height: 0;
  flex: 1;
  overflow: auto;
  padding: 7px;
  background: #F5F7FA;
}
.companion-day-grid,
.companion-air-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 6px;
}
.companion-day-card,
.companion-air-card {
  min-width: 0;
  min-height: 70px;
  background: #FFFFFF;
  border: 1px solid #DCE3EB;
  border-radius: 5px;
  display: grid;
  align-items: center;
  gap: 9px;
  padding: 8px;
}
.companion-day-card {
  grid-template-columns: 44px minmax(0, 1fr) auto;
  border-left: 4px solid var(--status-color, #94A3B8);
}
.companion-air-card { grid-template-columns: minmax(0, 1fr) auto; }
.companion-time {
  min-width: 0;
  display: flex;
  flex-direction: column;
  color: #173454;
  font-variant-numeric: tabular-nums;
}
.companion-time strong { font-size: 15px; }
.companion-time span { color: #7B8796; font-size: 10px; }
.companion-card-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.companion-card-kicker {
  color: #748195;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.companion-card-main > button {
  min-width: 0;
  border: 0;
  background: transparent;
  color: #17283C;
  padding: 0;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.companion-card-main > button:hover { color: #0B6E75; }
.companion-card-main small {
  color: #657386;
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.companion-amount {
  position: relative;
  align-self: stretch;
  display: flex;
  align-items: center;
  padding: 0 8px;
  border-left: 1px solid #E5EAF0;
  color: #0B6E75;
  font-variant-numeric: tabular-nums;
  cursor: help;
}
.companion-amount > strong { white-space: nowrap; font-size: 13px; }
.companion-amount-popover {
  display: none;
  position: fixed;
  right: 18px;
  bottom: 58px;
  width: min(370px, calc(100vw - 36px));
  max-height: 360px;
  overflow: auto;
  z-index: 1500;
  background: #FFFFFF;
  border: 1px solid #AAB8C7;
  border-radius: 6px;
  box-shadow: 0 14px 32px rgba(24, 39, 58, 0.2);
  padding: 10px;
  color: #26374A;
}
.companion-amount:hover .companion-amount-popover,
.companion-amount:focus .companion-amount-popover,
.companion-amount:focus-within .companion-amount-popover { display: block; }
.companion-amount-group + .companion-amount-group { margin-top: 8px; padding-top: 8px; border-top: 1px solid #E5EAF0; }
.companion-amount-group { display: flex; flex-direction: column; gap: 4px; }
.companion-amount-group > strong { font-size: 11px; color: #173454; }
.companion-amount-group > span {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  font-size: 11px;
}
.companion-amount-group i { font-style: normal; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.companion-amount-group b { font-variant-numeric: tabular-nums; }
.companion-amount-group small { color: #748195; font-size: 10px; }
.companion-discount { margin-top: 8px; padding-top: 8px; border-top: 1px solid #E5EAF0; display: flex; justify-content: space-between; color: #B45309; font-size: 11px; }
.companion-air-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 5px;
}
.companion-air-actions strong { color: #0B6E75; font-size: 12px; white-space: nowrap; }
.companion-air-actions button {
  border: 1px solid #AAB8C7;
  border-radius: 5px;
  background: #EEF5F5;
  color: #0B6E75;
  padding: 5px 8px;
  font-family: inherit;
  font-size: 10px;
  font-weight: 800;
  cursor: pointer;
}
.companion-empty { min-height: 70px; display: grid; place-items: center; color: #7B8796; font-size: 12px; }
.grid-body { display: flex; min-height: 100%; }

.time-col {
  width: 64px;
  flex-shrink: 0;
  border-right: 1px solid #E2E8F0;
  background: white;
  position: sticky;
  left: 0;
  z-index: 5;
}
:root {
  --slot-h: 72px;
}

.time-slot {
  height: var(--slot-h);
  border-bottom: 1px solid #EEF2F7;
  display: flex;
  align-items: flex-start;
  padding: 4px 6px 0;
  font-size: 11px;
  color: #94A3B8;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.time-slot.full-hour {
  font-weight: 700;
  font-size: 13px;
  color: #64748B;
  border-bottom-color: #CBD5E1;
}
.time-slot-end {
  height: 0;
  overflow: visible;
  font-size: 11px;
  color: #94A3B8;
  padding-left: 6px;
  padding-top: 1px;
}

/* ── Посты ── */
.posts-area { display: flex; flex: 1; }
.posts-area.master-view {
  flex: 1 0 auto;
  min-width: 0;
}

.post-col {
  flex: 1;
  position: relative;
  border-right: 1px solid #E2E8F0;
  background: #FAFBFF;
  cursor: crosshair;
  min-width: 0;
}
.posts-area.master-view .post-col {
  flex: 1 1 0;
  min-width: 160px;
}
.post-col.no-master-col {
  background: #F8FAFC;
}
.post-col.air-col {
  background: #F8FBFF;
  border-left: 2px solid #BFDBFE;
}
.post-col:nth-child(4n+1) { background: #FAFBFF; }
.post-col:nth-child(4n+2) { background: #F8FBF7; }
.post-col:nth-child(4n+3) { background: #FFFDF7; }
.post-col:nth-child(4n+4) { background: #F8FAFF; }
.post-header:nth-child(4n+1) { background: #FFFFFF; }
.post-header:nth-child(4n+2) { background: #F7FBF7; }
.post-header:nth-child(4n+3) { background: #FFFCF2; }
.post-header:nth-child(4n+4) { background: #F7FAFF; }
.post-col:last-child { border-right: none; }

.grid-line {
  height: var(--slot-h);
  border-bottom: 1px solid #EEF2F7;
  pointer-events: none;
}
.grid-line.full-hour { border-bottom-color: #CBD5E1; }

/* Полоса текущего времени */
.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #EF4444;
  z-index: 4;
  pointer-events: none;
}
.now-line::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #EF4444;
}

/* Линия предварительного просмотра (зеленая) */
.preview-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1.5px dashed rgba(34, 197, 94, 0.7);
  z-index: 3;
  pointer-events: none;
  display: none;
}
.preview-label {
  position: fixed;
  background: #22C55E;
  color: white;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  pointer-events: none;
  white-space: nowrap;
  z-index: 1000;
  display: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  transform: translate(12px, -50%);
  border: 1px solid rgba(255,255,255,0.2);
}

/* ── Карточка записи ── */
.appt-block {
  position: absolute;
  left: 3px;
  right: 3px;
  border-radius: 7px;
  cursor: grab;
  user-select: none;
  overflow: hidden;
  z-index: 2;
  transition: box-shadow 0.15s;
  touch-action: none;
}
.appt-block:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  z-index: 3;
}
.appt-block:focus-visible {
  outline: 3px solid #38BDF8;
  outline-offset: 2px;
}
.appt-hover-tooltip {
  display: none;
  position: fixed;
  width: min(360px, calc(100vw - 20px));
  max-height: min(430px, calc(100vh - 20px));
  overflow: auto;
  z-index: 1800;
  pointer-events: none;
  padding: 11px;
  border: 1px solid #CBD5E1;
  border-radius: 10px;
  background: #FFFFFF;
  color: #1E293B;
  box-shadow: 0 16px 38px rgba(15, 23, 42, 0.28);
  font-size: 12px;
  line-height: 1.35;
}
.appt-hover-tooltip.active { display: block; }
.appt-hover-head,
.appt-hover-total,
.appt-hover-group-title,
.appt-hover-row,
.appt-hover-discount {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.appt-hover-head {
  padding-bottom: 8px;
  border-bottom: 1px solid #E2E8F0;
  color: #475569;
  font-weight: 800;
}
.appt-hover-head strong,
.appt-hover-total strong { color: #0F766E; white-space: nowrap; font-size: 14px; }
.appt-hover-group { padding-top: 8px; }
.appt-hover-group + .appt-hover-group { margin-top: 8px; border-top: 1px solid #E2E8F0; }
.appt-hover-group-title { color: #334155; font-weight: 800; }
.appt-hover-row { margin-top: 4px; color: #64748B; }
.appt-hover-row span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.appt-hover-row b,
.appt-hover-group-title b { color: #334155; white-space: nowrap; font-variant-numeric: tabular-nums; }
.appt-hover-group small,
.appt-hover-empty { display: block; padding-top: 7px; color: #64748B; }
.appt-hover-discount { margin-top: 8px; padding-top: 8px; border-top: 1px solid #E2E8F0; color: #B45309; }
.appt-hover-total { margin-top: 9px; padding-top: 9px; border-top: 2px solid #CBD5E1; font-weight: 900; }
.appt-block.unpaid-order {
  outline: 3px solid #DC2626;
  outline-offset: 1px;
}
.appt-block.unpaid-order::after {
  content: "ДОЛГ";
  position: absolute;
  right: 4px;
  bottom: 4px;
  background: #DC2626;
  color: white;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-weight: 900;
}
.appt-block.air-order {
  box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.55);
}
.appt-block.is-dragging {
  cursor: grabbing;
  opacity: 0.9;
  z-index: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.appt-inner {
  padding: 5px 7px;
  height: 100%;
  color: white;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow: hidden;
}
.appt-plate {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 1px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appt-car {
  font-size: 16.5px;
  color: #FFFFFF;
  font-weight: 600;
  opacity: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}
.appt-client {
  font-size: 11px;
  opacity: 0.85;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appt-assignment {
  font-size: 11px;
  line-height: 1.2;
  opacity: 0.9;
  margin-top: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appt-worktype {
  font-size: 10px;
  opacity: 0.8;
  white-space: nowrap;
  overflow: hidden;
}
.appt-master {
  font-size: 20px;
  opacity: 0.8;
  margin-top: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appt-time {
  font-size: 20px;
  opacity: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── Кнопка удаления записи ── */
.appt-delete-btn {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: none;
  background: rgba(0,0,0,0.35);
  color: white;
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
  z-index: 10;
  padding: 0;
}
.appt-block:hover .appt-delete-btn {
  opacity: 1;
}
.appt-delete-btn:hover {
  background: rgba(220,38,38,0.85);
}
.appt-call-marker {
  position: absolute;
  top: 5px;
  right: 25px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: rgba(255,255,255,.92);
  color: #6D28D9;
  font-size: 13px;
  box-shadow: 0 1px 3px rgba(15,23,42,.18);
}
.appt-call-marker[hidden] { display: none; }

.resize-handle {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 8px;
  cursor: ns-resize;
  background: rgba(0,0,0,0.15);
  border-radius: 0 0 7px 7px;
  touch-action: none;
}
.resize-handle:hover { background: rgba(0,0,0,0.3); }

/* ── Легенда ── */
.legend {
  background: white;
  border-top: 1px solid #E2E8F0;
  padding: 5px 20px;
  display: flex;
  align-items: center;
  gap: 8px 14px;
  flex-wrap: wrap;
  flex-shrink: 0;
  font-size: 12px;
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
}
.legend-actions {
  flex: 1 0 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.legend-actions-title {
  order: 0;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .06em;
}
.legend-actions .done-debt-action { order: 1; }
.legend-actions .open-orders-action { order: 2; }
.legend-actions .planned-orders-action { order: 3; }
.legend-actions .schedule-plan-toggle { order: 4; }
.legend-actions .longterm-button { order: 5; }
.legend-actions .callback-button { order: 6; }
.legend-actions .kanban-legend-button { order: 7; }
.legend-actions .parts-search-action { order: 8; }
.legend-actions .refresh-status { order: 9; }
.legend-actions .timeline-scale-control { order: 10; margin-left: auto; }
.legend-actions .parts-button {
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
}
.schedule-plan-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #E8EEF4;
  border-color: #AAB8C7;
  color: #173454;
  font-weight: 900;
}
.schedule-plan-toggle.active { background: #173454; border-color: #173454; color: #FFFFFF; }
.schedule-plan-toggle span { font-size: 15px; line-height: 1; }
.legend-title { color: #94A3B8; font-weight: 600; }
.legend-item { display: flex; align-items: center; gap: 5px; color: #475569; }
.legend-dot { width: 13px; height: 13px; border-radius: 3px; flex-shrink: 0; }
.legend-item.compact-status {
  gap: 4px;
  font-weight: 800;
  min-width: 32px;
}
.calendar-view-switch {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #F8FAFC;
}
.calendar-view-switch button {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.calendar-view-switch button.active {
  background: #1E3A5F;
  color: white;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.18);
}
.parts-dropdown-container {
  position: relative;
}
.parts-button {
  padding: 8px 16px;
  font-size: 14px;
  border-radius: 8px;
  border: 1px solid #E2E8F0;
  background: #FEF2F2;
  color: #991B1B;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}
.parts-button:hover { background: #FEE2E2; }
.kanban-legend-button {
  white-space: nowrap;
}
.open-orders-button {
  background: #ECFDF5;
  color: #166534;
  border-color: #BBF7D0;
}
.open-orders-button:hover { background: #DCFCE7; }

.parts-popup {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: 400px;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  background: white;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
  border: 1px solid #E2E8F0;
  z-index: 1001;
  padding: 8px 0;
  max-height: 400px;
  overflow-y: auto;
  display: none;
}
.parts-popup.active { display: block; }
.open-orders-popup { width: 460px; }
.done-debt-popup { width: 520px; }
.debt-popup-filters {
  display: grid;
  grid-template-columns: 130px 120px 1fr;
  gap: 6px;
  padding: 8px 10px;
  border-bottom: 1px solid #E2E8F0;
  background: #FEF2F2;
}
.debt-popup-filters select,
.debt-popup-filters input {
  min-width: 0;
  border: 1px solid #FECACA;
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 12px;
  outline: none;
  background: #fff;
}
.debt-popup-summary {
  padding: 7px 12px;
  font-size: 11px;
  font-weight: 800;
  color: #991B1B;
  background: #FFF7ED;
  border-bottom: 1px solid #FED7AA;
}

.parts-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid #F1F5F9;
}
.parts-item:last-child { border-bottom: none; }
.parts-item:hover { background: #F8FAFC; }
.parts-item-car { font-weight: 700; font-size: 14px; color: #1E293B; margin-bottom: 2px; }
.parts-item-list { font-size: 12px; color: #64748B; line-height: 1.4; }
.parts-item-hint { font-size: 10px; color: #94A3B8; margin-top: 4px; text-transform: uppercase; }
.parts-item-actions { display: flex; gap: 6px; margin-top: 6px; }
.parts-item-actions button {
  border: 1px solid #CBD5E1;
  background: #F8FAFC;
  color: #1E3A5F;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.parts-item-actions button:hover { background: #E0F2FE; border-color: #7DD3FC; }

.dash-dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 2200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dash-dialog {
  width: min(520px, 100%);
  max-height: 92vh;
  overflow: auto;
  background: white;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
  border: 1px solid #E2E8F0;
}
.dash-dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #E2E8F0;
  background: #F8FAFC;
}
.dash-dialog-title {
  font-size: 16px;
  font-weight: 800;
  color: #1E3A5F;
}
.dash-dialog-subtitle {
  margin-top: 3px;
  font-size: 12px;
  color: #64748B;
}
.dash-dialog-body {
  padding: 16px 18px;
}
.dash-dialog-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #E2E8F0;
  background: #F8FAFC;
}
.dash-detail-block {
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #FAFBFF;
}
.dash-detail-block:last-child { margin-bottom: 0; }
.dash-detail-block h4 {
  margin: 0 0 6px;
  font-size: 12px;
  color: #64748B;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.dash-detail-block p {
  margin: 0;
  color: #1E293B;
  font-size: 14px;
  line-height: 1.45;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 80px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  align-items: flex-end;
}
.toast {
  background: #1E293B;
  color: white;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  animation: toast-in 0.3s ease-out forwards, toast-out 0.3s ease-in 2.7s forwards;
  opacity: 0;
  max-width: 360px;
  word-break: break-word;
}
/* ✅ Успех */
.toast-success { background: #166534; border-left: 4px solid #22C55E; }
/* ❌ Ошибка */
.toast-error   { background: #991B1B; border-left: 4px solid #EF4444; }
/* ⚠️ Предупреждение */
.toast-warn    { background: #92400E; border-left: 4px solid #F59E0B; }

@keyframes toast-in { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { from { transform: translateX(0); opacity: 1; } to { transform: translateX(50px); opacity: 0; } }


.refresh-status { margin-left: auto; font-size: 11px; color: #94A3B8; }

/* ── Модалка ── */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.55);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
}
.modal.hidden { display: none; }

.modal-content {
  background: white;
  border-radius: 14px;
  width: 459px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
}

.modal-header {
  padding: 16px 20px 14px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8FAFC;
  border-radius: 14px 14px 0 0;
  gap: 12px;
}
.modal-header-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.modal-order-num {
  font-size: 15px;
  font-weight: 800;
  color: #1E3A5F;
  white-space: nowrap;
}
.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #94A3B8;
  padding: 4px 8px;
  border-radius: 6px;
  flex-shrink: 0;
  line-height: 1;
}
.close-btn:hover { background: #F1F5F9; color: #1E293B; }

.modal-body { padding: 16px 20px; }

.modal-section {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid #F1F5F9;
}
.modal-section:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.modal-section h3 {
  font-size: 11px;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

.modal-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.modal-row:last-child { margin-bottom: 0; }
.modal-row label {
  font-size: 13px;
  color: #64748B;
  width: 90px;
  flex-shrink: 0;
  font-weight: 500;
}
.modal-row input,
.modal-row select,
.modal-row textarea {
  flex: 1;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  color: #1E293B;
  background: #F8FAFC;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.modal-row input:focus,
.modal-row select:focus,
.modal-row textarea:focus {
  border-color: #2E86AB;
  background: white;
}
.modal-row textarea { resize: vertical; min-height: 56px; }

/* Кнопки статусов */
.status-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.status-btn {
  padding: 5px 10px;
  border-radius: 7px;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s;
  font-family: inherit;
}
.status-btn.new       { background: #F1F5F9; color: #475569; }
.status-btn.confirmed { background: #FEF3C7; color: #92400E; }
.status-btn.in_progress { background: #DBEAFE; color: #1E40AF; }
.status-btn.waiting_parts { background: #FFEDD5; color: #9A3412; }
.status-btn.call_pending { background: #EDE9FE; color: #6D28D9; }
.status-btn.done      { background: #DCFCE7; color: #166534; }
.status-btn.cancelled { background: #FEE2E2; color: #991B1B; }
.status-btn.active { border-color: currentColor; }

/* Бейдж статуса */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.status-badge.new       { background: #F1F5F9; color: #64748B; }
.status-badge.confirmed { background: #FEF3C7; color: #92400E; }
.status-badge.in_progress { background: #DBEAFE; color: #1E40AF; }
.status-badge.waiting_parts { background: #FFEDD5; color: #9A3412; }
.status-badge.call_pending { background: #EDE9FE; color: #6D28D9; }
.status-badge.done      { background: #DCFCE7; color: #166534; }
.status-badge.cancelled { background: #FEE2E2; color: #991B1B; }

/* Футер модалки */
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid #E2E8F0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #F8FAFC;
  border-radius: 0 0 14px 14px;
}
.modal-footer-right { display: flex; gap: 8px; }

.btn-primary {
  background: #1E3A5F;
  color: white;
  border: none;
  padding: 8px 22px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-primary:hover { background: #2E86AB; }

.btn-done {
  background: #22C55E;
  color: white;
  border: none;
  padding: 8px 22px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-done:hover { background: #16A34A; }
.btn-done:disabled { background: #86EFAC; cursor: not-allowed; }

.btn-secondary {
  background: white;
  color: #475569;
  border: 1px solid #E2E8F0;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-secondary:hover { background: #F1F5F9; }

.btn-danger {
  background: #FEE2E2;
  color: #991B1B;
  border: none;
  padding: 8px 14px;
  border-radius: 7px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.btn-danger:hover { background: #EF4444; color: white; }

/* ── Кастомный диалог подтверждения (вместо window.confirm) ─────────────────── */
#confirm-dialog,
#warranty-dialog {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.12s ease;
}
.confirm-box {
  background: white;
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}
.confirm-msg {
  font-size: 15px;
  color: #1E293B;
  margin: 0 0 20px;
  line-height: 1.4;
}
.confirm-btns {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* Мастер-аватар в модалке */
.master-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: white;
}

/* Скроллбар */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #F1F5F9; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ── Zoom controls ── */
.zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #94A3B8;
  font-size: 13px;
}
.timeline-scale-control {
  min-height: 30px;
  padding: 0 7px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  background: #F8FAFC;
}
.zoom-slider {
  width: 80px;
  accent-color: #2E86AB;
  cursor: pointer;
}

/* ── ЗН-номер на карточке ── */
.appt-zn {
  font-size: 10px;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

/* ── Боковое меню ── */
.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: white;
  z-index: 1100;
  box-shadow: 10px 0 30px rgba(0,0,0,0.1);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease;
}
.side-menu.hidden { transform: translateX(-100%); }

.sm-header {
  padding: 20px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sm-title { font-weight: 800; font-size: 18px; color: #1E3A5F; }

.sm-body { padding: 10px 0; flex: 1; }
.sm-item {
  display: block;
  width: 100%;
  padding: 14px 20px;
  text-align: left;
  background: none;
  border: none;
  font-size: 15px;
  font-weight: 600;
  color: #475569;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.sm-item:hover { background: #F1F5F9; color: #1E3A5F; padding-left: 25px; }
.sm-item.active { color: #1E3A5F; font-weight: 700; background: #EFF6FF; }

/* Быстрое создание ЗН рядом с пунктом меню */
.sm-item-row { display: flex; align-items: center; }
.sm-item-row .sm-item { flex: 1; }
.sm-quick-btn {
  flex-shrink: 0;
  background: #22C55E;
  color: white;
  border: none;
  border-radius: 50%;
  width: 26px;
  height: 26px;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 14px;
  transition: background 0.15s;
}
.sm-quick-btn:hover { background: #16A34A; }

/* Выпадающая группа в боковом меню */
.sm-group { border-radius: 8px; overflow: hidden; }
.sm-group-title {
  display: block; padding: 10px 18px; font-size: 14px; font-weight: 600;
  color: #475569; cursor: pointer; user-select: none;
  transition: background 0.15s;
}
button.sm-group-title {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
}
.sm-group-title:hover { background: #F1F5F9; color: #1E3A5F; }
.sm-group-body { display: none; }
.sm-group.open .sm-group-body { display: block; }
.sm-group.open .sm-group-title { color: #1E3A5F; }

/* ── Боковые панели (общие стили) ── */
.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.35);
  z-index: 1100;
  backdrop-filter: blur(1px);
}
.panel-overlay.hidden { display: none; }

.side-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 400px;
  max-width: 100vw;
  height: 100vh;
  background: white;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 40px rgba(0,0,0,0.2);
  transform: translateX(0);
  transition: transform 0.25s ease;
}
.side-panel.hidden { transform: translateX(100%); }

/* ЗН-панель: широкая с возможностью ресайза */
#order-panel {
  width: 65vw;
  min-width: 400px;
  max-width: 98vw;
}
#order-panel .sp-panel-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 6px;
  cursor: ew-resize;
  background: transparent;
  z-index: 10;
  transition: background 0.15s;
}
#order-panel .sp-panel-resize-handle:hover { background: rgba(46,134,171,0.25); }

/* Тоталс-бар внутри ЗН-панели */
#op-totals-bar {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 8px 20px;
  background: #F0F9FF;
  border-bottom: 1px solid #BAE6FD;
  font-size: 13px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
#op-totals-bar .tot-item { display: flex; flex-direction: column; align-items: center; min-width: 80px; }
#op-totals-bar .tot-label { font-size: 10px; color: #64748B; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
#op-totals-bar .tot-value { font-size: 15px; font-weight: 800; color: #1E3A5F; }
#op-totals-bar .tot-item.grand .tot-value { color: #16A34A; font-size: 17px; }
#op-totals-bar .tot-sep { width: 1px; height: 30px; background: #BAE6FD; flex-shrink: 0; }

/* Зелёные кнопки добавления */
.btn-add-green {
  background: #22C55E;
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: 7px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-add-green:hover { background: #16A34A; }

.sp-header {
  padding: 16px 20px;
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #F8FAFC;
  flex-shrink: 0;
  gap: 12px;
}
.sp-header-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.sp-header-right { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ЗН-панель: шапка */
.sp-header.op-panel-header {
  padding: 10px 16px;
}
.op-unsaved .sp-header.op-panel-header {
  background: #FEF2F2;
  border-bottom-color: #FCA5A5;
}
.op-unsaved #op-num {
  color: #B91C1C;
}
.op-unsaved-badge {
  display: none;
  align-items: center;
  background: #DC2626;
  color: #fff;
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  margin-left: 8px;
  white-space: nowrap;
}
.op-unsaved-badge.is-saving { background: #2563EB; }
.op-unsaved-badge.is-saved { background: #15803D; }
.op-unsaved-badge.is-error { background: #B91C1C; }
.op-unsaved-badge.is-waiting { background: #B45309; }
.op-post-conflict-badge {
  position: relative;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #F59E0B;
  border-radius: 50%;
  background: #FFF7ED;
  color: #B45309;
  font-size: 15px;
  font-weight: 900;
  cursor: help;
}
.op-post-conflict-badge[hidden] { display: none; }
.sp-title {
  font-size: 16px;
  font-weight: 800;
  color: #1E3A5F;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sp-icon-btn {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  line-height: 1;
}
.sp-icon-btn:hover { background: #F1F5F9; }
.sp-btn-icon { font-size: 15px; line-height: 1; }
.sp-btn-label { font-size: 10px; color: #64748B; white-space: nowrap; }

.op-status-bar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 4px;
  flex-shrink: 0;
  padding-right: 10px;
  margin-right: 4px;
  border-right: 1px solid #E2E8F0;
}
.sp-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.sp-section {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid #F1F5F9;
}
.sp-section:last-child { border-bottom: none; margin-bottom: 0; }
.sp-section h3 {
  font-size: 11px;
  font-weight: 700;
  color: #94A3B8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 10px;
}

/* Компактный прототип ЗН: только правая панель, легко откатить этим блоком */
#order-panel .sp-body { padding: 12px 16px; }
#order-panel .sp-section {
  margin-bottom: 12px;
  padding-bottom: 12px;
}
#order-panel .sp-section h3 { margin-bottom: 8px; }
#order-panel .modal-row {
  gap: 6px;
  margin-bottom: 6px;
}
#order-panel .modal-row label {
  width: 78px;
  font-size: 12px;
}
#order-panel .modal-row input,
#order-panel .modal-row select,
#order-panel .modal-row textarea {
  padding: 6px 8px;
  min-height: 28px;
}
#order-panel .op-vehicle-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(230px, 1fr));
  gap: 6px 12px;
}
#order-panel .op-vehicle-section h3,
#order-panel .op-vehicle-section #op-vehicle-picker-row {
  grid-column: 1 / -1;
}
#order-panel .op-task-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(240px, 1fr));
  gap: 8px 12px;
}
#order-panel .op-task-section h3 { grid-column: 1 / -1; }
#order-panel .op-task-section textarea { min-height: 46px !important; }
#order-panel .op-schedule-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(230px, 1fr));
  gap: 6px 12px;
}
#order-panel .op-schedule-section h3,
#order-panel .op-schedule-section p {
  grid-column: 1 / -1;
}
#order-panel .op-schedule-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}
#order-panel .op-schedule-section .modal-row {
  margin-bottom: 0;
}
#order-panel .op-schedule-section .modal-row[style*="position:relative"] {
  min-width: 0;
}
@media (max-width: 900px) {
  #order-panel .op-schedule-section,
  #order-panel .op-vehicle-section,
  #order-panel .op-task-section { grid-template-columns: 1fr; }
}

/* Списки в панелях (мастера, посты) */
.master-list-item, .post-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  margin-bottom: 10px;
}
.master-color-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.post-type-badge {
  font-size: 18px;
  width: 32px;
  height: 32px;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.master-info, .post-info { flex: 1; min-width: 0; }
.master-info-name, .post-info-name {
  font-weight: 700;
  color: #1E293B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.master-info-role, .post-info-type { font-size: 11px; color: #64748B; }

.master-edit-form, .post-edit-form {
  background: #F1F5F9;
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 20px;
  border: 1px solid #E2E8F0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sp-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sp-row label { font-size: 11px; font-weight: 700; color: #94A3B8; text-transform: uppercase; }
.sp-row input, .sp-row select {
  padding: 8px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  outline: none;
  font-family: inherit;
  font-size: 13px;
}
.master-form-actions, .post-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.sp-footer {
  padding: 12px 20px;
  border-top: 1px solid #E2E8F0;
  background: #F8FAFC;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
  gap: 8px;
}
.sp-footer .btn-primary { margin-left: auto; }
.sp-footer .btn-done { margin-left: auto; }
.sp-footer .btn-done + .btn-primary { margin-left: 0; }

/* ── Мастера-панель: список ── */
.master-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  margin-bottom: 6px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
}
.master-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}
.master-info { flex: 1; min-width: 0; }
.master-info-name {
  font-weight: 700;
  font-size: 14px;
  color: #1E293B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.master-info-role { font-size: 11px; color: #94A3B8; }
.master-item-actions { display: flex; gap: 6px; flex-shrink: 0; }
.master-order-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.master-edit-form {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 9px;
  padding: 14px;
  margin-bottom: 12px;
}
.master-edit-form .sp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.master-edit-form .sp-row:last-child { margin-bottom: 0; }
.master-edit-form label {
  font-size: 13px;
  color: #64748B;
  width: 80px;
  flex-shrink: 0;
  font-weight: 500;
}
.master-edit-form input[type="text"],
.master-edit-form input[type="color"] {
  flex: 1;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  color: #1E293B;
  background: white;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}
.master-edit-form input[type="color"] {
  padding: 2px 4px;
  height: 34px;
  cursor: pointer;
}
.master-edit-form input:focus { border-color: #2E86AB; }
.master-form-actions { display: flex; gap: 8px; margin-top: 10px; justify-content: flex-end; }

/* ── Конфликт мастера ── */
.conflict-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #FEF3C7;
  color: #92400E;
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  margin-top: 4px;
}

/* ── Мобильный дашборд ── */
.mobile-dashboard { display: none; }

.op-works-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.op-work-header-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}
.op-quick-work-actions {
  display: flex;
  min-width: 0;
  max-width: min(58vw, 620px);
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.op-quick-work-button,
.op-add-work-button {
  flex: 0 0 auto;
  min-height: 28px;
  border: 1px solid #BFDBFE;
  border-radius: 6px;
  padding: 3px 7px;
  background: #EFF6FF;
  color: #1D4ED8;
  font: 750 11px inherit;
  cursor: pointer;
}
.op-add-work-button { padding: 3px 8px !important; font-size: 12px !important; }

.mobile-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.mobile-kpi {
  min-width: 0;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 10px 8px;
  text-align: left;
  color: #1E293B;
}
.mobile-kpi span {
  display: block;
  font-size: 11px;
  color: #64748B;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mobile-kpi strong {
  display: block;
  margin-top: 3px;
  font-size: 22px;
  line-height: 1;
  color: #1E3A5F;
}
.mobile-kpi-button {
  border-color: #BBF7D0;
  background: #ECFDF5;
  cursor: pointer;
  font-family: inherit;
}
.mobile-kpi-button strong { color: #166534; }
.mobile-kpi-button.tasks {
  border-color: #DDD6FE;
  background: #F5F3FF;
}
.mobile-kpi-button.tasks strong { color: #6D28D9; }

.mobile-finance-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}
.mobile-finance-btn {
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 11px 8px;
  font-size: 14px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  background: white;
  color: #1E293B;
}
.mobile-finance-btn.income {
  background: #DCFCE7;
  border-color: #86EFAC;
  color: #166534;
}
.mobile-finance-btn.expense {
  background: #FEE2E2;
  border-color: #FCA5A5;
  color: #991B1B;
}
.mobile-finance-btn.neutral {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: #1D4ED8;
}

.mobile-list-section,
.mobile-open-orders,
.mobile-kanban {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}
.mobile-open-orders { display: none; }
.mobile-open-orders.active { display: block; }
.mobile-kanban { display: none; }
.mobile-kanban.active { display: block; }
.mobile-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.mobile-section-header h2 {
  margin: 0;
  font-size: 16px;
  color: #1E3A5F;
  text-transform: capitalize;
}
.mobile-section-header p {
  margin: 2px 0 0;
  color: #94A3B8;
  font-size: 12px;
}
.mobile-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: none;
  background: #22C55E;
  color: white;
  font-size: 24px;
  line-height: 1;
  font-weight: 700;
  cursor: pointer;
}
.mobile-master-group {
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 10px;
  background: #F8FAFC;
}
.mobile-master-group:last-child { margin-bottom: 0; }
.mobile-master-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: #F1F5F9;
  border-bottom: 1px solid #E2E8F0;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}
.mobile-master-title strong {
  min-width: 24px;
  text-align: center;
  border-radius: 999px;
  padding: 2px 7px;
  background: #fff;
  color: #1E3A5F;
}
.mobile-master-group-plan .mobile-master-title {
  background: #EFF6FF;
  color: #1D4ED8;
}
.mobile-master-group-air .mobile-master-title {
  background: #FFF7ED;
  color: #9A3412;
}
.mobile-master-group .mobile-appt-card {
  margin: 8px;
}
.mobile-appointment-list,
.mobile-order-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mobile-appt-card,
.mobile-order-card,
.mobile-kanban-card {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px 10px;
  border: 1px solid #E2E8F0;
  border-left: 5px solid #94A3B8;
  border-radius: 8px;
  padding: 10px;
  background: #FAFBFF;
}
.mobile-appt-card.status-confirmed,
.mobile-order-card.status-confirmed { border-left-color: #F59E0B; }
.mobile-appt-card.status-in_progress,
.mobile-order-card.status-in_progress,
.mobile-kanban-card.status-in_progress { border-left-color: #3B82F6; }
.mobile-appt-card.status-waiting_parts,
.mobile-order-card.status-waiting_parts { border-left-color: #FB923C; }
.mobile-appt-card.status-call_pending,
.mobile-order-card.status-call_pending { border-left-color: #8B5CF6; }

.op-hide-buy-control {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid #FCA5A5;
  background: #FEF2F2;
  border-radius: 6px;
  cursor: pointer;
}
.op-hide-buy-control input { margin: 0; accent-color: #DC2626; }
.op-part-arrival-warning {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 50%;
  background: #FDE68A;
  color: #92400E;
  border: 1px solid #F59E0B;
  font-weight: 900;
  font-size: 12px;
}
.op-part-arrival-warning[hidden] { display: none; }
.op-status-control { display:inline-flex; align-items:center; gap:4px; min-width:0; }
#op-waiting-parts-date { width:118px; min-width:0; border:1px solid #FB923C; border-radius:6px; padding:4px 5px; background:#FFF7ED; color:#9A3412; font:700 10px inherit; }
.op-stock-picker-modal { width:min(760px,96vw); }
.op-stock-picker-row { display:grid; grid-template-columns:minmax(180px,1fr) 90px 90px 75px auto; gap:8px; align-items:center; padding:9px 6px; border-bottom:1px solid #E2E8F0; }
.op-stock-picker-row small { display:block; margin-top:2px; color:#64748B; font-size:10px; }
.op-stock-picker-row.low { background:#FFF7ED; color:#9A3412; }
.op-stock-picker-row input { width:100%; min-width:0; border:1px solid #CBD5E1; border-radius:6px; padding:6px; }
.mobile-appt-card.status-done,
.mobile-order-card.status-done,
.mobile-kanban-card.status-done { border-left-color: #22C55E; }
.mobile-appt-card.status-cancelled,
.mobile-order-card.status-cancelled { border-left-color: #EF4444; opacity: 0.72; }
.mobile-kanban-card.status-waiting { border-left-color: #F59E0B; }
.mobile-appt-card.status-new,
.mobile-order-card.status-new,
.mobile-kanban-card.status-new { border-color: #BFDBFE; border-left-color: #60A5FA; }
.mobile-appt-card.status-confirmed,
.mobile-order-card.status-confirmed,
.mobile-kanban-card.status-confirmed { border-color: #FDE68A; border-left-color: #F59E0B; }
.mobile-appt-card.status-in_progress,
.mobile-order-card.status-in_progress,
.mobile-kanban-card.status-in_progress { border-color: #93C5FD; border-left-color: #3B82F6; }
.mobile-appt-card.status-waiting_parts,
.mobile-order-card.status-waiting_parts,
.mobile-kanban-card.status-waiting_parts { border-color: #FDBA74; border-left-color: #FB923C; }
.mobile-appt-card.status-call_pending,
.mobile-order-card.status-call_pending,
.mobile-kanban-card.status-call_pending { border-color: #C4B5FD; border-left-color: #8B5CF6; }
.mobile-appt-card.status-done,
.mobile-order-card.status-done,
.mobile-kanban-card.status-done { border-color: #86EFAC; border-left-color: #22C55E; }
.mobile-appt-card.status-cancelled,
.mobile-order-card.status-cancelled,
.mobile-kanban-card.status-cancelled { border-color: #FCA5A5; border-left-color: #EF4444; }
#op-opened-date { font-size:12px; font-weight:500; color:inherit; white-space:nowrap; }
#op-mobile-total { display:none; }
.mobile-appt-preview { border:0; padding:0; margin:0; background:transparent; text-align:left; font:inherit; cursor:pointer; min-width:0; }
.mobile-order-reader { width:min(680px,96vw); max-height:90dvh; padding:0; border:1px solid var(--aspect-border,#CBD5E1); border-radius:8px; background:var(--aspect-surface,#fff); color:var(--aspect-text,#17212b); }
.mobile-order-reader[open] { display:flex; flex-direction:column; }
.mobile-order-reader::backdrop { background:rgba(0,0,0,.5); }
.mobile-order-reader header, .mobile-order-reader footer { flex-shrink:0; display:flex; align-items:center; justify-content:space-between; padding:12px; gap:10px; }
.mobile-order-reader header button { background:transparent; color:inherit; border:0; width:44px; height:44px; font-size:24px; }
.mobile-reader-body { overflow:auto; min-height:0; padding:0 14px; overflow-wrap:anywhere; }
.mobile-reader-body dl { margin:0; }
.mobile-reader-body dl > div { display:grid; grid-template-columns:100px minmax(0,1fr); gap:8px; margin:8px 0; }
.mobile-reader-body dt { color:var(--aspect-muted,#526173); }
.mobile-reader-body dd { margin:0; }
.mobile-reader-body section { border-top:1px solid var(--aspect-border,#CBD5E1); padding:8px 0; }
.mobile-reader-body h4 { margin:8px 0; }
.mobile-reader-body li { margin-bottom:10px; }
.mobile-reader-body ul { padding-left:18px; }
.mobile-reader-body .mobile-reader-checklist { list-style:none; padding-left:0; }
.mobile-reader-body li span, .mobile-reader-body li small { display:block; }
.mobile-order-reader footer button { width:100%; min-height:44px; }
.mobile-appt-time {
  font-size: 13px;
  font-weight: 800;
  color: #1E3A5F;
  font-variant-numeric: tabular-nums;
}
.mobile-appt-main,
.mobile-order-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.mobile-appt-main strong,
.mobile-order-top strong {
  color: #1E293B;
  font-size: 14px;
  overflow-wrap: anywhere;
}
.mobile-appt-main span,
.mobile-order-client {
  color: #475569;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.mobile-appt-main small,
.mobile-order-meta {
  color: #94A3B8;
  font-size: 11px;
}
.mobile-order-meta.warn { color: #B45309; }
.mobile-order-meta.ok { color: #047857; }
.mobile-appt-actions {
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 2px;
}
.mobile-appt-actions a,
.mobile-appt-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #CBD5E1;
  border-radius: 7px;
  background: white;
  color: #1E3A5F;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  font-family: inherit;
  cursor: pointer;
}
.mobile-order-card,
.mobile-kanban-card {
  grid-template-columns: 1fr;
}
.mobile-order-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.mobile-order-top span {
  flex-shrink: 0;
  color: #64748B;
  font-size: 11px;
  font-weight: 700;
}
.mobile-order-top select {
  border: 1px solid #CBD5E1;
  border-radius: 7px;
  background: white;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 6px;
}
.mobile-kanban-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.mobile-kanban-part {
  display: grid;
  grid-template-columns: 1fr 118px 78px;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.mobile-kanban-part span {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}
.mobile-kanban-part input,
.mobile-kanban-part button {
  min-width: 0;
  border: 1px solid #CBD5E1;
  border-radius: 7px;
  padding: 6px 7px;
  font-family: inherit;
  font-size: 11px;
}
.mobile-kanban-part button {
  background: #EFF6FF;
  border-color: #BFDBFE;
  color: #1D4ED8;
  font-weight: 800;
}
.mobile-empty {
  padding: 18px 10px;
  text-align: center;
  color: #94A3B8;
  font-size: 13px;
}
.mobile-empty-error {
  color: #B91C1C;
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-radius: 8px;
}

@media (max-width: 900px) {
  body {
    height: auto;
    min-height: 100vh;
    overflow: auto;
    background: #F1F5F9;
  }
  .app-header {
    height: auto;
    min-height: 56px;
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
    position: sticky;
    top: 0;
  }
  .header-left {
    flex: 1 1 auto;
    gap: 8px;
    min-width: 0;
  }
  .app-header .header-logo,
  .app-header .branch-selector,
  .app-header .app-theme-toggle,
  .app-header #dashboard-ops-status-button { display: none !important; }
  .branch-selector select {
    max-width: 132px;
    padding: 5px 8px;
    font-size: 12px;
  }
  .header-center {
    order: 3;
    width: 100%;
    display: flex;
    justify-content: space-between;
    gap: 4px;
  }
  .dashboard-page .header-center {
    display: none !important;
    grid-template-columns: 34px minmax(0, 1fr) 34px 66px 38px;
  }
  .header-center .nav-btn {
    padding: 6px 9px;
    font-size: 13px;
  }
  .date-display {
    min-width: 0;
    width: 100%;
    font-size: 14px;
  }
  .header-right {
    flex: 0 0 auto;
    gap: 6px;
  }
  #clock,
  #user-display,
  #header-availability,
  .header-right .nav-btn[title="Выйти"] {
    display: none !important;
  }
  .header-right .btn-add {
    display: none !important;
  }
  .grid-header,
  .calendar-outer,
  .dashboard-summary,
  .schedule-companion,
  .dashboard-page .legend,
  .dashboard-page .mobile-kpis {
    display: none !important;
  }
  .schedule-plan-toggle,
  .timeline-scale-control { display: none !important; }
  .mobile-dashboard {
    display: block;
    flex: 1;
    padding: 12px 12px 150px;
    overflow: visible;
  }
  #mobile-dashboard .mobile-icon-btn {
    display: none !important;
  }
  .mobile-order-fab {
    display:grid !important;
    place-items:center;
    position:fixed;
    right:16px;
    bottom:76px;
    z-index:1150;
    width:54px;
    height:54px;
    border:0;
    border-radius:50%;
    background:#16A34A;
    color:#fff;
    box-shadow:0 8px 22px rgba(15,23,42,.28);
    font:900 30px/1 inherit;
  }
  .mobile-date-fab {
    position: fixed;
    left: 12px;
    right: 82px;
    bottom: 76px;
    z-index: 1150;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) 64px 44px;
    height: 54px;
    overflow: hidden;
    border: 1px solid var(--aspect-border, #CBD5E1);
    border-radius: 8px;
    background: var(--aspect-surface, #fff);
    box-shadow: 0 8px 22px rgba(15,23,42,.24);
  }
  .mobile-date-fab button {
    min-width: 0;
    border: 0;
    border-right: 1px solid var(--aspect-border, #E2E8F0);
    background: transparent;
    color: var(--aspect-text, #1E293B);
    font: 800 24px/1 inherit;
  }
  .mobile-date-fab button:last-child { border-right: 0; }
  .mobile-date-fab .mobile-date-fab-label {
    overflow: hidden;
    padding: 0 8px;
    font-size: 13px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }
  .mobile-date-fab .mobile-date-fab-today {
    color: #1D4ED8;
    font-size: 11px;
    font-weight: 900;
  }
  #order-panel {
    width: 100vw !important;
    min-width: 0;
    max-width: 100vw;
    overflow: hidden;
  }
  .op-works-heading {
    align-items: flex-start;
    flex-direction: column;
  }
  .op-work-header-actions { width: 100%; }
  .op-quick-work-actions { max-width: none; flex: 1; }
  #order-panel,
  #order-panel * {
    box-sizing: border-box;
  }
  #order-panel .sp-header.op-panel-header {
    padding: 7px 8px;
  }
  #order-panel .sp-body {
    padding: 8px 8px;
  }
  #order-panel .sp-section {
    margin-bottom: 9px;
    padding-bottom: 9px;
  }
  #order-panel .sp-header {
    align-items: flex-start;
    gap: 8px;
  }
  #order-panel .sp-header.op-panel-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  #order-panel .sp-header-left,
  #order-panel .sp-header-right {
    width: 100%;
    min-width: 0;
  }
  #order-panel .op-status-control.waiting_parts { flex:0 0 190px; }
  #op-waiting-parts-date { width:116px; flex:0 0 116px; }
  .op-stock-picker-row { grid-template-columns:minmax(0,1fr) 65px 65px; }
  .op-stock-picker-row > span:nth-of-type(2) { display:none; }
  .op-stock-picker-row input { grid-column:2; }
  .op-stock-picker-row button { grid-column:3; }
  #order-panel .sp-header-right {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    justify-content: end;
    overflow: hidden;
  }
  #order-panel .op-status-bar {
    grid-column: 1 / -1;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    border-right: 0;
    margin-right: 0;
    padding: 0 0 3px;
  }
  #order-panel .sp-icon-btn,
  #order-panel .sp-header-right > .close-btn {
    width: 32px;
    height: 30px;
    min-width: 0;
    padding: 4px;
  }
  #order-panel .sp-btn-label {
    display: none;
  }
  #order-panel .op-schedule-section h3 {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start !important;
    gap: 8px;
  }
  #order-panel .op-schedule-actions {
    width: 100%;
    justify-content: flex-start;
  }
  #order-panel .op-schedule-actions button {
    flex: 1;
    min-width: 0;
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
  #order-panel .op-schedule-time-row {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) 44px minmax(0, 1fr);
  }
  #order-panel .op-schedule-time-row label {
    width: auto;
    margin-left: 0 !important;
  }
  #order-panel .modal-row,
  #order-panel .modal-row > div,
  #order-panel .modal-row input,
  #order-panel .modal-row select,
  #order-panel .modal-row textarea {
    min-width: 0;
    max-width: 100%;
  }
  #order-panel .sp-footer {
    gap: 4px;
    padding: 6px;
  }
  #order-panel .sp-footer > button {
    flex: 1 1 0;
    min-width: 0;
    padding: 7px 2px;
    font-size: 11px;
    white-space: normal;
  }
  #order-panel .sp-header-right {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  #op-totals-bar {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0;
    padding: 5px 6px;
    flex-wrap: nowrap;
    align-items: stretch;
  }
  #op-totals-bar .tot-sep {
    display: none;
  }
  #op-totals-bar .tot-item {
    min-width: 0;
    padding: 0 2px;
    overflow: hidden;
  }
  #op-totals-bar .tot-label {
    font-size: 0;
    line-height: 1;
    letter-spacing: 0;
    white-space: nowrap;
  }
  #op-totals-bar .tot-label::after {
    font-size: 9px;
    color: #64748B;
    font-weight: 900;
    letter-spacing: 0;
  }
  #op-totals-bar .tot-item:nth-child(1) .tot-label::after { content: "РАБ."; }
  #op-totals-bar .tot-item:nth-child(3) .tot-label::after { content: "ЗАП."; }
  #op-totals-bar .tot-item:nth-child(5) .tot-label::after { content: "СТОР."; }
  #op-totals-bar .tot-item:nth-child(7) .tot-label::after { content: "ИТОГ"; }
  #op-totals-bar .tot-value,
  #op-totals-bar .tot-item.grand .tot-value {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    line-height: 1.15;
  }
  #op-payment-bar > div:first-child {
    gap: 3px !important;
    padding: 4px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
  }
  #op-payment-bar > div:first-child > span:first-child {
    display: none !important;
  }
  #op-payment-bar > div:first-child label {
    flex: 0 0 auto;
    gap: 1px !important;
    font-size: 0 !important;
    white-space: nowrap;
  }
  #op-payment-bar > div:first-child label[data-mobile-label]::after {
    content: attr(data-mobile-label);
    font-size: 10px;
    font-weight: 800;
    color: #9A3412;
  }
  #op-debt-badge {
    display: none !important;
  }
  #op-payment-method-row .op-discount-toggle {
    padding: 4px 5px;
    font-size: 10px;
  }
  #op-multi-pay-fields,
  #op-partial-fields {
    padding: 5px 6px !important;
    gap: 5px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
  }
  #op-multi-pay-fields input {
    width: 64px !important;
  }
  #op-partial-amount {
    width: 84px !important;
  }
  #op-works-container .op-work-row {
    display: grid !important;
    grid-template-columns: 42px minmax(26px, 1fr) 28px 42px 36px 36px 24px;
    gap: 2px !important;
    align-items: center !important;
    width: 100%;
    min-width: 0;
  }
  #op-works-container .op-work-row .op-w-action {
    width: 42px !important;
    min-width: 0;
    padding: 4px 1px !important;
    font-size: 9px !important;
  }
  #op-works-container .op-work-row .op-w-name {
    min-width: 0 !important;
    width: 100% !important;
    padding: 5px 4px !important;
    font-size: 11px !important;
  }
  #op-works-container .op-work-row .op-w-qty {
    width: 28px !important;
    min-width: 0;
    padding: 5px 1px !important;
    font-size: 10px !important;
  }
  #op-works-container .op-work-row .op-w-price {
    width: 42px !important;
    min-width: 0;
    padding: 5px 1px !important;
    font-size: 10px !important;
  }
  #op-works-container .op-work-row .op-w-master,
  #op-works-container .op-work-row .op-w-master2 {
    width: 36px !important;
    min-width: 0;
    padding: 4px 1px !important;
    font-size: 9px !important;
  }
  #op-works-container .op-work-row .btn-danger,
  #op-parts-container .op-part-row .btn-danger {
    width: 24px !important;
    min-width: 24px !important;
    padding: 3px 0 !important;
    font-size: 10px !important;
  }
  #op-parts-container .op-part-row {
    display: grid !important;
    grid-template-columns: 20px 26px minmax(18px, 1fr) 24px 32px 32px 52px 50px 24px;
    gap: 2px !important;
    align-items: center !important;
    width: 100%;
    min-width: 0;
  }
  #op-parts-container .op-part-row > button:first-child {
    width: 20px !important;
    min-width: 20px !important;
    padding: 2px 0 !important;
    font-size: 11px !important;
  }
  #op-parts-container .op-part-row .op-p-art {
    width: 26px !important;
    min-width: 0;
    padding: 4px 1px !important;
    font-size: 8px !important;
  }
  #op-parts-container .op-part-row .op-p-name {
    min-width: 0 !important;
    width: 100% !important;
    padding: 5px 3px !important;
    font-size: 10px !important;
  }
  #op-parts-container .op-part-row .op-p-qty {
    width: 24px !important;
    min-width: 0;
    padding: 5px 1px !important;
    font-size: 9px !important;
  }
  #op-parts-container .op-part-row .op-p-buy,
  #op-parts-container .op-part-row .op-p-sell {
    width: 32px !important;
    min-width: 0;
    padding: 5px 1px !important;
    font-size: 9px !important;
  }
  #op-parts-container .op-part-row .op-p-arrival {
    width: 52px !important;
    min-width: 0;
    padding: 4px 1px !important;
    font-size: 8px !important;
  }
  #op-parts-container .op-part-row .op-p-status {
    width: 50px !important;
    min-width: 0;
    padding: 4px 1px !important;
    font-size: 8px !important;
  }
  #op-parts-container .op-part-row .op-p-sold-wrap {
    grid-column: 3 / 7;
    grid-row: 2;
    font-size: 9px !important;
  }
  #op-parts-container .op-part-row .op-rossko-status {
    grid-column: 3 / 9;
    grid-row: 3;
    width: 100%;
    max-width: 100%;
    padding: 3px 5px;
    font-size: 8px;
  }
  #op-parts-container .op-part-row > .btn-danger:last-child {
    grid-column: 9;
    grid-row: 1;
  }
  #order-panel .sp-section > h3 > div {
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .modal-content {
    width: calc(100vw - 24px);
    border-radius: 8px;
  }
  .parts-popup,
  .open-orders-popup {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: 70vh;
  }
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
    align-items: stretch;
  }
  .toast { max-width: none; }
}

.sm-mobile-tools { display: none; }
.op-repeat-date-modal { width: min(420px, calc(100vw - 24px)); }
.op-repeat-date-note { margin: 0 0 14px; color: #64748B; font-size: 13px; }
.op-repeat-date-field { display: grid; gap: 6px; color: #334155; font-size: 12px; font-weight: 800; }
.op-repeat-date-field input { width: 100%; min-height: 38px; border: 1px solid #CBD5E1; border-radius: 7px; padding: 8px 10px; font: 14px inherit; }
.op-repeat-date-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

@media (max-width: 900px) {
  .sm-mobile-tools { display: grid; gap: 5px; margin: 12px 0 4px; padding-top: 12px; border-top: 1px solid var(--aspect-border, #E2E8F0); }
  .sm-mobile-tools-title { padding: 0 12px 4px; color: var(--aspect-muted, #64748B); font-size: 10px; font-weight: 850; text-transform: uppercase; }
  .sm-mobile-tool,
  .sm-mobile-tool-select { display: flex; width: 100%; min-height: 38px; align-items: center; gap: 8px; padding: 8px 12px; border: 0; border-radius: 6px; background: transparent; color: var(--aspect-text, #1E293B); font: 700 13px inherit; text-align: left; text-decoration: none; }
  .sm-mobile-tool:hover { background: var(--aspect-surface-2, #F1F5F9); }
  .sm-mobile-tool-select { justify-content: space-between; }
  .sm-mobile-tool-select select { min-width: 130px; border: 1px solid var(--aspect-border, #CBD5E1); border-radius: 6px; padding: 6px 8px; background: var(--aspect-input-bg, #fff); color: var(--aspect-text, #1E293B); font: 700 12px inherit; }
}

@media (max-width: 420px) {
  .dashboard-page .header-center { grid-template-columns: 34px minmax(0, 1fr) 34px 38px; }
  .header-center .today-btn {
    display: none;
  }
  .finance-v2-kpis,
  .finance-v2-grid {
    grid-template-columns: 1fr;
  }
  .mobile-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mobile-finance-actions {
    grid-template-columns: 1fr 1fr;
  }
  .mobile-finance-btn.neutral {
    grid-column: auto;
  }
  .mobile-appt-card {
    grid-template-columns: 1fr;
  }
  .mobile-appt-actions {
    grid-column: 1;
  }
  .mobile-kanban-part {
    grid-template-columns: 1fr;
  }
}

/* ── Печать ── */
.print-area { display: none; }

@media print {
  @page { size: A4 portrait; margin: 10mm 12mm; }
  body > *:not(#print-area) { display: none !important; }
  .print-area {
    display: block !important;
    padding: 0;
    font-family: Arial, sans-serif;
    font-size: 12px;
    color: #000;
  }
  .print-zn-title {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
  }
  .print-zn-info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 14px;
  }
  .print-zn-info-table td {
    padding: 4px 8px;
    border: 1px solid #ccc;
    font-size: 12px;
  }
  .print-zn-section-title {
    font-size: 13px;
    font-weight: bold;
    margin: 12px 0 4px;
    border-bottom: 2px solid #000;
    padding-bottom: 2px;
  }
  .print-zn-works-table,
  .print-zn-parts-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
    font-size: 11px;
  }
  .print-zn-works-table th,
  .print-zn-works-table td,
  .print-zn-parts-table th,
  .print-zn-parts-table td {
    border: 1px solid #ccc;
    padding: 4px 6px;
    text-align: left;
  }
  .print-zn-works-table th,
  .print-zn-parts-table th {
    background: #f0f0f0;
    font-weight: bold;
  }
  .print-zn-total {
    text-align: right;
    font-weight: bold;
    font-size: 13px;
    margin-top: 10px;
  }
  .print-zn-sign {
    margin-top: 30px;
    display: flex;
    justify-content: space-between;
  }
  .print-zn-sign-line {
    border-top: 1px solid #000;
    width: 200px;
    padding-top: 4px;
    font-size: 11px;
    color: #555;
  }

  /* Лист задания на ремонт */
  .print-rt-sheet {
    box-sizing: border-box;
    height: 277mm;
    max-height: 277mm;
    overflow: hidden;
    break-before: auto;
    break-after: avoid-page;
    page-break-before: auto;
    page-break-after: avoid;
    font-family: Arial, sans-serif;
    font-size: 12px;
    color: #000;
    padding: 0;
  }
  .print-rt-title {
    font-size: 15px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 8px;
    letter-spacing: 0.5px;
  }
  .print-rt-info {
    font-size: 11px;
    background: #f5f5f5;
    border: 1px solid #ccc;
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 14px;
    line-height: 1.6;
  }
  .print-rt-section {
    margin-bottom: 14px;
    border: 1px solid #bbb;
    border-radius: 4px;
    overflow: hidden;
  }
  .print-rt-section-title {
    background: #1E3A5F;
    color: white;
    font-weight: bold;
    font-size: 11px;
    padding: 5px 10px;
    letter-spacing: 0.5px;
  }
  .print-rt-text {
    min-height: 60px;
    padding: 8px 10px;
    font-size: 12px;
    line-height: 1.6;
    background: white;
  }
  .print-rt-sign {
    margin-top: 20px;
    display: flex;
    gap: 40px;
  }
  .print-rt-sign-line {
    font-size: 11px;
    color: #555;
    border-top: 1px solid #000;
    padding-top: 4px;
    min-width: 200px;
  }
}
/* ── Финансы ── */
.finance-container {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.quick-finance-bar {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.quick-finance-btn {
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
}
.quick-finance-btn.income {
  background: #DCFCE7;
  color: #166534;
  border-color: #86EFAC;
}
.quick-finance-btn.expense {
  background: #FEE2E2;
  color: #991B1B;
  border-color: #FCA5A5;
}
.finance-view-switch {
  margin-left: auto;
  display: inline-flex;
  padding: 3px;
  background: #E2E8F0;
  border-radius: 9px;
  gap: 3px;
}
.finance-view-btn {
  border: 0;
  background: transparent;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
}
.finance-view-btn.active {
  background: #fff;
  color: #0F172A;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}
.finance-scope-switch {
  margin-left: 0;
}
.finance-mini-switch {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 8px;
  background: #E2E8F0;
  flex-shrink: 0;
}
.finance-mini-switch button {
  border: 0;
  background: transparent;
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  color: #475569;
  cursor: pointer;
}
.finance-mini-switch button.active {
  background: #fff;
  color: #0F172A;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}
.finance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
  align-items: start;
}
.summary-card {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
  border-left: 5px solid #CBD5E1;
}
.summary-card.income { border-left-color: #10B981; }
.summary-card.parts { border-left-color: #3B82F6; }
.summary-card.expense { border-left-color: #EF4444; }
.summary-card.profit { border-left-color: #8B5CF6; background: #F5F3FF; }

.card-label { font-size: 13px; color: #64748B; margin-bottom: 8px; font-weight: 500; }
.card-value { font-size: 24px; font-weight: 800; color: #1E293B; }
.card-hint {
  margin-top: 4px;
  color: #94A3B8;
  font-size: 11px;
  font-weight: 600;
}
.finance-cash-mini {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  font-size: 11px;
  color: #047857;
}
.finance-cash-mini span {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.finance-cash-mini strong {
  color: #064E3B;
  font-size: 15px;
  font-weight: 900;
  white-space: nowrap;
}

.finance-insight-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 20px;
  margin: -10px 0 30px;
}
.finance-insight-card {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 10px;
  padding: 18px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.04);
}
.section-header.compact {
  margin-bottom: 14px;
  align-items: flex-start;
}
.section-header.compact h3 {
  margin: 0;
  font-size: 16px;
  color: #1E293B;
}
.section-header.compact span {
  font-size: 12px;
  color: #94A3B8;
}
.finance-mini-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.finance-mini-stat {
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 10px;
  background: #F8FAFC;
}
.finance-mini-stat span {
  display: block;
  font-size: 11px;
  color: #64748B;
  margin-bottom: 5px;
}
.finance-mini-stat strong {
  display: block;
  font-size: 16px;
  color: #1E293B;
}
.finance-mini-stat.good { background: #F0FDF4; border-color: #BBF7D0; }
.finance-mini-stat.good strong { color: #15803D; }
.finance-mini-stat.bad { background: #FEF2F2; border-color: #FECACA; }
.finance-mini-stat.bad strong { color: #DC2626; }
.finance-mini-stat.info { background: #EFF6FF; border-color: #BFDBFE; }
.finance-mini-stat.info strong { color: #1D4ED8; }
.finance-breakdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.finance-breakdown-row > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: #475569;
  margin-bottom: 5px;
}
.finance-breakdown-row strong {
  color: #1E293B;
  font-size: 13px;
}
.finance-breakdown-bar {
  height: 8px;
  background: #F1F5F9;
  border-radius: 999px;
  overflow: hidden;
}
.finance-breakdown-bar span {
  display: block;
  height: 100%;
  background: #F97316;
  border-radius: inherit;
}

.finance-main {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  align-items: start;
}
.finance-list-section, .finance-form-section {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.filters { display: flex; gap: 8px; }
.filters input {
  padding: 6px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 6px;
  font-size: 13px;
}

.finance-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.finance-table th { text-align: left; padding: 12px 10px; border-bottom: 2px solid #F1F5F9; color: #64748B; font-weight: 600; }
.finance-table td { padding: 12px 10px; border-bottom: 1px solid #F1F5F9; }
.amount-income { color: #059669; font-weight: 700; }
.amount-expense { color: #DC2626; font-weight: 700; }

.badge-income { background: #DCFCE7; color: #166534; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-expense { background: #FEE2E2; color: #991B1B; padding: 3px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.finance-impact-preview {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  color: #334155;
  font-size: 12px;
  line-height: 1.35;
  margin: 4px 0 14px;
  padding: 10px;
}
.finance-impact-title {
  color: #475569;
  font-weight: 700;
  margin-bottom: 8px;
}
.finance-impact-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.finance-impact-tags span {
  background: white;
  border: 1px solid #CBD5E1;
  border-radius: 999px;
  color: #0F172A;
  font-weight: 700;
  padding: 4px 8px;
}
.finance-impact-warning {
  color: #B45309;
  font-weight: 700;
  margin-top: 8px;
}

.branch-selector select {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
}
.branch-selector select option { color: #333; }

.w-100 { width: 100%; }
.form-group { margin-bottom: 15px; }
.form-group label { display: block; font-size: 13px; color: #64748B; margin-bottom: 5px; font-weight: 600; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 14px;
}
.finance-page { overflow: auto !important; }

.finance-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  border-bottom: 1px solid #E2E8F0;
}
.finance-tab {
  border: none;
  background: transparent;
  padding: 10px 14px;
  color: #64748B;
  font-family: inherit;
  font-weight: 800;
  cursor: pointer;
  border-bottom: 3px solid transparent;
}
.finance-tab.active {
  color: #1E3A5F;
  border-bottom-color: #1E3A5F;
}
.finance-sources-panel {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 18px;
}
.section-subtitle {
  display: block;
  color: #64748B;
  font-size: 12px;
  margin-top: 4px;
}
.finance-custom-panel {
  min-height: 360px;
}
.finance-widget-save-state {
  color: #64748B;
  font-size: 12px;
  font-weight: 700;
  margin: -8px 0 14px;
}
.finance-widget-save-state.good { color: #047857; }
.finance-widget-save-state.bad { color: #DC2626; }
.finance-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  align-items: start;
}
.finance-widget-card {
  background: #fff;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);
  min-height: 188px;
  padding: 14px;
}
.finance-widget-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.finance-widget-card-head strong {
  display: block;
  color: #0F172A;
  font-size: 15px;
}
.finance-widget-card-head span {
  display: block;
  color: #64748B;
  font-size: 11px;
  line-height: 1.35;
  margin-top: 3px;
}
.finance-widget-controls {
  display: grid;
  grid-template-columns: repeat(3, 28px);
  gap: 4px;
  flex-shrink: 0;
}
.finance-widget-controls button {
  width: 28px;
  height: 28px;
  border: 1px solid #CBD5E1;
  border-radius: 7px;
  background: #F8FAFC;
  color: #334155;
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  line-height: 1;
}
.finance-widget-controls button:hover:not(:disabled) {
  background: #E0F2FE;
  border-color: #7DD3FC;
  color: #075985;
}
.finance-widget-controls button:disabled {
  cursor: default;
  opacity: 0.35;
}
.finance-widget-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.finance-widget-kpi {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  min-height: 70px;
  padding: 10px;
}
.finance-widget-kpi span,
.finance-widget-line span {
  display: block;
  color: #64748B;
  font-size: 11px;
  font-weight: 700;
}
.finance-widget-kpi strong {
  display: block;
  color: #1E293B;
  font-size: 18px;
  margin-top: 5px;
}
.finance-widget-kpi.good strong,
.finance-widget-line.good strong,
.finance-widget-record em.good { color: #047857; }
.finance-widget-kpi.bad strong,
.finance-widget-line.bad strong,
.finance-widget-record em.bad { color: #DC2626; }
.finance-widget-kpi.info strong,
.finance-widget-line.info strong { color: #1D4ED8; }
.finance-widget-lines,
.finance-widget-records,
.finance-widget-bars {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.finance-widget-line,
.finance-widget-record,
.finance-widget-bar-row > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.finance-widget-line {
  border-bottom: 1px solid #F1F5F9;
  padding: 7px 0;
}
.finance-widget-line strong {
  color: #1E293B;
  font-size: 14px;
  white-space: nowrap;
}
.finance-widget-bar-row span {
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}
.finance-widget-bar-row strong {
  color: #0F172A;
  font-size: 13px;
  white-space: nowrap;
}
.finance-widget-bar-row em {
  display: block;
  height: 8px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #F1F5F9;
}
.finance-widget-bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #F97316;
}
.finance-widget-record {
  border-bottom: 1px solid #F1F5F9;
  padding: 7px 0;
}
.finance-widget-record strong {
  display: block;
  color: #0F172A;
  font-size: 12px;
}
.finance-widget-record span {
  color: #64748B;
  font-size: 11px;
}
.finance-widget-record em {
  font-style: normal;
  font-weight: 800;
  white-space: nowrap;
}
.finance-widget-empty,
.finance-widget-empty-dashboard {
  border: 1px dashed #CBD5E1;
  border-radius: 8px;
  color: #64748B;
  padding: 16px;
  text-align: center;
}
.finance-widget-empty-dashboard {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-height: 180px;
  place-content: center;
}
.finance-widget-empty-dashboard strong {
  color: #0F172A;
}
.finance-widget-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1205;
  width: 380px;
  max-width: 100%;
  height: 100%;
  background: #fff;
  box-shadow: -12px 0 30px rgba(15, 23, 42, 0.16);
  display: flex;
  flex-direction: column;
  transform: translateX(0);
  transition: transform 0.25s ease;
}
.finance-widget-drawer.hidden {
  transform: translateX(100%);
}
.finance-widget-drawer-head {
  border-bottom: 1px solid #E2E8F0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
}
.finance-widget-drawer-head strong {
  display: block;
  color: #0F172A;
  font-size: 18px;
}
.finance-widget-drawer-head span {
  color: #64748B;
  display: block;
  font-size: 12px;
  margin-top: 3px;
}
.finance-widget-drawer-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 14px;
}
.finance-widget-drawer-row {
  align-items: center;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px;
}
.finance-widget-drawer-row.active {
  background: #ECFDF5;
  border-color: #A7F3D0;
}
.finance-widget-drawer-row strong {
  display: block;
  color: #0F172A;
  font-size: 13px;
}
.finance-widget-drawer-row span {
  color: #64748B;
  display: block;
  font-size: 11px;
  margin-top: 3px;
}
.source-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.source-kpi {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 12px;
}
.source-kpi span {
  display: block;
  color: #64748B;
  font-size: 12px;
  font-weight: 700;
}
.source-kpi strong {
  display: block;
  margin-top: 4px;
  color: #1E293B;
  font-size: 19px;
}
.source-kpi.good strong { color: #047857; }
.source-kpi.bad strong { color: #DC2626; }
.finance-closing-panel {
  background: #F8FAFC;
}
.closing-period-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.closing-period-card,
.closing-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 14px;
}
.closing-period-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.closing-period-head strong {
  color: #0F172A;
  font-size: 16px;
}
.closing-period-head span {
  color: #64748B;
  font-size: 12px;
  font-weight: 800;
}
.closing-period-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.closing-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  margin-bottom: 14px;
}
.closing-form {
  display: grid;
  gap: 10px;
}
.closing-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.closing-form label {
  display: grid;
  gap: 5px;
  color: #64748B;
  font-size: 12px;
  font-weight: 800;
}
.closing-form input,
.closing-form textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 9px 10px;
  color: #0F172A;
  font: inherit;
}
.closing-comment {
  margin-top: 4px;
}
.closing-wallets-root {
  display: grid;
  gap: 9px;
}
.closing-wallet-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(280px, auto);
  gap: 10px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 10px;
  background: #FFFFFF;
}
.closing-wallet-row.good {
  border-color: #BBF7D0;
  background: #F0FDF4;
}
.closing-wallet-row.bad {
  border-color: #FECACA;
  background: #FEF2F2;
}
.closing-wallet-main strong {
  display: block;
  color: #0F172A;
  font-size: 14px;
}
.closing-wallet-main span,
.closing-wallet-reason {
  color: #64748B;
  font-size: 11px;
}
.closing-wallet-numbers {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.closing-wallet-numbers span {
  color: #64748B;
  font-size: 11px;
  font-weight: 800;
}
.closing-wallet-numbers b {
  display: block;
  color: #0F172A;
  font-size: 13px;
  margin-top: 2px;
  white-space: nowrap;
}
.closing-wallet-reason {
  grid-column: 1 / -1;
  padding-top: 4px;
  border-top: 1px solid rgba(148, 163, 184, .24);
}
.closing-history-table {
  min-width: 920px;
}
.source-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}
.source-chart-row {
  display: grid;
  grid-template-columns: 180px 1fr 110px;
  gap: 12px;
  align-items: center;
}
.source-chart-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.source-chart-label strong { font-size: 13px; }
.source-chart-label span { color: #64748B; font-size: 11px; }
.source-chart-bar {
  height: 16px;
  border-radius: 999px;
  background: #F1F5F9;
  overflow: hidden;
}
.source-chart-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}
.source-chart-value {
  text-align: right;
  font-size: 12px;
  color: #1E293B;
  font-weight: 800;
}
.source-pill {
  display: inline-flex;
  color: white;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 800;
}
.muted { color: #94A3B8; font-size: 11px; }
.order-finance-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.order-pay-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}
.order-pay-strip span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 8px 10px;
  color: #64748B;
  font-size: 12px;
  font-weight: 700;
}
.order-pay-strip strong {
  color: #0F172A;
  font-size: 13px;
}
.order-week-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}
.order-week-card {
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 11px;
}
.order-week-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.order-week-head strong {
  color: #1E293B;
  font-size: 13px;
}
.order-week-head span {
  color: #64748B;
  font-size: 12px;
  font-weight: 800;
}
.order-week-values {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}
.order-week-values span {
  color: #64748B;
  font-size: 11px;
}
.order-week-values strong {
  display: block;
  margin-top: 2px;
  color: #1E293B;
  font-size: 13px;
}
.order-finance-table-wrap {
  max-height: 62vh;
  overflow: auto;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
}
.order-finance-table {
  min-width: 1320px;
  font-size: 12px;
}
.order-finance-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fff;
  white-space: nowrap;
}
.order-finance-table td {
  white-space: nowrap;
  vertical-align: top;
}
.order-fin-client {
  color: #1E293B;
  font-weight: 800;
  margin-top: 4px;
}
.finance-v2-panel {
  background: #F8FAFC;
}
.finance-v2-status {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #FFFFFF;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}
.finance-v2-status span {
  color: #1E3A5F;
  font-weight: 900;
}
.finance-v2-status strong {
  color: #64748B;
  font-size: 12px;
}
.finance-v2-kpis {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.finance-v2-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.finance-v2-card,
.finance-v2-section {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 14px;
}
.finance-v2-card h4 {
  margin: 0 0 10px;
  color: #0F172A;
  font-size: 15px;
}
.finance-v2-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #F1F5F9;
  color: #64748B;
  font-size: 12px;
}
.finance-v2-line:last-child {
  border-bottom: 0;
}
.finance-v2-line strong {
  color: #0F172A;
  white-space: nowrap;
}
.finance-v2-partner {
  padding: 8px 0;
  border-bottom: 1px solid #E2E8F0;
}
.finance-v2-partner:last-child {
  border-bottom: 0;
}
.finance-v2-partner > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}
.finance-v2-partner > div:first-child strong {
  color: #0F172A;
}
.finance-v2-partner > div:first-child span {
  color: #64748B;
  font-size: 12px;
  font-weight: 700;
}
.finance-v2-payments {
  margin-bottom: 16px;
}
.finance-v2-section {
  margin-bottom: 16px;
}
.finance-v2-table th,
.finance-v2-table td {
  vertical-align: top;
}
.finance-v2-diagnostics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}
.finance-v2-diagnostic {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 11px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #FFFFFF;
}
.finance-v2-diagnostic.warn {
  border-color: #FDBA74;
  background: #FFF7ED;
}
.finance-v2-diagnostic.ok {
  border-color: #86EFAC;
  background: #F0FDF4;
}
.finance-v2-diagnostic strong {
  color: #0F172A;
  font-size: 13px;
}
.finance-v2-diagnostic span {
  color: #64748B;
  font-size: 12px;
}
.finance-audit-grid {
  align-items: stretch;
}
.audit-waterfall {
  display: grid;
  gap: 8px;
}
.audit-waterfall-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 130px;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #F8FAFC;
}
.audit-waterfall-row strong,
.audit-waterfall-row span {
  display: block;
}
.audit-waterfall-row strong {
  color: #0F172A;
  font-size: 13px;
}
.audit-waterfall-row span {
  margin-top: 2px;
  color: #64748B;
  font-size: 11px;
}
.audit-waterfall-row b,
.audit-waterfall-row em {
  justify-self: end;
  white-space: nowrap;
  font-style: normal;
  font-weight: 900;
}
.audit-waterfall-row.in b {
  color: #047857;
}
.audit-waterfall-row.out b {
  color: #DC2626;
}
.audit-waterfall-row em {
  color: #334155;
}
.audit-waterfall-total {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  background: #FFFFFF;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}
.audit-waterfall-total strong {
  color: #0F172A;
  white-space: nowrap;
}
.audit-wallet-table th,
.audit-wallet-table td {
  white-space: nowrap;
}
.audit-issues .finance-v2-diagnostic em {
  color: #0F172A;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}
.finance-audit-rossko-grid .finance-v2-line {
  align-items: flex-start;
}
.finance-audit-rossko-grid .finance-v2-line strong {
  max-width: 70%;
  white-space: normal;
  text-align: right;
}
.audit-note {
  padding: 8px 0;
  border-bottom: 1px solid #F1F5F9;
  color: #475569;
  font-size: 12px;
  line-height: 1.4;
}
.audit-note:last-child {
  border-bottom: 0;
}

.stock-movement-history {
  display: grid;
  gap: 8px;
}

.stock-movement-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 9px 10px;
  background: #F8FAFC;
  font-size: 12px;
}

.stock-movement-row strong {
  display: block;
  color: #1E293B;
}

.stock-movement-row span {
  display: block;
  color: #64748B;
  margin-top: 2px;
}

.stock-movement-row > div:last-child {
  text-align: right;
  white-space: nowrap;
}

.stock-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 2800;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.stock-modal {
  width: min(720px, 96vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #FFFFFF;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.28);
}

.stock-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid #E2E8F0;
  background: #2B2F36;
  color: #FFFFFF;
}

.stock-modal-body {
  padding: 14px 16px;
  overflow: auto;
}

.article-decode-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #E2E8F0;
}

.article-decode-row:last-child {
  border-bottom: 0;
}

.article-decode-row small {
  display: block;
  color: #64748B;
  font-size: 11px;
}

.stock-rossko-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.stock-rossko-frequent-head {
  color: #64748B;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.stock-markup-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  background: #F8FAFC;
  margin-bottom: 12px;
}

.stock-markup-box h3 {
  margin: 0;
  color: #0F172A;
  font-size: 14px;
}

.stock-markup-box p {
  margin: 0;
  color: #64748B;
  font-size: 12px;
}

.stock-markup-box label {
  display: grid;
  gap: 4px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}

.stock-markup-box input,
.stock-markup-box select {
  min-width: 0;
  border: 1px solid #CBD5E1;
  border-radius: 7px;
  padding: 8px 9px;
  font: inherit;
  background: #FFFFFF;
}

.stock-checkline {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  grid-template-columns: auto 1fr;
}

.notification-button { position: relative; min-width: 52px; }
.notification-button.has-items { background: #F59E0B; color: #111827; }
.notification-button span { font-size: 11px; font-weight: 900; }

.utility-side-panel {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1100;
  width: min(430px, 94vw); background: #fff; border-left: 1px solid #CBD5E1;
  box-shadow: -12px 0 32px rgba(15, 23, 42, .18); display: flex; flex-direction: column;
}
.utility-side-panel.hidden { display: none; }
.utility-panel-head {
  min-height: 64px; padding: 12px 14px; background: #F8FAFC; border-bottom: 1px solid #E2E8F0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.utility-panel-head div { display: grid; gap: 2px; }
.utility-panel-head strong { color: #0F172A; font-size: 16px; }
.utility-panel-head span { color: #64748B; font-size: 11px; }
.utility-panel-head button { width: 34px; height: 34px; border: 0; background: transparent; font-size: 24px; cursor: pointer; color: #475569; }
.utility-panel-body { padding: 12px; overflow: auto; display: grid; gap: 9px; }
.longterm-order-row, .notification-row, .op-history-row {
  border: 1px solid #E2E8F0; border-radius: 7px; padding: 10px; background: #fff;
}
.longterm-order-row > div:first-child, .notification-row > div:first-child, .op-history-row > div:first-child {
  display: flex; justify-content: space-between; gap: 10px; align-items: baseline;
}
.longterm-order-row strong, .notification-row strong, .op-history-row strong { color: #0F172A; font-size: 13px; }
.longterm-order-row span, .notification-row span, .op-history-row span { color: #64748B; font-size: 11px; }
.longterm-order-row p, .notification-row p, .op-history-row p { margin: 5px 0; color: #475569; font-size: 12px; line-height: 1.4; }
.notification-row small { display: block; color: #B45309; margin: 5px 0; }
.longterm-row-actions, .notification-actions { display: flex; gap: 7px; margin-top: 8px; }
.longterm-row-actions button, .notification-actions button, .longterm-order-row > button, .op-history-row > button {
  border: 1px solid #CBD5E1; border-radius: 6px; background: #F8FAFC; color: #1E293B; padding: 5px 8px; font-size: 11px; font-weight: 700; cursor: pointer;
}
.notification-actions button:first-child { background: #2563EB; border-color: #2563EB; color: #fff; }
.notification-actions button:disabled { opacity: .55; cursor: default; }
.notification-actions button.muted { background: #F8FAFC; border-color: #CBD5E1; color: #475569; }
.lower-appointments-cue {
  position: fixed; left: 50%; bottom: 64px; transform: translateX(-50%); z-index: 680;
  border: 1px solid #F59E0B; border-radius: 7px; background: #FFFBEB; color: #92400E;
  padding: 8px 14px; font-size: 12px; font-weight: 900; box-shadow: 0 5px 18px rgba(15, 23, 42, .14); cursor: pointer;
}
.lower-appointments-cue.hidden { display: none; }
.lower-column-cue {
  position:fixed; z-index:680; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  border:1px solid #F59E0B; border-radius:6px; background:#FFFBEB; color:#92400E;
  padding:7px 5px; font-size:10px; font-weight:900; box-shadow:0 4px 14px rgba(15,23,42,.15); cursor:pointer;
}
.op-history-modal { width: min(720px, 94vw); }

.op-collapsible { padding: 0 !important; overflow: hidden; }
.op-collapsible-toggle {
  width: 100%; min-height: 42px; display: grid; grid-template-columns:auto minmax(0, 1fr) auto;
  align-items: center; gap: 10px; border: 0; background: transparent; padding: 9px 12px;
  color: #1D4ED8; text-align: left; cursor: pointer; font: 800 13px inherit;
}
.op-collapsible-toggle small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #64748B; font-weight: 600; }
.op-collapsible-content { padding: 2px 12px 11px; }
.op-collapsible.collapsed .op-collapsible-content { display: none; }
.op-collapse-arrow { font-size: 18px; transition: transform .15s ease; }
.op-collapsible:not(.collapsed) .op-collapse-arrow { transform: rotate(180deg); }
.op-inline-actions { display:flex; justify-content:flex-end; gap:7px; margin-top:8px; }

.op-discount-toggle {
  flex: 0 0 auto; border: 1px solid #FDBA74; border-radius: 6px; background: #FFF7ED;
  color: #9A3412; padding: 5px 9px; font: 800 11px inherit; cursor: pointer; white-space: nowrap;
}
.op-discount-toggle.active { background: #FFEDD5; border-color: #F97316; color: #9A3412; }
.op-discount-panel {
  display: grid; grid-template-columns: 94px 100px minmax(150px, 1fr) auto; gap: 7px; align-items: center;
  padding: 7px 14px; background: #FFF7ED; border-bottom: 1px solid #FED7AA;
}
.op-discount-panel.collapsed { display: none; }
.op-discount-panel input, .op-discount-panel select { min-width:0; border:1px solid #FED7AA; border-radius:6px; padding:5px 7px; font:12px inherit; background:#fff; }
.op-discount-panel > span { color:#9A3412; font-size:12px; font-weight:800; }
.op-discount-panel > small { grid-column:1 / -1; color:#9A3412; font-size:10px; }
.op-rossko-status { flex-shrink:0; max-width:150px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; background:#FFE3E4; color:#A30F17; border:1px solid #F8C6C9; border-radius:6px; padding:4px 6px; font-size:10px; font-weight:800; }
.op-call-form { display:grid; grid-template-columns:145px 140px 145px minmax(150px, 1fr) auto; gap:7px; align-items:center; padding:10px; margin-bottom:10px; background:#EFF6FF; border:1px solid #BFDBFE; }
.op-call-form input, .op-call-form select { min-width:0; border:1px solid #CBD5E1; border-radius:6px; padding:7px; font:12px inherit; }
.op-part-delete-modal { width:min(520px, 94vw); }
.op-part-delete-form { display:grid; gap:10px; }
.op-part-delete-form label { display:grid; gap:4px; color:#475569; font-size:12px; font-weight:800; }
.op-part-delete-form input { min-width:0; border:1px solid #CBD5E1; border-radius:6px; padding:8px; font:13px inherit; }
.op-part-delete-name { color:#0F172A; font-size:14px; font-weight:900; }
.op-part-delete-form .op-return-check { display:flex; align-items:center; gap:7px; }
.op-part-delete-form .op-return-check input { width:auto; }
.op-part-delete-form small { color:#64748B; line-height:1.4; }
.stock-modal-actions { display:flex; justify-content:flex-end; gap:8px; padding:10px 14px; border-top:1px solid #E2E8F0; background:#F8FAFC; }
.op-rossko-archive-status { color:#A30F17 !important; font-weight:800; }

.global-order-search-overlay { position:fixed; inset:0; z-index:3200; display:flex; justify-content:center; align-items:flex-start; padding:8vh 16px 16px; background:rgba(15,23,42,.48); }
.global-order-search { width:min(680px, 100%); max-height:82vh; overflow:hidden; display:flex; flex-direction:column; background:#fff; border:1px solid #CBD5E1; box-shadow:0 24px 70px rgba(15,23,42,.3); }
.global-search-head { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:10px; padding:11px 13px; border-bottom:1px solid #E2E8F0; background:#F8FAFC; }
.global-search-head strong { color:#0F172A; font-size:15px; }
.global-search-head span { color:#64748B; font-size:11px; }
.global-search-head button { width:30px; height:30px; border:0; background:transparent; color:#475569; font-size:24px; cursor:pointer; }
.global-search-input-wrap { display:grid; grid-template-columns:auto minmax(0,1fr); align-items:center; gap:8px; margin:12px; border:2px solid #2563EB; padding:7px 10px; }
.global-search-input-wrap input { min-width:0; border:0; outline:0; font:15px inherit; }
.global-order-search-results { overflow:auto; border-top:1px solid #EEF2F7; }
.global-order-search-row { display:grid; grid-template-columns:minmax(0,1fr) 42px; border-bottom:1px solid #EEF2F7; }
.global-order-search-main { display:grid; gap:3px; min-width:0; border:0; background:#fff; padding:10px 12px; text-align:left; cursor:pointer; }
.global-order-search-main:hover { background:#F8FAFC; }
.global-order-search-main > span { display:flex; justify-content:space-between; gap:8px; }
.global-order-search-main b { color:#1E3A5F; }
.global-order-search-main i { color:#64748B; font-size:11px; font-style:normal; }
.global-order-search-main strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#0F172A; }
.global-order-search-main small { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:#475569; }
.global-order-search-main small em { margin-left:7px; color:#94A3B8; font-size:10px; font-style:normal; font-weight:700; }
.global-order-call { display:grid; place-items:center; border-left:1px solid #EEF2F7; color:#166534; text-decoration:none; font-size:19px; }
.global-search-button { width:38px; min-width:38px; padding:4px !important; font-size:24px !important; line-height:1; }
.ops-status-button { width: 32px; min-width: 32px; padding: 0 !important; font-size: 16px; font-weight: 900; }
.ops-status-ok { color: #15803D !important; }
.ops-status-degraded { color: #B45309 !important; }
.ops-status-critical,
.ops-status-unavailable { color: #B91C1C !important; }
.ops-status-unknown { color: #64748B !important; }

@media (max-width: 760px) {
  .notification-button { min-width: 42px; padding: 6px; }
  .utility-side-panel { width: 100vw; }
  #order-panel .op-mobile-accordion > h3 { cursor:pointer; padding-right:22px; position:relative; }
  #order-panel .op-mobile-accordion > h3::after { content:'⌃'; position:absolute; right:2px; top:0; color:#64748B; font-size:16px; }
  #order-panel .op-mobile-accordion.mobile-collapsed > h3::after { content:'⌄'; }
  #order-panel .op-mobile-accordion.mobile-collapsed > :not(h3) { display:none !important; }
  #order-panel .op-mobile-accordion.mobile-collapsed { padding-bottom:2px; }
  #order-panel .op-callback-section .modal-row > label { width:90px; font-size:11px; }
  .op-discount-panel { grid-template-columns:74px 70px minmax(0,1fr); padding:6px; }
  .op-discount-panel > span { grid-column:1 / -1; }
  .op-call-form { grid-template-columns:1fr; }
  .global-order-search-overlay { padding:0; align-items:stretch; }
  .global-order-search { width:100%; max-height:100vh; min-height:100vh; }
}

.stock-checkline input {
  width: auto;
}

.stock-modal.external-warehouse-modal { width: min(1040px, 96vw); height: min(820px, 92vh); }
.external-warehouse-toolbar { display: flex; gap: 8px; padding: 10px 14px; border-bottom: 1px solid #E2E8F0; }
.external-warehouse-toolbar select { flex: 1; border: 1px solid #CBD5E1; border-radius: 6px; padding: 7px 9px; }
.external-warehouse-economy { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.external-warehouse-economy > div { border: 1px solid #E2E8F0; border-radius: 7px; padding: 10px; display: grid; gap: 4px; }
.external-warehouse-economy span { color: #64748B; font-size: 11px; }
.external-warehouse-economy strong { color: #0F172A; font-size: 16px; }
.external-item-form { display: grid; grid-template-columns: 2fr 1fr .7fr .7fr 1fr 1fr 1fr 1fr auto; gap: 6px; margin: 12px 0; }
.external-item-form input, .external-item-form select { min-width: 0; border: 1px solid #CBD5E1; border-radius: 6px; padding: 7px; font-size: 12px; }
.external-items-list { display: grid; gap: 6px; }
.external-item-row { display: grid; grid-template-columns: 2fr .7fr 1.4fr auto; gap: 10px; align-items: center; border: 1px solid #E2E8F0; border-radius: 7px; padding: 9px; font-size: 12px; }
.external-item-row > div:first-child { display: grid; gap: 2px; }
.external-item-row span { color: #64748B; font-size: 11px; }
.stock-operation-form { display: grid; gap: 10px; }
.stock-operation-form label { display: grid; gap: 4px; font-size: 12px; font-weight: 700; color: #475569; }
.stock-operation-form input, .stock-operation-form select { border: 1px solid #CBD5E1; border-radius: 6px; padding: 8px; font: inherit; }

@media (max-width: 760px) {
  .external-warehouse-economy { grid-template-columns: 1fr 1fr; }
  .external-item-form { grid-template-columns: 1fr 1fr; }
  .external-item-form button { grid-column: 1 / -1; }
  .external-item-row { grid-template-columns: 1fr; }
}

/* ── Канбан ── */
.kanban-page {
  height: 100vh;
  overflow: hidden;
  background: #F1F5F9;
}
.kanban-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
}
.kanban-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.kanban-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: #475569;
  font-size: 13px;
}
.kanban-summary span {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 7px 10px;
}
.kanban-summary .warn { color: #B45309; border-color: #FED7AA; background: #FFFBEB; }
.kanban-help {
  display: grid;
  grid-template-columns: 180px repeat(3, minmax(0, 1fr));
  gap: 10px;
  align-items: stretch;
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 10px 12px;
  color: #475569;
  font-size: 12px;
}
.kanban-help strong {
  color: #1E3A5F;
  font-size: 13px;
}
.kanban-help span {
  border-left: 3px solid #BFDBFE;
  padding-left: 9px;
  line-height: 1.35;
}
.kanban-board {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
}
.kanban-column {
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
}
.kanban-column:nth-child(2) { background: #F7FBFF; }
.kanban-column:nth-child(3) { background: #FFFBEB; }
.kanban-column:nth-child(4) { background: #F0FDF4; }
.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid #E2E8F0;
  color: #1E3A5F;
  font-weight: 900;
}
.kanban-column-header span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.kanban-column-header small {
  color: #64748B;
  font-size: 10px;
  font-weight: 600;
  line-height: 1.25;
}
.kanban-column-header strong {
  background: white;
  color: #475569;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
}
.kanban-column-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.kanban-card {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}
.kanban-card.overdue { border-color: #F59E0B; box-shadow: 0 0 0 1px #FED7AA; }
.kanban-card-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
}
.kanban-order-link {
  border: none;
  background: transparent;
  color: #1D4ED8;
  font-weight: 900;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.kanban-car {
  margin-top: 2px;
  color: #1E293B;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.kanban-client {
  color: #64748B;
  font-size: 12px;
  margin-top: 6px;
  overflow-wrap: anywhere;
}
.kanban-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}
.kanban-card-tags span {
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 999px;
  padding: 2px 7px;
  color: #475569;
  font-size: 10px;
  font-weight: 800;
}
.kanban-card-tags span.done {
  background: #F0FDF4;
  border-color: #BBF7D0;
  color: #047857;
}
.kanban-card-note {
  margin-top: 8px;
  background: #F0FDF4;
  color: #047857;
  border: 1px solid #BBF7D0;
  border-radius: 7px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
}
.kanban-archive-btn {
  width: 24px;
  height: 24px;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
  background: #F8FAFC;
  color: #64748B;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}
.kanban-sublist {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.kanban-subtitle {
  color: #64748B;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.kanban-subtitle span {
  display: block;
  margin-top: 2px;
  color: #94A3B8;
  font-size: 10px;
  font-weight: 700;
  text-transform: none;
}
.kanban-task {
  display: grid;
  grid-template-columns: 1fr 92px 118px 24px;
  gap: 5px;
}
.kanban-task.overdue input,
.kanban-task.overdue select {
  border-color: #F59E0B;
  background: #FFFBEB;
}
.kanban-task input,
.kanban-task select,
.kanban-add-task input,
.kanban-part input {
  min-width: 0;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
  padding: 6px 7px;
  font-size: 11px;
  font-family: inherit;
}
.kanban-task button,
.kanban-add-task button,
.kanban-part button {
  border: 1px solid #BFDBFE;
  border-radius: 7px;
  background: #EFF6FF;
  color: #1D4ED8;
  font-weight: 900;
  cursor: pointer;
  font-family: inherit;
}
.kanban-part {
  display: grid;
  grid-template-columns: 1fr 118px 80px;
  gap: 6px;
  align-items: center;
  background: #F8FAFC;
  border: 1px solid #E2E8F0;
  border-radius: 7px;
  padding: 7px;
}
.kanban-part strong,
.kanban-part span {
  display: block;
  font-size: 12px;
}
.kanban-part span { color: #64748B; font-size: 11px; margin-top: 1px; }
.kanban-add-task {
  display: grid;
  grid-template-columns: 1fr 118px 32px;
  gap: 6px;
  margin-top: 10px;
}
.kanban-empty,
.kanban-loading {
  color: #94A3B8;
  text-align: center;
  padding: 20px 8px;
  font-size: 13px;
}

/* ── Типовые работы ── */
.op-work-suggestions {
  display: none;
  position: absolute;
  left: 100px;
  right: 190px;
  top: calc(100% + 4px);
  z-index: 720;
  max-height: 260px;
  overflow-y: auto;
  background: white;
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  padding: 5px;
}
.op-work-suggestion {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  border: none;
  border-radius: 6px;
  background: transparent;
  padding: 8px 9px;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}
.op-work-suggestion:hover { background: #F1F5F9; }
.op-work-suggestion strong { color: #1E293B; font-size: 12px; }
.op-work-suggestion span { color: #64748B; font-size: 11px; }
.op-checklist-block {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 8px;
}
.op-checklist-block:first-of-type { margin-top: 0; }
.op-checklist-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.op-checklist-head label {
  font-size: 12px;
  color: #15803D;
  font-weight: 800;
}
.op-checklist-items {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.op-checklist-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 6px;
  align-items: center;
}
.op-checklist-check {
  width: 17px;
  height: 17px;
  accent-color: #16A34A;
}
.op-checklist-text,
.op-checklist-extra {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #86EFAC;
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  background: #fff;
}
.op-checklist-extra {
  resize: vertical;
  min-height: 54px;
}
.print-check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 7px;
  font-size: 18px;
  line-height: 1.35;
}
.print-check-box {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 1.5px solid #111;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  margin-top: 3px;
}

.work-settings-page {
  height: 100vh;
  overflow: hidden;
  background: #F1F5F9;
}
.work-settings-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 14px;
}
.work-settings-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}
.work-settings-toolbar h1 {
  font-size: 22px;
  color: #1E3A5F;
  margin-bottom: 3px;
}
.work-settings-toolbar p {
  color: #64748B;
  font-size: 13px;
}
.work-settings-toolbar input {
  width: min(320px, 45vw);
  border: 1px solid #CBD5E1;
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  background: white;
}
.work-settings-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.work-settings-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 14px;
}
.work-template-form,
.work-template-group {
  background: white;
  border: 1px solid #E2E8F0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
}
.work-template-form {
  padding: 14px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.work-template-form h2 {
  color: #1E3A5F;
  font-size: 16px;
  margin-bottom: 2px;
}
.work-template-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
}
.work-template-form input {
  border: 1px solid #CBD5E1;
  border-radius: 7px;
  padding: 8px 9px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
}
.work-template-check {
  flex-direction: row !important;
  align-items: center;
}
.work-template-check input {
  width: auto;
}
.work-template-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 4px;
}
.work-template-list {
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.work-template-group header {
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #E2E8F0;
  padding: 10px 12px;
}
.work-template-group header strong {
  color: #1E3A5F;
  font-size: 14px;
}
.work-template-group header span {
  color: #64748B;
  font-size: 12px;
}
.work-template-items {
  display: flex;
  flex-direction: column;
}
.work-template-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid #F1F5F9;
}
.work-template-row:last-child { border-bottom: none; }
.work-template-row.inactive {
  opacity: 0.55;
  background: #F8FAFC;
}
.work-template-row strong {
  display: block;
  color: #1E293B;
  font-size: 13px;
}
.work-template-row span {
  display: block;
  margin-top: 2px;
  color: #64748B;
  font-size: 11px;
}
.work-template-row-actions {
  display: flex;
  gap: 6px;
  white-space: nowrap;
}

@media (max-width: 760px) {
  .kanban-help {
    grid-template-columns: 1fr;
  }
  .work-settings-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .work-settings-toolbar input {
    width: 100%;
  }
  .work-settings-tools {
    justify-content: stretch;
  }
  .work-settings-tools button {
    flex: 1;
  }
  .work-settings-layout {
    grid-template-columns: 1fr;
    overflow-y: auto;
  }
  .work-template-list {
    overflow: visible;
  }
  .op-work-suggestions {
    left: 0;
    right: 0;
  }
  .finance-container {
    padding: 12px;
  }
  .quick-finance-bar {
    position: sticky;
    top: 0;
    z-index: 15;
    justify-content: stretch;
    background: #F1F5F9;
    padding: 8px 0;
  }
  .quick-finance-btn {
    flex: 1;
  }
  .finance-view-switch {
    width: 100%;
    margin-left: 0;
  }
  .finance-view-btn {
    flex: 1;
  }
  .finance-summary {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 12px;
  }
  .finance-top-summary {
    grid-template-columns: 1fr;
  }
  .summary-card {
    padding: 12px;
    border-radius: 8px;
  }
  .card-value {
    font-size: 18px;
  }
  .finance-insight-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 0 0 12px;
  }
  .finance-insight-card {
    border-radius: 8px;
    padding: 12px;
  }
  .finance-mini-grid {
    grid-template-columns: 1fr 1fr;
  }
  .finance-widget-grid {
    grid-template-columns: 1fr;
  }
  .finance-widget-card {
    min-height: 0;
    padding: 12px;
  }
  .finance-widget-drawer {
    width: min(100%, 360px);
  }
  .finance-widget-drawer-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .finance-widget-drawer-row button {
    width: 100%;
  }
  .finance-main {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .finance-tabs {
    overflow-x: auto;
  }
  .source-kpi-grid {
    grid-template-columns: 1fr 1fr;
  }
  .order-finance-kpis {
    grid-template-columns: 1fr 1fr;
  }
  .finance-v2-kpis,
  .finance-v2-grid {
    grid-template-columns: 1fr 1fr;
  }
  .closing-period-grid,
  .closing-layout {
    grid-template-columns: 1fr;
  }
  .closing-wallet-row {
    grid-template-columns: 1fr;
  }
  .closing-wallet-numbers {
    grid-template-columns: 1fr 1fr 1fr;
  }
  .finance-v2-status {
    align-items: flex-start;
    flex-direction: column;
  }
  .finance-v2-diagnostics {
    grid-template-columns: 1fr;
  }
  .order-week-values {
    grid-template-columns: 1fr;
  }
  .source-chart-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .source-chart-value {
    text-align: left;
  }
  .finance-list-section,
  .finance-form-section {
    border-radius: 8px;
    padding: 12px;
  }
  .section-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }
  .filters {
    width: 100%;
    flex-wrap: wrap;
  }
  .filters input,
  .filters button {
    flex: 1;
    min-width: 130px;
  }
  .table-wrapper {
    overflow-x: auto;
  }
  .finance-v2-table {
    min-width: 720px;
  }
  .kanban-page {
    height: auto;
    overflow: auto;
  }
  .kanban-shell {
    padding: 10px;
  }
  .kanban-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .kanban-board {
    display: flex;
    flex-direction: column;
    overflow: visible;
  }
  .kanban-column {
    max-height: none;
  }
  .kanban-column-body {
    overflow: visible;
  }
  .kanban-task,
  .kanban-part,
  .kanban-add-task {
    grid-template-columns: 1fr;
  }
  .op-manager-task-row {
    grid-template-columns: 1fr !important;
  }
}

.op-approval-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 12px;
}
.op-line-approval {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 4px;
  font-size: 11px;
  cursor: pointer;
}
.op-line-approval input { width: 16px; height: 16px; margin: 0; accent-color: #16866b; }
.op-line-approval span { display: none; }
.op-line-pending { border-left: 3px solid #d59a22; padding-left: 3px; box-sizing: border-box; }
.zero-buy-breakdown { margin-top: 14px; border-top: 1px solid var(--aspect-border, #dce5ea); padding-top: 14px; }
.zero-buy-breakdown summary { cursor: pointer; font-weight: 700; min-height: 44px; }
.zero-buy-breakdown p, .zero-buy-order ul { color: var(--aspect-muted, #64748b); font-size: 13px; }
.zero-buy-order { padding: 10px 0; border-top: 1px solid var(--aspect-border, #dce5ea); }
.zero-buy-order > span { margin-left: 10px; }
.zero-buy-order .btn-zn-link { border: 0; padding: 0; background: transparent; color: var(--aspect-teal, #16866b); font: inherit; text-decoration: underline; cursor: pointer; }
#order-panel .op-part-buy-attention { outline: 2px solid #d59a22; outline-offset: 2px; }
.op-part-arrival-summary[hidden], #op-parts-waiting-summary[hidden] { display: none !important; }
.op-part-arrival-summary { border: 0; border-radius: 6px; padding: 6px; color: var(--aspect-muted, #64748b); background: transparent; font-size: 11px; white-space: nowrap; cursor: pointer; }
.op-part-arrival-summary.overdue { color: #b42318; background: #fff1f0; }
#op-parts-waiting-summary { color: var(--aspect-muted, #64748b); font-size: 12px; margin: 8px 0; }
#op-finance-summary { display:grid; grid-template-columns:minmax(0,1fr) auto; flex-shrink:0; align-items:stretch; gap:8px 12px; padding:8px 12px; border-bottom:1px solid var(--aspect-border,#dce5ea); background:var(--aspect-surface-2,#f0f9ff); }
#op-account-summary { grid-column:1/-1; display:flex; justify-content:flex-end; align-items:center; gap:12px; min-width:0; }
#order-panel #op-finance-summary #op-totals-bar { display:grid; grid-template-columns:repeat(5,minmax(0,1fr)); gap:6px; min-width:0; padding:0; border:0; background:transparent!important; align-items:stretch; }
#order-panel #op-finance-summary #op-totals-bar .tot-item { min-width:0; padding:6px; border:1px solid var(--aspect-border,#dce5ea); border-radius:7px; background:var(--aspect-surface,#fff); align-items:flex-start; justify-content:center; }
#order-panel #op-finance-summary #op-totals-bar .tot-item.grand { border-color:var(--aspect-success-border,#86efac); background:var(--aspect-green-soft,#f0fdf4); }
#order-panel #op-finance-summary #tot-discount { color:var(--aspect-amber,#9a650d)!important; }
#order-panel #op-finance-summary #op-totals-bar .tot-sep { display:none; }
#order-panel #op-finance-summary #op-totals-bar .tot-label { font-size:9px; letter-spacing:0; }
#order-panel #op-finance-summary #op-totals-bar .tot-value { font-size:13px; white-space:normal; overflow-wrap:anywhere; max-width:100%; line-height:1.25; }
#op-finance-summary #op-agreement-totals { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; min-width:0; padding:4px 0 4px 10px; border:0; border-left:1px solid var(--aspect-border,#dce5ea); background:transparent; font-size:11px; align-items:center; }
#op-agreement-totals > div { display:flex; flex-direction:column; gap:2px; min-width:0; }
#op-agreement-totals strong { font-size:13px; white-space:normal; overflow-wrap:anywhere; line-height:1.25; }
#op-agreement-totals small { color:var(--aspect-muted,#64748b); font-size:10px; }
#op-finance-summary #op-payment-summary-toggle { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-content:center; gap:2px 8px; min-width:0; padding:4px 0 4px 10px; border:0; border-left:1px solid var(--aspect-border,#dce5ea); background:transparent; font:inherit; }
#op-payment-summary-toggle > span { display:flex; flex-direction:column; gap:2px; min-width:0; font-size:11px; }
#op-payment-summary-toggle strong { font-size:13px; white-space:normal; overflow-wrap:anywhere; line-height:1.25; }
#op-payment-summary-toggle small { grid-column:1/-1; color:var(--aspect-teal,#16866b); font-size:10px; }
#op-payment-summary-toggle:hover { background:var(--aspect-hover,#e7f1f5)!important; border-radius:6px; }
.op-client-history-actions { display:flex; flex-wrap:wrap; gap:6px; margin:0 0 10px 94px; }
.op-client-history-actions button { min-height:32px; font-size:12px; }
.op-client-history-modal .stock-modal-body { display:grid; gap:10px; }
.op-client-history-modal .stock-modal-head strong { min-width:0; overflow-wrap:anywhere; }
.op-client-history-modal .stock-modal-head button { flex-shrink:0; min-width:44px; min-height:44px; border:0; border-radius:6px; background:transparent; color:inherit; font-size:22px; cursor:pointer; }
.op-client-history-modal .op-history-note { margin:0; color:var(--aspect-muted,#64748b); font-size:12px; }
.op-client-history-modal .op-history-row { background:var(--aspect-surface,#fff); border-color:var(--aspect-border,#dce5ea); overflow-wrap:anywhere; }
.op-client-history-modal .op-history-row :is(strong,p) { color:var(--aspect-text,#19394c); }
.op-client-history-modal .op-history-row > div:first-child { flex-wrap:wrap; }
.op-client-history-modal .op-history-row button { min-height:40px; }
@media (min-width:901px) {
  #order-panel { container-type:inline-size; width:max(65vw,min(980px,98vw)); }
  #op-documents-toggle { width:40px; height:36px; padding:0; font-size:20px; }
  #op-finance-summary #op-status-bar { display:flex; flex-wrap:nowrap; align-items:flex-start; justify-content:flex-end; gap:4px; min-width:0; max-width:100%; padding:4px; margin:0; border:0; background:transparent; }
  #order-panel #op-finance-summary .status-btn { padding:6px; font-size:11px; white-space:nowrap; }
  #op-finance-summary .op-status-control { flex-shrink:0; }
  #op-finance-summary .op-status-control.waiting_parts { flex-direction:column; }
  #op-finance-summary #op-waiting-parts-date { width:100%; max-width:112px; box-sizing:border-box; }
  #op-finance-summary #op-agreement-totals { display:flex; gap:14px; padding:0; border:0; flex-shrink:0; }
  #op-account-summary #op-agreement-totals > div { flex-direction:row; align-items:baseline; gap:4px; white-space:nowrap; }
  #op-account-summary #op-agreement-totals > div > span::after, #op-payment-summary-toggle > span > span::after { content:':'; }
  #op-account-summary #op-agreement-totals small::before { content:'· '; }
  #op-account-summary #op-agreement-totals strong { font-size:11px; }
  #op-finance-summary #op-payment-summary-toggle { display:flex; align-items:baseline; gap:12px; padding:4px 0 4px 12px; }
  #op-account-summary #op-payment-summary-toggle > span { flex-direction:row; align-items:baseline; gap:4px; white-space:nowrap; }
  #op-account-summary #op-payment-summary-toggle strong { font-size:11px; }
  #op-account-summary #op-payment-summary-toggle small { white-space:nowrap; }
  @container (max-width:760px) {
    #op-finance-summary { grid-template-columns:minmax(0,1fr); }
    #op-finance-summary #op-status-bar { grid-column:1; overflow-x:auto; justify-content:flex-start; }
    #op-account-summary { flex-wrap:wrap; }
  }
}
#op-approved-total { color: var(--aspect-teal, #16866b); }
#op-pending-total { color: #9a650d; }
@media print { #op-agreement-totals, #op-payment-summary-toggle, #op-documents-toggle, #op-documents-menu { display: none !important; } }
@media (max-width: 760px) {
  #op-totals-bar { flex-wrap: wrap; }
  #order-panel .op-line-approval { grid-column: 1 / -1; grid-row: auto; min-height: 28px; }
  #order-panel .op-line-approval span { display: inline; }
  #op-parts-container .op-part-row > .btn-danger { grid-column: 9; grid-row: 1; }
  #op-external-container .op-external-row { display: grid !important; grid-template-columns: minmax(40px, 1fr) 30px 48px 48px 24px; gap: 3px !important; }
  #op-external-container .op-external-row > input { width: 100% !important; min-width: 0; box-sizing: border-box; }
}
@media print {
  .op-line-approval, .op-approval-toolbar, #op-pending-total { display: none !important; }
}

/* Payment acknowledgements live beside the advance, across all order panels. */
#op-payment-receipts { display:flex;flex-wrap:wrap;align-items:center;gap:10px;padding:10px 14px;border-top:1px solid var(--aspect-border,#d8e0e8);background:var(--aspect-surface,#fff);color:var(--aspect-text,#17212b); }
#op-payment-receipts[hidden] { display:none!important; }
#op-payment-receipts small { width:100%;font-size:12px;line-height:1.5;color:var(--aspect-muted,#64748b); }
#op-payment-receipts button { white-space:normal;min-height:40px;text-align:left; }
#op-receipt-history { min-width:0;width:100%;font-size:13px; }
#op-receipt-history summary { cursor:pointer;padding:8px 0;font-weight:600; }
#op-receipt-history a { display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:10px 0;color:inherit;border-top:1px solid var(--aspect-border,#d8e0e8);text-decoration:none;overflow-wrap:anywhere; }
@media(max-width:600px) { #op-payment-receipts button { width:100%; } #op-receipt-history a { flex-direction:column;gap:4px; } }
#op-print-latest-payment-receipt { display:inline-flex;align-items:center;min-height:40px;text-decoration:none;white-space:normal; }
#op-parking-control {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  padding: 8px 14px;
  font-size: 12px;
}
#op-parking-control label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }
#op-parking-note { color: var(--text-muted, #64748b); font-size: 11px; }
