:root {
  color-scheme: light;
  --ink: #122033;
  --muted: #66758a;
  --line: #d9e1eb;
  --panel: #ffffff;
  --bg: #f3f6fa;
  --navy: #123c64;
  --navy-2: #1f5a8d;
  --teal: #158675;
  --teal-soft: #e8f6f3;
  --amber: #c87b13;
  --red: #b63b45;
  --shadow: 0 16px 45px rgba(19, 48, 79, .10);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 70px; display: flex; align-items: center; gap: 18px; padding: 10px 24px; color: #fff; background: linear-gradient(110deg, #0c2d4d, #174f7d); box-shadow: 0 5px 20px rgba(7, 31, 54, .2); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.brand img { width: 38px; height: 38px; }
.brand strong { display: block; font-size: 18px; }
.brand small { display: block; color: #c8d9e8; }
.nav { display: flex; flex: 1; gap: 5px; overflow-x: auto; }
.nav button { color: #dce9f4; border: 0; border-radius: 9px; background: transparent; padding: 11px 13px; white-space: nowrap; }
.nav button:hover, .nav button.active { color: #fff; background: rgba(255,255,255,.14); }
.user-menu { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.user-menu button { color: #fff; border: 1px solid rgba(255,255,255,.28); border-radius: 9px; background: transparent; padding: 8px 11px; }
.content { padding: 22px; max-width: 1680px; margin: 0 auto; }
.page-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 4px; font-size: clamp(26px, 3vw, 38px); letter-spacing: -.035em; }
.eyebrow { color: var(--teal); font-weight: 800; text-transform: uppercase; letter-spacing: .09em; font-size: 12px; }
.muted { color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); }
.panel-pad { padding: 20px; }
.scheduler-grid { display: grid; grid-template-columns: minmax(480px, 1.35fr) 152px minmax(420px, 1fr); gap: 16px; align-items: start; }
.record-panel { min-height: 700px; }
.mode-row, .tab-row, .filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.seg { border: 1px solid var(--line); background: #f8fafc; color: var(--ink); border-radius: 999px; padding: 9px 14px; }
.seg.active { border-color: var(--navy); background: var(--navy); color: #fff; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #46566a; font-size: 13px; font-weight: 750; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #cbd5e1; border-radius: 9px; padding: 11px 12px; color: var(--ink); background: #fff; }
.field textarea { min-height: 88px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 3px solid rgba(31, 90, 141, .14); border-color: var(--navy-2); }
.checkbox { display: flex; align-items: center; gap: 8px; margin: 5px 0 12px; }
.workbook { grid-column: 1 / -1; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.workbook-head, .work-line { display: grid; grid-template-columns: 65px 120px 1fr 100px 105px 40px; gap: 8px; padding: 9px; align-items: center; }
.workbook-head { color: #fff; background: var(--navy); font-size: 12px; font-weight: 800; }
.work-line { border-top: 1px solid var(--line); }
.work-line input { min-width: 0; width: 100%; border: 0; border-bottom: 1px solid #bac6d3; padding: 7px 4px; background: transparent; }
.work-line button { border: 0; color: var(--red); background: transparent; font-size: 20px; }
.actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; }
.btn { border: 0; border-radius: 10px; padding: 11px 16px; font-weight: 750; }
.btn-primary { color: #fff; background: var(--navy); }
.btn-primary:hover { background: var(--navy-2); }
.btn-secondary { color: var(--navy); background: #e8eef5; }
.btn-success { color: #fff; background: var(--teal); }
.btn-danger { color: #fff; background: var(--red); }
.rail { display: grid; gap: 9px; position: sticky; top: 92px; }
.rail button { min-height: 64px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--navy); font-weight: 800; box-shadow: 0 8px 24px rgba(19, 48, 79, .07); }
.rail button:hover { transform: translateY(-1px); border-color: #9db4ca; }
.rail .alert { color: #fff; border: 0; background: linear-gradient(135deg, #cc6f08, #e29b28); animation: glow 1.6s ease-in-out infinite alternate; }
@keyframes glow { to { box-shadow: 0 0 0 7px rgba(226,155,40,.16), 0 10px 28px rgba(200,123,19,.2); } }
.calendar { overflow: hidden; }
.calendar-head { display: flex; align-items: center; justify-content: space-between; padding: 17px; border-bottom: 1px solid var(--line); }
.calendar-list { max-height: 780px; overflow: auto; }
.day-group { padding: 13px 15px 6px; color: var(--navy); font-weight: 850; background: #f7f9fc; border-bottom: 1px solid var(--line); }
.job-card { margin: 10px; border: 1px solid var(--line); border-left: 5px solid var(--navy-2); border-radius: 10px; padding: 12px; background: #fff; }
.job-card.completed { border-left-color: var(--teal); opacity: .72; }
.job-card.unassigned { border-left-color: var(--amber); }
.job-card strong { display: block; }
.job-meta { display: flex; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 6px; }
.mini-action { border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; color: var(--navy); background: #fff; font-size: 11px; font-weight: 750; }
.mini-action.danger { color: var(--red); }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 800; text-transform: capitalize; background: #e8eef5; color: var(--navy); }
.badge.green { color: #0c675a; background: var(--teal-soft); }
.badge.amber { color: #855006; background: #fff0d8; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { padding: 17px; background: #fff; border: 1px solid var(--line); border-radius: 13px; }
.stat b { display: block; font-size: 25px; color: var(--navy); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; border-bottom: 1px solid var(--line); padding: 12px 10px; vertical-align: top; }
th { color: #526177; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; background: #f7f9fc; }
.table-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.table-actions button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 7px 9px; }
.mobile-list { display: grid; gap: 14px; max-width: 860px; margin: 0 auto; }
.mobile-job { overflow: hidden; }
.mobile-job summary { list-style: none; padding: 18px; cursor: pointer; }
.mobile-job summary::-webkit-details-marker { display: none; }
.mobile-job[open] summary { border-bottom: 1px solid var(--line); }
.mobile-job-body { padding: 18px; }
.mobile-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; margin-top: 14px; }
.vehicle-check { padding: 17px; border: 2px solid #d6e2ee; background: #f7fbff; border-radius: 14px; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 20%, #d8edf0 0, transparent 34%), linear-gradient(135deg, #eff5fa, #dfe9f3); }
.login-card { width: min(460px, 100%); padding: 32px; background: rgba(255,255,255,.94); border: 1px solid rgba(255,255,255,.8); border-radius: 22px; box-shadow: 0 24px 70px rgba(16,45,73,.18); }
.login-brand { display: flex; align-items: center; gap: 13px; margin-bottom: 25px; }
.login-brand img { width: 52px; }
.login-card .field { margin-bottom: 14px; }
.login-card .btn { width: 100%; margin-top: 8px; }
.notice { padding: 12px 14px; border-radius: 10px; color: #0c675a; background: var(--teal-soft); border: 1px solid #b9e1da; }
.error { color: #8e2831; background: #fcebed; border-color: #efc2c7; }
.empty { padding: 38px 20px; text-align: center; color: var(--muted); }
.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; max-width: 380px; transform: translateY(120px); opacity: 0; transition: .25s ease; color: #fff; background: #163b5e; border-radius: 11px; padding: 13px 16px; box-shadow: var(--shadow); }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.error { background: #8e2831; }
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(8,25,42,.58); }
.modal { width: min(620px, 100%); max-height: 90vh; overflow: auto; background: #fff; border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.28); padding: 22px; }
@media (max-width: 1150px) {
  .scheduler-grid { grid-template-columns: minmax(430px, 1.25fr) 125px minmax(340px, .9fr); }
  .content { padding: 14px; }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; padding: 10px 14px; }
  .brand { min-width: 0; flex: 1; }
  .nav { order: 3; flex-basis: 100%; }
  .user-menu span { display: none; }
  .scheduler-grid { grid-template-columns: 1fr; }
  .rail { position: static; grid-template-columns: repeat(3, 1fr); }
  .record-panel { min-height: 0; }
  .calendar-list { max-height: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .content { padding: 10px; }
  .page-head { align-items: start; flex-direction: column; }
  .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .workbook { overflow-x: auto; }
  .workbook-head, .work-line { min-width: 680px; }
  .rail { display: flex; overflow-x: auto; }
  .rail button { min-width: 120px; }
  .stats { grid-template-columns: 1fr 1fr; }
  th, td { padding: 10px 7px; }
}
