/* GT Freight Lines — operations panel. Design language: Company Operations Dashboard
   (prototype). Dark near-black theme, orange accent, ledger rows, stat cards. */
:root {
  --bg: #0a0c10;
  --bg2: #0e1117;
  --card: #141821;
  --card2: #1a1f2a;
  --line: #242b38;
  --text: #ffffff;
  --muted: #9aa1ae;
  --faint: #646b78;
  --accent: #e8632b;
  --accent-dim: rgba(232, 99, 43, .14);
  --green: #3ecf6f;
  --green-dim: rgba(62, 207, 111, .13);
  --gold: #f5b544;
  --gold-dim: rgba(245, 181, 68, .13);
  --red: #f05145;
  --red-dim: rgba(240, 81, 69, .13);
  --steel: #8fa8cf;
  --steel-dim: rgba(143, 168, 207, .13);
  --radius: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
#app { min-height: 100%; }
a { color: var(--accent); }

/* ---------- login ---------- */
.login-wrap {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #141a24 0%, var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  text-align: center;
}
.login-card .mark {
  width: 64px; height: 48px; border-radius: 12px; margin: 0 auto 18px;
  background: #f2f3f5; color: #141821;
  font-weight: 900; font-style: italic; font-size: 20px; letter-spacing: -.02em;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 22px; letter-spacing: -.02em; }
.login-card .sub { color: var(--muted); font-size: 13px; margin: 6px 0 22px; }
.login-card form { text-align: left; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; padding: 12px 14px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); font-size: 15px; font-family: var(--font);
}
.field input:focus { outline: none; border-color: var(--accent); }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 12px 20px; border: none; border-radius: 12px;
  background: var(--accent); color: #fff;
  font-size: 15px; font-weight: 700; font-family: var(--font);
  cursor: pointer; width: 100%;
}
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--line); width: auto; font-weight: 600;
}
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.login-err {
  display: none; margin-top: 14px; padding: 10px 12px;
  background: var(--red-dim); border: 1px solid rgba(240,81,69,.35);
  border-radius: 12px; color: var(--red); font-size: 13px;
}

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100dvh; }
.side {
  width: 232px; flex-shrink: 0;
  background: var(--bg2); border-right: 1px solid var(--line);
  padding: 20px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100dvh;
}
.brand { padding: 4px 10px 18px; display: flex; align-items: center; gap: 10px; }
.brand .mark {
  width: 44px; height: 34px; border-radius: 8px; flex-shrink: 0;
  background: #f2f3f5; color: #141821;
  font-weight: 900; font-style: italic; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.brand .t1 { font-weight: 800; font-size: 15px; letter-spacing: -.01em; }
.brand .t2 { color: var(--muted); font-size: 12px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav a:hover { background: var(--card); color: var(--text); }
.nav a.on { background: var(--accent-dim); color: var(--accent); }
.nav .ico { width: 20px; text-align: center; }
.side .who { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line); }
.side .who .n { font-size: 13px; font-weight: 600; }
.side .who .r { font-size: 11px; color: var(--muted); text-transform: capitalize; }
.side .who button {
  margin-top: 8px; background: none; border: none; color: var(--faint);
  font-size: 12px; cursor: pointer; padding: 0; font-family: var(--font);
}
.side .who button:hover { color: var(--red); }
.main { flex: 1; padding: 28px 32px; max-width: 1180px; }

/* mobile app header — mirrors the prototype's logo + "Company Operations" + date card */
.app-head { display: none; }
.page-h { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-h h2 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.page-h .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.page-h .meta { color: var(--muted); font-size: 13px; }
.page-h .btn { flex-shrink: 0; }

/* ---------- cards ---------- */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .grid2 { grid-template-columns: 1fr; } }
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px;
}
.card h3 { font-size: 17px; letter-spacing: -.01em; font-weight: 700; }
.card .lbl {
  display: inline-block; margin-top: 4px;
  font-size: 12px; color: var(--muted);
}
.card .body { margin-top: 12px; font-size: 14px; }
.empty { color: var(--faint); font-size: 14px; padding: 18px 0 6px; }

/* prototype-style empty state: white icon tile + title + muted subtitle */
.empty-block {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 44px 24px; text-align: center;
}
.empty-block .eico {
  width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 18px;
  background: #f2f3f5; color: #141821;
  display: flex; align-items: center; justify-content: center; font-size: 28px;
}
.empty-block h4 { font-size: 21px; font-weight: 700; margin-bottom: 8px; letter-spacing: -.01em; }
.empty-block p { color: var(--muted); font-size: 14px; max-width: 340px; margin: 0 auto; }

/* prototype-style info note row */
.note-row {
  display: flex; gap: 12px; align-items: center;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  color: var(--muted); font-size: 14px; margin-bottom: 12px;
}
.note-row .nico { color: var(--accent); font-size: 18px; flex-shrink: 0; }

.sched { font-weight: 600; color: var(--green); font-size: 13px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { text-align: right; font-variant-numeric: tabular-nums; }
.micro {
  font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--faint); font-weight: 600;
}

/* ---------- stat cards (prototype: big number, orange/gold top edge) ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px;
  position: relative; overflow: hidden;
}
.stat::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--accent); }
.stat.gold::before { background: var(--gold); }
.stat .sl { color: var(--muted); font-size: 14px; }
.stat .sv {
  font-size: 34px; font-weight: 800; letter-spacing: -.02em;
  margin: 8px 0; font-variant-numeric: tabular-nums;
}
.stat .sv.neg { color: var(--red); }
.stat .ss { color: var(--muted); font-size: 13px; }

/* ---------- ledger rows (prototype list style) ---------- */
.ledger { display: flex; flex-direction: column; gap: 10px; }
.ledger-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px;
  cursor: pointer;
}
.ledger-row:hover { border-color: #354052; }
.ledger-ico {
  width: 48px; height: 48px; flex: 0 0 48px; border-radius: 12px;
  background: #20262f; color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800;
}
.ledger-ico.light { background: #f2f3f5; color: #141821; }
.ledger-main { flex: 1; min-width: 0; }
.ledger-t { font-weight: 700; font-size: 16px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ledger-s { color: var(--muted); font-size: 13px; margin-top: 3px; }
.ledger-s2 { color: var(--faint); font-size: 13px; margin-top: 2px; }
.ledger-r {
  text-align: right; font-weight: 800; font-size: 17px;
  font-variant-numeric: tabular-nums; white-space: nowrap; flex-shrink: 0;
}
.ledger-r.neg { color: var(--red); }
.ledger-r .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 2px; }

/* ---------- driver card (prototype fleet style) ---------- */
.drv-top { display: flex; gap: 14px; align-items: center; }
.drv-top .ledger-ico { width: 56px; height: 56px; flex-basis: 56px; font-size: 22px; }
.drv-name { font-size: 19px; font-weight: 700; }
.drv-eid { color: var(--accent); font-weight: 700; font-size: 14px; margin-top: 2px; }
.drv-sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.mini-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.mini-grid .ml { color: var(--muted); font-size: 12px; }
.mini-grid .mv { font-weight: 700; font-size: 16px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.contact-green { color: var(--green); }
.link-orange { color: var(--accent); }

/* in-transit switcher */
.transit-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.transit-bar .arrow {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line); color: var(--text);
  font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.transit-bar .arrow:hover { border-color: var(--accent); color: var(--accent); }
.transit-bar .count { color: var(--muted); font-size: 13px; }

/* ---------- tables (kept for genuinely tabular data) ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; padding: 12px 14px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .06em; color: var(--faint); border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: var(--card2); }
.num { font-variant-numeric: tabular-nums; text-align: right; }
.pill {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700; white-space: nowrap;
  text-transform: uppercase; letter-spacing: .05em;
}
.pill.green { background: var(--green-dim); color: var(--green); }
.pill.amber { background: var(--gold-dim); color: var(--gold); }
.pill.blue { background: var(--steel-dim); color: var(--steel); }
.pill.gray { background: rgba(154,161,174,.12); color: var(--muted); }
.pill.red { background: var(--red-dim); color: var(--red); }

/* ---------- detail ---------- */
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; flex-wrap: wrap; }
.detail-head h2 { font-size: 30px; letter-spacing: -.02em; font-weight: 800; }
.route { font-size: 16px; color: var(--muted); margin-bottom: 16px; }
.route b { color: var(--text); }
.actions { display: flex; gap: 10px; margin: 18px 0; flex-wrap: wrap; }
.actions .btn { width: auto; }
.section-t { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); margin: 22px 0 10px; font-weight: 600; }
.big-amount { font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(4,6,10,.7);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal {
  width: 100%; max-width: 480px; background: var(--card);
  border: 1px solid var(--line); border-radius: 20px; padding: 24px;
  max-height: 90dvh; overflow-y: auto;
}
.modal h3 { font-size: 19px; margin-bottom: 16px; font-weight: 800; letter-spacing: -.01em; }
.modal .row { display: flex; gap: 10px; margin-top: 18px; }
.modal .row .btn { flex: 1; }
select.field-in, textarea.field-in {
  width: 100%; padding: 12px 14px; background: var(--bg2);
  border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); font-size: 15px; font-family: var(--font);
}
select.field-in:focus, textarea.field-in:focus { outline: none; border-color: var(--accent); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--card2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 20px; border-radius: 12px; font-size: 14px; z-index: 99;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

@media (max-width: 860px) {
  .side { display: none; }
  .main { padding: 20px 16px; }
  .app-head {
    display: flex; align-items: center; gap: 12px;
    background: var(--card); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 12px 14px; margin-bottom: 18px;
  }
  .app-head .logo {
    width: 52px; height: 40px; border-radius: 8px; flex-shrink: 0;
    background: #f2f3f5; color: #141821;
    font-weight: 900; font-style: italic; font-size: 15px; letter-spacing: -.02em;
    display: flex; align-items: center; justify-content: center;
  }
  .app-head .t1 { font-weight: 800; font-size: 17px; letter-spacing: -.01em; }
  .app-head .t2 { color: var(--muted); font-size: 13px; }
  .tabbar {
    position: fixed; bottom: 0; left: 0; right: 0;
    display: flex; background: var(--bg2); border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 40;
    overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  }
  .tabbar::-webkit-scrollbar { display: none; }
  .tabbar a {
    flex: 0 0 auto; min-width: 68px; text-align: center; padding: 8px 10px; border-radius: 14px;
    color: var(--muted); text-decoration: none; font-size: 11px; font-weight: 600;
    white-space: nowrap;
  }
  .tabbar a.on { background: #f2f3f5; color: #141821; }
  .tabbar a.on .ico { color: var(--accent); }
  .tabbar .ico { display: block; font-size: 20px; margin-bottom: 2px; }
  .main { padding-bottom: 84px; }
  table.tbl { min-width: 620px; }
  .page-h h2 { font-size: 26px; }
}
@media (min-width: 861px) { .tabbar { display: none; } }
