:root {
  color: #172840;
  background: #eef3f8;
  font: 16px/1.5 system-ui, sans-serif;
  --blue: #135abb;
  --border: #d7e0ea;
}
* { box-sizing: border-box; }
body { margin: 0; }
.workspace { display: grid; grid-template-columns: 225px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; min-height: 0; height: 100dvh; display: flex; flex-direction: column; gap: 24px; padding: 22px 14px; background: #102948; color: #e4effb; }
.brand { display: flex; align-items: center; gap: 9px; color: white; text-decoration: none; }
.brand span { background: #ddeeff; color: #173450; font-weight: 800; padding: 7px; border-radius: 9px; }
.sidebar nav { display: grid; gap: 5px; }
.sidebar nav a { color: inherit; text-decoration: none; padding: 10px 11px; border-radius: 8px; }
.sidebar nav a:hover, .sidebar nav a[aria-current] { color: white; background: #284a6f; }
.account { margin-top: auto; display: grid; gap: 8px; overflow-wrap: anywhere; }
.account button { background: transparent; border-color: #7395b6; color: white; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
main { max-width: 1000px; padding: 26px 22px; margin: auto; }
.workspace main { width: 100%; margin: 0 auto; }
h1 { margin: 0 0 16px; line-height: 1.15; font-size: clamp(1.65rem, 4vw, 2.35rem); }
h2 { margin-top: 0; }
a { color: var(--blue); }
.title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 12px; }
.title h1 { margin: 0; }
.hero { align-items: end; padding-bottom: 10px; }
.hero p { margin: 0 0 6px; }
.metrics { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-top: 12px; }
.metric { display: grid; gap: 6px; padding: 16px; background: white; border-radius: 12px; border: 1px solid var(--border); border-top: 3px solid currentColor; text-decoration: none; font-weight: 650; overflow-wrap: anywhere; }
.metric strong { font-size: 2rem; line-height: 1; }
.dashboard { display: grid; grid-template-columns: 1.2fr 1fr; gap: 14px; }
.dashboard .panel { min-width: 0; }
.dashboard-actions { margin-top: 16px; }
.job-action { margin: 0 0 12px; }
.job-shortcuts { margin-bottom: 10px; }
.section-title { display: flex; gap: 10px; justify-content: space-between; align-items: baseline; flex-wrap: wrap; }
.section-title h2 { font-size: 1.2rem; margin-bottom: 10px; }
.empty { color: #425870; padding: 12px 0; }
.panel, .filters, .records {
  background: white; padding: 22px; border: 1px solid var(--border);
  border-radius: 15px; margin: 16px 0;
}
.login { max-width: 420px; margin: 32px auto; }
.fields, .filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.filters { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
.filters > label:first-child { grid-column: span 2; }
label { display: grid; gap: 6px; font-weight: 650; min-width: 0; }
input, textarea, select, button, .button {
  font: inherit; padding: 9px 12px; border-radius: 8px; border: 1px solid #a7b8c9;
  min-height: 44px; color: inherit; background: white;
}
input, textarea, select { width: 100%; }
textarea { min-height: 100px; resize: vertical; }
button, .button { display: inline-block; text-decoration: none; cursor: pointer; font-weight: 650; }
.primary { color: white; background: var(--blue); border-color: var(--blue); }
.login label { margin-bottom: 16px; }
.fields + .fields { margin-top: 16px; }
fieldset { padding: 0; margin: 0 0 18px; border: 0; min-width: 0; }
fieldset + fieldset { border-top: 1px solid var(--border); padding-top: 10px; }
legend { font-size: 1.15rem; font-weight: 750; padding: 0 10px 5px 0; }
#photo-feedback:empty { display: none; }
.records { padding: 0 16px; }
.record { display: flex; justify-content: space-between; gap: 12px; padding: 14px 0; text-decoration: none; color: inherit; }
.record + .record { border-top: 1px solid var(--border); }
.dispatch-card + .dispatch-card { border-top: 1px solid var(--border); }
.dispatch-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; padding-bottom: 14px; }
.dispatch-form label { flex: 1 1 190px; }
.record div { display: grid; gap: 3px; overflow-wrap: anywhere; }
.record div:last-child { text-align: right; flex-shrink: 0; }
.record span, .muted { color: #425870; font-size: .9rem; }
.record .status { color: #164b84; font-weight: 700; }
.record .priority { font-weight: 700; color: #a32623; }
.status-0, .record .status-0 { color: #8b4a0c; }
.status-1, .record .status-1 { color: #175ca6; }
.status-2, .record .status-2 { color: #176449; }
.error { color: #a31929; }
.error:empty { display: none; }
.consent { display: flex; align-items: center; gap: 9px; margin-top: 16px; }
.consent input { width: 20px; min-height: 20px; flex-shrink: 0; }
.activity { list-style: none; padding: 0; margin: 0; }
.activity li { display: grid; padding: 9px 0; border-top: 1px solid var(--border); }
.activity span { color: #425870; font-size: .9rem; }
.work-log { list-style: none; padding: 0; margin: 14px 0 0; }
.work-log li { padding: 12px 0; border-top: 1px solid var(--border); }
.work-log li > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.work-log li span { font-size: .875rem; color: #425870; }
.work-log li p, .receipt-log p { white-space: pre-wrap; overflow-wrap: anywhere; margin: 5px 0; }
.receipt h2 { margin: 3mm 0 1mm; font-size: 11pt; break-after: avoid; }
.receipt-log { padding-left: 4mm; }
.filter-option { display: flex; align-items: center; gap: 8px; }
.filter-option input { width: 20px; min-height: 20px; }
.customer-search { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 12px; }
.report-form { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)) auto; gap: 12px; align-items: end; }
.table-scroll { overflow-x: auto; }
.table-scroll table { width: 100%; border-collapse: collapse; min-width: 560px; }
.table-scroll th, .table-scroll td { padding: 10px; text-align: right; border-bottom: 1px solid var(--border); }
.table-scroll th:first-child { text-align: left; }
.table-scroll thead, .table-scroll tfoot { background: #eef3f8; font-weight: 750; }
.team-member { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 14px; padding: 14px 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.team-member p { margin: 3px 0; color: #425870; }
.team-member .actions, .team-create { margin-top: 10px; }
.photos { display: grid; grid-template-columns: repeat(auto-fill,minmax(125px,1fr)); gap: 10px; }
.photo-stage { max-width: 300px; margin-bottom: 12px; }
.photos figure { margin: 0; min-width: 0; }
.photos figcaption { color: #425870; font-size: .875rem; overflow-wrap: anywhere; padding-top: 4px; }
.photos img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; }
blockquote { margin: 16px 0; padding: 12px; border-left: 3px solid var(--blue); background: #eef3f8; }
.receipt { background: white; color: black; margin: 16px auto; padding: 3mm; overflow-wrap: anywhere; font: 10pt/1.3 system-ui, sans-serif; }
.receipt.w58 { width: 54mm; }
.receipt.w80 { width: 76mm; }
.receipt h1 { font-size: 14pt; }
.receipt dt { font-weight: 700; margin-top: 2mm; break-after: avoid; }
.receipt dd { margin: 0; white-space: pre-wrap; }
.signature { margin-top: 8mm; padding-bottom: 8mm; border-top: 1px solid; }
@media (max-width: 760px) {
  .workspace { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; height: auto; padding: 10px 14px; gap: 5px; }
  .sidebar nav { grid-template-columns: repeat(auto-fit, minmax(74px, 1fr)); gap: 4px; }
  .sidebar nav a { padding: 8px 4px; text-align: center; font-size: .875rem; }
  .account { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  main { padding-left: 14px; padding-right: 14px; }
  .panel, .filters { padding: 15px; }
  .fields, .filters { grid-template-columns: 1fr; }
  .filters > label:first-child { grid-column: auto; }
  .dashboard { grid-template-columns: 1fr; gap: 0; }
  .team-member { grid-template-columns: 1fr; }
  .report-form { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .job-action button { width: 100%; }
  .photo-form > button { width: 100%; }
  .metric { font-size: .875rem; padding: 10px; }
}
@page { size: auto; margin: 0; }
@media print {
  .sidebar, .no-print { display: none; }
  .workspace { display: block; }
  html, body, main { background: white; padding: 0; margin: 0; }
  .receipt { margin: 0; }
}
