/* TrailCommand Cloud dashboard. Both themes use the website colors. */
@font-face { font-family: Barlow; font-weight: 400; font-display: swap; src: url(fonts/barlow-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 500; font-display: swap; src: url(fonts/barlow-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Barlow; font-weight: 600; font-display: swap; src: url(fonts/barlow-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url(fonts/barlow-condensed-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url(fonts/barlow-condensed-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url(fonts/barlow-condensed-latin-700-normal.woff2) format("woff2"); }

:root {
  --bg: #142A1D; --bar: #0E1E14; --panel: #1F3B2D; --panel-2: #244433;
  --line: #2F5C44; --line-2: #2A5039; --input: #142A1D; --border: #648C76;
  --text: #F1EBDD; --text-2: #DCD4C2; --muted: #B9C7B5;
  --accent: #E39363; --accent-text: #F0B793; --accent-bg: #3D2F1E; --accent-line: #7A5236; --on-accent: #142A1D;
  --logo: #E9A955;
  --track: #E39363; --trip-muted: #8A6A54; --map-mark-bg: #142A1D; --map-mark-fg: #F1EBDD;
  --map-bg: #1F3B2D; --attribution-bg: rgba(20,42,29,.8);
  --switch-off: #648C76; --switch-pending: #2B4A75; --switch-queued: #7A5236;
  --danger-line: #8A4A40; --signal-off: #4F7360;
  --good: #6FBF8E; --good-text: #A6DDBB; --good-bg: #17301F;
  --warn: #FACC15; --warn-text: #FDE68A; --warn-bg: #352D0E;
  --bad: #F87171; --bad-text: #FCA5A5; --bad-bg: #3A1A1A;
  --info: #60A5FA; --info-text: #93C5FD; --info-bg: #17243A;
  --radius: 14px;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  color-scheme: dark;
}

/* Light theme: the website's cream, forest and rust. */
:root[data-theme="light"] {
  --bg: #F1EBDD; --bar: #FBF8F1; --panel: #FFFFFF; --panel-2: #F7F3EA;
  --line: #DCD4C2; --line-2: #E6DFCF; --input: #FFFFFF; --border: #849689;
  --text: #1F3B2D; --text-2: #3A5444; --muted: #55695C;
  --accent: #8F3F16; --accent-text: #7A3512; --accent-bg: #F6E7DC; --accent-line: #E0BBA3; --on-accent: #F1EBDD;
  --good: #2E8B57; --good-text: #1E6B3E; --good-bg: #DDEFE2;
  --warn: #B87C08; --warn-text: #7A5200; --warn-bg: #FBEFC9;
  --bad: #C8402F; --bad-text: #9B2C20; --bad-bg: #FBE3DF;
  --info: #2F6FD6; --info-text: #1D4FB0; --info-bg: #DEE9FB;
  --logo: #8F3F16;
  --track: #8F3F16; --trip-muted: #C49B80; --map-mark-bg: #FFFFFF; --map-mark-fg: #1F3B2D;
  --map-bg: #E6DFCF; --attribution-bg: rgba(255,255,255,.85);
  --switch-off: #849689; --switch-pending: #4A78B8; --switch-queued: #A87B3D;
  --danger-line: #D9A49C; --signal-off: #C7CFC6;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.4 Barlow, system-ui, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-text); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; letter-spacing: 0.02em; margin: 0; }
h1 { font-size: 34px; }
h2 { font-size: 22px; letter-spacing: 0.03em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.label { color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.num { font-family: var(--display); font-weight: 600; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------- buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--border); background: transparent; color: var(--text); cursor: pointer; font-weight: 500; white-space: nowrap; }
.btn:hover { background: var(--panel-2); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-text); }
.btn.soft { border-color: var(--accent-line); background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.btn.danger { border-color: var(--danger-line); color: var(--bad-text); }
.btn.sm { min-height: 40px; padding: 0 12px; font-size: 14px; }
.input { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--input); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { color: var(--text-2); font-size: 14px; font-weight: 500; }
.seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.seg button { min-height: 40px; padding: 0 16px; border-radius: 9px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.chip { min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: transparent; color: var(--text-2); cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }

/* ---------- pills */
.pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-bg); color: var(--good-text); }
.pill.good .dot { background: var(--good); }
.pill.warn { background: var(--accent-bg); color: var(--accent-text); }
.pill.warn .dot { background: var(--accent); }
.pill.plain { background: var(--input); color: var(--text-2); font-weight: 500; }
.pill.info { background: var(--info-bg); color: var(--info-text); }

/* ---------- shell */
.topbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--bar); position: sticky; top: 0; z-index: 1000; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-block { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.brand-credit { display: inline-flex; align-items: center; min-height: 24px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.brand-credit:hover { color: var(--accent-text); text-decoration: underline; }
.brand b { font-family: var(--display); font-weight: 700; font-size: 22px; letter-spacing: .06em; text-transform: uppercase; }
.brand span { font-size: 12px; font-weight: 600; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; }
.topbar select { min-height: 44px; border-radius: 8px; border: 1px solid var(--border); background: var(--input); padding: 0 10px; max-width: 260px; }
.topbar .status { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; align-items: center; }
.avatar { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--border); background: var(--input); font-weight: 600; cursor: pointer; }

.layout { display: flex; flex-wrap: wrap; gap: 24px; padding: 24px; max-width: 1480px; margin: 0 auto; }
.nav { flex: 1 1 180px; max-width: 220px; display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; color: var(--text-2); min-height: 44px; }
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-bg); color: var(--accent-text); font-weight: 600; }
.nav svg { flex: none; }
main { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
@media (max-width: 720px) {
  .layout { padding: 16px; gap: 12px; }
  .nav { max-width: none; flex-direction: row; overflow-x: auto; }
  .nav a { padding: 10px 12px; white-space: nowrap; }
  .topbar { padding: 10px 16px; }
  .topbar select { max-width: 170px; }
  h1 { font-size: 28px; }
}

/* ---------- cards */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 12px; }
.grid-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 20px; align-items: start; }
.tile { gap: 8px; padding: 18px 20px; }
.tile .big { font-family: var(--display); font-size: 46px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.tile .row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.meter { height: 10px; border-radius: 6px; background: var(--line); overflow: hidden; }
.meter > div { height: 100%; border-radius: 6px; transition: width .4s; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--accent-bg); border: 1px solid var(--accent-line); color: var(--accent-text); }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 0; border-top: 1px solid var(--line-2); min-height: 64px; }
.list-row .grow { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.list-row .name { font-weight: 600; font-size: 16px; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px 20px; margin: 0; }
.kv div { display: flex; flex-direction: column; gap: 2px; }
.kv dt { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.kv dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.subcard { background: var(--panel-2); border-radius: 12px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.tires { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.tires div { background: var(--panel-2); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; }
.tires .num { font-size: 24px; }
.sensors { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.sensors div { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.sensors .num { font-size: 22px; }

/* ---------- switch */
.switch { flex: none; width: 58px; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; display: flex; align-items: center; }
.switch .track { position: relative; display: block; width: 58px; height: 32px; border-radius: 999px; background: var(--switch-off); transition: background .2s; }
.switch .knob { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #F4F2EE; transition: left .2s; }
.switch[aria-checked="true"] .track { background: var(--accent); }
.switch[aria-checked="true"] .knob { left: 30px; }
.switch.pending .track { background: var(--switch-pending); }
.switch.queued .track { background: var(--switch-queued); }
.switch:disabled { cursor: progress; }
.ctl-status { font-size: 13px; font-weight: 600; min-width: 96px; text-align: right; }

/* ---------- tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
th { text-align: left; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; padding: 10px 12px; }
td { padding: 12px; border-top: 1px solid var(--line-2); vertical-align: middle; }
td.actions { text-align: right; white-space: nowrap; }
td.actions .btn { margin-left: 6px; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: var(--accent-bg); color: var(--accent-text); font-size: 13px; font-weight: 600; }

/* ---------- map */
.map { width: 100%; height: 260px; border-radius: 10px; background: var(--map-bg); z-index: 0; }
.map.tall { height: auto; min-height: 460px; }
.leaflet-container { font: inherit; background: var(--map-bg); }
.leaflet-bar a, .leaflet-control-layers { background: var(--panel); color: var(--text); border-color: var(--border) !important; }
.leaflet-bar a:hover { background: var(--panel-2); }
.leaflet-control-attribution { font-size: 11px !important; background: var(--attribution-bg) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--text-2) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--panel); color: var(--text); }
.gm-style .gm-style-iw-c, .gm-style .gm-style-iw-tc::after { background: var(--panel); }
.gm-style .gm-style-iw-d { overflow: auto !important; }
.map-tip { color: var(--text); font: 13px/1.4 system-ui, sans-serif; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; color: var(--muted); font-size: 13px; align-items: center; }
.legend .sw { display: inline-block; width: 22px; height: 4px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.trip-btn { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 10px; color: var(--text); text-align: left; background: transparent; border: 1px solid transparent; cursor: pointer; width: 100%; }
.trip-btn:hover { background: var(--panel-2); }
.trip-btn[aria-pressed="true"] { background: var(--accent-bg); border-color: var(--accent-line); }
.trip-btn .top { display: flex; justify-content: space-between; gap: 8px; font-weight: 600; }

/* ---------- charts */
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis text { fill: var(--muted); font-size: 12px; }
.chart .grid line { stroke: var(--line-2); }
.chart .tip { position: absolute; pointer-events: none; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; font-size: 13px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: 0 4px 14px rgba(0,0,0,.4); }
.chart .tip b { font-family: var(--display); font-size: 18px; font-weight: 600; }
.chart-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.charts { display: flex; flex-direction: column; gap: 18px; }

/* ---------- dialog & toast */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: 16px; padding: 0; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
dialog::backdrop { background: rgba(0,0,0,.6); }
dialog form, dialog .body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
dialog pre { margin: 0; max-height: 60vh; overflow: auto; background: var(--bg); border-radius: 10px; padding: 14px; font-size: 13px; color: var(--text-2); }
dialog video { width: 100%; border-radius: 10px; background: #000; }
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 2000; }
.toast { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; max-width: 360px; box-shadow: 0 6px 20px rgba(0,0,0,.4); }
.toast.err { border-color: var(--danger-line); color: var(--bad-text); }

/* ---------- two-factor setup */
.stack { display: flex; flex-direction: column; gap: 14px; }
.row-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.row-actions.start { justify-content: flex-start; }
.qr { width: 200px; height: 200px; align-self: center; border-radius: 8px; overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: 100%; }
.key { display: block; margin-top: 8px; font-size: 14px; overflow-wrap: anywhere; color: var(--text); }
.code-input { font-size: 18px; letter-spacing: .08em; font-variant-numeric: tabular-nums; }
.codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 6px 16px; margin: 0; padding: 14px 14px 14px 36px; background: var(--panel-2); border-radius: 10px; font-family: ui-monospace, monospace; font-size: 14px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
textarea.input { resize: vertical; font: inherit; color: inherit; }
.human:empty { display: none; }
.field-row { display: grid; grid-template-columns: 2fr 3fr; gap: 12px; }

/* ---------- login */
/* Ozark Mountain Technologies website colors, scoped to this page. It stays
   dark in both themes, so it sets everything it uses that the light theme changes. */
.login {
  --logo: #E9A955; --bad-text: #FCA5A5; color-scheme: dark;
  --panel: #142A1D; --panel-2: #1F3B2D; --input: #1F3B2D; --border: #5E8570;
  --text: #F1EBDD; --text-2: #DCD4C2; --muted: #B9C7B5;
  --accent: #E39363; --accent-text: #F0B793; --on-accent: #142A1D;
  position: relative; isolation: isolate; min-height: 100vh; display: grid; align-items: center; justify-items: start;
  padding: 24px clamp(24px, 7vw, 112px); background: #142A1D; color: var(--text);
}
/* The photo starts right of the card so the truck and trailer stay in view. */
.login::before {
  content: ""; position: absolute; inset: 0 0 0 30%; z-index: -1;
  background: linear-gradient(90deg, #142A1D, rgba(20,42,29,0) 24%), url(img/login-bg-v2.jpg) 45% 100% / cover no-repeat;
}
@media (max-width: 1100px) {
  .login { justify-items: center; align-items: start; padding-top: 42vw; }
  .login::before { inset: 0 0 auto; height: 44vw; background: linear-gradient(0deg, #142A1D, rgba(20,42,29,0) 16%), url(img/login-bg-v2.jpg) 50% 100% / cover no-repeat; }
}
.login .card { width: min(420px, 100%); padding: 28px; gap: 16px; border: 2px solid #2F5C44; border-radius: 12px; box-shadow: 0 30px 60px rgba(0,0,0,.28); }
.login .brand { justify-content: center; margin-bottom: 4px; }
.login h1 { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.login .btn { min-height: 48px; border-radius: 4px; font-family: var(--display); font-size: 18px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.login .btn.soft { background: transparent; border: 2px solid var(--text); color: var(--text); }
.login .btn.soft:hover { background: #2F5C44; }
.login .input { border-radius: 4px; }
.powered { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 44px; padding-top: 16px; border-top: 1px solid #2F5C44; color: var(--text); }
.powered svg { flex: none; }
.powered > span:not(.sr-only) { display: flex; flex-direction: column; line-height: 1.25; }
.powered b { font-family: var(--display); font-size: 16px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.powered:hover b { color: var(--accent); text-decoration: underline; }
.err-text { color: var(--bad-text); font-size: 14px; min-height: 20px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.skeleton { color: var(--muted); padding: 20px 0; }
.mapboxgl-map { font: inherit; }
.mapboxgl-popup-content { background: var(--panel); padding: 6px 10px; border-radius: 8px; box-shadow: 0 2px 10px rgb(0 0 0 / .35); }
.mapboxgl-popup-tip { border-top-color: var(--panel) !important; border-bottom-color: var(--panel) !important; }
.tc-map-dot { border-radius: 50%; box-sizing: border-box; cursor: pointer; }
.tc-style-switch { display: flex; }
.mapboxgl-ctrl-group.tc-style-switch button { width: auto; padding: 0 10px; font: 600 12px/29px system-ui, sans-serif; color: #333; }
.mapboxgl-ctrl-group.tc-style-switch button + button { border-top: 0; border-left: 1px solid #ddd; }
.mapboxgl-ctrl-group.tc-style-switch button[aria-pressed="true"] { background: #333; color: #fff; }

/* plans */
.locked { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 14px; border: 1px dashed var(--line-2); border-radius: 10px; color: var(--text-2); }
.locked .grow { flex: 1 1 200px; }
dialog:has(.body.wide) { width: min(900px, calc(100vw - 32px)); }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.plan-card { display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--line-2); border-radius: 12px; background: var(--panel-2); }
.plan-card.current { border-color: var(--good); }
.plan-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.plan-head h3 { margin: 0; font-size: 20px; }
.plan-card ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: 14px; flex: 1; }
.plan-buy { display: flex; flex-direction: column; gap: 6px; }
.switch:disabled:not(.pending):not(.queued) { opacity: .5; cursor: not-allowed; }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
