/* ───── Operator page ───── */
.op-page {
  display: flex; flex-direction: column;
  gap: 16px;
}

/* KPI row */
.op-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.op-kpis { gap: 8px; }
.op-kpi {
  background: #fff;
  border-radius: 9px;
  border: 1px solid #e5e7eb;
  padding: 4px 9px;
  display: grid;
  grid-template-columns: 22px 1fr;
  grid-template-rows: auto auto;
  column-gap: 7px;
  align-items: center;
  position: relative; overflow: hidden;
}
.op-kpi__icon {
  grid-row: 1 / span 2;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px;
  background: rgba(255,193,7,0.1);
  border-radius: 6px;
}
.op-kpi__val { font-size: 14px; font-weight: 800; line-height: 1.05; color: #111827; }
.op-kpi__label { font-size: 8.5px; color: #6b7280; text-transform: uppercase; letter-spacing: 0.2px; font-weight: 600; }
.op-kpi-online .op-kpi__icon { background: rgba(34,197,94,0.12); }
.op-kpi-busy .op-kpi__icon { background: rgba(244,67,54,0.12); }
.op-kpi-orders .op-kpi__icon { background: rgba(33,150,243,0.12); }
.op-kpi-warn .op-kpi__icon { background: rgba(245,158,11,0.12); }
.op-kpi-warn .op-kpi__val { color: #d97706; }

/* 2-column grid: большая карта слева + узкая колонка (заказы+водители) справа */
.op-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 14px;
  align-items: stretch;
}

.op-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.op-col-center { gap: 14px; }

/* Panels */
.op-panel {
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
.op-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(255,193,7,0.05), transparent);
  border-bottom: 1px solid #f3f4f6;
}
.op-panel__head h3 {
  margin: 0;
  font-size: 15px; font-weight: 800; color: #111827;
}
.op-select {
  padding: 5px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

/* Map — увеличена ~на 50% (480→720) под 3D-обзор */
.op-panel-map { flex: 1; min-height: 0; }
.op-map {
  width: 100%; height: 720px;
  background: #e8eaed;
  position: relative;
}
/* нативный MapLibre-канвас заполняет контейнер */
.op-map .maplibregl-canvas { outline: none; }
/* кнопка переключения 3D/2D наклона поверх карты */
.op-map-3dtoggle {
  position: absolute; top: 10px; right: 10px; z-index: 5;
  background: rgba(17,24,39,0.82); color: #fff; border: 0;
  border-radius: 8px; padding: 7px 12px; font-weight: 700; font-size: 12.5px;
  cursor: pointer; font-family: inherit; letter-spacing: 0.3px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.op-map-3dtoggle:hover { background: #111827; }
.op-legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  font-size: 12px; color: #6b7280;
  align-items: center;
}
.op-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.op-dot-free { background: #22c55e; }
.op-dot-busy { background: #f44336; }
.op-dot-order { background: #FFC107; }

/* Map markers */
.op-marker-driver, .op-marker-order {
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 14px;
  width: 32px; height: 32px;
  cursor: pointer;
}
.op-marker-order { width: 28px; height: 28px; font-size: 13px; }

/* Lists — заказы и водители теперь стопкой в правой колонке, каждый скроллится */
.op-orders-list, .op-drivers-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
.op-orders-list { max-height: 320px; }
.op-drivers-list { max-height: 360px; }
/* правая колонка панелей не должна растягиваться выше карты */
.op-col-right { max-height: 760px; }
.op-empty {
  padding: 20px; text-align: center;
  color: #9ca3af; font-style: italic; font-size: 13px;
}

/* Order item */
.op-order {
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  margin-bottom: 6px;
  border: 1px solid transparent;
  transition: all 0.15s;
  background: #f9fafb;
}
.op-order:hover {
  background: #fff;
  border-color: #FFC107;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}
.op-order-warn { background: #fef3c7; border-color: rgba(245,158,11,0.4); }
.op-order__head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.op-order__id { font-weight: 800; color: #111827; font-size: 14px; }
.op-order__time { margin-left: auto; font-size: 11px; color: #9ca3af; }
.op-order__route { font-size: 12.5px; }
.op-order__from { color: #111827; font-weight: 500; }
.op-order__to { color: #6b7280; margin-top: 2px; }
.op-order__meta {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 8px; padding-top: 6px;
  border-top: 1px dashed #e5e7eb;
  font-size: 11.5px; color: #6b7280;
}
.op-order__price { margin-left: auto; font-weight: 700; color: #111827; font-size: 13px; }
.op-status {
  padding: 2px 7px; border-radius: 5px;
  font-size: 10.5px; font-weight: 700;
}

/* Driver category tabs */
.op-driver-cat-tabs {
  display: flex; gap: 4px;
  padding: 8px 10px 0;
  border-bottom: 1px solid #f3f4f6;
}
.op-cat-tab {
  flex: 1; padding: 7px 8px;
  background: transparent;
  border: 0; border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px; font-weight: 600;
  color: #6b7280;
  transition: all 0.15s;
}
.op-cat-tab:hover { color: #111827; }
.op-cat-tab.active {
  color: #B8860B;
  border-bottom-color: #FFC107;
}

/* Driver item */
.op-driver {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  cursor: pointer;
  margin-bottom: 4px;
  transition: background 0.15s;
}
.op-driver:hover { background: rgba(255,193,7,0.08); }
.op-presence {
  width: 12px; height: 12px; border-radius: 50%;
  flex-shrink: 0;
}
.op-presence-free {
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34,197,94,0.6);
  animation: opPulse 1.6s ease-out infinite;
}
.op-presence-busy { background: #f44336; }
.op-presence-off { background: #d1d5db; }
@keyframes opPulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,0.7); }
  70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}
.op-driver__body { flex: 1; min-width: 0; }
.op-driver__name {
  font-weight: 700; font-size: 13.5px; color: #111827;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.op-driver__sub {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 2px;
  font-size: 11px; color: #6b7280;
}
.op-chip {
  display: inline-block; padding: 1px 6px; border-radius: 4px;
  background: rgba(255,193,7,0.15); color: #B8860B;
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.3px;
}
.op-driver__status { color: #6b7280; }
.op-bal { font-weight: 700; color: #16a34a; margin-left: auto; }
.op-bal-low { color: #f59e0b; }
.op-bal-neg { color: #ef4444; }

/* Create order form */
.op-create { padding: 14px 16px 16px; }
.op-form-row {
  display: grid; gap: 10px;
  margin-bottom: 10px;
}
.op-form-row:has(> :nth-child(3)) { grid-template-columns: 1.4fr 1fr 1fr; }
.op-form-row:has(> :nth-child(2):last-child) { grid-template-columns: 1fr 1fr; }
.op-field label {
  display: block;
  font-size: 11px; color: #6b7280;
  text-transform: uppercase; letter-spacing: 0.5px;
  font-weight: 600;
  margin-bottom: 4px;
}
.op-input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-family: inherit;
  font-size: 13px;
}
.op-input:focus {
  outline: none;
  border-color: #FFC107;
  box-shadow: 0 0 0 3px rgba(255,193,7,0.15);
}
.op-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 18px;
  border: 0; border-radius: 9px;
  font-family: inherit;
  font-weight: 700; font-size: 13.5px;
  cursor: pointer;
  transition: all 0.15s;
}
.op-btn-yellow { background: #FFC107; color: #000; }
.op-btn-yellow:hover {
  background: #B8860B; color: #fff;
  box-shadow: 0 4px 12px rgba(255,193,7,0.4);
}

/* Адаптив для маленьких экранов */
/* Create-bar — форма создания заказа ОДНОЙ СТРОКОЙ под дашбордом */
.op-create-bar { padding: 8px 12px; }
.op-create-inline {
  display: flex; align-items: flex-end; gap: 10px; flex-wrap: nowrap;
}
.op-create-inline .op-field { margin: 0; min-width: 0; }
.op-create-inline .op-field-sm { flex: 0 0 132px; }
.op-create-inline .op-field-grow { flex: 1 1 0; position: relative; }
.op-create-inline label {
  display: block; font-size: 10px; color: #6b7280;
  text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; margin-bottom: 3px;
}
.op-create-inline .op-input { padding: 8px 10px; font-size: 13px; }
.op-create-inline .op-create-submit {
  flex: 0 0 auto; white-space: nowrap; padding: 9px 16px; height: 38px;
}
.op-create-inline .addr-suggestions { position: absolute; z-index: 20; left: 0; right: 0; }

/* A/B пины выбора точки на карте (MapLibre marker) */
.op-pick-pin {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 800; font-size: 12px;
  border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,0.45);
}
.op-pick-from { background: #16a34a; }
.op-pick-to { background: #ef4444; }
.op-map .maplibregl-marker { cursor: pointer; }

@media (max-width: 1180px) {
  .op-grid { grid-template-columns: 1fr; }
  .op-col-right { max-height: none; }
  .op-map { height: 460px; }
  .op-kpis { grid-template-columns: repeat(2, 1fr); }
  .op-form-row { grid-template-columns: 1fr !important; }
  .op-create-inline { flex-wrap: wrap; }
  .op-create-inline .op-field-sm,
  .op-create-inline .op-field-grow { flex: 1 1 45%; }
}
