/* "Industry" design system from the Crew Clock design handoff: tokens + component classes,
   plus the app-specific pieces for the crew phone app and office dashboard. */
@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;700&family=Barlow+Condensed:wght@400;600&display=swap');

:root {
  --color-bg: #f2f2f3;
  --color-surface: #e9e9ea;
  --color-text: #1d1f20;
  --color-accent: #5980a6;
  --color-divider: color-mix(in srgb, #1d1f20 16%, transparent);
  --color-hair: color-mix(in srgb, #1d1f20 8%, transparent);

  --color-neutral-100: #f5f5f8;
  --color-neutral-200: #e7e7ea;
  --color-neutral-300: #d4d4d7;
  --color-neutral-400: #b7b7ba;
  --color-neutral-500: #98989b;
  --color-neutral-600: #7a7a7d;
  --color-neutral-700: #5d5d60;
  --color-neutral-800: #424244;
  --color-neutral-900: #2b2b2d;

  --color-accent-100: #eef6ff;
  --color-accent-200: #d6ebff;
  --color-accent-300: #b5d9fd;
  --color-accent-400: #94bce3;
  --color-accent-500: #749dc4;
  --color-accent-600: #597ea3;
  --color-accent-700: #416180;
  --color-accent-800: #2c455d;
  --color-accent-900: #1d2d3d;

  --font-heading: "Barlow Condensed", system-ui, sans-serif;
  --font-body: "Barlow", system-ui, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;

  --shadow-sm: 0 1px 2px color-mix(in srgb, #2b2b2d 14%, transparent);
  --shadow-md: 0 3px 10px color-mix(in srgb, #2b2b2d 16%, transparent);
  --shadow-lg: 0 12px 32px color-mix(in srgb, #2b2b2d 22%, transparent);

  --ride-stripes: repeating-linear-gradient(45deg, var(--color-accent-400) 0 3px, var(--color-accent-200) 3px 6px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--color-bg); color: var(--color-text);
  font-family: var(--font-body); font-size: 15px; line-height: 1.55; font-weight: 400;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 600; line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 6.8px; }
h1 { font-size: 42px; } h2 { font-size: 30px; } h3 { font-size: 22px; } h4 { font-size: 18px; }
p { margin: 0 0 10.2px; }
a { color: var(--color-accent-700); text-underline-offset: 3px; }
a:hover { color: var(--color-accent-800); }
button, input, select, textarea { font-family: inherit; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }
.hidden { display: none !important; }
.muted { color: var(--color-neutral-700); }
.mono { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums; }
.kicker { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--color-accent-700); font-weight: 600; }
.label-sm { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--color-neutral-700); }
.heading { font-family: var(--font-heading); font-weight: 600; }

/* — blueprint frame with "+" registration marks — */
.blueprint { position: relative; border: 1px solid var(--color-divider); border-radius: 0; }
.blueprint > .corner { position: absolute; width: 11px; height: 11px; color: color-mix(in srgb, var(--color-text) 55%, transparent); pointer-events: none; }
.blueprint > .corner::before, .blueprint > .corner::after { content: ""; position: absolute; background: currentColor; }
.blueprint > .corner::before { left: 5px; top: 0; width: 1px; height: 100%; }
.blueprint > .corner::after { top: 5px; left: 0; width: 100%; height: 1px; }
.blueprint > .corner.tl { top: -6px; left: -6px; }
.blueprint > .corner.tr { top: -6px; right: -6px; }
.blueprint > .corner.bl { bottom: -6px; left: -6px; }
.blueprint > .corner.br { bottom: -6px; right: -6px; }

/* — buttons — */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; text-decoration: none;
  font-family: var(--font-heading); font-weight: 600; font-size: 14px; line-height: 1.2; color: var(--color-text);
  background: transparent; border: 1px solid var(--color-divider); border-radius: 0;
  padding: 6.8px 12.2px; min-height: 44px;
}
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-bg); }
.btn-primary:hover { background: var(--color-accent-600); }
.btn-primary:active { background: var(--color-accent-700); }
.btn-secondary:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }
.btn-secondary:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn-ghost { color: var(--color-accent-700); border-color: transparent; padding-inline: 3.4px; }
.btn-ghost:hover { background: color-mix(in srgb, var(--color-accent) 10%, transparent); }
.btn-dark { background: var(--color-neutral-800); border-color: var(--color-neutral-800); color: var(--color-bg); }
.btn-dark:hover { background: var(--color-neutral-900); }
.btn-dark:active { background: var(--color-neutral-700); }
.btn-big { height: 60px; font-size: 20px; width: 100%; }
.btn-mid { height: 48px; font-size: 15px; width: 100%; }
.btn-sm { min-height: 32px; font-size: 13px; padding: 4px 10px; }

/* — forms — */
.field { margin-bottom: 12px; }
.field > label { display: block; font-size: 12px; margin-bottom: 5px; color: color-mix(in srgb, var(--color-text) 70%, transparent); }
.input {
  width: 100%; min-height: 40px; padding: 6px 10px; font: inherit; font-size: 15px; color: var(--color-text);
  background: var(--color-surface); border: 1px solid var(--color-divider); border-radius: 0;
}
.input:hover { border-color: color-mix(in srgb, var(--color-text) 45%, transparent); }
.input:focus-visible { border-color: var(--color-accent); outline-offset: 0; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--color-accent-700); }

/* — tags — */
.tag { display: inline-flex; align-items: center; font-size: 11px; letter-spacing: .02em; padding: 3px 10px; border-radius: 0; white-space: nowrap; }
.tag-accent { background: var(--color-accent-100); color: var(--color-accent-800); }
.tag-neutral { background: var(--color-neutral-200); color: var(--color-neutral-800); }
.tag-outline { border: 1px solid var(--color-divider); color: var(--color-neutral-700); font-size: 10px; letter-spacing: .06em; padding: 2px 6px; }

/* — tables — */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: color-mix(in srgb, var(--color-text) 60%, transparent); padding: 6.8px; border-bottom: 1px solid var(--color-divider); white-space: nowrap; font-weight: 500; }
.table td { padding: 6.8px; border-bottom: 1px solid var(--color-hair); }
.table tbody tr:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }

/* — banners — */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; font-size: 13px; line-height: 1.35; }
.banner-gps { background: var(--color-accent-100); border: 1px solid var(--color-accent-300); color: var(--color-accent-900); }
.banner-gps button { flex: none; border: 1px solid var(--color-accent-500); background: transparent; color: var(--color-accent-800); font-size: 12px; font-weight: 600; padding: 6px 10px; cursor: pointer; min-height: 32px; }
.banner-gps button:hover { background: var(--color-accent-200); }
.banner-line { border: 1px solid var(--color-text); align-items: center; }
.banner-err { border: 1px solid var(--color-text); background: var(--color-neutral-100); }
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 92px; z-index: 40; display: flex; flex-direction: column; gap: 8px; width: min(380px, calc(100% - 32px)); }
.toasts .banner { background: var(--color-text); color: var(--color-bg); box-shadow: var(--shadow-lg); }

/* ================= Crew phone app ================= */
.phone { min-height: 100dvh; display: flex; flex-direction: column; max-width: 520px; margin: 0 auto; background: var(--color-bg); }
.phone-head {
  position: sticky; top: 0; z-index: 10; background: var(--color-bg);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 20px 12px; border-bottom: 1px solid var(--color-divider);
}
.brand-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.head-mark { height: 40px; width: auto; flex: none; }
.login-logo { display: block; width: min(260px, 72%); height: auto; margin: 4px auto 8px; }
.phone-head .title { font-family: var(--font-heading); font-weight: 600; font-size: 22px; line-height: 1.1; }
.phone-head .sub { font-size: 13px; color: var(--color-neutral-700); }
.phone-body { flex: 1; padding: 16px 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.tabbar {
  position: sticky; bottom: 0; z-index: 10; background: var(--color-bg);
  display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--color-divider);
  padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
}
.tabbar button {
  height: 48px; border: 0; border-top: 2px solid transparent; background: transparent; cursor: pointer;
  font-family: var(--font-heading); font-weight: 600; font-size: 15px; color: var(--color-neutral-600);
}
.tabbar button.on { color: var(--color-accent-700); border-top-color: var(--color-accent); }

.status { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 6px; }
.status .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.status .rate { font-size: 11px; padding: 2px 8px; background: var(--color-neutral-200); color: var(--color-neutral-800); }
.status .timer { font-family: var(--font-heading); font-weight: 600; font-size: 64px; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.status .what { font-family: var(--font-heading); font-weight: 600; font-size: 19px; }
.status .where { display: flex; gap: 6px; align-items: flex-start; font-size: 12.5px; color: var(--color-neutral-700); }
.status .where svg { flex: none; margin-top: 2px; }
.status .where .mono { font-size: 11px; }

.actions { display: flex; flex-direction: column; gap: 8px; }
.actions .pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.totals { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--color-divider); }
.totals > div { padding: 10px 12px; }
.totals > div + div { border-left: 1px solid var(--color-divider); }
.totals .v { font-family: var(--font-heading); font-weight: 600; font-size: 24px; font-variant-numeric: tabular-nums; }
.totals .paid { background: var(--color-accent-100); }
.totals .paid .label-sm { color: var(--color-accent-800); }
.totals .paid .v { color: var(--color-accent-900); }

.dayline .ends { display: flex; justify-content: space-between; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--color-neutral-700); }
.dayline .bar { position: relative; height: 22px; border: 1px solid var(--color-divider); background: var(--color-neutral-100); overflow: hidden; margin: 6px 0; }
.dayline .bar i { position: absolute; top: 0; bottom: 0; }
.k-work { background: var(--color-accent-700); }
.k-ride { background: var(--ride-stripes); }
.k-lunch { background: var(--color-neutral-400); }
.legend { display: flex; gap: 14px; font-size: 11px; color: var(--color-neutral-700); }
.legend span { display: flex; gap: 5px; align-items: center; }
.legend i { width: 10px; height: 10px; display: inline-block; }

.route, .omap { isolation: isolate; } /* keep Leaflet's z-indexes from covering the tab bar */
.route { height: 170px; }
.route .map { position: absolute; inset: 0; }
.route .cap { position: absolute; left: 10px; bottom: 10px; z-index: 500; font: 11px var(--font-mono); background: var(--color-bg); padding: 3px 6px; }

.log-title { font-family: var(--font-heading); font-weight: 600; font-size: 17px; padding-bottom: 6px; border-bottom: 1px solid var(--color-divider); }
.log-row { display: grid; grid-template-columns: 62px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--color-hair); font-size: 13px; }
.log-row .t { font-variant-numeric: tabular-nums; font-weight: 600; }
.log-row .l { line-height: 1.3; }
.log-row .g { font: 10.5px var(--font-mono); color: var(--color-neutral-700); }
.log-row .tag-outline { height: fit-content; }

.jobcard {
  text-align: left; background: transparent; padding: 14px 16px; cursor: pointer; color: var(--color-text); width: 100%;
  display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; font: inherit;
}
.jobcard.sel { background: var(--color-accent-100); }
.jobcard .client { font-family: var(--font-heading); font-weight: 600; font-size: 19px; line-height: 1.15; }
.jobcard .meta { font-size: 13px; color: var(--color-neutral-700); }
.jobcard .radio { grid-row: span 3; align-self: center; width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--color-accent); box-shadow: inset 0 0 0 4px var(--color-bg); }
.jobcard.sel .radio { background: var(--color-accent); }

.sheet-wrap { position: fixed; inset: 0; z-index: 30; }
.sheet-wrap .scrim { position: absolute; inset: 0; background: color-mix(in srgb, var(--color-neutral-900) 45%, transparent); }
.sheet {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 520px;
  background: var(--color-bg); border-top: 1px solid var(--color-divider);
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-lg);
}
.sheet .stepper { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--color-divider); padding: 8px 10px; }
.sheet .stepper .val { font-family: var(--font-heading); font-weight: 600; font-size: 20px; min-width: 72px; text-align: center; }

/* login */
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.names button { min-height: 60px; font-family: var(--font-heading); font-weight: 600; font-size: 19px; background: transparent; border: 1px solid var(--color-divider); cursor: pointer; color: var(--color-text); }
.names button:hover { background: var(--color-accent-100); }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 18px 0; }
.pin-dots span { width: 14px; height: 14px; border: 1.5px solid var(--color-neutral-700); }
.pin-dots span.on { background: var(--color-text); border-color: var(--color-text); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: 300px; margin: 0 auto; }
.pad button { height: 60px; font-family: var(--font-heading); font-weight: 600; font-size: 26px; background: transparent; border: 1px solid var(--color-divider); cursor: pointer; color: var(--color-text); }
.pad button:active { background: var(--color-accent-100); }

/* ================= Office dashboard ================= */
.office { max-width: 1240px; margin: 0 auto; padding: 28px 24px 64px; display: flex; flex-direction: column; gap: 18px; }
.office-nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; border-bottom: 1px solid var(--color-divider); padding-bottom: 12px; }
.office-nav .brand { font-family: var(--font-heading); font-weight: 600; font-size: 20px; margin-right: auto; display: flex; align-items: center; gap: 12px; }
.office-logo { height: 92px; width: auto; }
@media (max-width: 860px) { .office-logo { height: 64px; } }
.office-nav a { color: inherit; text-decoration: none; font-size: 14px; font-weight: 500; }
.office-nav a:hover, .office-nav a.on { color: var(--color-accent-700); }
.panel { padding: 22px 24px; display: flex; flex-direction: column; gap: 18px; }
.panel-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.weeknav { display: flex; align-items: center; gap: 6px; }
.weeknav button { min-height: 28px; padding: 0 8px; font-size: 13px; }

.alerts { border: 1px solid var(--color-text); display: flex; flex-direction: column; }
.alerts-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--color-accent-900); color: var(--color-bg); flex-wrap: wrap; }
.alerts-head .t { font-family: var(--font-heading); font-weight: 600; font-size: 17px; flex: 1; }
.alerts-head .to { font-size: 11px; letter-spacing: .06em; opacity: .85; text-transform: uppercase; }
.alert-row { display: grid; grid-template-columns: 4px 112px 110px 1fr auto; gap: 12px; align-items: center; padding: 9px 14px 9px 0; border-top: 1px solid var(--color-divider); cursor: pointer; font-size: 13px; }
.alert-row:hover { background: var(--color-accent-100); }
.alert-row .mark { align-self: stretch; }
.alert-row .tier { justify-self: start; font-size: 10px; font-weight: 600; letter-spacing: .06em; padding: 2px 6px; border: 1px solid; white-space: nowrap; }
.alert-row .when { font-size: 12px; color: var(--color-neutral-700); text-align: right; }
.tier-alert1 .mark { background: var(--color-accent-400); }
.tier-alert1 .tier { border-color: var(--color-accent-400); color: var(--color-accent-800); }
.tier-alert2 .mark { background: var(--color-accent-800); }
.tier-alert2 .tier { border-color: var(--color-accent-800); background: var(--color-accent-800); color: var(--color-bg); }
.tier-ot .mark { background: var(--color-text); }
.tier-ot .tier { border-color: var(--color-text); background: var(--color-text); color: var(--color-bg); }

.crew-table tr { cursor: pointer; }
.crew-table tr.sel { background: var(--color-accent-100) !important; }
.ottag { font-size: 11px; padding: 2px 8px; border: 1px solid transparent; white-space: nowrap; }
.ottag.near { border-color: var(--color-accent); font-weight: 600; }
.ottag.over { border-color: var(--color-text); font-weight: 700; }

.detail { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 24px; }
.detail-title { font-family: var(--font-heading); font-weight: 600; font-size: 18px; padding-bottom: 6px; border-bottom: 1px solid var(--color-divider); display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.olog-row { display: grid; grid-template-columns: 70px 1fr 170px auto; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--color-hair); font-size: 13px; align-items: baseline; }
.olog-row .t { font-weight: 600; font-variant-numeric: tabular-nums; }
.olog-row .g { font: 10.5px var(--font-mono); color: var(--color-neutral-700); }
.payroll { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; align-self: start; }
.payroll .row { display: flex; justify-content: space-between; font-size: 14px; border-bottom: 1px solid var(--color-hair); padding-bottom: 6px; }
.payroll .row b { font-variant-numeric: tabular-nums; }
.omap { height: 260px; margin-top: 14px; }
.omap .map { position: absolute; inset: 0; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.section-title { font-family: var(--font-heading); font-weight: 600; font-size: 20px; margin: 0 0 10px; }
.note { font-size: 11.5px; color: var(--color-neutral-700); line-height: 1.4; }
.warn { display: inline-block; font-size: 10px; font-weight: 600; letter-spacing: .06em; padding: 1px 6px; border: 1px solid var(--color-text); text-transform: uppercase; margin: 2px 4px 0 0; }

@media (max-width: 860px) {
  .office { padding: 16px 16px 48px; }
  .panel { padding: 16px; }
  .detail, .grid2 { grid-template-columns: 1fr; }
  .alert-row { grid-template-columns: 4px 1fr auto; }
  .alert-row .msg, .alert-row .when { grid-column: 2 / -1; text-align: left; }
  .olog-row { grid-template-columns: 62px 1fr auto; }
  .olog-row .g { grid-column: 2 / 3; }
  .table-scroll { overflow-x: auto; }
}

.leaflet-container { font-family: var(--font-body); background: var(--color-neutral-200); }
