/* Lifetime Logistics tracking. Brand navy and gold from the company logo. */
:root {
  --brand: #22206f;
  --brand-ink: #ffffff;
  --gold: #d4a017;
  --bg: #f4f5f9;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --text: #16172b;
  --muted: #5d6178;
  --line: #d9dce8;
  --ok: #1f8a4c;
  --warn: #b26a00;
  --bad: #c62f2f;
  --none: #6b7086;
  --focus: #3b5bdb;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 22, 60, .08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #8f8cf2;
    --brand-ink: #10112a;
    --gold: #e7b93a;
    --bg: #0f1020;
    --surface: #1a1b31;
    --surface-2: #24253f;
    --text: #eceef8;
    --muted: #a3a7c2;
    --line: #34365a;
    --ok: #4cc27f;
    --warn: #f0a93b;
    --bad: #ff6b6b;
    --none: #9a9eb8;
    --focus: #8fa8ff;
    --shadow: 0 2px 12px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #8f8cf2; --brand-ink: #10112a; --gold: #e7b93a; --bg: #0f1020; --surface: #1a1b31; --surface-2: #24253f;
  --text: #eceef8; --muted: #a3a7c2; --line: #34365a; --ok: #4cc27f; --warn: #f0a93b; --bad: #ff6b6b; --none: #9a9eb8;
  --focus: #8fa8ff; --shadow: 0 2px 12px rgba(0, 0, 0, .4); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: .2em 0 .5em; }
h2 { font-size: 1rem; margin: 0 0 .5em; }
h3 { font-size: .95rem; margin: 1.3em 0 .5em; }
.muted { color: var(--muted); font-weight: normal; }
.fine { color: var(--muted); font-size: .85rem; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: .7em 1.1em; font: inherit; font-weight: 600; cursor: pointer;
}
.btn:hover { border-color: var(--brand); }
.btn-primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn-big { width: 100%; padding: 1.05em; font-size: 1.15rem; margin: .6em 0 .3em; }
.btn-small { padding: .35em .75em; font-size: .85rem; }

/* ---- driver page ---- */
body.driver { min-height: 100vh; display: flex; justify-content: center; padding: 16px; }
.driver-card {
  width: 100%; max-width: 460px; background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px 20px 16px; align-self: flex-start;
}
.driver-brand { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.driver-brand img { height: 56px; width: auto; }
.brand-name { font-weight: 800; letter-spacing: .02em; color: var(--brand); font-size: 1.15rem; }
.brand-sub { color: var(--gold); font-weight: 600; font-size: .9rem; text-transform: uppercase; letter-spacing: .12em; }
.load-line { font-size: 1.1rem; }
.load-line .label { color: var(--muted); }
.load-number { font-size: 1.6rem; }
.route { font-weight: 600; margin-top: .1em; }
.status-box {
  display: flex; align-items: center; gap: 14px; background: var(--surface-2);
  border-radius: 10px; padding: 14px; margin: 12px 0;
}
.status-title { font-weight: 700; }
.status-line { color: var(--muted); font-size: .92rem; }
.pulse { width: 14px; height: 14px; border-radius: 50%; background: var(--ok); flex: none; animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31, 138, 76, .5); } 70% { box-shadow: 0 0 0 12px rgba(31, 138, 76, 0); } 100% { box-shadow: 0 0 0 0 rgba(31, 138, 76, 0); } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
.toggle { display: flex; align-items: center; gap: .5em; margin-top: 14px; }
.toggle input { width: 20px; height: 20px; }
.help { background: var(--surface-2); border-radius: 10px; padding: 4px 14px; margin-bottom: 14px; }
.privacy { background: var(--surface-2); border-radius: 10px; padding: 10px 14px; margin: 10px 0 4px; font-size: .92rem; }
.privacy h2 { font-size: .95rem; margin: 0 0 .3em; }
.privacy ul { margin: 0; padding-left: 1.2em; }
.privacy li + li { margin-top: .2em; }
.help h2 { margin-top: .8em; }
.driver-foot { margin-top: 18px; color: var(--muted); font-size: .8rem; text-align: center; }

/* ---- login ---- */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 24px; text-align: center; }
.login-card img { height: 120px; width: auto; }
.login-card form { display: grid; gap: 12px; text-align: left; margin-top: 10px; }
.login-card label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
.login-card input { font: inherit; padding: .65em .75em; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--text); }
.error { color: var(--bad); font-weight: 600; }

/* ---- team map ---- */
body.team { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; gap: 12px; padding: 8px 16px; background: #22206f; color: #fff;
  flex: none;
}
.topbar img { background: #fff; border-radius: 6px; padding: 2px 3px; height: 34px; width: auto; }
.topbar-title { font-weight: 800; white-space: nowrap; }
.topbar-title span { color: var(--gold); font-weight: 600; margin-left: .3em; }
.switches { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.switch { font-size: .75rem; padding: .2em .6em; border-radius: 99px; background: rgba(255, 255, 255, .15); white-space: nowrap; }
.switch.on { background: var(--gold); color: #1b1300; font-weight: 700; }
.topbar-user { font-size: .9rem; opacity: .9; }
.topbar-title span { color: #e7b93a; }
.topbar .btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .4); }
.topbar form { margin: 0; }

.layout { flex: 1; display: grid; grid-template-columns: 360px 1fr; min-height: 0; }
.sidebar { overflow-y: auto; padding: 12px; border-right: 1px solid var(--line); background: var(--bg); }
.counts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.count {
  display: grid; justify-items: center; padding: 6px 2px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); font: inherit; cursor: pointer;
}
.count strong { font-size: 1.2rem; line-height: 1.1; }
.count span { font-size: .68rem; color: var(--muted); text-align: center; }
.count-ok strong { color: var(--ok); } .count-warn strong { color: var(--warn); }
.count-bad strong { color: var(--bad); } .count-none strong { color: var(--none); }
.count.is-on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.search { width: 100%; font: inherit; padding: .55em .75em; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); margin-bottom: 12px; }
.panel { margin-bottom: 16px; }
.load-list, .alert-list, .stops, .messages, .detail-alerts { list-style: none; margin: 0; padding: 0; }
.load-list li + li, .alert-list li + li { margin-top: 6px; }
.load-item, .alert-item {
  width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px;
}
.load-item:hover, .alert-item:hover { border-color: var(--brand); }
.load-item.is-selected { border-color: var(--brand); box-shadow: inset 3px 0 0 var(--brand); }
.load-top { display: flex; align-items: center; gap: 8px; }
.load-route { font-weight: 600; margin-top: 2px; }
.load-meta { color: var(--muted); font-size: .82rem; }
.empty { color: var(--muted); padding: 8px 2px; }
.alert-item { border-left-width: 4px; }
.alert-title { font-weight: 600; font-size: .9rem; }
.sev-high { border-left-color: var(--bad); }
.sev-medium { border-left-color: var(--warn); }

.chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: .12em .55em; border-radius: 99px; white-space: nowrap; }
.chip-ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.chip-warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); }
.chip-bad { background: color-mix(in srgb, var(--bad) 16%, transparent); color: var(--bad); }
.chip-none { background: var(--surface-2); color: var(--muted); }
.badge { margin-left: auto; background: var(--bad); color: #fff; border-radius: 99px; font-size: .72rem; font-weight: 700; padding: 0 .5em; }

.map-area { position: relative; min-height: 0; }
#map { position: absolute; inset: 0; background: var(--surface-2); }
.detail {
  position: absolute; top: 12px; right: 12px; bottom: 12px; width: 400px; max-width: calc(100% - 24px);
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow-y: auto;
  padding: 14px 16px; z-index: 1000;
}
.detail-head { display: flex; align-items: center; justify-content: space-between; position: sticky; top: -14px; background: var(--surface); padding: 4px 0 8px; }
.detail-head h2 { margin: 0; font-size: 1.2rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: .9rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.stop { display: grid; grid-template-columns: 70px 1fr; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.stop-kind { font-weight: 700; font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.stop-row-pickup .stop-kind { color: var(--ok); }
.stop-row-delivery .stop-kind { color: var(--brand); }
.detail-alerts li { border-left: 4px solid var(--line); padding: 4px 10px; margin-bottom: 8px; font-size: .9rem; }
.detail-alerts p { margin: .25em 0; }
.link-row { display: flex; gap: 6px; }
.link-box { flex: 1; min-width: 0; font: .8rem ui-monospace, monospace; padding: .45em .5em; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); }
.messages li { border-top: 1px solid var(--line); padding: 7px 0; font-size: .88rem; }
.messages summary { cursor: pointer; color: var(--muted); font-size: .8rem; }
.msg-body { white-space: pre-wrap; background: var(--surface-2); padding: 8px; border-radius: 8px; margin: 4px 0 0; }
.msg-sent { color: var(--ok); font-weight: 600; }
.msg-failed, .msg-uncertain { color: var(--bad); font-weight: 600; }
.msg-suppressed { color: var(--muted); }

.stop-pin {
  display: grid !important; place-items: center; border-radius: 50%; font-weight: 800; font-size: 13px;
  color: #fff; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.stop-pickup { background: var(--ok); }
.stop-delivery { background: var(--brand); color: var(--brand-ink); }
.leaflet-container { font: inherit; }

@media (max-width: 800px) {
  body.team { height: auto; overflow: auto; }
  .topbar { flex-wrap: wrap; }
  .switches { margin-left: 0; order: 5; width: 100%; }
  .layout { display: flex; flex-direction: column-reverse; }
  .map-area { height: 55vh; }
  .sidebar { border-right: 0; }
  .counts { grid-template-columns: repeat(3, 1fr); }
  .detail { position: fixed; top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 70vh; }
}

/* Claim hold: location history kept for a possible cargo claim. */
.chip-hold { background: color-mix(in srgb, var(--gold) 35%, transparent); color: #5a4300; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-top: 1px solid var(--line); padding: 7px 0; font-size: .88rem; }

/* Driver page: the offer to use the app instead of keeping the page open. */
.app-box { border: 2px solid var(--brand); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.app-box p { margin: .35em 0 .7em; font-size: .92rem; }
.app-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.app-actions .btn { text-decoration: none; text-align: center; flex: 1 1 140px; }

/* The privacy page. */
.policy h1 { font-size: 1.45rem; margin: .2em 0 0; }
.policy h2 { font-size: 1.05rem; margin: 1.2em 0 .3em; }
.policy ul { margin: 0 0 .6em; padding-left: 1.2em; }
.policy li { margin-bottom: .35em; }
.driver-foot a { color: inherit; }
