:root {
  --color-bg: #f4f6f8;
  --color-surface: #ffffff;
  --color-border: #e1e5ea;
  --color-text: #1a2230;
  --color-muted: #6b7684;
  --color-primary: #1d6fb8;
  --color-primary-dark: #16588f;
  --color-danger: #c62828;
  --color-danger-bg: #fdeaea;
  --color-success: #1e7a3e;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --radius: 8px;
  --tabbar-height: 60px;

  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

#app { min-height: 100%; }

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.4rem; margin: 0 0 var(--space-1); }
h2 { font-size: 1.05rem; margin: 0 0 var(--space-3); }
h3 { font-size: 0.95rem; margin: 0 0 var(--space-2); }

.muted { color: var(--color-muted); font-size: 0.85rem; }

/* ---------- Shell / navigation ---------- */

.shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding-bottom: var(--tabbar-height);
}

.topbar {
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.brand { font-weight: 700; font-size: 1rem; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand span { font-weight: 400; color: var(--color-muted); }
.brand-logo { width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0; }

.user-chip { font-size: 0.85rem; color: var(--color-muted); margin-right: auto; }
.user-chip em { font-style: normal; text-transform: capitalize; color: var(--color-text); }

.link-btn {
  background: none; border: none; color: var(--color-muted); font-size: 0.9rem;
  cursor: pointer; padding: var(--space-1) 0;
}
.link-btn:hover { color: var(--color-danger); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabbar-height);
  background: var(--color-surface); border-top: 1px solid var(--color-border);
  display: flex; align-items: stretch;
  z-index: 10;
}
.tabbar a {
  flex: 1; display: flex; align-items: center; justify-content: center;
  color: var(--color-muted); font-size: 0.85rem; text-decoration: none;
}
.tabbar a.active { color: var(--color-primary); font-weight: 600; }

/* Left sidebar — hidden on mobile, shown instead of .topbar at the desktop breakpoint */
.sidenav {
  display: none;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  padding: var(--space-4);
}
.sidenav .user-chip { margin-right: 0; }
.sidenav-links { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidenav-links a {
  color: var(--color-text); font-size: 0.92rem; padding: var(--space-2) var(--space-3);
  border-radius: 6px; text-decoration: none;
}
.sidenav-links a:hover { background: var(--color-bg); text-decoration: none; }
.sidenav-links a.active { background: var(--color-primary); color: #fff; font-weight: 600; }
.sidenav .link-btn { text-align: left; padding: var(--space-2) var(--space-3); }

.content { flex: 1; padding: var(--space-4); max-width: 960px; width: 100%; margin: 0 auto; }

/* ---------- Login ---------- */

.login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--space-4);
}
.login-card {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: var(--space-6) var(--space-5); width: 100%; max-width: 360px;
}
.login-logo { display: block; width: 72px; height: 72px; margin: 0 auto var(--space-4); border-radius: 14px; }
.login-card h1 { text-align: center; font-size: 1.2rem; margin-bottom: var(--space-5); }
.login-card h1 span { display: block; font-weight: 400; color: var(--color-muted); font-size: 0.85rem; }

.location-toggle {
  display: flex; align-items: center; gap: var(--space-2); font-size: 0.95rem; font-weight: 600;
  margin-bottom: var(--space-2); cursor: pointer;
}
.location-toggle input { width: 18px; height: 18px; }
.login-form { display: flex; flex-direction: column; gap: var(--space-3); }
.login-form button { margin-top: var(--space-2); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius); border: 1px solid transparent;
  padding: 10px 16px; font-size: 0.92rem; font-weight: 600; cursor: pointer;
  min-height: 40px;
}
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-dark); text-decoration: none; }
.btn-primary:disabled { opacity: 0.6; cursor: default; }
.btn-ghost { background: var(--color-surface); border-color: var(--color-border); color: var(--color-text); }
.btn-ghost:hover { text-decoration: none; border-color: var(--color-primary); }
.btn-danger { background: var(--color-danger-bg); color: var(--color-danger); border-color: #f3c6c6; }
.btn-danger:hover { text-decoration: none; background: var(--color-danger); color: #fff; }
.btn-small { min-height: 32px; padding: 6px 10px; font-size: 0.8rem; }

button { font-family: inherit; }

/* ---------- Forms ---------- */

.form-grid {
  display: grid; grid-template-columns: 1fr; gap: var(--space-3);
}
.field { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--color-muted); }
.field span { font-weight: 600; }
.field input, .field select, .field textarea {
  font-family: inherit; font-size: 0.95rem; color: var(--color-text);
  padding: 9px 10px; border: 1px solid var(--color-border); border-radius: 6px; background: var(--color-surface);
  min-height: 40px;
}
.field textarea { min-height: unset; resize: vertical; }
.field select[multiple] { min-height: auto; }
.field-wide { grid-column: 1 / -1; }

.customer-picker { display: flex; gap: var(--space-2); align-items: center; }
.customer-picker select { flex: 1; }
.new-customer-form {
  background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: var(--space-3); margin-top: -4px;
}
.new-customer-form .form-actions { margin-top: var(--space-2); }

.job-form, .password-form, .add-user-form, .add-customer-form { max-width: 640px; }

.form-actions { display: flex; gap: var(--space-3); margin-top: var(--space-4); align-items: center; }
.form-error { color: var(--color-danger); font-size: 0.88rem; background: var(--color-danger-bg); padding: var(--space-2) var(--space-3); border-radius: 6px; }
.form-success { color: var(--color-success); font-size: 0.88rem; background: #e7f6ec; padding: var(--space-2) var(--space-3); border-radius: 6px; }

.status-form { display: flex; gap: var(--space-3); align-items: center; flex-wrap: wrap; }
.status-form select { min-height: 44px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--color-border); font-size: 0.95rem; }

/* ---------- Page header / filters ---------- */

.page-header {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3);
  margin-bottom: var(--space-4); flex-wrap: wrap;
}
.page-header-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.job-subheader { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-top: 4px; }
.job-id { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.8rem; color: var(--color-muted); }

.filters {
  display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4);
}
.filters input, .filters select {
  padding: 9px 10px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 0.92rem; min-height: 40px;
}

/* ---------- Job cards ---------- */

.job-cards { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
.job-card {
  display: block; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: var(--space-3) var(--space-4); color: var(--color-text);
}
.job-card:hover { border-color: var(--color-primary); text-decoration: none; }
.job-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.job-title { margin: 0 0 var(--space-2); font-size: 1rem; }
.job-meta { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); font-size: 0.82rem; color: var(--color-muted); align-items: center; }

.empty-state { color: var(--color-muted); font-size: 0.9rem; padding: var(--space-4) 0; }
.page-error { color: var(--color-danger); padding: var(--space-4); }

/* ---------- Task cards (My Tasks) ---------- */

.task-cards { display: grid; grid-template-columns: 1fr; gap: var(--space-3); }
.task-card { margin-bottom: 0; }
.task-card-top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: 4px; }
.task-card-actions { display: flex; gap: var(--space-2); align-items: center; margin-top: var(--space-3); flex-wrap: wrap; }
.task-card-actions select { flex: 1; min-width: 140px; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--color-border); font-size: 0.9rem; }

@media (min-width: 768px) {
  .task-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
  .task-cards { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Dashboard stat tiles ---------- */

.stat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin-bottom: var(--space-4);
}
.stat-grid-secondary { grid-template-columns: repeat(2, 1fr); }
.stat-tile {
  display: block; background: var(--color-surface); border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-border); border-radius: var(--radius); padding: var(--space-3) var(--space-4);
  text-decoration: none; color: inherit;
}
.stat-tile:hover { border-color: var(--color-primary); text-decoration: none; }
.stat-tile:hover.stat-tile-alert { border-color: var(--color-danger); }
.stat-tile-count { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat-tile-label { font-size: 0.82rem; color: var(--color-muted); margin-top: 2px; }

.stat-tile-new { border-left-color: #445; }
.stat-tile-new .stat-tile-count { color: #445; }
.stat-tile-scheduled { border-left-color: #1d4ed8; }
.stat-tile-scheduled .stat-tile-count { color: #1d4ed8; }
.stat-tile-on_way { border-left-color: #6d28d9; }
.stat-tile-on_way .stat-tile-count { color: #6d28d9; }
.stat-tile-in_progress { border-left-color: #b45309; }
.stat-tile-in_progress .stat-tile-count { color: #b45309; }
.stat-tile-completed { border-left-color: #15803d; }
.stat-tile-completed .stat-tile-count { color: #15803d; }
.stat-tile-cancelled { border-left-color: #b91c1c; }
.stat-tile-cancelled .stat-tile-count { color: #b91c1c; }
.stat-tile-alert { border-left-color: var(--color-danger); }
.stat-tile-alert .stat-tile-count { color: var(--color-danger); }
.stat-tile-neutral { border-left-color: var(--color-primary); }
.stat-tile-neutral .stat-tile-count { color: var(--color-primary); }

@media (min-width: 600px) {
  .stat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1024px) {
  .stat-grid { grid-template-columns: repeat(6, 1fr); }
  .stat-grid-secondary { grid-template-columns: repeat(2, 1fr); max-width: 480px; }
}

/* ---------- Badges ---------- */

.status-badge, .priority-badge {
  display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.02em; padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.status-new, .status-open { background: #e6eaf0; color: #445; }
.status-scheduled { background: #dbeafe; color: #1d4ed8; }
.status-on_way { background: #ede9fe; color: #6d28d9; }
.status-in_progress { background: #fef3c7; color: #b45309; }
.status-completed { background: #dcfce7; color: #15803d; }
.status-cancelled { background: #fee2e2; color: #b91c1c; }

.priority-badge { background: #eef1f4; color: #555; }
.priority-low { background: #eef1f4; color: #667; }
.priority-normal { background: #e0edfb; color: #1d6fb8; }
.priority-high { background: #ffe8cc; color: #b5560a; }
.priority-urgent { background: #fddede; color: #b91c1c; }

/* ---------- Timer panel ---------- */

.timer-panel {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: var(--space-4); margin-bottom: var(--space-4);
}
.timer-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.timer-total { font-size: 1.3rem; font-weight: 700; }
.timer-running-note { font-size: 0.82rem; color: var(--color-muted); margin-top: 2px; }
.timer-running-note span { font-variant-numeric: tabular-nums; color: var(--color-primary); font-weight: 600; }

/* ---------- Panels / detail rows ---------- */

.panel {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: var(--space-4); margin-bottom: var(--space-4);
}

/* ---------- Technician location map (dashboard) ---------- */

.map-wrap { min-height: 60px; }
.tech-map {
  height: 360px; width: 100%; border-radius: 6px; border: 1px solid var(--color-border);
}

.job-readonly .detail-row {
  display: flex; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); font-size: 0.9rem;
}
.job-readonly .detail-row:last-child { border-bottom: none; }
.job-readonly .detail-row span { color: var(--color-muted); }
.job-readonly .detail-row strong { font-weight: 500; text-align: right; }

/* ---------- Services list (customer detail) ---------- */

.services-list { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-3); }
.service-row {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 6px;
  padding: var(--space-2) var(--space-3);
}
.add-service-form { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.add-service-form input {
  flex: 1; min-width: 160px; padding: 9px 10px; border: 1px solid var(--color-border);
  border-radius: 6px; font-size: 0.9rem; font-family: inherit;
}

/* ---------- Roster table ---------- */

.roster-wrap { overflow-x: auto; }
.roster-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; min-width: 640px; }
.roster-table th, .roster-table td { text-align: left; padding: var(--space-2) var(--space-2); border-bottom: 1px solid var(--color-border); }
.roster-table input { width: 100%; padding: 6px 8px; border: 1px solid var(--color-border); border-radius: 5px; font-size: 0.85rem; }
.roster-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.notes-row td { background: var(--color-bg); }

.permissions-grid {
  display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center;
  background: var(--color-bg); padding: var(--space-2) var(--space-3); border-radius: 6px;
}
.permission-check { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; white-space: nowrap; }
.permission-check input { width: auto; }

/* ---------- Settings hub ---------- */

.settings-tabs {
  display: flex; gap: var(--space-2); flex-wrap: wrap;
  border-bottom: 1px solid var(--color-border); margin-bottom: var(--space-4);
}
.settings-tabs a {
  padding: var(--space-2) var(--space-3); font-size: 0.9rem; color: var(--color-muted);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.settings-tabs a:hover { color: var(--color-text); text-decoration: none; }
.settings-tabs a.active { color: var(--color-primary); font-weight: 600; border-bottom-color: var(--color-primary); }

.permissions-card {
  background: var(--color-bg); border-radius: 6px; padding: var(--space-3);
  margin-bottom: var(--space-3);
}
.permissions-card:last-child { margin-bottom: 0; }

/* ---------- Custom fields ---------- */

.custom-fields-wrap { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-3); }
.custom-field-card {
  background: var(--color-bg); border-radius: 6px; padding: var(--space-3);
}
.custom-field-card-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.custom-field-card-header h3 { margin: 0; }
.custom-field-options { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--space-2); }
.option-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 999px;
  padding: 4px 6px 4px 10px; font-size: 0.82rem;
}
.chip-remove {
  background: none; border: none; color: var(--color-muted); cursor: pointer;
  font-size: 1rem; line-height: 1; padding: 2px 4px;
}
.chip-remove:hover { color: var(--color-danger); }
.add-option-form, .add-field-form { display: flex; gap: var(--space-2); }
.add-option-form input, .add-field-form input {
  flex: 1; padding: 6px 8px; border: 1px solid var(--color-border); border-radius: 5px; font-size: 0.85rem;
}

/* ---------- Job forms panel ---------- */

.job-forms-panel {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: var(--space-4); margin-bottom: var(--space-4);
}
.job-forms-list { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-3); }
.job-form-row {
  display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap;
  background: var(--color-bg); border-radius: 6px; padding: var(--space-2) var(--space-3);
}
.job-form-name { font-weight: 600; margin-right: auto; }
.attach-form-form { display: flex; gap: var(--space-2); }
.attach-form-form select { flex: 1; padding: 6px 8px; border: 1px solid var(--color-border); border-radius: 5px; font-size: 0.85rem; }

/* ---------- Print pages (job cards / filled forms) ---------- */

.print-page { max-width: 720px; margin: 0 auto; }
.print-toolbar { margin-bottom: var(--space-4); }
.print-sheet {
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
  padding: var(--space-6);
}
.print-header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-5); }
.print-logo { width: 48px; height: 48px; border-radius: 10px; }
.print-header h1 { margin: 0; }
.print-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-3); margin-bottom: var(--space-5); }
.print-meta span { display: block; font-size: 0.78rem; color: var(--color-muted); }
.print-fields { width: 100%; border-collapse: collapse; margin-bottom: var(--space-4); }
.print-fields th, .print-fields td { text-align: left; padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--color-border); vertical-align: top; }
.print-fields th { width: 40%; font-weight: 600; color: var(--color-muted); }

@media print {
  .sidenav, .topbar, .tabbar, .print-toolbar { display: none !important; }
  .content { padding: 0; max-width: none; }
  .print-sheet { border: none; padding: 0; }
}

/* ---------- Notes ---------- */

.notes-panel { margin-top: var(--space-2); }
.notes-list { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-3); max-height: 320px; overflow-y: auto; }
.note { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 6px; padding: var(--space-2) var(--space-3); }
.note-meta { font-size: 0.75rem; color: var(--color-muted); margin-bottom: 2px; }
.note-text { font-size: 0.9rem; white-space: pre-wrap; }
.note-form { display: flex; gap: var(--space-2); align-items: flex-end; }
.note-form textarea {
  flex: 1; font-family: inherit; font-size: 0.9rem; padding: 8px 10px;
  border: 1px solid var(--color-border); border-radius: 6px; resize: vertical;
}

/* ---------- Attachments ---------- */

.attachments-panel { margin-bottom: var(--space-4); }
.attachments-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.attachment-thumb {
  position: relative; background: var(--color-surface); border: 1px solid var(--color-border);
  border-radius: var(--radius); padding: var(--space-2); text-align: center;
}
.attachment-thumb a { color: inherit; display: block; }
.attachment-thumb img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; border-radius: 6px; margin-bottom: 6px; display: block;
}
.attachment-file-icon {
  width: 100%; aspect-ratio: 1 / 1; border-radius: 6px; margin-bottom: 6px;
  background: var(--color-bg); display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; color: var(--color-muted); letter-spacing: 0.02em;
}
.attachment-name {
  display: block; font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-meta { display: block; font-size: 0.68rem; color: var(--color-muted); margin-top: 2px; }
.attachment-delete {
  position: absolute; top: 4px; right: 4px; width: 22px; height: 22px; line-height: 20px;
  border-radius: 50%; border: none; background: rgba(0,0,0,0.55); color: #fff; font-size: 1rem;
  cursor: pointer; z-index: 1;
}
.attachment-delete:hover { background: var(--color-danger); }
.attachment-form { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.attachment-form input[type="file"] { font-size: 0.85rem; max-width: 100%; }
.attachment-pending { opacity: 0.75; }

/* ---------- Offline mode ---------- */

.sync-status {
  font-size: 0.75rem; font-weight: 600; padding: 3px 9px; border-radius: 12px;
  white-space: nowrap;
}
.sync-status-offline { background: var(--color-danger-bg); color: var(--color-danger); }
.sync-status-pending { background: #fef3c7; color: #b45309; }
.pending-badge {
  display: inline-block; font-size: 0.68rem; font-weight: 600; color: #b45309;
  background: #fef3c7; padding: 1px 7px; border-radius: 10px; margin-left: 4px; vertical-align: middle;
}
.attachment-pending .pending-badge {
  position: absolute; top: 4px; left: 4px; margin-left: 0; z-index: 1;
}
.timer-offline-note { font-size: 0.8rem; color: var(--color-muted); margin-top: var(--space-2); }

/* ---------- Dispatch board ---------- */

.dispatch-toolbar { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); flex-wrap: wrap; }
.dispatch-toolbar input[type="date"] {
  padding: 8px 10px; border: 1px solid var(--color-border); border-radius: 6px; font-size: 0.9rem; min-height: 40px;
}

.dispatch-board-wrap { overflow-x: auto; margin-bottom: var(--space-5); }
.dispatch-board {
  border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface);
  min-width: 760px;
}
.dispatch-header-row, .dispatch-row { display: grid; grid-template-columns: 140px 1fr; }
.dispatch-header-row { border-bottom: 1px solid var(--color-border); }
.dispatch-label-col {
  padding: var(--space-2) var(--space-3); border-right: 1px solid var(--color-border);
  font-weight: 600; font-size: 0.85rem; display: flex; align-items: center;
}
.dispatch-hours {
  display: flex; justify-content: space-between; align-items: center;
  padding: var(--space-2) var(--space-3); font-size: 0.72rem; color: var(--color-muted);
}
.dispatch-row { border-bottom: 1px solid var(--color-border); }
.dispatch-row:last-child { border-bottom: none; }
.dispatch-timeline { position: relative; min-height: 60px; }
.dispatch-block {
  position: absolute; top: 6px; bottom: 6px; border-radius: 6px; color: #fff;
  padding: 4px 8px; font-size: 0.74rem; overflow: hidden; text-decoration: none;
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
}
.dispatch-block:hover { filter: brightness(0.92); text-decoration: none; }
.dispatch-block--offhours { outline: 2px dashed rgba(255,255,255,0.6); outline-offset: -3px; }
.dispatch-block--allday {
  background-image: repeating-linear-gradient(135deg, rgba(255,255,255,0.15) 0 8px, transparent 8px 16px);
}

/* ---------- Technician schedule (agenda) ---------- */

.schedule-day { margin-bottom: var(--space-5); }
.schedule-day h2 {
  font-size: 0.95rem; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.03em;
  margin-bottom: var(--space-2); padding-bottom: var(--space-1); border-bottom: 1px solid var(--color-border);
}
.dispatch-block-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dispatch-block-time { font-size: 0.68rem; opacity: 0.9; white-space: nowrap; }

.dispatch-block-status-new { background: #64748b; }
.dispatch-block-status-scheduled { background: #2563eb; }
.dispatch-block-status-on_way { background: #7c3aed; }
.dispatch-block-status-in_progress { background: #d97706; }
.dispatch-block-status-completed { background: #16a34a; }
.dispatch-block-status-cancelled { background: #dc2626; }

.unscheduled-wrap h2 { margin-bottom: var(--space-3); }

/* ---------- Toasts ---------- */

.toast-container {
  position: fixed; bottom: calc(var(--tabbar-height) + var(--space-3)); left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: var(--space-2); z-index: 100; width: calc(100% - var(--space-6)); max-width: 420px;
}
.toast {
  background: var(--color-text); color: #fff; padding: var(--space-3) var(--space-4); border-radius: 8px;
  font-size: 0.88rem; opacity: 0; transform: translateY(8px); transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
}
.toast.visible { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--color-success); }
.toast-error { background: var(--color-danger); }

/* ---------- Responsive ---------- */

@media (min-width: 600px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .filters { flex-direction: row; }
  .filters input { flex: 1; }
}

@media (min-width: 768px) {
  .job-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .shell {
    padding-bottom: 0;
    flex-direction: row;
    align-items: stretch;
  }
  .topbar { display: none; }
  .tabbar { display: none; }
  .sidenav {
    display: flex;
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
  }
  .content { padding: var(--space-5) var(--space-6); margin: 0; max-width: none; }
  .job-cards { grid-template-columns: repeat(3, 1fr); }
  .toast-container { bottom: var(--space-4); }
}
