:root {
  --ink: #18212f;
  --muted: #647184;
  --line: #d9e0ea;
  --panel: #ffffff;
  --page: #f5f7fa;
  --accent: #0f766e;
  --accent-dark: #0b5853;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #047857;
  --soft: #e9f4f3;
  --focus: #2563eb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  overflow-x: hidden;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(135deg, #f7faf9 0%, #e9f3f1 100%);
}

.login-screen[hidden],
.app-shell[hidden] {
  display: none !important;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(24, 33, 47, 0.12);
  padding: 28px;
}

.login-brand {
  margin-bottom: 22px;
}

.login-card h1 {
  margin: 0 0 18px;
}

.login-card .primary {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.role-panel button {
  width: 100%;
  margin-top: 10px;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select,
input,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
}

button {
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  min-height: 38px;
  padding: 0 12px;
}

.button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  display: inline-flex;
  min-height: 38px;
  padding: 0 12px;
  text-decoration: none;
}

button:hover,
.button:hover,
.map-link:hover {
  border-color: #9aa8b8;
}

.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.primary:hover {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
}

.danger-button {
  border-color: #fecaca;
  color: var(--danger);
}

.danger-button:hover {
  background: #fee2e2;
  border-color: #fca5a5;
}

.icon-button {
  width: 36px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
  max-width: 100vw;
  overflow-x: hidden;
}

.sidebar {
  background: #101820;
  color: #f8fafc;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 6px 10px;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fff;
  color: #111827;
  font-weight: 800;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .16);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 5px;
}

.brand-mark span {
  display: none;
}

.brand-mark.fallback-logo {
  background: #f97316;
}

.brand-mark.fallback-logo span {
  display: block;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  color: #a8b3c2;
  font-size: 13px;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #dbe4ef;
  border-color: transparent;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-item[aria-current="page"] {
  background: #1f2a37;
  color: #fff;
  border-color: #334155;
}

.nav-item small {
  color: #9aa8b8;
}

.role-panel {
  margin-top: auto;
  display: grid;
  gap: 8px;
  background: #17212c;
  padding: 12px;
  border-radius: 8px;
}

.role-panel label {
  font-size: 12px;
  color: #bfccd9;
  text-transform: uppercase;
}

.role-panel select {
  width: 100%;
  min-height: 38px;
}

.main {
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 18px 26px;
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 26px;
  margin-bottom: 0;
}

h2 {
  font-size: 19px;
}

h3 {
  font-size: 16px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 420px;
  justify-content: flex-end;
  min-width: 0;
  max-width: 720px;
}

.search {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.search input {
  border: 0;
  outline: 0;
  min-height: 38px;
  width: 100%;
}

.view-host {
  padding: 24px 26px 32px;
  display: grid;
  gap: 18px;
  align-content: start;
  min-width: 0;
  max-width: 100%;
  overflow-x: hidden;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
}

.stat {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  min-height: 88px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.stat:hover {
  border-color: var(--accent);
  box-shadow: 0 10px 24px rgba(24, 33, 47, .08);
  transform: translateY(-1px);
}

.stat:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .25);
  outline-offset: 2px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.layout-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, .8fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  min-width: 0;
  max-width: 100%;
}

.panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
}

.panel-body {
  padding: 16px;
  min-width: 0;
}

.padded-empty {
  margin: 0;
  padding: 16px;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

.table-caption {
  color: var(--muted);
  font-size: 13px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

table {
  width: 100%;
  min-width: max-content;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  background: #f8fafc;
}

tr:last-child td {
  border-bottom: 0;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: #f8fafc;
}

.clickable-row.selected td {
  background: #e9f4f3;
}

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 650;
  background: #eef2f7;
  color: #344055;
}

.badge.ok {
  background: #e6f6ef;
  color: var(--ok);
}

.badge.warn {
  background: #fff4df;
  color: var(--warn);
}

.badge.danger {
  background: #fee2e2;
  color: var(--danger);
}

.reminder-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact-actions {
  flex-wrap: nowrap;
}

.compact-actions button {
  padding: 0 9px;
  white-space: nowrap;
}

.row-primary-actions {
  margin-top: 8px;
}

.row-primary-actions button {
  min-height: 30px;
}

.customer-register-table .sticky-actions {
  background: #fff;
  box-shadow: 8px 0 12px rgba(15, 23, 42, .06);
  left: 0;
  min-width: 210px;
  position: sticky;
  z-index: 2;
}

.customer-register-table th.sticky-actions {
  background: #f8fafc;
  z-index: 3;
}

.map-link {
  min-height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.map-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.google-maps-link {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
}

.google-maps-link:hover {
  background: #1558b0;
  border-color: #1558b0;
  color: #fff;
}

.waze-link {
  background: #33ccff;
  border-color: #12a7d8;
  color: #063547;
}

.waze-link:hover {
  background: #12a7d8;
  border-color: #0d83aa;
  color: #fff;
}

.site-jobs-button {
  background: #2f855a;
  border-color: #2f855a;
  color: #fff;
}

.site-jobs-button:hover {
  background: #276749;
  border-color: #276749;
  color: #fff;
}

.add-equipment-button {
  background: #d97706;
  border-color: #d97706;
  color: #fff;
}

.add-equipment-button:hover {
  background: #b45309;
  border-color: #b45309;
  color: #fff;
}

.map-list {
  display: grid;
  gap: 10px;
}

.map-list .map-link {
  min-height: 30px;
  padding: 0 9px;
  margin-top: 4px;
  font-size: 13px;
}

.actions button.selected {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.calendar-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.calendar-toolbar strong,
.calendar-toolbar span {
  display: block;
}

.calendar-nav {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.technician-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.technician-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.technician-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(140px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--line);
  gap: 1px;
}

.calendar-grid.day {
  grid-template-columns: minmax(260px, 1fr);
}

.calendar-day {
  min-height: 220px;
  background: #fff;
  padding: 10px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.calendar-day.outside {
  background: #f8fafc;
}

.calendar-day header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
}

.calendar-day header strong {
  color: var(--ink);
  font-size: 18px;
}

.appointment-list {
  display: grid;
  align-content: start;
  gap: 8px;
}

.appointment {
  width: 100%;
  min-height: 0;
  text-align: left;
  border-left: 5px solid var(--accent);
  padding: 9px;
  display: grid;
  gap: 4px;
  background: #fdfefe;
}

.appointment:hover {
  background: var(--soft);
}

.appointment span,
.appointment em,
.appointment small {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.appointment strong {
  white-space: normal;
  line-height: 1.25;
}

.appointment .badge {
  justify-self: start;
}

.empty-slot {
  font-size: 13px;
  margin: 0;
}

.technician-location-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1.2fr) minmax(300px, .8fr);
  gap: 16px;
  align-items: stretch;
}

.technician-map {
  position: relative;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #dbeafe;
}

.google-map-real {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-empty-state {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  z-index: 2;
  background: rgba(255, 255, 255, .9);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: #eef6fb;
}

.map-settings {
  display: grid;
  grid-template-columns: minmax(220px, 420px) auto;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
}

.map-settings .field {
  margin: 0;
}

.map-info-window {
  display: grid;
  gap: 5px;
  min-width: 190px;
  color: #172033;
  font-family: inherit;
}

.map-info-window p {
  margin: 0;
}

.map-info-window button {
  justify-self: start;
  min-height: 32px;
  padding: 6px 10px;
}

.technician-location-list {
  display: grid;
  gap: 12px;
  align-content: start;
}

.technician-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fdfefe;
}

.technician-card p:last-child {
  margin-bottom: 0;
}

.technician-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.technician-card-head h3,
.technician-card-head p {
  margin: 0;
}

.tech-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.location-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.location-status span:last-child {
  color: var(--muted);
  font-size: 13px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  min-width: 0;
}

.asset-summary {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 1fr) repeat(2, minmax(110px, .45fr));
  gap: 12px;
  min-width: 0;
}

.asset-summary > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fdfefe;
  min-width: 0;
}

.asset-summary span,
.asset-summary strong {
  display: block;
}

.asset-summary strong {
  font-size: 18px;
  margin: 5px 0;
}

.asset-summary p {
  margin-bottom: 0;
  color: var(--muted);
}

.access-summary {
  display: grid;
  gap: 5px;
}

.access-summary .badge {
  justify-self: start;
}

.site-asset-list {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.site-asset-card .panel-header {
  align-items: flex-start;
}

.site-asset-card .panel-header p {
  margin: 4px 0 0;
}

.site-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
  min-width: 0;
}

.site-meta p {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin: 0;
  background: #f8fafc;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  gap: 9px;
}

.card h3 {
  margin-bottom: 0;
}

.jobsheet-photo-panel {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}

.photo-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef2f7;
}

.reminder-list {
  display: grid;
  gap: 12px;
}

.reminder-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(220px, .9fr) minmax(260px, 1.2fr) auto;
  gap: 14px;
  align-items: start;
  min-width: 0;
}

.reminder-card h3,
.reminder-card p {
  margin-bottom: 8px;
}

.reminder-preview {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.reminder-preview p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.reminder-note {
  margin-top: 12px;
  margin-bottom: 0;
}

.toggle-row {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 10px;
  background: #fff;
}

.coordinate-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  margin-top: 14px;
  padding-top: 14px;
}

.coordinate-tools span {
  font-size: 13px;
}

.muted {
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--muted);
  font-size: 13px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  background: #fff;
}

.field input[readonly] {
  background: #f1f5f9;
  color: var(--muted);
  cursor: not-allowed;
}

.field textarea {
  min-height: 86px;
  resize: vertical;
}

.job-workflow {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 18px;
}

.engineer-start-panel {
  max-width: 1100px;
}

.push-panel {
  align-items: center;
  background: #eaf7f4;
  border: 1px solid #9bd4ca;
  border-radius: 8px;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 14px 16px;
}

.push-panel strong {
  color: #11443c;
}

.push-panel p {
  margin: 4px 0 0;
}

.push-button {
  background: #2f8074;
  border-color: #2f8074;
  color: #fff;
}

.push-button:hover {
  background: #24695f;
  border-color: #24695f;
  color: #fff;
}

.step-list {
  display: grid;
  gap: 8px;
}

.step {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.step.active {
  border-color: var(--accent);
  background: var(--soft);
}

.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.check-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 8px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.segmented button {
  min-height: 32px;
  padding: 0 6px;
}

.segmented button.selected {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.service-chart-editor {
  display: grid;
  gap: 18px;
}

.service-system-selector {
  align-items: center;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.4fr);
  padding: 14px;
}

.service-system-selector h3,
.service-system-selector p {
  margin: 0;
}

.service-system-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.service-system-options button.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.service-chart-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.service-chart-head {
  border-bottom: 2px solid var(--ink);
  margin-bottom: 12px;
  padding-bottom: 10px;
  text-align: center;
}

.service-chart-head span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.service-chart-head h3 {
  margin: 4px 0 0;
}

.service-chart-meta,
.service-chart-fields {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-bottom: 12px;
}

.service-chart-meta div,
.service-chart-fields label {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 3px;
  padding: 5px 0;
}

.service-chart-meta strong,
.service-chart-fields label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.service-chart-fields input {
  border: 0;
  color: var(--ink);
  font: inherit;
  outline: 0;
  padding: 3px 0;
}

.service-chart-table {
  border: 1px solid var(--line);
  display: grid;
}

.service-chart-row {
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 94px 94px 110px;
  min-height: 38px;
}

.service-chart-row:last-child {
  border-bottom: 0;
}

.service-chart-row > strong,
.service-chart-row > span,
.service-chart-row > button {
  align-items: center;
  border-right: 1px solid var(--line);
  display: flex;
  padding: 7px 8px;
}

.service-chart-row > :last-child {
  border-right: 0;
}

.service-chart-row.header {
  background: #f8fafc;
  font-size: 12px;
}

.service-chart-row button {
  background: #fff;
  border: 0;
  border-radius: 0;
  color: #111827;
  font-weight: 800;
  justify-content: center;
}

.service-chart-row button.selected {
  background: #e0f2fe;
  color: #075985;
}

.certificate {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  max-width: 900px;
}

.certificate-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 16px;
}

.agreement-selector {
  align-items: center;
  border-top: 1px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px;
}

.agreement-selector label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.agreement-preview {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 0 16px 16px;
  max-width: 980px;
  padding: 24px;
  white-space: normal;
}

.agreement-preview-head {
  align-items: flex-start;
  border-bottom: 3px solid var(--ink);
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
}

.agreement-preview h3,
.agreement-preview h4,
.agreement-preview p {
  margin-top: 0;
}

.agreement-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  margin: 14px 0 18px;
}

.agreement-grid div {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.agreement-grid span,
.signature-grid span {
  display: block;
}

.agreement-workflow-panel {
  background: #fbfcfd;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin: 16px 0;
  padding: 14px;
}

.agreement-timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.agreement-timeline span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  padding: 6px 10px;
}

.agreement-timeline span.active {
  border-color: #2563eb;
  color: #1d4ed8;
  font-weight: 700;
}

.agreement-workflow-controls {
  align-items: end;
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 12px;
}

.upload-control {
  color: var(--muted);
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
}

.upload-control input {
  font: inherit;
}

.signature-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-top: 28px;
}

.signature-grid div {
  border-top: 1px solid var(--ink);
  padding-top: 8px;
}

.qr {
  width: 84px;
  height: 84px;
  background:
    linear-gradient(90deg, #111 8px, transparent 8px) 0 0 / 16px 16px,
    linear-gradient(#111 8px, transparent 8px) 0 0 / 16px 16px,
    #fff;
  border: 6px solid #fff;
  outline: 1px solid #111;
}

.signature-line {
  min-height: 58px;
  border-bottom: 1px solid var(--ink);
  font-family: "Segoe Script", cursive;
  font-size: 22px;
  display: flex;
  align-items: end;
  padding: 0 8px 6px;
}

.jobsheet-equipment-editor {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.equipment-editor-row {
  display: grid;
  grid-template-columns: 80px minmax(180px, 1fr) 160px 150px;
  gap: 8px;
}

.equipment-editor-row input {
  min-height: 38px;
  padding: 8px 10px;
}

.signature-pad-wrap {
  display: grid;
  gap: 10px;
}

.signature-pad {
  width: 100%;
  height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(#fff, #fff) padding-box,
    repeating-linear-gradient(0deg, transparent 0 42px, #eef2f7 43px) border-box;
  touch-action: none;
  cursor: crosshair;
}

.signature-image {
  max-width: 220px;
  max-height: 54px;
  object-fit: contain;
}

.jobsheet-print {
  background: #fff;
  color: #2f2f2f;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 36px 44px;
  max-width: 900px;
  font-family: Georgia, "Times New Roman", serif;
}

.jobsheet-letterhead {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  min-height: 132px;
  padding-bottom: 26px;
}

.jobsheet-logo img {
  width: 118px;
  height: auto;
  object-fit: contain;
}

.jobsheet-company {
  text-align: right;
  font-size: 15px;
  line-height: 1.45;
}

.jobsheet-date-row {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #cfcfcf;
  padding: 14px 2px;
  margin-bottom: 0;
  font-size: 17px;
}

.jobsheet-date-row p,
.jobsheet-company p {
  margin: 0;
}

.jobsheet-customer-table,
.jobsheet-equipment-table,
.jobsheet-footer-table {
  width: 100%;
  border-collapse: collapse;
  white-space: normal;
}

.jobsheet-customer-table th,
.jobsheet-customer-table td,
.jobsheet-footer-table th,
.jobsheet-footer-table td {
  border-bottom: 1px solid #d7d7d7;
  padding: 12px 10px;
  font-size: 15px;
  background: #fff;
  text-transform: none;
}

.jobsheet-customer-table tr:nth-child(even),
.jobsheet-footer-table tr:nth-child(even) {
  background: #f7f7f7;
}

.jobsheet-customer-table th,
.jobsheet-footer-table th {
  width: 42%;
  color: #333;
  font-weight: 700;
  text-align: left;
}

.jobsheet-section-title,
.jobsheet-confirmation,
.jobsheet-equipment-table thead th {
  background: #3d3d3b;
  color: #fff;
  text-align: center;
  font-weight: 400;
}

.jobsheet-section-title {
  padding: 13px;
  margin-top: 0;
}

.jobsheet-description {
  min-height: 80px;
  padding: 14px 10px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.jobsheet-equipment-table th,
.jobsheet-equipment-table td {
  border: 1px solid #dedede;
  padding: 9px 10px;
  height: 28px;
  font-size: 15px;
}

.jobsheet-equipment-table td:first-child {
  width: 12%;
  text-align: center;
}

.jobsheet-equipment-table td:nth-child(3),
.jobsheet-equipment-table td:last-child {
  width: 22%;
  text-align: center;
}

.jobsheet-equipment-table tfoot th,
.jobsheet-equipment-table tfoot td {
  background: #f7f7f7;
  font-weight: 700;
  text-align: right;
}

.jobsheet-confirmation {
  margin-top: 18px;
  padding: 13px 46px;
  line-height: 1.45;
}

.jobsheet-footer-table {
  margin-top: 10px;
}

.jobsheet-footer-table .signature-line {
  border-bottom: 0;
  min-height: 44px;
  padding-left: 0;
  color: #2563eb;
}

dialog {
  border: 0;
  padding: 0;
  background: transparent;
  width: min(720px, calc(100vw - 24px));
}

dialog::backdrop {
  background: rgba(15, 23, 42, .45);
}

.dialog-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, .25);
  overflow: hidden;
}

.dialog-card header,
.dialog-card footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-card footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  justify-content: flex-end;
  gap: 8px;
}

#dialogBody {
  padding: 16px;
}

@media (max-width: 1050px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    display: block;
  }

  .brand,
  .role-panel {
    margin-bottom: 12px;
  }

  .nav-list {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .topbar,
  .topbar-actions {
    flex-direction: column;
    align-items: stretch;
    min-width: 0;
  }

  .stats-grid,
  .layout-2,
  .asset-summary,
  .calendar-grid,
  .technician-location-layout,
  .reminder-card,
  .site-meta,
  .job-workflow {
    grid-template-columns: 1fr;
  }

  .technician-map {
    min-height: 360px;
  }

  .map-settings {
    grid-template-columns: 1fr;
  }

  .calendar-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .technician-legend {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .view-host,
  .topbar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  body {
    background: #fff;
  }

  .sidebar,
  .topbar,
  .panel-header button,
  .actions {
    display: none !important;
  }

  .app-shell,
  .main {
    display: block;
  }

  .view-host {
    padding: 0;
  }

  .certificate {
    border: 0;
    max-width: none;
  }

  body.printing-jobsheet * {
    visibility: hidden !important;
  }

  body.printing-jobsheet .jobsheet-print,
  body.printing-jobsheet .jobsheet-print * {
    visibility: visible !important;
  }

  body.printing-jobsheet .jobsheet-print {
    position: absolute;
    left: 0;
    top: 0;
    width: 190mm;
    min-height: 277mm;
    max-width: none;
    border: 0;
    border-radius: 0;
    padding: 8mm 9mm;
    margin: 0;
    box-shadow: none;
    font-size: 11pt;
  }

  body.printing-jobsheet .jobsheet-letterhead {
    min-height: 35mm;
    padding-bottom: 7mm;
  }

  body.printing-jobsheet .jobsheet-logo img {
    width: 28mm;
  }

  body.printing-jobsheet .jobsheet-company {
    font-size: 10.5pt;
  }

  body.printing-jobsheet .jobsheet-date-row {
    padding: 4mm 0;
    font-size: 13pt;
  }

  body.printing-jobsheet .jobsheet-customer-table th,
  body.printing-jobsheet .jobsheet-customer-table td,
  body.printing-jobsheet .jobsheet-footer-table th,
  body.printing-jobsheet .jobsheet-footer-table td {
    padding: 3.2mm;
    font-size: 10.5pt;
  }

  body.printing-jobsheet .jobsheet-section-title {
    padding: 3.5mm;
  }

  body.printing-jobsheet .jobsheet-description {
    min-height: 21mm;
    padding: 3.5mm 3mm;
  }

  body.printing-jobsheet .jobsheet-equipment-table th,
  body.printing-jobsheet .jobsheet-equipment-table td {
    padding: 2.4mm;
    height: 7mm;
    font-size: 10pt;
  }

  body.printing-jobsheet .jobsheet-confirmation {
    margin-top: 6mm;
    padding: 4mm 12mm;
  }
}
