:root {
  --primary: #1a56db;
  --primary-dark: #1442a8;
  --bg: #f3f5f9;
  --panel: #ffffff;
  --border: #e2e5ec;
  --text: #1f2430;
  --muted: #6b7280;
  --danger: #d92d20;
  --danger-bg: #fef3f2;
  --success: #067647;
  --radius: 10px;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { font-weight: 700; font-size: 18px; color: var(--primary-dark); }
.user-box { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }

.layout {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
}
.panel h2 { margin: 0 0 8px; font-size: 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }

input[type=text], input[type=password] {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 4px;
}
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }

.btn {
  display: inline-block;
  padding: 9px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #eef2ff; color: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-large { padding: 12px 22px; font-size: 15px; margin-top: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.result-box { margin-top: 12px; padding: 10px 14px; border-radius: 6px; font-size: 13px; white-space: pre-line; }
.vehicle-warning { color: var(--danger); font-size: 11px; font-weight: 600; }
.result-box.ok { background: #ecfdf3; color: var(--success); }
.result-box.err { background: var(--danger-bg); color: var(--danger); }

.alert { padding: 10px 14px; border-radius: 6px; font-size: 14px; margin-top: 10px; }
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warn { background: #fffaeb; color: #b54708; }
.traffic-notes { font-size: 13px; line-height: 1.5; }
.traffic-notes div + div { margin-top: 4px; }
tr.traffic-row td { border-top: none; padding-top: 0; }

.start-row { display: grid; grid-template-columns: 2fr 1fr 1fr auto; gap: 12px; align-items: end; }

.atm-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.atm-toolbar input { flex: 1; min-width: 200px; margin-bottom: 0; }
.sel-count { font-size: 13px; color: var(--muted); margin-left: auto; }

.atm-table-wrap { max-height: 420px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; }
.atm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.atm-table th {
  position: sticky; top: 0; background: #f8f9fc; text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border); font-weight: 700; color: var(--muted);
}
.atm-table td { padding: 8px 12px; border-bottom: 1px solid #f0f1f5; vertical-align: top; }
.atm-table tr:hover td { background: #f8faff; }
.muted { color: var(--muted); }

.map { height: 420px; border-radius: 8px; margin: 14px 0; border: 1px solid var(--border); }

.route-summary { display: flex; gap: 24px; margin-bottom: 6px; flex-wrap: wrap; }
.route-summary .stat { background: #f8f9fc; border-radius: 8px; padding: 10px 18px; }
.route-summary .stat .label { font-size: 12px; color: var(--muted); }
.route-summary .stat .value { font-size: 20px; font-weight: 700; color: var(--primary-dark); }

.waze-btn {
  display: inline-block; background: #33ccff; color: #fff; padding: 5px 10px;
  border-radius: 5px; font-size: 12px; font-weight: 700; text-decoration: none;
}

.source-badge {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 20px;
  background: #fff7e6; color: #92600a; margin-left: 8px;
}

/* Login */
.login-body { display: flex; align-items: center; justify-content: center; height: 100vh; }
.login-card {
  background: var(--panel); padding: 34px 30px; border-radius: var(--radius);
  border: 1px solid var(--border); width: 340px;
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .subtitle { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.login-card button { width: 100%; margin-top: 10px; padding: 11px; }

@media print {
  .topbar, .panel:not(#resultPanel), #exportCsvBtn, #printBtn, .btn { display: none !important; }
  .map { height: 300px; }
}

@media (max-width: 700px) {
  .start-row { grid-template-columns: 1fr; }
}

/* Briqada modulu üçün əlavələr */
.topnav { display: flex; gap: 4px; }
.topnav a {
  color: var(--muted); text-decoration: none; font-size: 14px; padding: 6px 12px;
  border-radius: 6px;
}
.topnav a:hover { background: var(--bg); color: var(--text); }
.topnav a.active { background: var(--primary); color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.mini-route-summary { font-size: 12px; color: var(--muted); margin-top: 4px; }

@media (max-width: 700px) {
  .topnav { order: 3; width: 100%; justify-content: center; margin-top: 8px; }
  .topbar { flex-wrap: wrap; }
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.two-col h3 { font-size: 14px; margin: 0 0 8px; display: flex; align-items: center; justify-content: space-between; }
.return-row td { background: #f0fdf4; }
details summary { outline: none; }
details[open] summary { margin-bottom: 6px; }
.atm-table input[type="text"], .atm-table select { width: 100%; padding: 4px 6px; font-size: 12px; border: 1px solid var(--border); border-radius: 4px; }

@media (max-width: 700px) {
  .two-col { grid-template-columns: 1fr; }
}

.badge-ok { background:#d1fadf; color:#067647; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; }

/* Bildirişlərin qeydiyyatı (alerts_log.php) */
#logFilters { grid-template-columns: repeat(4, 1fr) auto; }
@media (max-width: 900px) {
  #logFilters { grid-template-columns: 1fr 1fr; }
}

/* Marşrut dayanacaqlarının icra qeydiyyatı (panel.js) */
.badge-pending { background:#f2f4f7; color:#475467; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; }
.badge-warn { background:#fef3f2; color:#d92d20; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; }
.exec-row-done td { background: #f6fef9; }
.exec-row-problem td { background: #fef6f5; }
.exec-row-next td { background: #fffaeb; border-top: 2px solid #f79009; border-bottom: 2px solid #f79009; }
.badge-next { background:#fef0c7; color:#b54708; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; margin-left:6px; }
.next-stop-card { background:#fffaeb; border:1px solid #f79009; border-radius:8px; padding:14px; margin:14px 0; }
.next-stop-card .next-stop-label { font-size:12px; font-weight:700; color:#b54708; text-transform:uppercase; letter-spacing:.03em; }
.next-stop-card .next-stop-name { font-size:17px; font-weight:700; margin:4px 0 2px; }
.next-stop-card .next-stop-addr { font-size:13px; color:var(--muted); margin-bottom:10px; }
.exec-note { font-size:12px; color:var(--muted); margin-top:3px; }
.exec-actions { display:flex; gap:6px; flex-wrap:wrap; }
.exec-form { margin-top:8px; padding:10px; background:#f8faff; border:1px solid var(--border); border-radius:6px; display:flex; flex-direction:column; gap:8px; }
.exec-form label { font-size:12px; color:var(--muted); }
.exec-form input[type="number"], .exec-form textarea { width:100%; padding:6px 8px; font-size:13px; border:1px solid var(--border); border-radius:4px; font-family:inherit; }
.exec-progress { font-size:13px; color:var(--muted); margin:4px 0 10px; }
