/* ===================================================================
   AUTO BILLING ENTRY SYSTEM — Plain HTML/CSS/JS
   Design: dark canvas + amber "beacon" accent, asymmetric layout,
   Space Grotesk + JetBrains Mono, no gradients on dark, subtle grain.
   =================================================================== */

:root {
  --bg: #0b0d10;
  --bg-2: #101318;
  --panel: #14181f;
  --panel-2: #1a1f27;
  --border: #232a34;
  --border-strong: #2f3743;
  --text: #e7ecf3;
  --text-dim: #9aa4b2;
  --muted: #6b7482;
  --accent: #f5a623;         /* amber beacon */
  --accent-2: #ffcf70;
  --accent-ink: #1a1204;
  --ok: #4ade80;
  --err: #ef6a6a;
  --info: #7fb3ff;
  --shadow: 0 20px 40px -20px rgba(0,0,0,0.6);
  --radius: 14px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 500px at 90% -10%, rgba(245,166,35,0.08), transparent 60%),
    radial-gradient(900px 400px at -10% 110%, rgba(127,179,255,0.06), transparent 60%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--accent); color: var(--accent-ink); }

.mono { font-family: 'JetBrains Mono', ui-monospace, monospace; }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--err); font-size: 13px; margin: 6px 0 0; min-height: 18px; }
.ok  { color: var(--ok);  font-size: 13px; margin: 6px 0 0; min-height: 18px; }
.center { text-align: center; }
.right { text-align: right; }

/* ---------- View switching ---------- */
.view { display: none; }
.view.active { display: block; min-height: 100vh; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-shell {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 100vh;
  gap: 0;
}
.login-brand {
  padding: 80px 72px;
  border-right: 1px solid var(--border);
  background: var(--bg-2);
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
  overflow: hidden;
}
.login-brand::after{
  content:"";
  position:absolute; inset:0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.05'/></svg>");
  pointer-events:none;
  mix-blend-mode:overlay;
}
.brand-mark {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 12px; border: 1px solid var(--border-strong);
  border-radius: 999px; width: fit-content;
  font-size: 12px; letter-spacing: 0.14em; color: var(--text-dim);
  font-family: 'JetBrains Mono', monospace;
}
.brand-mark-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.login-title {
  font-size: clamp(38px, 5vw, 60px);
  line-height: 1.02;
  margin: 28px 0 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.login-title .accent { color: var(--accent); }
.login-sub {
  color: var(--text-dim); font-size: 17px; max-width: 460px; margin-bottom: 32px;
}
.login-feat { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.login-feat li { color: var(--text-dim); display: flex; align-items: center; gap: 10px; }
.login-feat .dot { width: 6px; height: 6px; border-radius: 999px; background: var(--accent); }

.login-card {
  padding: 80px 72px;
  display: flex; flex-direction: column; justify-content: center;
  background: var(--bg);
}
.login-card h2 { font-size: 28px; margin: 0 0 4px; letter-spacing: -0.01em; }
.login-card .muted { margin-bottom: 24px; display: block; }
.login-card form { display: grid; gap: 6px; max-width: 380px; }
.login-card label { color: var(--text-dim); font-size: 13px; margin-top: 10px; }
.login-card input {
  background: var(--panel); border: 1px solid var(--border);
  color: var(--text); padding: 12px 14px; border-radius: var(--radius-sm);
  font: inherit; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245,166,35,0.15); }
.hint { margin-top: 22px; color: var(--muted); font-size: 12px; }
.hint code {
  background: var(--panel); padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border); font-family: 'JetBrains Mono', monospace;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-ghost {
  cursor: pointer; font: inherit; border-radius: 999px;
  padding: 12px 20px; border: 1px solid transparent;
  transition: transform 0.15s ease, background 0.15s, border-color 0.15s, color 0.15s;
}
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  font-weight: 600; margin-top: 18px;
}
.btn-primary:hover { transform: translateY(-1px); background: var(--accent-2); }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
  background: transparent; color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost {
  background: transparent; color: var(--text-dim);
  border-color: transparent; padding: 8px 14px;
}
.btn-ghost:hover { color: var(--accent); }
.btn-danger {
  background: transparent; color: var(--err);
  border: 1px solid rgba(239,106,106,0.35); border-radius: 999px;
  padding: 6px 12px; font-size: 12px; cursor: pointer;
}
.btn-danger:hover { background: rgba(239,106,106,0.1); }

/* ============================================================
   TOPBAR / SHELL
   ============================================================ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 40px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.02em; }
.pill {
  display: inline-block; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); border: 1px solid rgba(245,166,35,0.35);
  padding: 3px 10px; border-radius: 999px; font-family: 'JetBrains Mono', monospace;
}
.pill-alt { color: var(--info); border-color: rgba(127,179,255,0.35); }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.ws-badge {
  font-family: 'JetBrains Mono', monospace; font-size: 11px;
  color: var(--muted); padding: 4px 8px; border-radius: 999px;
  border: 1px solid var(--border);
}
.ws-badge.online { color: var(--ok); border-color: rgba(74,222,128,0.35); }

.admin-main, .driver-main {
  padding: 32px 40px 60px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ============================================================
   TABS
   ============================================================ */
.tabs {
  display: flex; gap: 4px; margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.tab {
  background: transparent; border: none;
  color: var(--text-dim); padding: 10px 18px;
  cursor: pointer; font: inherit;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-color: var(--accent); }

.tab-panel { display: none; animation: fadeIn 0.25s ease; }
.tab-panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ============================================================
   CARDS / STATS
   ============================================================ */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative; overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.stat-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.stat-card::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent); opacity: 0.6;
}
.stat-label { color: var(--text-dim); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 10px; }
.stat-value { font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }

/* ============================================================
   SECTIONS / TABLES
   ============================================================ */
.section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 26px;
  margin-bottom: 20px;
}
.section h3 { margin: 0 0 16px; font-size: 16px; letter-spacing: 0.01em; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; }
.date-row { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.date-row label { color: var(--text-dim); font-size: 13px; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td {
  padding: 12px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.tbl th {
  color: var(--text-dim); font-weight: 500; font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase;
  background: var(--panel-2);
}
.tbl tr:last-child td { border-bottom: none; }
.tbl tr.flash { animation: flash 1.6s ease; }
@keyframes flash {
  0%   { background: rgba(245,166,35,0.18); }
  100% { background: transparent; }
}

/* ============================================================
   FORMS
   ============================================================ */
.form-row {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
}
.form-row input, .form-row select {
  flex: 1; min-width: 160px;
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); padding: 10px 12px; border-radius: var(--radius-sm);
  font: inherit; outline: none;
}
.form-row input:focus, .form-row select:focus { border-color: var(--accent); }

#trip-form { display: grid; gap: 6px; }
#trip-form label { color: var(--text-dim); font-size: 13px; margin-top: 8px; }
#trip-form input, #trip-form select {
  background: var(--bg-2); border: 1px solid var(--border);
  color: var(--text); padding: 10px 12px; border-radius: var(--radius-sm);
  font: inherit; outline: none;
}
#trip-form input:focus { border-color: var(--accent); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ============================================================
   DRIVER MAIN GRID
   ============================================================ */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand, .login-card { padding: 40px 28px; }
  .admin-main, .driver-main { padding: 20px 16px; }
  .topbar { padding: 12px 16px; }
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed; bottom: 28px; right: 28px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 12px 18px; border-radius: 10px;
  box-shadow: var(--shadow);
  transform: translateY(20px); opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
  pointer-events: none; z-index: 100;
  font-size: 14px;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.ok { border-color: rgba(74,222,128,0.5); }
.toast.err { border-color: rgba(239,106,106,0.5); }
