:root {
  color-scheme: light;
  --brand: #f5b900;
  --brand-dark: #765900;
  --ink: #181914;
  --muted: #65665f;
  --paper: #f5f5f0;
  --line: #d6d6ce;
  --success: #147a3d;
  --danger: #a52430;
  --shadow: 0 26px 70px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: #151613; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: radial-gradient(circle at 82% 8%, rgba(245,185,0,.13), transparent 25%), linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px), #151613; background-size: auto, 96px 96px, 96px 96px, auto; color: var(--ink); font-family: Arial, Helvetica, sans-serif; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, a { transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 150ms ease; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid rgba(245,185,0,.52); outline-offset: 3px; }

.driver-header { display: flex; min-height: 86px; align-items: center; justify-content: space-between; gap: 20px; padding: 0 max(20px, calc((100vw - 1260px) / 2)); border-bottom: 1px solid rgba(255,255,255,.12); color: #fff; }
.driver-brand { display: flex; align-items: baseline; gap: 9px; color: #fff; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 20px; font-weight: 900; text-decoration: none; }
.driver-brand-word { color: #fff; }
.driver-brand-hub, .driver-brand-cursor { color: var(--brand); }
.driver-brand > strong { margin-left: 12px; padding: 5px 9px; border: 1px solid rgba(245,185,0,.45); border-radius: 999px; color: var(--brand); font-family: Arial, Helvetica, sans-serif; font-size: 10px; letter-spacing: .8px; text-transform: uppercase; }
.driver-user-actions { display: flex; align-items: center; gap: 12px; color: #deded5; font-size: 12px; font-weight: 700; }
.driver-user-actions button, .dashboard-controls button, .point-modal button { border: 1px solid #bdbdb4; border-radius: 8px; background: #fff; color: var(--ink); font-weight: 800; cursor: pointer; }
.driver-user-actions button { min-height: 34px; padding: 0 12px; }

main { width: min(1260px, calc(100% - 32px)); margin: 0 auto; }
.login-view { display: grid; min-height: calc(100vh - 158px); place-items: center; align-content: center; gap: 18px; padding: 48px 0; }
.login-card { width: min(480px, 100%); padding: clamp(28px, 6vw, 54px); border-radius: 18px; background: var(--paper); box-shadow: var(--shadow); }
.eyebrow { color: var(--brand-dark); font-size: 10px; font-weight: 900; letter-spacing: 1.7px; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; letter-spacing: -.8px; }
.login-card h1 { margin: 14px 0 12px; font-size: clamp(30px, 6vw, 43px); line-height: 1; }
.login-card > p { color: var(--muted); font-size: 14px; line-height: 1.55; }
.form-stack { display: grid; gap: 15px; margin-top: 26px; }
label { display: grid; gap: 7px; }
label > span { color: #42433d; font-size: 11px; font-weight: 800; }
input, select, textarea { width: 100%; min-height: 49px; padding: 12px 14px; border: 1px solid #c6c6bd; border-radius: 8px; background: #fff; color: var(--ink); }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-dark); box-shadow: 0 0 0 4px rgba(245,185,0,.15); outline: 0; }
.primary-button { min-height: 49px; padding: 0 18px; border: 1px solid #c49300 !important; border-radius: 8px; background: var(--brand) !important; color: var(--ink) !important; font-weight: 900 !important; cursor: pointer; }
.primary-button:hover:not(:disabled) { background: #ffc400 !important; transform: translateY(-1px); }
button:disabled { opacity: .55; cursor: wait; }
.form-error { min-height: 18px; margin: 0; color: var(--danger); font-size: 12px; font-weight: 700; line-height: 1.4; }
.login-note { max-width: 560px; margin: 0; color: #aeaea6; font-size: 11px; line-height: 1.5; text-align: center; }

.dashboard-view { padding: 42px 0 72px; }
.dashboard-heading { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 24px; padding: 28px; border-radius: 16px; background: var(--brand); }
.dashboard-heading h1 { margin: 9px 0 8px; font-size: clamp(30px, 5vw, 52px); line-height: .96; }
.dashboard-heading p { margin: 0; color: #4e430f; font-size: 12px; font-weight: 700; }
.dashboard-controls { display: grid; grid-template-columns: minmax(220px, 1fr) 105px auto; gap: 10px; align-items: end; width: min(600px, 100%); }
.dashboard-controls input { min-height: 43px; }
.dashboard-controls button { min-height: 43px; padding: 0 16px; background: var(--ink); color: #fff; border-color: var(--ink); }
.driver-jobs { display: grid; gap: 18px; }
.loading, .empty { padding: 42px; border: 1px solid rgba(255,255,255,.16); border-radius: 14px; color: #d5d5ce; text-align: center; }
.job-card { overflow: hidden; border-radius: 14px; background: var(--paper); box-shadow: 0 14px 40px rgba(0,0,0,.18); }
.job-card > summary, .schedule > summary { list-style: none; cursor: pointer; }
.job-card > summary::-webkit-details-marker, .schedule > summary::-webkit-details-marker { display: none; }
.job-card > summary { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 20px 23px; border-bottom: 1px solid var(--line); }
.job-card > summary::after, .schedule > summary::after { content: '+'; font-family: ui-monospace, monospace; font-size: 22px; font-weight: 900; }
.job-card[open] > summary::after, .schedule[open] > summary::after { content: '−'; }
.job-title { display: grid; gap: 4px; }
.job-title > strong { color: var(--brand-dark); font-family: ui-monospace, monospace; font-size: 12px; }
.job-title > span { font-size: 18px; font-weight: 850; }
.job-title > small { color: var(--muted); }
.job-body { padding: 18px 22px 24px; }
.job-meta, .chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 13px; }
.job-meta span, .chips span { padding: 6px 9px; border-radius: 999px; background: #e9e9e2; color: #4e4f48; font-size: 10px; }
.job-meta strong { margin-right: 5px; }
.schedules { display: grid; gap: 12px; }
.schedule { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.schedule > summary { display: grid; grid-template-columns: minmax(0,1fr) auto auto 20px; gap: 12px; align-items: center; padding: 14px 16px; }
.schedule > summary > span { font-weight: 850; }
.schedule > summary > time, .schedule > summary > small { color: var(--muted); font-size: 11px; }
.schedule-body { padding: 0 16px 16px; }
.driver-list { display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 8px; margin-bottom: 13px; }
.driver { padding: 10px; border-radius: 8px; background: #f2f2ed; font-size: 11px; }
.driver div { display: flex; justify-content: space-between; gap: 8px; }
.driver a, .stop a { color: var(--brand-dark); font-weight: 800; }
.route { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.stop { padding: 15px; border: 1px solid var(--line); border-radius: 9px; }
.stop-head { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.stop h4 { margin: 10px 0 4px; font-size: 16px; }
.stop address, .stop p { margin: 4px 0; color: var(--muted); font-size: 12px; font-style: normal; line-height: 1.45; }
.stop-note { margin-top: 10px; padding: 9px 10px; border-left: 3px solid var(--brand); background: #f6f3e8; }
.contact { margin-top: 9px; font-size: 11px; }
.point-status { margin-top: 13px; padding: 11px; border-radius: 8px; background: #f0f0eb; }
.point-status.is-completed { background: #e5f5ea; }
.point-status.is-arrived { background: #e8f2fb; }
.point-status.is-issue { background: #fbe9ea; }
.point-status-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.point-status-head > div { display: grid; gap: 3px; }
.point-status-head span { color: var(--muted); font-size: 10px; }
.point-status-head button { min-height: 35px; padding: 0 12px; border: 1px solid var(--brand-dark); border-radius: 7px; background: var(--brand); font-weight: 850; cursor: pointer; }
.driver-point-list { display: grid; gap: 6px; margin-top: 9px; }
.driver-point { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding-top: 7px; border-top: 1px solid rgba(0,0,0,.1); font-size: 10px; }
.driver-point small { grid-column: 1 / -1; color: var(--muted); }

.modal-backdrop { position: fixed; z-index: 10; inset: 0; display: grid; place-items: center; padding: 18px; background: rgba(0,0,0,.72); }
.point-modal { width: min(620px, 100%); max-height: calc(100vh - 36px); overflow: auto; border-radius: 15px; background: var(--paper); box-shadow: var(--shadow); }
.point-modal > header { position: sticky; z-index: 2; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 18px; border-bottom: 1px solid var(--line); background: var(--paper); }
.point-modal > header > div { display: grid; gap: 3px; }
.point-modal > header span { color: var(--muted); font-size: 10px; }
.point-modal button { min-height: 36px; padding: 0 12px; }
.modal-body { display: grid; gap: 14px; padding: 18px; }
.modal-body small, .muted { margin: 0; color: var(--muted); font-size: 10px; }
.signature-panel { display: grid; gap: 9px; }
.signature-panel > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.signature-panel > div span { display: flex; gap: 7px; }
.signature-panel canvas { width: 100%; height: 180px; border: 1px dashed #a9a99f; border-radius: 8px; background: #fff; touch-action: pan-y; }
.signature-panel.is-drawing canvas { border-color: var(--brand-dark); touch-action: none; }
.point-modal footer { position: sticky; bottom: 0; display: flex; justify-content: flex-end; gap: 9px; padding: 14px 18px; border-top: 1px solid var(--line); background: var(--paper); }
.point-modal footer .primary-button { min-width: 145px; }
.site-footer { display: flex; min-height: 72px; align-items: center; justify-content: space-between; gap: 18px; width: min(1260px, calc(100% - 32px)); margin: 0 auto; color: #aaa9a2; font-size: 10px; }

@media (max-width: 820px) {
  .dashboard-heading { display: grid; }
  .dashboard-controls { grid-template-columns: minmax(0,1fr) 90px; }
  .dashboard-controls label:first-child { grid-column: 1 / -1; }
  .schedule > summary { grid-template-columns: minmax(0,1fr) 20px; }
  .schedule > summary > time, .schedule > summary > small { grid-column: 1; }
  .schedule > summary::after { grid-column: 2; grid-row: 1 / span 3; }
}

@media (max-width: 560px) {
  .driver-header { min-height: 72px; padding: 0 16px; }
  .driver-brand { gap: 5px; font-size: 17px; }
  .driver-brand > strong { margin-left: 5px; }
  .driver-user-actions > span { display: none; }
  main { width: min(100% - 18px, 1260px); }
  .dashboard-view { padding-top: 18px; }
  .dashboard-heading { padding: 20px; }
  .dashboard-controls { grid-template-columns: 1fr; }
  .dashboard-controls label:first-child { grid-column: auto; }
  .job-body { padding: 12px; }
  .job-card > summary { padding: 16px; }
  .point-status-head { align-items: stretch; flex-direction: column; }
  .point-status-head button { width: 100%; }
  .stop-head { display: grid; gap: 4px; }
  .site-footer { padding: 14px 0; }
}

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; } }
