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

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

/* ── Шапка ── */
.app-header {
  background: #1E3A5F;
  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 { font-size: 20px; font-weight: 800; letter-spacing: 2px; }
.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; }

.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;
}
.clock {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
  opacity: 0.9;
}

/* ── Заголовок постов ── */
.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);
}
.time-header {
  width: 64px;
  flex-shrink: 0;
  border-right: 1px solid #E2E8F0;
}
.post-headers { display: flex; flex: 1; }
.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-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;
}
.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: 96px;
}

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

/* ── Посты ── */
.posts-area { display: flex; flex: 1; }

.post-col {
  flex: 1;
  position: relative;
  border-right: 1px solid #E2E8F0;
  background: #FAFBFF;
  cursor: crosshair;
  min-width: 0;
}
.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.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: 26px;
  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-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;
}

.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: 18px;
  flex-shrink: 0;
  font-size: 12px;
}
.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; }
.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; }

.parts-popup {
  position: absolute;
  bottom: calc(100% + 10px);
  right: 0;
  width: 400px;
  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; }

.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; }

/* 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;
}
@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: 540px;
  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: 7px 14px;
  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.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.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-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; }

/* Мастер-аватар в модалке */
.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;
}
.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-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;
}
.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: 500px;
  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%); }

.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-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: 6px 10px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1;
}
.sp-icon-btn:hover { background: #F1F5F9; }

.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;
}

/* Списки в панелях (мастера, посты) */
.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; }

/* ── Мастера-панель: список ── */
.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-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;
}

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

@media print {
  body > *:not(#print-area) { display: none !important; }
  .print-area {
    display: block !important;
    padding: 20px;
    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;
  }
}
/* ── Финансы ── */
.finance-container {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.finance-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.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; }

.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; }

.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; }
