:root {
  --ink: #0f1b24;
  --ink-soft: #41525c;
  --muted: #7a8a93;
  --line: #e4e9ec;
  --surface: #ffffff;
  --bg: #f3f6f7;
  --teal: #0f9e75;
  --teal-dark: #0b6e54;
  --teal-soft: #e3f5ee;
  --amber: #b5790f;
  --amber-soft: #fbf0d8;
  --danger: #b3261e;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(15, 27, 36, 0.06), 0 6px 24px rgba(15, 27, 36, 0.05);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
h2 { font-size: 20px; font-weight: 600; margin: 0; }
h3 { font-size: 17px; font-weight: 600; margin: 0; }

/* ---- Brand ---- */
.brand-mark { font-size: 22px; font-weight: 500; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
.brand-mark.sm { font-size: 17px; }
.brand-mark strong { font-weight: 700; color: var(--teal-dark); }
.brand-mark .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px var(--teal-soft); }

/* ---- Buttons ---- */
.btn { font-family: inherit; font-size: 14px; font-weight: 500; padding: 9px 16px; border-radius: 9px; border: 1px solid transparent; cursor: pointer; transition: all .15s; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:hover { background: #eef2f3; }
.btn-block { width: 100%; margin-top: 8px; }

/* ---- Inputs ---- */
.input { width: 100%; font-family: inherit; font-size: 14px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); outline: none; transition: border .15s; }
.input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.field-label { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin: 12px 0 5px; }
.select-sm { width: auto; min-width: 180px; padding: 8px 12px; }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); padding: 32px; border-radius: 16px; box-shadow: var(--shadow); }
.login-sub { color: var(--muted); font-size: 13px; margin: 10px 0 18px; line-height: 1.5; }
.error-text { color: var(--danger); font-size: 13px; min-height: 18px; margin: 10px 0 0; }

/* ---- App layout ---- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.admin-name { font-size: 14px; color: var(--ink-soft); font-weight: 500; }

.tabs { display: flex; gap: 4px; padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.tab { font-family: inherit; font-size: 14px; font-weight: 500; color: var(--muted); background: none; border: none; padding: 13px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); }

.content { padding: 22px; max-width: 1100px; margin: 0 auto; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }

/* ---- Cards / tables ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.form-card { padding: 18px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.form-actions { margin-top: 14px; display: flex; align-items: center; gap: 12px; }
.form-msg, .form-msg.ok { font-size: 13px; color: var(--teal-dark); }
.form-msg.err { color: var(--danger); }

.table-card { overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; padding: 13px 16px; border-bottom: 1px solid var(--line); background: #fafbfb; }
.data-table td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--ink-soft); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr.clickable { cursor: pointer; }
.data-table tbody tr.clickable:hover { background: #f7faf9; }
.data-table td.empty { text-align: center; color: var(--muted); padding: 28px; }
.cell-strong { color: var(--ink); font-weight: 500; }

.pay { color: var(--amber); font-weight: 600; }

/* ---- Badges ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 500; padding: 4px 10px; border-radius: 20px; }
.badge.on { background: var(--teal-soft); color: var(--teal-dark); }
.badge.idle { background: #eef2f3; color: var(--muted); }
.badge.completed { background: #eef2f3; color: var(--ink-soft); }
.badge.running { background: var(--teal-soft); color: var(--teal-dark); }
.badge .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: .3; } 100% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .badge .pulse { animation: none; } }

.link { color: var(--teal-dark); text-decoration: none; font-weight: 500; }
.link:hover { text-decoration: underline; }

/* ---- Map ---- */
.map-card { padding: 0; overflow: hidden; }
.map { width: 100%; height: 480px; }
.map-modal { height: 360px; border-radius: 10px; }

/* ---- Modal ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(15, 27, 36, .45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 1000; }
.modal { background: #fff; border-radius: 16px; width: 100%; max-width: 640px; padding: 20px; box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.trip-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 14px; }
.stat { background: var(--bg); border-radius: 10px; padding: 11px 14px; }
.stat .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.stat .value { font-size: 18px; font-weight: 600; color: var(--ink); margin-top: 3px; }
.stat .value.pay { color: var(--amber); }

@media (max-width: 600px) {
  .content { padding: 14px; }
  .data-table th:nth-child(3), .data-table td:nth-child(3) { display: none; }
}
