:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: #1b2940;
  background: #f4f7fb;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: #2367c6; text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 5px; font-size: 12px; }

/* Layout */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  background: #13213a; color: #dce6f6; width: 238px; flex-shrink: 0;
  padding: 28px 18px; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brand { font-size: 22px; font-weight: 800; letter-spacing: -.8px; margin: 3px 10px 32px; color: white; }
.brand span { color: #64b5ff; }
.brand small { display: block; font-size: 9px; letter-spacing: 3px; color: #9caec7; margin-left: 26px; }
nav { display: grid; gap: 4px; }
nav a { color: #adbed4; padding: 10px 14px; border-radius: 10px; font-size: 14px; }
nav a:hover { background: #223653; color: white; text-decoration: none; }
.user { margin-top: auto; color: #b2c2d8; font-size: 12px; padding: 14px; }
.user a { color: #dce6f6; font-weight: 600; }
.main { width: 100%; min-width: 0; max-width: 1600px; margin: auto; padding: 38px 42px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; }
footer { color: #a2acb9; font-size: 12px; margin: 35px 0; }
footer a { color: #8796ab; }

/* Typography */
.eyebrow { font-size: 11px; letter-spacing: 2px; color: #4485d1; font-weight: 800; }
h1 { font-size: 32px; letter-spacing: -1px; margin: 8px 0; }
h2 { font-size: 18px; margin: 0 0 6px; }
h2.spaced { margin-top: 26px; }
p { color: #77869a; margin: 6px 0; font-size: 14px; }
.muted { color: #8b98aa; }
.small { font-size: 12px; }
.date { color: #8794a5; font-size: 13px; }
.orange { color: #d78321; }
.missing { background: #fff3dc; color: #8a5a0b; padding: 1px 5px; border-radius: 5px; }

/* Cards */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px; margin-bottom: 24px; }
.stats.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stats article, .panel, .login-card {
  background: white; border: 1px solid #e7edf5; border-radius: 16px; box-shadow: 0 4px 22px #1e355008;
}
.stats article { padding: 23px; }
.stats span, .stats small { display: block; color: #8492a6; font-size: 12px; }
.stats strong { display: block; font-size: 28px; letter-spacing: -1px; margin: 9px 0; }
.panel { padding: 24px; margin-bottom: 24px; }
.narrow-panel { max-width: 720px; }
.error-panel { max-width: 720px; margin: 8vh auto; }
.section-head { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-bottom: 18px; }
.head-actions { display: flex; gap: 8px; align-items: center; }
.head-actions input { max-width: 300px; }

/* Tables */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th {
  text-align: left; color: #8b98aa; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  font-weight: 700; border-bottom: 1px solid #e9eef5; padding: 13px 10px; white-space: nowrap;
}
td { padding: 13px 10px; border-bottom: 1px solid #eef2f7; white-space: nowrap; vertical-align: top; }
td.wrap { white-space: normal; min-width: 180px; }
td small { display: block; color: #98a3b1; margin-top: 5px; }
tr.inactive td { opacity: .55; }

/* Forms */
button, input, select, textarea { font: inherit; }
input, select, textarea {
  background: white; border: 1px solid #dfe7f1; border-radius: 9px; padding: 10px 12px;
  max-width: 100%; color: #253b57;
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid #a9d0ff; }
button, .button {
  display: inline-block; border: 1px solid #dfe7f1; border-radius: 9px; padding: 9px 15px; cursor: pointer;
  background: white; color: #344d6b; font-size: 14px; line-height: 1.3;
}
.button:hover { text-decoration: none; background: #f6f9fd; }
.primary { background: #2674d9; border-color: #2674d9; color: white; font-weight: 650; }
.primary:hover { background: #195fbd; }
.ghost { background: transparent; color: #b5c8e2; border-color: #4b5e79; margin-top: 12px; }
.link { border: 0; background: transparent; color: #2872d1; padding: 4px; }
.danger { color: #bd3f4e; }
.danger-button { background: #bd3f4e; border-color: #bd3f4e; }
.mini { padding: 5px 10px; }
.narrow { width: 110px; }
.copy-link { width: 220px; font-size: 11px; margin-top: 6px; display: block; }
.wide-input { width: 100%; }
.form-box { margin-top: 22px; border-top: 1px solid #e8edf5; padding-top: 18px; }
.form-box summary { font-weight: 700; cursor: pointer; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; margin-bottom: 18px; }
.form-grid.compact { grid-template-columns: repeat(4, minmax(0, 1fr)); align-items: end; }
.form-grid label, .login-card label, .stack label, .filter-bar label {
  display: grid; gap: 7px; font-size: 12px; color: #69798d;
}
.stack { display: grid; gap: 16px; margin: 16px 0; }
.wide { grid-column: 1 / -1; }
.actions { display: flex; gap: 8px; }
.task-form, .upload { display: flex; gap: 9px; flex-wrap: wrap; margin: 20px 0; }
.task-form input, .task-form select { min-width: 125px; flex: 1; }
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.inline { display: inline; margin-left: 6px; }
.inline-form { display: flex; gap: 6px; }
.inline-form input { width: 150px; }
.row-actions { display: flex; gap: 6px; }
.consent { display: flex !important; align-items: center; gap: 8px; font-size: 12px; color: #4d5f75; }
.consent input { width: auto; flex-shrink: 0; }
.export-links { margin-top: 14px; }
.work-time summary { cursor: pointer; color: #2872d1; font-size: 12px; margin-top: 6px; }
.compact-stack { gap: 8px; margin: 10px 0 0; min-width: 240px; }
.day-picker { border: 1px solid #e3e9f2; border-radius: 9px; padding: 6px 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.day-picker legend { font-size: 11px; color: #69798d; padding: 0 4px; }
.day-picker label { display: flex; align-items: center; gap: 3px; font-size: 12px; }
.day-picker input { width: auto; }
.time-range { display: flex; gap: 8px; }
.time-range label { display: grid; gap: 4px; font-size: 11px; color: #69798d; }
.file-label { display: grid; gap: 5px; font-size: 12px; color: #69798d; }
.confirm-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; align-items: start; }
.doc-preview img { width: 100%; border-radius: 12px; border: 1px solid #e2e8f0; margin-bottom: 12px; }
.doc-preview object { width: 100%; height: 520px; border-radius: 12px; border: 1px solid #e2e8f0; }
.source { font-size: 10px; font-weight: 700; color: #2d7a4b; background: #e3f5ea; padding: 1px 6px; border-radius: 6px; margin-left: 4px; }
.source.ai { color: #5b3fb3; background: #efe9ff; }
@media (max-width: 1100px) { .confirm-layout { grid-template-columns: 1fr; } }

/* Notices */
.notice { padding: 12px 16px; background: #e8f5ed; border: 1px solid #bde4cb; border-radius: 9px; margin-bottom: 14px; font-size: 14px; }
.notice.error { background: #fff0f0; border-color: #f4bebe; }
.edit-banner { background: #eaf2ff; border-color: #c4dafc; }

/* Pills and lists */
.pill { background: #eaf2ff; color: #3664a4; padding: 5px 10px; border-radius: 100px; font-size: 11px; white-space: nowrap; }
.pill.overdue { background: #ffe9e9; color: #b82f3c; }
.pill.soon { background: #fff3dc; color: #aa6d0d; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid #eef2f7; font-size: 13px; }
.list-item small { display: block; color: #8b99a9; margin-top: 6px; }
.done { text-decoration: line-through; color: #9aa8b8; }
.plain-list { padding-left: 18px; color: #4d5f75; font-size: 14px; line-height: 1.55; }

/* Login */
.login-card { max-width: 440px; margin: 10vh auto; padding: 36px; }
.login-card form { display: grid; gap: 20px; margin: 26px 0 14px; }
.login-card input { width: 100%; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 18px; }
.photo-card { border: 1px solid #e2e8f0; border-radius: 14px; overflow: hidden; background: white; }
.photo-card img { width: 100%; height: 180px; object-fit: cover; display: block; }
.photo-meta { padding: 14px; }
.photo-meta details { margin-top: 10px; }
.ocr-json { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; max-height: 200px; overflow: auto; background: #f1f5f9; padding: 10px; border-radius: 8px; }
.review-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.review-form textarea { width: 100%; }
.review-form button { font-size: 12px; padding: 7px; }

/* Map */
.map { height: 390px; border-radius: 14px; background: #e7eef3; margin: 12px 0 6px; }

/* Reports */
.bars { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr auto; gap: 12px; align-items: center; font-size: 13px; }
.bar { background: #eef2f7; border-radius: 6px; height: 12px; overflow: hidden; }
.bar-fill { background: #2674d9; height: 100%; }

/* Privacy notice */
.prose p, .prose li { color: #3d4f66; line-height: 1.6; }
.prose h2 { margin-top: 26px; }
.prose-table td { white-space: normal; min-width: 140px; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .form-grid.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .main { padding: 25px; }
}
@media (max-width: 680px) {
  .shell { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; padding: 12px; }
  .brand { margin: 4px 8px 10px; }
  nav { display: flex; overflow-x: auto; }
  nav a { white-space: nowrap; padding: 8px; }
  .user { padding: 5px; }
  .main { padding: 18px 16px; }
  .stats, .stats.three { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stats article { padding: 15px; }
  .form-grid, .form-grid.compact { grid-template-columns: 1fr; }
  header { align-items: flex-start; flex-direction: column; }
  .date { display: none; }
  .section-head { display: block; }
  .head-actions { margin-top: 12px; }
  .head-actions input { width: 100%; max-width: none; }
  .bar-row { grid-template-columns: 1fr; gap: 4px; }
}

/* Map with route panel */
.map-layout { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; margin: 12px 0 6px; }
.map-layout .map { margin: 0; height: 480px; }
.route-panel { border: 1px solid #e7edf5; border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.route-panel h3 { font-size: 14px; margin: 0; }
.route-list { display: grid; gap: 6px; max-height: 260px; overflow-y: auto; }
.route-item { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; padding: 4px; border-radius: 8px; }
.route-item:hover { background: #f4f7fb; }
.route-item input { width: auto; }
.route-item small { display: block; color: #8b98aa; }
.swatch { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; background: #ccc; }
.route-actions { display: flex; gap: 6px; }
.hours-slider { display: grid; gap: 6px; font-size: 13px; color: #4d5f75; }
.hours-slider input { width: 100%; padding: 0; }
.vehicle-marker span { display: block; width: 22px; height: 22px; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 1px 5px #0006; }
.plate-label { font-weight: 700; font-size: 11px; padding: 1px 6px; }
.map-popup { font-size: 13px; line-height: 1.5; }
.map-popup strong { font-size: 15px; }
@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; }
  .map-layout .map { height: 380px; }
}

/* Login: Google button */
.google-button { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin-top: 22px; font-weight: 600; }
.divider { display: flex; align-items: center; gap: 10px; color: #98a3b1; font-size: 12px; margin: 18px 0 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid #e3e9f2; }
