:root {
  --ink: #171717;
  --muted: #6b7280;
  --line: #e5e7eb;
  --panel: #ffffff;
  --paper: #f6f5f2;
  --brand: #b11219;
  --brand-2: #20212b;
  --gold: #c4923a;
  --green: #157f3b;
  --blue: #1f5f99;
  --shadow: 0 18px 48px rgba(24, 24, 27, 0.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(--paper); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 480px) 1fr;
  background: #111118;
}
.login-panel { padding: 56px; background: #111118; color: white; display: flex; flex-direction: column; justify-content: center; }
.brand-mark { width: 48px; height: 48px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; font-weight: 800; margin-bottom: 24px; }
.brand-logo { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: var(--brand); box-shadow: 0 8px 24px rgba(0,0,0,.18); flex: 0 0 auto; }
.login-logo { width: 112px; height: 112px; margin-bottom: 24px; border-radius: 18px; }
.login-panel h1 { font-size: 34px; margin: 0 0 8px; letter-spacing: 0; }
.login-panel p { color: #b8bac7; margin: 0 0 28px; line-height: 1.5; }
.login-panel label, .field label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 7px; }
.login-panel input, .field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
}
.login-panel input { background: rgba(255,255,255,0.08); color: white; border-color: rgba(255,255,255,0.16); margin-bottom: 14px; }
.primary { border: 0; border-radius: 8px; padding: 11px 16px; background: var(--brand); color: white; font-weight: 800; }
.secondary { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; background: white; color: var(--ink); font-weight: 700; }
.button-link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.danger { border: 1px solid #fecaca; border-radius: 8px; padding: 8px 10px; background: #fee2e2; color: #b91c1c; font-weight: 850; }
.login-visual { background: linear-gradient(135deg, rgba(177,18,25,.92), rgba(32,33,43,.92)), url("https://images.unsplash.com/photo-1600518464441-9154a4dea21b?auto=format&fit=crop&w=1600&q=80"); background-size: cover; background-position: center; }
.error { min-height: 20px; color: #fca5a5; font-size: 13px; }
.login-text-btn { width: fit-content; border: 0; background: transparent; color: #d8dbe8; padding: 0; font-size: 13px; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
.login-divider { height: 1px; margin: 22px 0; background: rgba(255,255,255,.14); }
.recovery-form { margin-top: 4px; }
.recovery-form h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: 0; }
.recovery-form p { margin-bottom: 16px; font-size: 13px; }
.recovery-actions { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.dark-secondary { background: rgba(255,255,255,.08); color: white; border-color: rgba(255,255,255,.18); }
.login-message { min-height: 20px; margin-top: 10px; font-size: 13px; font-weight: 750; color: #d8dbe8; line-height: 1.35; }
.login-message.success { color: #86efac; }
.login-message.error-text { color: #fca5a5; }

.app { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { background: #171720; color: white; padding: 18px 14px; display: flex; flex-direction: column; gap: 18px; }
.sidebar .brand { display: flex; align-items: center; gap: 10px; padding: 8px; }
.sidebar nav { display: grid; gap: 4px; }
.nav-btn { border: 0; background: transparent; color: #a7a9b8; text-align: left; padding: 10px 12px; border-radius: 8px; font-weight: 700; }
.nav-btn.active, .nav-btn:hover { background: rgba(177,18,25,.18); color: white; }
.sidebar-footer { margin-top: auto; display: grid; gap: 8px; padding: 8px; color: #a7a9b8; font-size: 13px; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 68px; background: white; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; padding: 0 28px; }
.topbar h2 { margin: 0; font-size: 18px; }
#topbarMeta { display: inline-flex; align-items: center; gap: 12px; }
.content { padding: 24px 28px 40px; overflow-x: hidden; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(150px, 1fr)); }
.dashboard-stats { grid-template-columns: repeat(3, minmax(240px, 1fr)); align-items: stretch; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.dashboard-stats .card { min-width: 0; min-height: 138px; display: flex; flex-direction: column; justify-content: space-between; }
.metric-card { text-align: left; color: inherit; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.metric-card:hover { border-color: rgba(177,18,25,.38); box-shadow: 0 10px 28px rgba(24, 24, 27, 0.08); transform: translateY(-1px); }
.metric-card.active { border-color: var(--brand); box-shadow: inset 0 0 0 1px rgba(177,18,25,.2), 0 10px 28px rgba(24, 24, 27, 0.08); }
.metric-card:focus-visible { outline: 3px solid rgba(31,95,153,.22); outline-offset: 2px; }
.stat-card-accent { border-color: #bfdbfe; background: linear-gradient(180deg, #ffffff, #eff6ff); }
.metric { color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; line-height: 1.25; letter-spacing: .03em; }
.value { font-size: 34px; font-weight: 850; margin-top: 8px; line-height: 1; letter-spacing: 0; white-space: nowrap; font-variant-numeric: tabular-nums; }
.value.expense { color: #b91c1c; }
.metric-sub { min-height: 34px; margin-top: 10px; color: var(--muted); font-size: 12px; line-height: 1.35; font-weight: 700; overflow-wrap: break-word; }
.metric-sub.green { color: var(--green); }
.metric-sub.red { color: #b91c1c; }
.metric-sub.blue { color: var(--blue); }
.metric-sub.warn { color: #92400e; }
.layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); gap: 16px; margin-top: 16px; align-items: start; }
.booking-layout { display: grid; grid-template-columns: minmax(0, .95fr) minmax(420px, 1.05fr); gap: 16px; align-items: start; }
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; gap: 12px; }
.section-head h3 { margin: 0; font-size: 15px; }
.panel-subtitle { margin: 5px 0 0; color: var(--muted); font-size: 13px; }
.dashboard-panel { margin-top: 16px; overflow: hidden; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { color: var(--muted); font-size: 12px; text-align: left; padding: 9px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 9px; border-bottom: 1px solid var(--line); vertical-align: top; }
.badge { display: inline-flex; padding: 4px 9px; border-radius: 999px; background: #eef2ff; color: #3730a3; font-size: 12px; font-weight: 800; }
.badge.confirmed { background: #dcfce7; color: var(--green); }
.badge.draft_estimate { background: #fef3c7; color: #92400e; }
.badge.in_progress { background: #dbeafe; color: #1d4ed8; }
.badge.completed { background: #e5e7eb; color: #374151; }
.confirmed-card { border-color: #bbf7d0; background: linear-gradient(180deg, #ffffff, #f0fdf4); }
.confirmed-note { display: inline-block; margin-top: 5px; color: var(--green); font-size: 12px; font-weight: 700; }
.finance-stats { grid-template-columns: repeat(3, minmax(220px, 1fr)); }
.income-card { border-color: #bbf7d0; background: linear-gradient(180deg, #ffffff, #f0fdf4); }
.expense-card { border-color: #fecaca; background: linear-gradient(180deg, #ffffff, #fff7f7); }
.settings-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; overflow: visible; }
.settings-tab { flex: 1 1 120px; min-width: 112px; border: 0; border-radius: 6px; padding: 10px 12px; background: transparent; color: var(--muted); font-weight: 850; cursor: pointer; text-align: center; }
.settings-tab.active,
.settings-tab.active:hover,
.settings-tab.active:focus { background: var(--brand); color: #fff; box-shadow: 0 8px 18px rgba(177,18,25,.18); }
.settings-tab:hover:not(.active) { background: #f4f4f5; color: var(--ink); }
.finance-layout { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; align-items: stretch; }
.finance-panel { display: flex; flex-direction: column; min-width: 0; min-height: 590px; overflow: hidden; }
.finance-panel .section-head {
  margin: -2px 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.finance-form {
  display: grid;
  grid-template-columns: minmax(130px, .75fr) minmax(0, 1.25fr);
  gap: 10px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfa;
}
.finance-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.finance-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.finance-form input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}
.finance-field select,
.finance-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}
.finance-field textarea { resize: vertical; line-height: 1.45; }
.finance-submit,
.finance-cancel {
  grid-column: 1 / -1;
  min-height: 42px;
}
.finance-form-income .finance-submit {
  border: 0;
  background: var(--green);
  color: white;
}
.finance-form-income .finance-submit:hover { background: #0f6b31; }
.finance-form-expense .finance-submit {
  border: 0;
  background: var(--brand);
  color: white;
}
.finance-form-expense .finance-submit:hover { background: #8f0f14; }
.rate-form { display: grid; grid-template-columns: minmax(220px, 1fr) 120px 120px 110px auto; gap: 8px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.rate-form input,
.rate-settings-row input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}
.rate-settings-list { display: grid; gap: 10px; }
.rate-settings-row { display: grid; grid-template-columns: minmax(220px, 1fr) 120px 120px 110px auto auto; gap: 8px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; }
.terms-settings-form { display: grid; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.terms-single-field {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfa;
}
.terms-single-field span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}
.terms-single-field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 700;
}
.terms-single-field textarea {
  width: 100%;
  min-height: 148px;
  max-height: 260px;
  resize: vertical;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
}
.terms-preview-drawer summary::-webkit-details-marker { display: none; }
.terms-settings-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.terms-settings-footer p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.terms-preview { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; }
.terms-preview-drawer summary { cursor: pointer; color: var(--ink); font-size: 14px; font-weight: 900; list-style: none; }
.terms-preview-drawer summary::after { content: "Open"; float: right; color: var(--blue); font-size: 12px; }
.terms-preview-drawer[open] summary::after { content: "Hide"; }
.terms-text-preview { margin-top: 12px; display: grid; gap: 10px; color: #374151; font-size: 13px; line-height: 1.5; }
.terms-text-preview p { margin: 0; }
.email-template-form { display: grid; gap: 14px; }
.email-template-field {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfa;
}
.email-template-field span {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}
.email-template-field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}
.email-template-field textarea {
  width: 100%;
  min-height: 108px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}
.email-template-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 2px;
}
.email-template-actions p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 700;
}
.finance-list {
  display: grid;
  flex: 1 1 auto;
  align-content: start;
  min-height: 260px;
  max-height: 340px;
  overflow-x: hidden;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.finance-list-head,
.finance-item {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(88px, .85fr) 74px 106px;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.finance-list-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.finance-item {
  padding: 10px 12px;
  border-bottom: 1px solid #eef0f3;
  background: white;
}
.finance-item:last-child { border-bottom: 0; }
.finance-item:hover { background: #fbfbfa; }
.finance-item-income { box-shadow: inset 4px 0 0 #16a34a; }
.finance-item-expense { box-shadow: inset 4px 0 0 #b91c1c; }
.finance-entry-description,
.finance-entry-meta { min-width: 0; }
.finance-entry-meta {
  display: grid;
  gap: 2px;
}
.finance-item strong { display: block; font-size: 14px; overflow-wrap: anywhere; }
.finance-item span { display: block; color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.finance-entry-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  white-space: nowrap;
}
.finance-entry-actions .mini { min-height: 32px; padding: 7px 9px; font-size: 12px; }
.finance-amount {
  min-width: 0;
  text-align: right;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}
.finance-amount.income { color: var(--green); }
.finance-amount.expense { color: #b91c1c; }
.notes-panel { display: grid; gap: 14px; }
.notes-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}
.notes-summary span,
.notes-summary strong {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #f3f4f6;
}
.notes-summary strong { color: #b91c1c; background: #fee2e2; }
.note-form {
  display: grid;
  grid-template-columns: 150px 230px 300px 125px;
  width: min(100%, 920px);
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .04);
}
.note-field {
  display: grid;
  gap: 7px;
  min-width: 0;
}
.note-field span {
  color: #667085;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.note-field input,
.note-field select,
.note-field textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fbfbfa;
  color: var(--ink);
  font-size: 14px;
}
.note-field textarea {
  min-height: 86px;
  resize: vertical;
  line-height: 1.45;
}
.note-details-field { grid-column: 1 / span 3; }
.note-form-actions {
  display: flex;
  justify-content: flex-end;
  align-self: stretch;
}
.note-submit { width: 125px; min-height: 42px; align-self: end; }
.notes-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
  color: #667085;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.notes-list-head strong {
  color: var(--muted);
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
}
.notes-list { display: grid; gap: 10px; }
.note-item {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) 92px auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: white;
}
.note-item.done {
  border-left-color: #9ca3af;
  background: #fbfbfa;
}
.note-date,
.note-main { display: grid; gap: 4px; min-width: 0; }
.note-date strong,
.note-main strong { font-size: 14px; overflow-wrap: anywhere; }
.note-main span,
.note-main p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.note-priority {
  justify-self: start;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 850;
  text-transform: capitalize;
}
.note-priority.high { background: #fee2e2; color: #b91c1c; }
.note-priority.low { background: #f3f4f6; color: #4b5563; }
.note-actions { display: flex; justify-content: flex-end; gap: 8px; white-space: nowrap; }
.storage-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(160px, 1fr)); gap: 10px; margin-bottom: 12px; }
.storage-summary-grid div { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; }
.storage-summary-grid span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.storage-summary-grid strong { display: block; margin-top: 5px; font-size: 18px; }
.storage-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.storage-actions p { margin: 0; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.45; }
.storage-list { display: grid; gap: 10px; }
.storage-job { border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; overflow: hidden; }
.storage-job summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; cursor: pointer; list-style: none; }
.storage-job summary::-webkit-details-marker { display: none; }
.storage-job summary strong { display: block; font-size: 14px; }
.storage-job summary span:not(.badge) { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.storage-job-meta { display: inline-flex; align-items: center; gap: 10px; }
.storage-files { display: grid; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); background: white; }
.storage-file { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid #eef0f3; border-radius: 8px; background: #fff; }
.storage-file strong { display: block; font-size: 13px; }
.storage-file span { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.storage-file-actions { display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.storage-delete-all { display: flex; justify-content: flex-end; }
.production-grid { display: grid; gap: 10px; }
.production-check-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; }
.production-check-row.ready { border-color: #bbf7d0; background: #f0fdf4; }
.production-check-row.todo { border-color: #fde68a; background: #fffbeb; }
.production-check-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: white; color: var(--muted); font-size: 11px; font-weight: 900; border: 1px solid var(--line); }
.production-check-row.ready .production-check-icon { color: var(--green); border-color: #86efac; }
.production-check-row.todo .production-check-icon { color: #92400e; border-color: #fbbf24; }
.production-check-row strong { display: block; font-size: 14px; }
.production-check-row span:not(.badge) { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 700; line-height: 1.4; }
.production-note { margin-top: 12px; padding: 13px; border: 1px solid #dbeafe; border-radius: 8px; background: #eff6ff; }
.production-note strong { display: block; margin-bottom: 5px; color: #1d4ed8; }
.production-note span { display: block; color: #334155; font-size: 13px; line-height: 1.45; font-weight: 700; }
.history-list { display: grid; gap: 14px; }
.history-card { display: block; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; overflow: hidden; }
.history-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px; cursor: pointer; list-style: none; }
.history-head::-webkit-details-marker { display: none; }
.history-card[open] .history-head { border-bottom: 1px solid var(--line); background: white; }
.history-head strong { display: block; font-size: 16px; }
.history-head span:not(.badge) { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; font-weight: 750; }
.history-summary-meta { display: inline-flex; align-items: center; gap: 10px; }
.history-summary-meta b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: #eef2ff; color: #1d4ed8; transition: transform .18s ease; }
.history-card[open] .history-summary-meta b { transform: rotate(180deg); }
.history-body { display: grid; gap: 14px; padding: 14px 16px 16px; }
.history-route { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.history-route div { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.history-route span { display: block; color: var(--muted); font-size: 11px; font-weight: 900; text-transform: uppercase; }
.history-route strong { display: block; margin-top: 4px; font-size: 13px; line-height: 1.35; }
.history-status-grid { display: grid; grid-template-columns: repeat(3, minmax(180px, 1fr)); gap: 8px; }
.history-status { padding: 11px; border: 1px solid #e5e7eb; border-radius: 8px; background: white; }
.history-status.ready { border-color: #bbf7d0; background: #f0fdf4; }
.history-status span { display: inline-flex; margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.history-status.ready span { color: var(--green); }
.history-status strong { display: block; font-size: 13px; line-height: 1.25; }
.history-status small { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.history-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.history-customer-panel { margin-top: 16px; }
.calendar-panel { display: grid; gap: 16px; }
.calendar-toolbar { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.calendar-toolbar h3 { margin: 0; font-size: 20px; }
.calendar-controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.calendar-stats { grid-template-columns: repeat(4, minmax(160px, 1fr)); }
.calendar-stat {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfa;
}
.calendar-stat .value { font-size: 28px; }
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.calendar-weekdays span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.calendar-day {
  min-height: 156px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}
.calendar-day.muted-day { background: #f4f4f5; border-style: dashed; }
.calendar-day.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px rgba(177,18,25,.22); }
.calendar-day.has-jobs { background: linear-gradient(180deg, #ffffff, #fbfbfa); }
.calendar-date { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 22px; }
.calendar-date strong { font-size: 16px; }
.calendar-date span { color: var(--blue); font-size: 11px; font-weight: 900; white-space: nowrap; }
.calendar-events { display: grid; gap: 6px; min-width: 0; }
.calendar-event {
  display: grid;
  gap: 2px;
  padding: 8px;
  border: 1px solid #dbeafe;
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: #eff6ff;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.calendar-event:hover { border-color: #93c5fd; }
.calendar-event b,
.calendar-event strong,
.calendar-event span,
.calendar-event em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-event b { color: #1d4ed8; font-size: 12px; }
.calendar-event strong { font-size: 12px; }
.calendar-event span,
.calendar-event em { color: #5b6577; font-size: 11px; font-style: normal; font-weight: 750; }
.calendar-event.completed { border-color: #bbf7d0; border-left-color: var(--green); background: #f0fdf4; }
.calendar-event.completed b { color: var(--green); }
.calendar-event.draft_estimate { border-color: #fde68a; border-left-color: #d97706; background: #fffbeb; }
.calendar-event.draft_estimate b { color: #92400e; }
.calendar-more { display: block; color: var(--muted); font-size: 11px; font-weight: 850; padding: 2px 4px; }
.email-preview-layout { display: grid; grid-template-columns: minmax(310px, 370px) minmax(0, 1fr); gap: 20px; align-items: start; }
.email-preview-archive { max-width: 1120px; display: grid; gap: 16px; }
.email-preview-control { position: sticky; top: 18px; display: grid; gap: 16px; padding: 16px; border-color: #d9dee8; background: linear-gradient(180deg, #ffffff, #fbfbfd); box-shadow: 0 12px 30px rgba(15, 23, 42, .05); }
.email-preview-control .section-head { margin-bottom: 0; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.preview-select-label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.email-preview-control select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: white;
  color: var(--ink);
  font-weight: 750;
}
.email-file-list { display: grid; gap: 10px; }
.email-file-record { border: 1px solid #e1e5ec; border-radius: 8px; background: #fff; overflow: hidden; }
.email-file-record[open] { border-color: rgba(177,18,25,.34); box-shadow: 0 14px 34px rgba(15, 23, 42, .07); }
.email-file-record summary::-webkit-details-marker { display: none; }
.email-file-item {
  width: 100%;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto auto;
  gap: 8px 12px;
  align-items: center;
  text-align: left;
  list-style: none;
  cursor: pointer;
  border: 0;
  border-left: 4px solid #cbd5e1;
  padding: 12px;
  background: #fff;
  color: var(--ink);
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
.email-file-item:hover { border-color: rgba(177,18,25,.28); box-shadow: 0 8px 20px rgba(15, 23, 42, .06); }
.email-file-record[open] .email-file-item { border-left-color: var(--brand); background: #fffafa; box-shadow: inset 0 -1px 0 rgba(177,18,25,.10); }
.email-file-logo { width: 42px; height: 42px; border-radius: 8px; object-fit: cover; background: var(--brand); box-shadow: 0 8px 18px rgba(15, 23, 42, .10); }
.email-file-main { min-width: 0; display: grid; gap: 4px; }
.email-file-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 900; }
.email-file-main b { color: #4b5563; font-size: 12px; font-weight: 850; }
.email-file-meta { grid-column: 2 / 3; display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; font-weight: 750; }
.email-file-item .badge { justify-self: end; }
.file-open-label { justify-self: end; min-width: 82px; display: inline-flex; justify-content: center; padding: 7px 10px; border: 1px solid #d8dee8; border-radius: 8px; background: #f8fafc; color: #374151; font-size: 12px; font-weight: 900; }
.email-file-record[open] .file-open-label { background: var(--brand); border-color: var(--brand); color: #fff; }
.email-file-record[open] .file-open-label::before { content: "Close file"; }
.email-file-record[open] .file-open-label { font-size: 0; }
.email-file-record[open] .file-open-label::before { font-size: 12px; }
.comm-status-list { display: grid; gap: 8px; }
.comm-status-group { margin-top: 4px; color: #4b5563; font-size: 11px; font-weight: 900; letter-spacing: .03em; text-transform: uppercase; }
.comm-status-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 12px; border: 1px solid var(--line); border-left: 4px solid #cbd5e1; border-radius: 8px; background: white; }
.comm-status-row.ready, .comm-status-row.sent { border-left-color: var(--green); background: #fbfffc; }
.comm-status-row.pending { border-left-color: #d97706; background: #fffdf7; }
.comm-status-row.failed { border-left-color: #b91c1c; background: #fff7f7; }
.comm-status-row strong { display: block; font-size: 13px; }
.comm-status-row span:not(.badge) { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; font-weight: 700; }
.comm-status-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.email-preview-note { display: grid; gap: 4px; padding: 13px; border-radius: 8px; background: #f8fafc; border: 1px solid #dbe4ef; }
.email-preview-note strong { font-size: 13px; }
.email-preview-note span { color: var(--muted); font-size: 12px; line-height: 1.4; font-weight: 700; }
.email-preview-stack { display: grid; gap: 20px; min-width: 0; }
.email-customer-file { display: grid; gap: 14px; padding: 14px; border-top: 1px solid var(--line); background: #fafafa; }
.customer-file-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border: 1px solid #d9dee8; border-radius: 8px; background: linear-gradient(180deg, #ffffff, #f9fafb); box-shadow: 0 10px 24px rgba(15, 23, 42, .04); }
.customer-file-title { min-width: 0; display: flex; align-items: center; gap: 13px; }
.customer-file-title img { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; background: var(--brand); box-shadow: 0 10px 24px rgba(15, 23, 42, .12); flex: 0 0 auto; }
.customer-file-header h3 { margin: 4px 0 3px; font-size: 22px; line-height: 1.1; letter-spacing: 0; }
.customer-file-header p { margin: 0; color: var(--muted); font-size: 13px; font-weight: 750; }
.file-eyebrow { color: var(--brand); font-size: 11px; font-weight: 950; letter-spacing: .04em; text-transform: uppercase; }
.customer-file-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; padding: 0; overflow: hidden; border-color: #d9dee8; background: #d9dee8; }
.customer-file-info div { min-width: 0; padding: 13px 14px; background: #fff; }
.customer-file-info span { display: block; color: var(--muted); font-size: 10px; font-weight: 950; text-transform: uppercase; }
.customer-file-info strong { display: block; margin-top: 5px; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.workflow-panel .email-preview-note { margin: 14px 18px 18px; }
.workflow-grid { padding: 16px 18px 0; }
.email-document-panel { overflow: hidden; padding: 0; border: 1px solid #d9dee8; border-radius: 8px; background: #fff; box-shadow: 0 10px 24px rgba(15, 23, 42, .04); }
.email-preview-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 0; padding: 16px 18px; border-bottom: 1px solid var(--line); background: #fff; }
.email-preview-heading h3 { margin: 0; font-size: 15px; }
.email-card-preview { width: 100%; max-width: none; border: 0; border-radius: 0; overflow: hidden; background: white; box-shadow: none; }
.email-preview-top { display: flex; align-items: center; gap: 12px; padding: 18px 20px; background: #171720; color: white; }
.email-preview-top img { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--brand); }
.email-preview-top strong { display: block; font-size: 17px; letter-spacing: 0; }
.email-preview-top span { display: block; margin-top: 4px; color: #d6d6df; font-size: 12px; font-weight: 750; }
.email-preview-subject { padding: 13px 20px; border-bottom: 1px solid var(--line); background: #f8fafc; color: #111827; font-size: 14px; font-weight: 900; }
.email-preview-body { padding: 20px; color: #374151; }
.email-preview-body p { margin: 0 0 10px; font-size: 14px; line-height: 1.45; font-weight: 650; }
.email-detail-card { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px; margin: 16px 0; overflow: hidden; border: 1px solid #dfe3ea; border-radius: 8px; background: #dfe3ea; }
.email-detail-card div { min-width: 0; padding: 12px 14px; background: #fbfcfe; }
.email-detail-card .email-detail-heading { grid-column: 1 / -1; padding: 12px 14px; background: #f8fafc; color: #111827; font-size: 13px; font-weight: 950; }
.email-detail-card span { display: block; color: var(--muted); font-size: 10px; font-weight: 900; text-transform: uppercase; }
.email-detail-card strong { display: block; margin-top: 4px; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.email-preview-documents { margin: 0 20px 16px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.email-preview-documents > strong { display: block; font-size: 14px; }
.email-preview-documents > p { margin: 4px 0 12px; color: var(--muted); font-size: 12px; line-height: 1.4; font-weight: 700; }
.email-attachments { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; }
.email-attachments span { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; color: #374151; font-size: 13px; font-weight: 800; }
.email-attachments b { display: inline-grid; place-items: center; width: 30px; height: 22px; border-radius: 5px; background: var(--brand); color: #fff; font-size: 10px; }
.email-preview-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 0 20px 20px; }
.email-preview-actions .button-link { min-height: 40px; padding: 10px 14px; border-radius: 8px; font-size: 13px; font-weight: 850; }
.email-preview-footer { padding: 13px 20px; border-top: 1px solid var(--line); background: #fbfbfa; color: var(--muted); font-size: 12px; font-weight: 750; }
.sms-preview-stack { display: grid; gap: 12px; }
.sms-preview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfa;
  overflow: hidden;
}
.sms-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: white;
}
.sms-preview-head strong { font-size: 14px; }
.sms-preview-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.phone-sms-link { text-decoration: none; }
.sms-preview-card pre {
  margin: 0;
  padding: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #1f2937;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  font-weight: 700;
}
.disabled-link { opacity: .45; pointer-events: none; cursor: not-allowed; }
.finance-entry-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }
.finance-amount { flex: 0 0 auto; min-width: 86px; text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; }
.finance-amount.income { color: var(--green); }
.finance-amount.expense { color: #b91c1c; }
.archive-panel { margin-top: 16px; }
.archive-grid { display: grid; gap: 10px; }
.month-archive { display: grid; grid-template-columns: minmax(180px, .6fr) 1fr; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; }
.month-archive span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.archive-numbers { display: grid; grid-template-columns: repeat(3, minmax(120px, 1fr)); gap: 8px; align-items: center; text-align: right; font-size: 13px; }
.archive-numbers strong { font-size: 14px; }
.empty-state { padding: 18px; border: 1px dashed #d1d5db; border-radius: 8px; color: var(--muted); font-size: 13px; background: #fbfbfa; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field.full { grid-column: 1 / -1; }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.maps-link { display: inline-block; margin-top: 7px; color: var(--blue); font-size: 12px; font-weight: 800; }
.booking-card { position: sticky; top: 16px; max-height: calc(100vh - 40px); overflow: auto; }
.booking-form-card { position: static; max-width: 880px; max-height: none; margin: 0 auto; overflow: visible; }
.booking-form-card .form-grid {
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: 12px;
  row-gap: 12px;
}
.booking-form-card .field {
  grid-column: span 4;
  min-width: 0;
}
.booking-form-card .field.full,
.booking-form-card .form-section,
.booking-form-card .dynamic-list,
.booking-form-card .fee-list {
  grid-column: 1 / -1;
}
.booking-form-card .location-address { grid-column: span 5; }
.booking-form-card .compact-field,
.booking-form-card .access-field { grid-column: span 3; }
.booking-form-card .notes-field { grid-column: span 4; }
.booking-form-card .medium-field { grid-column: span 6; }
.booking-form-card .action-field { grid-column: 1 / -1; display: flex; align-items: center; justify-content: flex-start; }
.booking-form-card .submit-field { justify-content: flex-end; padding-top: 8px; }
.booking-form-card .submit-field .primary { min-width: 240px; }
.booking-form-card .check-row {
  grid-column: span 2;
  align-items: center;
  min-height: 42px;
  margin: 0;
}
.booking-form-card .option-field { grid-column: span 2; }
.booking-form-card .date-field,
.booking-form-card .time-field { grid-column: span 4; }
.booking-form-card .truck-field,
.booking-form-card .source-field { grid-column: span 6; }
.booking-form-card .pricing-model-field,
.booking-form-card .hourly-rate-field { grid-column: span 6; }
.booking-form-card .pricing-small-field { grid-column: span 4; }
.booking-form-card input,
.booking-form-card select,
.booking-form-card textarea { width: 100%; }
.booking-form-card .secondary.mini { min-height: 34px; padding: 7px 11px; }
.form-section { grid-column: 1 / -1; margin-top: 8px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--brand); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: .03em; }
.form-section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.dynamic-list { display: grid; gap: 10px; }
.extra-stop { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 10px; padding: 12px; border: 1px dashed #d1d5db; border-radius: 8px; background: #fbfbfa; }
.extra-stop .full { grid-column: 1 / -1; }
.extra-stop .access-field { grid-column: span 3; }
.extra-stop .notes-field { grid-column: span 7; }
.extra-stop .remove-row { grid-column: span 2; align-self: end; }
.fee-list { display: grid; gap: 8px; margin-bottom: 8px; }
.fee-row { display: grid; grid-template-columns: 190px minmax(0, 1fr) 120px auto; gap: 8px; align-items: center; }
.fee-row input, .fee-row select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
}
.portal-link { font-size: 12px; color: var(--blue); word-break: break-all; }
.assign-worker {
  width: 170px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
  color: var(--ink);
  font-size: 13px;
}
.workers-panel { max-width: 980px; }
.worker-form { display: grid; grid-template-columns: minmax(160px, 1fr) 150px 150px minmax(180px, 1fr) 180px auto; gap: 8px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.users-settings-panel { display: grid; gap: 16px; }
.users-settings-grid,
.user-account-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.user-settings-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfbfa;
}
.user-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.user-card-head h4 {
  margin: 0;
  font-size: 15px;
}
.user-card-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}
.user-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 10px;
}
.user-form-grid .field { display: grid; gap: 6px; min-width: 0; }
.user-form-grid label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}
.user-form-grid input,
.user-form-grid select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}
.user-form-submit {
  width: auto;
  min-width: 190px;
  min-height: 42px;
  margin-top: 12px;
  justify-self: end;
}
.user-account-list { display: grid; gap: 10px; }
.user-account-item {
  background: white;
  align-items: center;
}
@media (max-width: 1280px) {
  .users-settings-grid,
  .user-account-columns { grid-template-columns: 1fr; }
  .user-form-grid { grid-template-columns: repeat(3, minmax(140px, 1fr)); }
}
@media (max-width: 760px) {
  .user-form-grid { grid-template-columns: 1fr; }
  .user-form-submit { width: 100%; min-width: 0; justify-self: stretch; }
}
.settings-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0 16px;
}
.worker-form input,
.worker-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
}
.settings-subhead {
  margin: 14px 0 8px;
  color: var(--ink);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: uppercase;
}
.worker-list { display: grid; gap: 10px; }
.worker-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; }
.worker-item strong { display: block; font-size: 14px; }
.worker-item span:not(.badge) { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.worker-actions { display: inline-flex; align-items: center; gap: 8px; }
.audit { display: grid; gap: 10px; }
.audit-item { border-left: 3px solid var(--gold); padding-left: 10px; font-size: 13px; color: var(--muted); }
.muted { color: var(--muted); }

.portal-page { min-height: 100vh; background: #f7f4ef; }
.portal-hero { background: #171720; color: white; padding: 20px; }
.portal-shell { max-width: 760px; margin: 0 auto; padding: 18px; }
.portal-card { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 18px; margin-top: 14px; box-shadow: var(--shadow); }
.portal-card h1 { margin: 10px 0 6px; font-size: 30px; letter-spacing: 0; }
.portal-card h2 { margin: 0 0 10px; font-size: 18px; }
.portal-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.portal-card .table { min-width: 0; }
.estimate-summary-table { table-layout: fixed; }
.estimate-summary-table td:first-child { width: 48%; color: var(--muted); font-weight: 850; }
.estimate-summary-table td:last-child { text-align: right; font-weight: 900; overflow-wrap: anywhere; }
.terms { display: grid; gap: 10px; margin: 14px 0; }
.terms-summary { display: grid; gap: 6px; padding: 14px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; color: #1f2937; }
.terms-summary strong { font-size: 14px; font-weight: 900; }
.terms-summary span { color: #475569; font-size: 13px; line-height: 1.45; }
.terms-summary a { color: var(--blue); font-weight: 850; text-decoration: underline; text-underline-offset: 3px; }
.check-row a { color: inherit; font-weight: 850; text-decoration: none; }
.check-row { display: flex; gap: 10px; align-items: flex-start; color: #374151; font-size: 14px; }
.check-row input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--brand); }
.signature-wrap { margin-top: 14px; }
.signature-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.signature-head label { font-size: 12px; font-weight: 800; color: var(--muted); }
.mini { padding: 7px 10px; font-size: 12px; }
#signaturePad { width: 100%; height: 220px; display: block; border: 1.5px dashed #c7c9d1; border-radius: 8px; background: linear-gradient(#fff, #fff) padding-box, repeating-linear-gradient(0deg, transparent, transparent 42px, #f1f5f9 43px) border-box; touch-action: none; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.portal-error { min-height: 20px; margin-top: 10px; color: var(--brand); font-size: 13px; font-weight: 700; }
.success-card { text-align: center; }
.success-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%; margin: 0 auto 14px; background: #dcfce7; color: var(--green); font-size: 34px; font-weight: 900; }
.portal-download { display: inline-block; margin-top: 18px; text-decoration: none; }

.worker-app { background: #f7f7f9; }
.worker-app .app { display: block; min-height: 100vh; }
.worker-app .sidebar { display: none; }
.worker-app .topbar { height: 74px; background: #171720; color: white; border-bottom: 0; }
.worker-app .topbar h2 { font-size: 17px; }
.worker-app #topbarMeta { color: #c8c8d4; }
.worker-app #topbarMeta .secondary { background: rgba(255,255,255,.08); color: #f8fafc; border-color: rgba(255,255,255,.18); }
.worker-app .content { min-height: calc(100vh - 74px); padding: 28px 18px 80px; background: #f7f7f9; }
.driver-portal { max-width: 860px; margin: 0 auto; }
.driver-summary { display: grid; grid-template-columns: 1fr 110px 110px; gap: 12px; align-items: stretch; margin-bottom: 18px; }
.driver-summary > div { padding: 16px; border: 1px solid var(--line); border-radius: 8px; background: white; }
.driver-summary span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .03em; }
.driver-summary strong { display: block; margin-top: 4px; font-size: 19px; }
.driver-stat { text-align: center; }
.driver-stat strong { font-size: 30px; line-height: 1; }
.driver-empty { min-height: 180px; display: grid; place-items: center; align-content: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; background: white; color: var(--muted); }
.driver-empty strong { color: var(--ink); font-size: 18px; }
.driver-empty span { font-weight: 650; }
.driver-jobs { display: grid; gap: 14px; }
.driver-job-card { padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 1px 0 rgba(0,0,0,.02); }
.pro-driver-card { padding: 0; overflow: hidden; }
.pro-driver-card .driver-job-head { padding: 18px 18px 14px; background: linear-gradient(180deg, #fff, #fbfbfd); }
.driver-job-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.driver-job-head strong { display: block; font-size: 18px; }
.driver-job-head span:not(.badge) { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.driver-contact-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.pro-driver-card .driver-info-sections, .pro-driver-card .driver-section-title, .pro-driver-card .driver-route-stack, .pro-driver-card .driver-job-info, .pro-driver-card .driver-job-grid, .pro-driver-card .driver-stops, .pro-driver-card .driver-worklog, .pro-driver-card .driver-checkout, .pro-driver-card .driver-final-total, .pro-driver-card .driver-receipt-note, .pro-driver-card .driver-actions, .pro-driver-card .driver-job-foot { margin-left: 18px; margin-right: 18px; }
.driver-steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.driver-steps > div { display: flex; align-items: center; gap: 8px; padding: 11px 12px; background: #f8fafc; color: var(--muted); }
.driver-steps > div.done { background: #f0fdf4; color: var(--green); }
.driver-steps span { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 999px; background: white; border: 1px solid currentColor; font-size: 12px; font-weight: 900; }
.driver-steps strong { font-size: 12px; }
.driver-contact-row a, .driver-contact-row span, .driver-stops span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f3f4f6;
  color: #374151;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}
.driver-contact-row a { color: var(--blue); background: #eff6ff; }
.driver-info-sections { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.driver-info-sections > div { display: grid; gap: 5px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.driver-info-sections label, .driver-section-title { color: var(--muted); font-size: 12px; font-weight: 850; text-transform: uppercase; }
.driver-info-sections strong { font-size: 15px; line-height: 1.3; }
.driver-info-sections a, .driver-info-sections span { color: #374151; font-size: 13px; font-weight: 750; text-decoration: none; }
.driver-info-sections a { color: var(--blue); }
.driver-section-title { display: block; margin-top: 16px; margin-bottom: 0; }
.driver-job-info { display: grid; gap: 0; margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; background: white; overflow: hidden; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.driver-job-info-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); background: #f8fafc; }
.driver-job-info-head label { color: #111827; font-size: 14px; font-weight: 900; text-transform: none; }
.driver-job-info-head span { color: #64748b; font-size: 12px; font-weight: 750; line-height: 1.3; text-transform: none; }
.driver-job-info dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.driver-job-info dl > div { display: grid; grid-template-columns: 126px minmax(0, 1fr); gap: 12px; align-items: start; min-width: 0; padding: 12px 16px; border-bottom: 1px solid #edf2f7; }
.driver-job-info dl > div:nth-child(odd) { border-right: 1px solid #edf2f7; }
.driver-job-info dl > div:nth-last-child(-n + 2) { border-bottom: 0; }
.driver-job-info dt { color: #64748b; font-size: 11px; font-weight: 900; letter-spacing: .03em; text-transform: uppercase; }
.driver-job-info dd { min-width: 0; margin: 0; color: #111827; font-size: 14px; font-weight: 900; line-height: 1.35; overflow-wrap: anywhere; }
.driver-job-info dd small { display: block; margin-top: 3px; color: #64748b; font-size: 12px; font-weight: 800; }
.driver-route-stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.driver-route-stack > div { display: grid; gap: 5px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; }
.driver-route-stack label { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.driver-route-stack strong { font-size: 15px; line-height: 1.35; }
.driver-route-stack span { color: #4b5563; font-size: 13px; font-weight: 750; }
.driver-route-stack a { color: var(--blue); font-size: 13px; font-weight: 850; }
.driver-job-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 14px; }
.driver-job-grid > div { padding: 13px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; }
.driver-job-grid label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.driver-job-grid p { margin: 0 0 6px; line-height: 1.4; }
.driver-job-grid a { color: var(--blue); font-size: 12px; font-weight: 800; }
.driver-stops { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.driver-stops span { background: #fff7ed; color: #9a3412; }
.driver-worklog { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.driver-worklog > div { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; }
.driver-worklog span { display: block; color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.driver-worklog strong { display: block; margin-top: 5px; font-size: 15px; }
.driver-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }
.driver-actions button { min-width: 140px; }
.driver-actions.in-checkout { margin: 0; justify-content: stretch; }
.driver-actions.in-checkout button { flex: 1; }
.driver-checkout { display: grid; gap: 12px; margin-top: 14px; padding: 14px; border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; }
.driver-checkout-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.driver-checkout-head span { color: var(--blue); font-size: 13px; font-weight: 800; }
.driver-checkout-grid { display: grid; grid-template-columns: 1fr 1fr 120px; gap: 10px; }
.driver-checkout-grid.time-grid { grid-template-columns: 1fr 1fr; }
.driver-checkout label { color: var(--muted); font-size: 12px; font-weight: 800; }
.driver-checkout input, .driver-checkout select, .driver-checkout textarea {
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}
.driver-start-summary {
  display: grid;
  gap: 0;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: white;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.driver-start-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid #dbeafe;
  background: #f8fafc;
}
.driver-start-summary-head strong {
  color: #111827;
  font-size: 16px;
  font-weight: 900;
}
.driver-start-summary-head span {
  color: #2563eb;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
}
.driver-start-summary dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}
.driver-start-summary dl > div {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  min-width: 0;
  padding: 12px 16px;
  border-bottom: 1px solid #edf2f7;
}
.driver-start-summary dl > div:nth-child(1),
.driver-start-summary dl > div:nth-child(3),
.driver-start-summary dl > div:nth-child(6) {
  border-right: 1px solid #edf2f7;
}
.driver-start-summary dl > div.summary-wide {
  grid-column: 1 / -1;
  border-right: 0;
}
.driver-start-summary dl > div:nth-last-child(-n + 2) {
  border-bottom: 0;
}
.driver-start-summary dt {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.driver-start-summary dd {
  min-width: 0;
  margin: 0;
  color: #111827;
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.driver-final-approval { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid #facc15; border-radius: 8px; background: #fefce8; color: #854d0e !important; line-height: 1.35; }
.driver-final-approval input { width: 18px; margin-top: 1px; flex: 0 0 auto; }
.driver-signature-box { display: grid; gap: 8px; padding: 12px; border: 1px solid #dbeafe; border-radius: 8px; background: white; }
.driver-signature-pad { width: 100%; height: 180px; border: 1px solid var(--line); border-radius: 8px; background: white; touch-action: none; }
.driver-charge-list { display: grid; gap: 8px; }
.driver-charge-row { display: grid; grid-template-columns: 160px minmax(0, 1fr) 120px 86px; gap: 8px; }
.driver-charge-row .remove-row { align-self: end; height: 41px; }
.driver-supplies { display: grid; gap: 0; border-radius: 8px; background: #f8fafc; border: 1px solid #dbeafe; overflow: hidden; }
.driver-supplies-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 14px; border: 0; background: white; color: var(--ink); text-align: left; cursor: pointer; }
.driver-supplies-toggle span { display: grid; gap: 3px; }
.driver-supplies-toggle strong { font-size: 15px; font-weight: 850; }
.driver-supplies-toggle small { color: #64748b; font-size: 13px; font-weight: 700; }
.driver-supplies-toggle b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #eff6ff; color: var(--blue); font-size: 18px; line-height: 1; }
.driver-supplies-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; padding: 12px; border-top: 1px solid #dbeafe; }
.driver-supplies.collapsed .driver-supplies-body { display: none; }
.driver-supply-row { display: grid; grid-template-columns: minmax(0, 1fr) 76px; gap: 8px; align-items: center; min-height: 58px; padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: white; box-shadow: 0 1px 0 rgba(15,23,42,.03); }
.driver-supply-row strong, .driver-supply-row span { display: block; }
.driver-supply-row strong { font-size: 15px; line-height: 1.25; }
.driver-supply-row span { margin-top: 2px; color: var(--muted); font-size: 13px; font-weight: 700; }
.driver-supply-row input { text-align: center; margin-top: 0; padding: 9px 8px; font-weight: 850; }
.driver-tip-box { display: grid; gap: 10px; padding: 12px; border: 1px solid #dbeafe; border-radius: 8px; background: white; }
.driver-tip-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.driver-tip-head strong { font-size: 15px; font-weight: 850; }
.driver-tip-head span { color: #64748b; font-size: 13px; font-weight: 700; }
.driver-tip-options { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.driver-tip-options label { display: block; color: var(--ink); }
.driver-tip-options input { position: absolute; opacity: 0; pointer-events: none; }
.driver-tip-options span { display: grid; place-items: center; min-height: 38px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafc; color: #334155; font-size: 14px; font-weight: 850; cursor: pointer; }
.driver-tip-options input:checked + span { border-color: #93c5fd; background: #eff6ff; color: var(--blue); box-shadow: inset 0 0 0 1px #93c5fd; }
.driver-terms-box { display: grid; gap: 0; border-radius: 8px; background: #f8fafc; border: 1px solid #dbeafe; overflow: hidden; }
.driver-terms-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 14px; border: 0; background: white; color: var(--ink); text-align: left; cursor: pointer; }
.driver-terms-toggle span { display: grid; gap: 3px; }
.driver-terms-toggle strong { font-size: 15px; font-weight: 850; }
.driver-terms-toggle small { color: #64748b; font-size: 13px; font-weight: 700; }
.driver-terms-toggle b { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #eff6ff; color: var(--blue); font-size: 18px; line-height: 1; }
.driver-terms-body { display: block; max-height: 300px; overflow: auto; padding: 12px; border-top: 1px solid #dbeafe; background: #f8fafc; }
.driver-terms-box.collapsed .driver-terms-body { display: none; }
.driver-terms-document { padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: white; color: #374151; }
.terms-document-heading { padding-bottom: 10px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.terms-document-heading strong { display: block; color: #111827; font-size: 14px; font-weight: 900; }
.terms-document-heading span { display: block; margin-top: 3px; color: #64748b; font-size: 11px; font-weight: 750; text-transform: uppercase; }
.driver-terms-document section { padding: 8px 0; border-bottom: 1px solid #eef2f7; }
.driver-terms-document section:last-child { border-bottom: 0; }
.driver-terms-document h5 { margin: 0 0 4px; color: #111827; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .02em; }
.driver-terms-document p, .driver-terms-document li { margin: 0; color: #475569; font-size: 12px; font-weight: 650; line-height: 1.45; }
.driver-terms-document ol { margin: 0; padding-left: 18px; display: grid; gap: 5px; }
.driver-invoice-preview { display: grid; gap: 0; overflow: hidden; border: 1px solid #cbd5e1; border-radius: 8px; background: white; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.invoice-preview-head, .invoice-total { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.invoice-line { display: grid; grid-template-columns: minmax(130px, .9fr) minmax(160px, 1.2fr) auto; align-items: center; gap: 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.invoice-preview-head { background: #f8fafc; color: #0f172a; align-items: center; }
.invoice-preview-head strong { font-size: 15px; font-weight: 850; letter-spacing: 0; }
.invoice-preview-head span { color: var(--blue); font-size: 13px; font-weight: 800; white-space: nowrap; }
.invoice-line b { color: #111827; font-size: 14px; font-weight: 850; line-height: 1.3; }
.invoice-line span { color: #64748b; font-size: 13px; font-weight: 700; line-height: 1.3; min-width: 0; }
.invoice-line strong { color: #111827; font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.invoice-detail-lines { display: grid; background: #fbfdff; }
.invoice-detail-lines:empty { display: none; }
.invoice-detail-lines div { display: grid; grid-template-columns: minmax(130px, .9fr) minmax(160px, 1.2fr) auto; align-items: center; gap: 16px; padding: 10px 14px; border-bottom: 1px solid var(--line); color: #64748b; font-size: 14px; font-weight: 700; }
.invoice-detail-lines b { color: #111827; font-size: 14px; font-weight: 800; }
.invoice-detail-lines span { color: #64748b; font-size: 13px; font-weight: 700; }
.invoice-detail-lines strong { color: #111827; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.invoice-line.muted-line { background: #fbfbfa; }
.invoice-total { border-bottom: 0; align-items: center; background: #0f172a; color: white; padding: 15px 14px; }
.invoice-total span { color: #cbd5e1; font-weight: 850; text-transform: uppercase; font-size: 13px; letter-spacing: .03em; }
.invoice-total strong { color: white; font-size: 22px; font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.driver-final-total { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 14px; }
.driver-final-total > div { padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #f0fdf4; }
.driver-final-total span { display: block; color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.driver-final-total strong { display: block; margin-top: 5px; font-size: 16px; }
.driver-receipt-note { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; padding: 12px; border: 1px solid #bbf7d0; border-radius: 8px; background: #f0fdf4; color: var(--green); font-size: 13px; font-weight: 800; }
.driver-receipt-note span { color: #166534; font-weight: 700; }
.driver-job-foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 12px 0 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 700; }
.receipt-card .table td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.receipt-logo { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 16px; margin: 0 0 14px; box-shadow: 0 10px 28px rgba(0,0,0,.12); }
.receipt-total { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; padding: 18px; border-radius: 8px; background: #f3f4f6; font-weight: 850; text-transform: uppercase; }
.receipt-total strong { color: var(--green); font-size: 24px; }
.receipt-signature { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: #fbfbfa; }
.receipt-signature strong { display: block; margin-bottom: 8px; }
.receipt-signature img { display: block; max-width: 360px; width: 100%; height: 120px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; background: white; }

@media print {
  .portal-hero, .portal-download { display: none !important; }
  body, .portal-page { background: white !important; }
  .portal-shell { max-width: none; padding: 0; }
  .portal-card { box-shadow: none; border-color: #d1d5db; break-inside: avoid; }
}

@media (max-width: 900px) {
  .login-page, .app, .layout, .booking-layout, .email-preview-layout { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 34px 22px; }
  .login-logo { width: 88px; height: 88px; border-radius: 14px; }
  .app { min-height: 100svh; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 10px 12px;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.08);
  }
  .sidebar .brand { padding: 4px 2px; }
  .sidebar .brand-logo { width: 42px; height: 42px; border-radius: 8px; }
  .sidebar nav {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-btn {
    flex: 0 0 auto;
    min-height: 42px;
    padding: 10px 13px;
    white-space: nowrap;
    background: rgba(255,255,255,.04);
  }
  .sidebar-footer {
    margin-top: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 4px 2px 0;
  }
  .sidebar-footer .secondary { min-height: 38px; padding: 8px 12px; }
  .topbar { height: auto; min-height: 58px; padding: 13px 16px; align-items: flex-start; gap: 8px; flex-direction: column; }
  .topbar h2 { font-size: 17px; }
  #topbarMeta { width: 100%; justify-content: space-between; flex-wrap: wrap; font-size: 13px; }
  .content { padding: 14px 12px 28px; overflow-x: clip; }
  .card { padding: 14px; }
  .section-head { align-items: stretch; flex-direction: column; }
  .section-head > .primary,
  .section-head > .secondary,
  .section-head > .danger { width: 100%; }
  .primary, .secondary, .danger { min-height: 44px; }
  .stats, .dashboard-stats, .finance-stats, .finance-layout, .form-grid, .calendar-stats { grid-template-columns: 1fr; }
  .booking-form-card .form-grid { grid-template-columns: 1fr; }
  .booking-form-card .field,
  .booking-form-card .field.full,
  .booking-form-card .location-address,
  .booking-form-card .compact-field,
  .booking-form-card .access-field,
  .booking-form-card .notes-field,
  .booking-form-card .medium-field,
  .booking-form-card .option-field,
  .booking-form-card .date-field,
  .booking-form-card .time-field,
  .booking-form-card .truck-field,
  .booking-form-card .source-field,
  .booking-form-card .pricing-model-field,
  .booking-form-card .hourly-rate-field,
  .booking-form-card .pricing-small-field,
  .booking-form-card .check-row,
  .booking-form-card .action-field {
    grid-column: 1 / -1;
  }
  .extra-stop { grid-template-columns: 1fr; }
  .extra-stop .full,
  .extra-stop .access-field,
  .extra-stop .notes-field,
  .extra-stop .remove-row { grid-column: 1 / -1; }
  .booking-form-card .submit-field { justify-content: stretch; }
  .booking-form-card .submit-field .primary { width: 100%; min-width: 0; }
  .dashboard-stats .card { min-height: 120px; }
  .dashboard-panel { overflow-x: auto; }
  .table { min-width: 760px; }
  .finance-list { max-height: none; overflow: visible; border: 0; background: transparent; gap: 10px; }
  .finance-list-head { display: none; }
  .finance-list .empty-state { border: 1px dashed #d1d5db; }
  .finance-item, .note-item, .worker-item, .history-head, .history-route, .history-status-grid { grid-template-columns: 1fr; }
  .finance-item, .worker-item, .history-head { align-items: stretch; flex-direction: column; }
  .finance-item { min-width: 0; border: 1px solid var(--line); border-radius: 8px; }
  .worker-actions, .finance-entry-actions { justify-content: stretch; width: 100%; }
  .worker-actions > *, .finance-entry-actions > * { flex: 1 1 auto; justify-content: center; }
  .finance-amount { min-width: 0; text-align: left; }
  .notes-summary { justify-content: flex-start; flex-wrap: wrap; }
  .note-form { grid-template-columns: 1fr; }
  .note-details-field { grid-column: auto; }
  .note-form-actions { justify-content: stretch; }
  .note-actions { justify-content: stretch; width: 100%; }
  .note-actions > * { flex: 1 1 auto; justify-content: center; }
  .storage-summary-grid { grid-template-columns: 1fr; }
  .storage-actions, .storage-job summary, .storage-file { align-items: stretch; flex-direction: column; }
  .storage-file-actions, .storage-job-meta { width: 100%; justify-content: space-between; }
  .settings-tabs { gap: 6px; padding: 5px; }
  .settings-tab { min-height: 42px; padding: 9px 13px; }
  .calendar-toolbar { flex-direction: column; align-items: stretch; }
  .calendar-controls { justify-content: stretch; }
  .calendar-controls .secondary { flex: 1 1 0; }
  .calendar-weekdays { display: none; }
  .calendar-grid { grid-template-columns: 1fr; }
  .calendar-day { min-height: auto; }
  .calendar-day.muted-day { display: none; }
  .booking-card { position: static; max-height: none; }
  .extra-stop, .fee-row, .finance-form, .rate-form, .rate-settings-row, .worker-form, .month-archive, .archive-numbers { grid-template-columns: 1fr; }
  .admin-account-form .field.full { grid-column: auto; }
  .user-create-form button { width: 100%; justify-self: stretch; }
  .terms-settings-footer { flex-direction: column; align-items: stretch; }
  .assign-worker { width: 100%; }
  .email-preview-control { position: static; }
  .email-file-list { max-height: none; }
  .email-file-item { grid-template-columns: 42px minmax(0, 1fr) auto; }
  .email-file-meta { grid-column: 2 / -1; flex-wrap: wrap; }
  .email-file-item .badge { grid-column: 2 / 3; justify-self: start; }
  .file-open-label { grid-column: 3 / 4; grid-row: 1 / 3; align-self: center; }
  .customer-file-header { flex-direction: column; align-items: stretch; }
  .email-detail-card { grid-template-columns: 1fr; }
  .email-preview-heading { flex-direction: column; align-items: stretch; }
  .comm-status-row { grid-template-columns: 1fr; align-items: stretch; }
  .archive-numbers { text-align: left; }
  .value { font-size: 32px; }
  .inline-fields, .email-detail-card { grid-template-columns: 1fr; }
  .email-preview-actions .primary,
  .email-preview-actions .secondary,
  .email-preview-actions .danger,
  .comm-status-actions .primary,
  .comm-status-actions .secondary,
  .comm-status-actions .danger { flex: 1 1 100%; }
  .portal-shell { padding: 14px; }
  .portal-card { padding: 16px; }
  .portal-card h1 { font-size: 25px; }
  .portal-detail-grid { grid-template-columns: 1fr; }
  .portal-card .estimate-summary-table,
  .portal-card .estimate-summary-table tbody,
  .portal-card .estimate-summary-table tr,
  .portal-card .estimate-summary-table td {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .portal-card .estimate-summary-table {
    border-collapse: separate;
    border-spacing: 0;
  }
  .portal-card .estimate-summary-table tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .portal-card .estimate-summary-table tr:last-child {
    border-bottom: 0;
  }
  .portal-card .estimate-summary-table td {
    padding: 0;
    border-bottom: 0;
  }
  .portal-card .estimate-summary-table td:first-child {
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: .02em;
  }
  .portal-card .estimate-summary-table td:last-child {
    margin-top: 5px;
    text-align: left;
    color: var(--ink);
    font-size: 17px;
    font-weight: 900;
  }
  .worker-app .topbar { height: auto; min-height: 74px; align-items: flex-start; flex-direction: column; gap: 10px; padding: 16px; }
  .worker-app #topbarMeta { width: 100%; justify-content: space-between; flex-wrap: wrap; }
  .driver-summary { grid-template-columns: 1fr 1fr; }
  .driver-summary > div:first-child { grid-column: 1 / -1; }
  .driver-steps, .driver-info-sections, .driver-job-info, .driver-job-info dl, .driver-route-stack, .driver-job-grid, .driver-worklog, .driver-checkout-grid, .driver-checkout-grid.time-grid, .driver-charge-row, .driver-supplies-body, .driver-supply-row, .driver-final-total, .driver-start-summary, .driver-start-summary dl { grid-template-columns: 1fr; }
  .driver-tip-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .invoice-line, .invoice-detail-lines div { grid-template-columns: minmax(0, 1fr) auto; gap: 8px 14px; }
  .invoice-line span, .invoice-detail-lines span { grid-column: 1 / -1; }
  .driver-start-summary-head { flex-direction: column; align-items: flex-start; }
  .driver-job-info-head { flex-direction: column; align-items: flex-start; }
  .driver-job-info dl > div,
  .driver-job-info dl > div:nth-child(odd) { grid-template-columns: 1fr; border-right: 0; }
  .driver-job-info dl > div:nth-last-child(2) { border-bottom: 1px solid #edf2f7; }
  .driver-start-summary dl > div,
  .driver-start-summary dl > div:nth-child(1),
  .driver-start-summary dl > div:nth-child(3),
  .driver-start-summary dl > div:nth-child(6) { grid-template-columns: 1fr; border-right: 0; }
  .driver-start-summary dl > div.summary-wide { grid-column: auto; }
  .driver-start-summary dl > div:nth-last-child(2) { border-bottom: 1px solid #edf2f7; }
  .driver-job-head, .driver-job-foot, .driver-actions { flex-direction: column; align-items: stretch; }
  .driver-contact-row a, .driver-contact-row span, .driver-stops span { width: 100%; justify-content: center; border-radius: 8px; }
  .driver-summary { grid-template-columns: 1fr; }
  .driver-stat { text-align: left; }
  #signaturePad { height: 190px; }
}

@media (max-width: 520px) {
  body { overflow-x: hidden; }
  .content { padding-left: 10px; padding-right: 10px; }
  .card, .portal-card, .driver-job-card { border-radius: 8px; }
  .dashboard-stats { gap: 10px; }
  .value { font-size: 30px; }
  .metric-sub { min-height: auto; }
  .portal-card h1 { font-size: 23px; }
  .customer-file-info { grid-template-columns: 1fr; }
  .email-preview-top { padding: 14px; }
  .email-preview-top img { width: 44px; height: 44px; }
  .email-preview-body, .email-preview-actions, .email-preview-footer { padding-left: 14px; padding-right: 14px; }
  .email-preview-documents { margin-left: 14px; margin-right: 14px; }
  .driver-checkout { padding: 12px; }
  .driver-signature-pad { height: 160px; }
}

@media (max-width: 1240px) and (min-width: 901px) {
  .dashboard-stats { grid-template-columns: repeat(2, minmax(240px, 1fr)); }
  .calendar-stats { grid-template-columns: repeat(2, minmax(220px, 1fr)); }
  .calendar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .calendar-weekdays { display: none; }
  .calendar-day.muted-day { display: none; }
}
