:root {
  color-scheme: light;
  --bg: #f7f5f2;
  --panel: #ffffff;
  --panel-soft: #fbfaf8;
  --ink: #221914;
  --muted: #746b63;
  --line: #e5ded6;
  --orange: #f97316;
  --orange-dark: #c2410c;
  --red: #b42318;
  --amber: #a15c07;
  --accent: #ea580c;
  --shadow: 0 14px 32px rgba(34, 25, 20, 0.07);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Tahoma, sans-serif;
  line-height: 1.5;
}

button,
input,
textarea {
  font: inherit;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: var(--orange);
  color: white;
  cursor: pointer;
  font-weight: 800;
  padding: 10px 16px;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

button:hover {
  background: var(--orange-dark);
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.secondary {
  background: #fff7ed;
  color: var(--ink);
  border: 1px solid var(--line);
}

.secondary:hover {
  background: #ffedd5;
}

.hidden {
  display: none !important;
}

.eyebrow,
.muted {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(360px, 0.85fr);
}

.login-visual {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 56px;
  color: white;
  background:
    linear-gradient(0deg, rgba(124, 45, 18, 0.86), rgba(194, 65, 12, 0.28)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='820' viewBox='0 0 1200 820'%3E%3Crect width='1200' height='820' fill='%23ea580c'/%3E%3Cpath d='M0 600C190 470 390 690 610 560C790 454 930 300 1200 340V820H0Z' fill='%23c2410c'/%3E%3Cpath d='M190 250H940' stroke='%23fff7ed' stroke-width='18' stroke-linecap='round' opacity='.35'/%3E%3Ccircle cx='330' cy='250' r='34' fill='%23fff' opacity='.88'/%3E%3Ccircle cx='850' cy='250' r='34' fill='%23fff' opacity='.88'/%3E%3Cpath d='M330 250C470 356 640 355 850 250' fill='none' stroke='%23fff' stroke-width='10' stroke-linecap='round' stroke-dasharray='22 22' opacity='.85'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

.login-visual .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.login-visual h1 {
  max-width: 720px;
  margin: 10px 0 14px;
  font-size: 52px;
  line-height: 1.08;
}

.login-visual p:last-child {
  max-width: 650px;
  margin: 0;
  font-size: 18px;
  line-height: 1.8;
}

.login-form {
  align-self: center;
  justify-self: center;
  width: min(420px, calc(100vw - 36px));
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.login-form h2,
.topbar h2,
.panel h3,
.queue-panel h3,
.case-details h3 {
  margin: 6px 0 18px;
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.16);
  outline: none;
}

textarea {
  min-height: 420px;
  direction: ltr;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
}

.error-text {
  min-height: 20px;
  color: var(--red);
}

.desk-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 224px minmax(0, 1fr);
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  background: #ffedd5;
  color: var(--ink);
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 24px;
}

.rail .eyebrow {
  color: #9a3412;
}

.rail h1 {
  margin: 6px 0 28px;
  font-size: 24px;
}

nav {
  display: grid;
  gap: 8px;
}

.nav-btn {
  width: 100%;
  text-align: right;
  background: transparent;
  color: var(--ink);
  border: 1px solid rgba(194, 65, 12, 0.14);
  min-height: 40px;
}

.nav-btn.active {
  background: white;
  color: var(--orange-dark);
  border-color: rgba(194, 65, 12, 0.22);
}

.rail .secondary {
  background: #fff7ed;
  color: var(--ink);
  border-color: rgba(194, 65, 12, 0.18);
}

.workspace {
  min-width: 0;
  padding: 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 58px;
  margin-bottom: 14px;
}

.topbar h2 {
  font-size: 24px;
  margin-bottom: 0;
}

.notice {
  padding: 12px 14px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  margin-bottom: 16px;
  font-weight: 800;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(112px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.orders-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.orders-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(34, 25, 20, 0.04);
  padding: 16px;
}

.orders-panel h3 {
  margin: 5px 0 4px;
}

.orders-tools {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.orders-tools input {
  background: var(--panel-soft);
}

.order-filter-btn,
.cancelled-filter-btn {
  min-height: 36px;
  padding: 7px 11px;
  background: var(--panel-soft);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 12px;
}

.order-filter-btn.active,
.cancelled-filter-btn.active {
  background: var(--orange-dark);
  border-color: var(--orange-dark);
  color: white;
}

.orders-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.orders-table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  text-align: right;
}

.orders-table th,
.orders-table td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.orders-table th {
  background: #fff7ed;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.orders-table tbody tr:last-child td {
  border-bottom: 0;
}

.orders-table tbody tr:hover {
  background: var(--panel-soft);
}

.orders-table td strong,
.orders-table td small {
  display: block;
}

.orders-table td small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.order-id,
.coordinates {
  direction: ltr;
  text-align: right;
  overflow-wrap: anywhere;
}

.monitoring-pill,
.clear-result,
.actor-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.monitoring-pill.active {
  background: #fff4dd;
  color: var(--amber);
}

.monitoring-pill.completed,
.clear-result {
  background: #f3f1ef;
  color: var(--muted);
}

.actor-pill.driver {
  background: #feeceb;
  color: var(--red);
}

.actor-pill.client {
  background: #fff4dd;
  color: var(--amber);
}

.actor-pill.system,
.actor-pill.unknown {
  background: #f3f1ef;
  color: var(--muted);
}

.orders-empty {
  padding: 36px !important;
  text-align: center;
  color: var(--muted);
}

.metric,
.panel,
.queue-panel,
.case-details {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(34, 25, 20, 0.04);
}

.metric {
  min-height: 82px;
  padding: 14px;
}

.metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 28px;
}

.metric.danger strong {
  color: var(--red);
}

.metric.warning strong {
  color: var(--amber);
}

.workload-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.workload-panel article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.workload-panel span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workload-panel strong {
  font-size: 22px;
}

.workload-panel .danger strong {
  color: var(--red);
}

.workload-panel .warning strong {
  color: var(--amber);
}

.suspicion-rules {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(0, 1.2fr);
  gap: 14px;
  align-items: start;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 12px;
}

.rules-intro h3 {
  margin: 4px 0 6px;
}

.rules-intro p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.rule-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.rule-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(194, 65, 12, 0.18);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 800;
}

.desk-grid {
  display: grid;
  grid-template-columns: minmax(320px, 370px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.queue-panel,
.case-details,
.panel {
  padding: 16px;
}

.queue-panel {
  position: sticky;
  top: 18px;
}

.panel-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.queue-head-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.export-btn {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.count-pill,
.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.count-pill {
  background: #fff7ed;
  color: var(--ink);
}

.pill.high {
  background: #feeceb;
  color: var(--red);
}

.pill.suspicious {
  background: #fff4dd;
  color: var(--amber);
}

.pill.normal {
  background: #fff7ed;
  color: var(--orange-dark);
}

.case-queue {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 306px);
  overflow: auto;
  padding-left: 4px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pagination button {
  min-height: 36px;
  padding: 7px 12px;
}

.queue-tools {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.queue-tools input {
  min-height: 42px;
  background: var(--panel-soft);
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-btn {
  min-height: 34px;
  padding: 7px 10px;
  background: var(--panel-soft);
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 12px;
}

.filter-btn.active {
  background: var(--orange-dark);
  border-color: var(--orange-dark);
  color: white;
}

.case-card {
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: 116px;
  text-align: right;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-right: 4px solid #d6c8ba;
  border-radius: 8px;
  padding: 13px;
}

.case-card:hover,
.case-card.selected {
  background: #fff7ed;
  border-color: #fed7aa;
}

.case-card.high {
  border-right-color: var(--red);
}

.case-card.suspicious {
  border-right-color: var(--amber);
}

.case-card.normal {
  border-right-color: var(--orange);
}

.case-card strong {
  font-size: 17px;
  overflow-wrap: anywhere;
}

.case-card span,
.case-card small {
  color: var(--muted);
}

.case-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.case-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
}

.case-card-footer b {
  display: inline-flex;
  min-width: 36px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: #fff7ed;
  color: var(--ink);
  font-size: 13px;
}

.empty-mini,
.empty-state {
  color: var(--muted);
}

.case-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.case-header h3 {
  font-size: 28px;
  margin-bottom: 8px;
  overflow-wrap: anywhere;
}

.risk-score {
  min-width: 110px;
  border-radius: 8px;
  background: var(--orange-dark);
  color: white;
  padding: 14px;
  text-align: center;
}

.operator-focus {
  display: grid;
  grid-template-columns: minmax(240px, 1.4fr) repeat(2, minmax(140px, 0.8fr));
  gap: 10px;
  margin: 14px 0;
}

.operator-focus div {
  min-height: 70px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  padding: 12px;
}

.operator-focus span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 5px;
}

.operator-focus strong {
  display: block;
  overflow-wrap: anywhere;
}

.risk-score span {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.75);
  font-weight: 800;
}

.risk-score strong {
  display: block;
  font-size: 34px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.summary-strip div {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.summary-strip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 6px;
}

.summary-strip strong {
  overflow-wrap: anywhere;
}

.summary-strip small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.sla.ok {
  color: var(--orange-dark);
}

.sla.due_soon {
  color: var(--amber);
}

.sla.overdue {
  color: var(--red);
}

.sla.closed {
  color: var(--muted);
}

.fraud-map-card {
  margin-bottom: 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.map-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.map-card-head h4 {
  margin: 4px 0 0;
}

.map-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.map-link {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
  text-decoration: none;
}

.map-hint,
.map-empty {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.fraud-map {
  margin-top: 14px;
}

.fraud-map svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 260px;
  border-radius: 8px;
  direction: ltr;
}

.map-bg {
  fill: #fff7ed;
}

.map-grid {
  fill: url(#mapGrid);
  stroke: #fed7aa;
}

.fraud-map pattern path {
  stroke: rgba(116, 107, 99, 0.2);
  stroke-width: 1;
}

.route-line {
  fill: none;
  stroke: var(--orange);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 12 10;
}

.driver-line {
  fill: none;
  stroke: #b42318;
  stroke-width: 4;
  stroke-linecap: round;
}

.dropoff-zone {
  fill: rgba(180, 35, 24, 0.08);
  stroke: rgba(180, 35, 24, 0.35);
  stroke-width: 2;
}

.map-marker circle {
  stroke: #fff;
  stroke-width: 4;
}

.map-marker text {
  fill: #fff;
  font-family: Arial, Tahoma, sans-serif;
  font-size: 12px;
  font-weight: 900;
  text-anchor: middle;
}

.map-marker.pickup circle {
  fill: var(--orange);
}

.map-marker.dropoff circle {
  fill: var(--red);
}

.map-marker.driver circle {
  fill: var(--orange-dark);
}

.map-legend,
.map-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.map-legend span,
.map-stats div {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.legend {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.legend.pickup {
  background: var(--orange);
}

.legend.dropoff {
  background: var(--red);
}

.legend.driver {
  background: var(--orange-dark);
}

.map-stats div {
  display: grid;
  min-width: 150px;
  align-items: start;
  gap: 4px;
}

.map-stats strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.support-actions {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  background: #fffaf2;
  border: 1px solid #f1d7ae;
  border-radius: 8px;
  padding: 12px;
}

.readonly-note {
  margin-bottom: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.readonly-note strong {
  display: block;
  margin-bottom: 6px;
}

.readonly-note p {
  margin: 0;
  color: var(--muted);
}

.review-note {
  margin: 0;
}

.review-note textarea {
  min-height: 76px;
  direction: rtl;
  font-family: Arial, Tahoma, sans-serif;
  font-size: 14px;
}

.decision-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.decision-buttons button {
  flex: 1 1 140px;
}

.detail-columns {
  display: grid;
  grid-template-columns: minmax(220px, 0.78fr) minmax(0, 1.22fr);
  gap: 14px;
}

.case-details h4 {
  margin: 14px 0 8px;
}

.checklist,
.rules-list,
.timeline {
  display: grid;
  gap: 10px;
}

.checklist div,
.rules-list article,
.timeline article,
.official-trip div {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
}

.rules-list article {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
}

.rules-list article span {
  font-weight: 900;
  color: var(--orange-dark);
}

.rules-list article p,
.timeline article p,
.official-trip p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.official-trip div {
  display: grid;
  gap: 6px;
}

.official-trip span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.timeline article {
  border-right: 3px solid var(--orange);
}

.timeline time,
.timeline small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

pre {
  white-space: pre-wrap;
  direction: ltr;
  text-align: left;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

@media (max-width: 1120px) {
  .metric-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .orders-metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .orders-tools {
    grid-template-columns: 1fr;
  }

  .workload-panel {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .desk-grid,
  .suspicion-rules,
  .operator-focus,
  .detail-columns,
  .event-grid {
    grid-template-columns: 1fr;
  }

  .case-queue {
    max-height: none;
  }

  .queue-panel {
    position: static;
  }
}

@media (max-width: 780px) {
  .login-view,
  .desk-view {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 38vh;
    padding: 32px;
  }

  .login-visual h1 {
    font-size: 34px;
  }

  .rail {
    position: static;
    height: auto;
  }

  .workspace {
    padding: 16px;
  }

  .metric-grid,
  .orders-metrics,
  .workload-panel,
  .operator-focus,
  .summary-strip {
    grid-template-columns: 1fr;
  }

  .topbar,
  .case-header {
    align-items: stretch;
    flex-direction: column;
  }
}
