@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;500;600;700&display=swap');

:root {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --text: #101010;
  --muted: #6f6f6f;
  --line: #deded9;
  --dark: #111111;
  --soft: #efefeb;
  --danger: #b42318;
  --success: #177245;
  --radius: 16px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Montserrat', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
a { color: inherit; }

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.auth-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 34px;
  box-shadow: 0 12px 40px rgba(0,0,0,.05);
}
.brand { font-weight: 700; letter-spacing: .16em; font-size: 22px; }
.tagline { margin-top: 6px; color: var(--muted); font-size: 13px; }
.auth-card h1 { font-size: 28px; margin: 34px 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 7px; }
.field { margin: 16px 0; }
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px 13px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #8f8f88; }
textarea { min-height: 95px; resize: vertical; }

.btn {
  border: 0;
  background: var(--dark);
  color: white;
  border-radius: 12px;
  padding: 11px 15px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { opacity: .9; }
.btn.secondary { background: var(--soft); color: var(--text); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.success { background: var(--success); }
.btn.full { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 220px 1fr; }
.sidebar {
  background: #0e0e0e;
  color: white;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}
.sidebar .brand { font-size: 18px; }
.nav { display: grid; gap: 8px; }
.nav button {
  background: transparent;
  border: 0;
  color: #c8c8c8;
  text-align: left;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.nav button.active, .nav button:hover { background: #222; color: white; }
.sidebar-footer { margin-top: auto; font-size: 12px; color: #aaa; }

.main { padding: 30px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 28px; }
.topbar h1 { margin: 0; font-size: 28px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 24px; }
.card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card { padding: 18px; }
.card .number { font-size: 28px; font-weight: 700; margin-top: 8px; }
.panel { padding: 18px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 14px; }
.panel h2 { margin: 0; font-size: 18px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 920px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
tr:last-child td { border-bottom: 0; }
.row-click { cursor: pointer; }
.row-click:hover td { background: #fafaf8; }

.badge { display: inline-flex; align-items: center; border-radius: 999px; background: var(--soft); padding: 5px 9px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge.new, .badge.assigned { background: #f0f0ec; }
.badge.accepted, .badge.driver_assigned { background: #e9f4ee; color: #14613d; }
.badge.on_the_way, .badge.arrived, .badge.passenger_onboard { background: #edf2f8; color: #244c73; }
.badge.completed { background: #e4f4e8; color: #17663b; }
.badge.declined, .badge.cancelled { background: #fbeceb; color: #982d25; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 30;
}
.modal-backdrop.open { display: flex; }
.modal {
  width: min(920px, 100%); max-height: 92vh; overflow-y: auto; background: white; border-radius: 20px; padding: 22px; box-shadow: 0 24px 80px rgba(0,0,0,.18);
}
.modal.small-modal { width: min(620px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-head h2 { margin: 0; }
.icon-btn { border: 0; background: var(--soft); width: 34px; height: 34px; border-radius: 10px; cursor: pointer; }

.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px 22px; }
.detail-item { border-bottom: 1px solid var(--line); padding: 9px 0; }
.detail-item .k { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.detail-item .v { margin-top: 5px; font-size: 13px; }

.notice { padding: 12px 14px; border-radius: 12px; background: #f1f1ed; font-size: 13px; margin: 14px 0; }
.error { color: var(--danger); font-size: 12px; margin-top: 8px; }
.success-text { color: var(--success); font-size: 12px; margin-top: 8px; }
.hidden { display: none !important; }

.status-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.operator-trip { padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: white; margin-bottom: 12px; }
.operator-trip h3 { margin: 0 0 6px; font-size: 16px; }
.trip-route { font-weight: 600; }
.trip-meta { color: var(--muted); font-size: 12px; margin-top: 6px; }
.trip-actions { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 10; flex-direction: row; align-items: center; padding: 13px 16px; overflow-x: auto; }
  .sidebar .brand, .sidebar-footer { display: none; }
  .nav { display: flex; }
  .nav button { white-space: nowrap; }
  .main { padding: 18px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .grid-2, .grid-3, .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .cards { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .auth-card { padding: 24px; }
}
