:root {
  --ink: #18212f;
  --muted: #667085;
  --line: #d9dee7;
  --page: #eef2f6;
  --critical: #c9392f;
  --watch: #b69715;
  --routine: #1f8f5f;
  --na: #667085;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--page);
  font-family: Arial, Helvetica, sans-serif;
}

.app-shell {
  width: min(1500px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.topbar {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 2.5vw, 35px);
  line-height: 0.95;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.summary-strip div {
  min-width: 58px;
  padding: 7px 9px;
  border-left: 1px solid var(--line);
}

.summary-strip div:first-child {
  border-left: 0;
}

.summary-strip span {
  display: block;
  font-size: 18px;
  font-weight: 900;
}

.summary-strip small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.workspace-header {
  margin-bottom: 12px;
}

.session-bar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.session-bar button {
  min-height: 30px;
  padding: 0 12px;
  font-size: 11px;
}

.app-tabs {
  display: flex;
  gap: 6px;
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: white;
  overflow-x: auto;
}

.tab-button {
  min-height: 34px;
  flex: 1 1 0;
  min-width: 0;
  padding: 0 24px;
  border-color: transparent;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  text-align: center;
}

.tab-button.is-active {
  border-color: #2f6f9f;
  color: white;
  background: #2f6f9f;
  box-shadow: 0 8px 18px rgba(47, 111, 159, 0.18);
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

.placeholder-panel {
  min-height: 360px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  background: rgba(255, 255, 255, 0.78);
}

.placeholder-panel h2 {
  margin: 0;
  font-size: clamp(24px, 3vw, 42px);
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: #eef2f6;
}

.login-shell {
  width: min(420px, calc(100% - 32px));
}

.login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
  background: white;
  box-shadow: 0 18px 48px rgba(20, 33, 50, 0.12);
}

.login-card h1 {
  margin-bottom: 22px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.login-form input {
  margin-top: 5px;
}

.login-message {
  min-height: 18px;
  margin: -4px 0 0;
  color: var(--critical);
  font-size: 12px;
  font-weight: 850;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.88);
}

.search-group,
.filter-group,
.action-group,
.sync-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.filter-group,
.action-group,
.sync-group {
  border-left: 1px solid var(--line);
  padding-left: 8px;
}

.search-group {
  flex: 1 1 240px;
  min-width: 220px;
}

.search-group input {
  width: 100%;
}

.filter-group {
  flex: 1 1 400px;
}

.action-group,
.sync-group {
  flex: 0 1 auto;
}

.filter-group select {
  flex: 1 1 130px;
  min-width: 130px;
}

.action-group button,
.sync-group button {
  white-space: nowrap;
}

.toolbar-menu {
  position: relative;
}

.toolbar-menu summary {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border: 1px solid #9fcef0;
  border-radius: 8px;
  padding: 0 22px;
  color: #0f4e78;
  background: #d7edfb;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
}

.toolbar-menu summary::-webkit-details-marker {
  display: none;
}

.toolbar-menu summary::after {
  content: "v";
  margin-left: 8px;
  font-size: 9px;
}

.toolbar-menu[open] summary::after {
  content: "^";
}

.toolbar-menu ul {
  position: absolute;
  left: 0;
  top: calc(100% - 1px);
  z-index: 60;
  display: grid;
  min-width: 170px;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 30px rgba(20, 33, 50, 0.18);
  list-style: none;
}

.toolbar-menu button {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: white;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.toolbar-menu button:hover {
  background: #eef4fa;
}

.sync-status {
  min-height: 20px;
  margin: -8px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.sync-status.is-error {
  color: var(--critical);
}

.sync-status.is-success {
  color: var(--routine);
}

.pm-controls {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 190px 180px auto;
  gap: 12px;
  margin-bottom: 8px;
}

.pm-add-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 0.6fr) auto auto auto;
  gap: 8px;
  align-items: end;
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 18px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.88);
}

.pm-add-toolbar label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.pm-add-toolbar input {
  min-height: 36px;
  margin-top: 4px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 850;
}

.pm-add-toolbar button {
  min-height: 36px;
  padding: 0 12px;
  font-size: 11px;
}

.history-page-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.88);
}

.history-page-controls input {
  flex: 1 1 230px;
}

.history-page-controls select {
  flex: 0 1 170px;
}

.history-page-controls button {
  flex: 0 0 auto;
  white-space: nowrap;
}

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

.pm-summary-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(78px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.pm-summary-strip div {
  padding: 7px 9px;
  border-left: 1px solid var(--line);
}

.pm-summary-strip div:first-child {
  border-left: 0;
}

.pm-summary-strip span {
  display: block;
  font-size: 18px;
  font-weight: 900;
}

.pm-summary-strip small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.pm-schedule {
  display: grid;
  gap: 14px;
}

.pm-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
  box-shadow: 0 8px 18px rgba(20, 33, 50, 0.08);
}

.pm-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
}

.pm-card h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1;
}

.pm-meta {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pm-meta-asset + .pm-meta {
  display: none;
}

.pm-asset-type {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  border-radius: 999px;
  padding: 0 7px;
  color: white;
  background: #2f6f9f;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.pm-item-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pm-item {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--na);
  border-radius: 8px;
  padding: 7px;
  background: #f8fafc;
}

.pm-item-main {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.pm-item-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.pm-item[data-status="overdue"] {
  border-left-color: var(--critical);
  background: #fff1ee;
}

.pm-item[data-status="upcoming"] {
  border-left-color: var(--watch);
  background: #fff9e2;
}

.pm-item[data-status="future"] {
  border-left-color: var(--routine);
  background: #effaf4;
}

.pm-item[data-status="scheduled"],
.pm-item[data-status="inProcess"] {
  border-left-color: #2f6f9f;
  background: #f5fbff;
}

.pm-item[data-status="completed"] {
  border-left-color: #2f6f9f;
  background: #f5fbff;
}

.pm-item-empty {
  border-left-color: var(--line);
  background: #f8fafc;
}

.pm-item-name {
  font-size: 12px;
  font-weight: 900;
}

.pm-item-value {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.pm-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
}

.pm-item-controls {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) 118px minmax(92px, 0.6fr) minmax(92px, 0.55fr) minmax(130px, 1fr) auto auto;
  gap: 7px;
  align-items: end;
}

.pm-item-controls label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.pm-item-controls input {
  min-height: 32px;
  margin-top: 3px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 850;
}

.pm-row-action {
  min-height: 32px;
  padding: 0 10px;
  font-size: 10px;
}

.pm-delete-item {
  min-height: 24px;
  border: 1px solid #d43831;
  border-radius: 999px;
  padding: 0 8px;
  color: #b42318;
  background: #fff7f5;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}

.pm-status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  color: white;
  background: var(--na);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.pm-status-badge[data-status="overdue"] {
  background: var(--critical);
}

.pm-status-badge[data-status="upcoming"] {
  background: var(--watch);
}

.pm-status-badge[data-status="future"] {
  background: var(--routine);
}

.pm-status-badge[data-status="scheduled"],
.pm-status-badge[data-status="inProcess"] {
  background: #2f6f9f;
}

.pm-status-badge[data-status="completed"] {
  background: #2f6f9f;
}

.pm-status-badge[data-status="note"],
.pm-status-badge[data-status="missing"] {
  background: var(--na);
}

.pm-company-counts span[data-status="missing"] {
  color: #425466;
  background: #eef2f6;
}

.pm-company-counts span[data-status="completed"] {
  color: #174e79;
  background: #d8ecfb;
}

.pm-asset-row[data-status="future"] {
  --safety-accent: var(--routine);
  background: #f5fbf8;
}

.pm-asset-row[data-status="upcoming"] {
  --safety-accent: var(--watch);
  background: #fffbee;
}

.pm-asset-row[data-status="completed"] {
  --safety-accent: #2f6f9f;
  background: #f5fbff;
}

.pm-asset-row[data-status="note"],
.pm-asset-row[data-status="missing"],
.pm-asset-row[data-status="noItems"] {
  --safety-accent: var(--na);
  background: #f8fafc;
}

.pm-asset-row[data-pm-asset-type="trailer"] {
  background: #f4f8f1;
}

.pm-row-details {
  background: rgba(255, 255, 255, 0.38);
}

.pm-row-item-list {
  gap: 6px;
}

.pm-mini-state strong {
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pm-mini-state[data-status="overdue"] {
  color: #b42318;
}

.pm-mini-state[data-status="upcoming"] {
  color: #6f5200;
}

.pm-mini-state[data-status="future"] {
  color: #1f6f4d;
}

.pm-mini-state[data-status="scheduled"],
.pm-mini-state[data-status="inProcess"] {
  color: #174e79;
}

.pm-mini-state[data-status="completed"] {
  color: #174e79;
}

.pm-mini-state[data-status="note"],
.pm-mini-state[data-status="missing"],
.pm-mini-state[data-status="noItems"] {
  color: #425466;
}

.safety-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(130px, 0.55fr) minmax(120px, 0.45fr) minmax(150px, 0.6fr) auto minmax(250px, 0.9fr);
  gap: 10px;
  align-items: stretch;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.88);
}

.safety-controls > * {
  min-width: 0;
}

.safety-toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.safety-toggle input {
  width: auto;
  min-height: 0;
}

.safety-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(66px, 1fr));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.safety-summary-strip div {
  padding: 7px 9px;
  border-left: 1px solid var(--line);
}

.safety-summary-strip div:first-child {
  border-left: 0;
}

.safety-summary-strip span {
  display: block;
  font-size: 18px;
  font-weight: 900;
}

.safety-summary-strip small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.safety-inspection-board {
  display: grid;
  gap: 14px;
}

.safety-company-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 18px rgba(20, 33, 50, 0.06);
  overflow: hidden;
}

.safety-company-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  min-height: 54px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: white;
}

.safety-company-head h2 {
  margin: 0;
  font-size: 17px;
}

.safety-company-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.safety-company-counts {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.safety-company-counts span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  color: #425466;
  background: #eef2f6;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.safety-company-counts span[data-status="overdue"] {
  color: #b42318;
  background: #fff1ee;
}

.safety-company-counts span[data-status="dueSoon"] {
  color: #6f5200;
  background: #fff0ba;
}

.safety-company-counts span[data-status="scheduled"] {
  color: #174e79;
  background: #d8ecfb;
}

.safety-company-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 12px;
}

.safety-type-section {
  min-width: 0;
}

.safety-type-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  padding: 0 10px;
  background: #f8fafc;
}

.safety-type-head h3 {
  margin: 0;
  font-size: 13px;
  font-weight: 900;
}

.safety-type-head span {
  min-width: 24px;
  border-radius: 999px;
  padding: 3px 7px;
  color: white;
  background: #2f6f9f;
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.safety-asset-list {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  padding: 7px;
  background: rgba(255, 255, 255, 0.55);
}

.safety-empty-row {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--muted);
  background: white;
  font-size: 12px;
  font-weight: 850;
}

.safety-asset-row {
  --safety-accent: var(--routine);
  border: 1px solid var(--line);
  border-left: 5px solid var(--safety-accent);
  border-radius: 8px;
  background: white;
  overflow: hidden;
}

.safety-asset-row[data-status="overdue"] {
  --safety-accent: var(--critical);
  background: #fff8f7;
}

.safety-asset-row[data-status="dueSoon"] {
  --safety-accent: var(--watch);
  background: #fffbee;
}

.safety-asset-row[data-status="scheduled"],
.safety-asset-row[data-status="inProgress"] {
  --safety-accent: #2f6f9f;
  background: #f5fbff;
}

.safety-asset-row[data-status="missing"] {
  --safety-accent: var(--na);
  background: #f8fafc;
}

.safety-asset-row[data-status="current"] {
  --safety-accent: var(--routine);
  background: #f5fbf8;
}

.safety-asset-row[data-safety-asset-type="trailer"] {
  background: #f4f8f1;
  border-color: #d3e2ca;
}

.safety-asset-row[open] {
  box-shadow: 0 8px 16px rgba(20, 33, 50, 0.08);
}

.safety-asset-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
  align-items: stretch;
  min-height: 64px;
  padding: 7px 10px;
  cursor: pointer;
  list-style: none;
}

.safety-asset-summary::-webkit-details-marker {
  display: none;
}

.safety-summary-top,
.safety-summary-bottom {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.safety-asset-main,
.safety-summary-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.safety-asset-main strong {
  font-size: 18px;
  line-height: 1;
}

.safety-summary-actions {
  justify-content: flex-end;
}

.safety-asset-detail {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.safety-row-statuses {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
  min-width: 0;
  overflow: visible;
}

.safety-mini-state {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  flex: 0 1 auto;
  min-width: 0;
  max-width: 180px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  white-space: nowrap;
}

.safety-mini-state strong {
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.safety-mini-state span {
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.safety-mini-state small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
}

.safety-mini-state[data-status="overdue"] {
  color: #b42318;
}

.safety-mini-state[data-status="dueSoon"] {
  color: #6f5200;
}

.safety-mini-state[data-status="scheduled"],
.safety-mini-state[data-status="inProgress"] {
  color: #174e79;
}

.safety-mini-state[data-status="current"] {
  color: #1f6f4d;
}

.safety-expand-label {
  justify-self: end;
  color: #174e79;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.safety-asset-row[open] .safety-expand-label {
  color: var(--muted);
}

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

.inspection-row-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.inspection-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--safety-accent);
  border-radius: 8px;
  padding: 9px;
  background: rgba(255, 255, 255, 0.72);
}

.inspection-row[data-status="overdue"] {
  border-left-color: var(--critical);
}

.inspection-row[data-status="dueSoon"] {
  border-left-color: var(--watch);
}

.inspection-row[data-status="scheduled"],
.inspection-row[data-status="inProgress"] {
  border-left-color: #2f6f9f;
}

.inspection-row[data-status="missing"] {
  border-left-color: var(--na);
}

.inspection-row[data-status="current"] {
  border-left-color: var(--routine);
}

.inspection-row h3 {
  margin: 0;
  font-size: 14px;
}

.inspection-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.inspection-fields {
  display: grid;
  grid-template-columns: 136px 140px 1fr;
  gap: 8px;
}

.inspection-fields label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.inspection-fields input,
.inspection-fields select {
  margin-top: 4px;
  min-height: 34px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 850;
  text-transform: none;
}

.inspection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  justify-content: flex-end;
}

.safety-row-action {
  min-height: 30px;
  padding: 0 12px;
  font-size: 11px;
}

.inspection-state {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 9px;
  color: white;
  background: var(--na);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.inspection-state[data-status="overdue"] {
  background: var(--critical);
}

.inspection-state[data-status="dueSoon"] {
  color: #5d4300;
  background: #ffeaa3;
}

.inspection-state[data-status="upcoming"] {
  color: #5d4300;
  background: #ffeaa3;
}

.inspection-state[data-status="scheduled"],
.inspection-state[data-status="inProgress"] {
  background: #2f6f9f;
}

.inspection-state[data-status="current"] {
  background: var(--routine);
}

.inspection-state[data-status="future"] {
  background: var(--routine);
}

.inspection-state[data-status="completed"] {
  background: #2f6f9f;
}

.inspection-state[data-status="note"],
.inspection-state[data-status="missing"] {
  background: var(--na);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: white;
  font-size: 15px;
  font-weight: 700;
}

textarea {
  min-height: 112px;
  padding: 12px;
  resize: vertical;
  line-height: 1.35;
}

button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: white;
  font: inherit;
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 111, 159, 0.25);
  outline-offset: 2px;
}

.primary-action {
  border-color: #9fc8e8;
  color: #174e79;
  background: #d8ecfb;
}

.secondary-action {
  border-color: #9fc8e8;
  color: #174e79;
  background: #d8ecfb;
}

.danger-action {
  color: white;
  background: var(--critical);
}

.icon-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  border-color: var(--line);
  font-size: 22px;
  line-height: 1;
}

.truck-board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: start;
  margin-bottom: 26px;
  padding-bottom: 16px;
}

.truck-board::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(47, 111, 159, 0.18), rgba(31, 143, 95, 0.18));
}

.board-section {
  min-width: 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px 8px 0 0;
  padding: 0 12px;
  background: white;
}

.section-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}

.section-head span {
  min-width: 28px;
  border-radius: 999px;
  padding: 4px 8px;
  color: white;
  background: #2f6f9f;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
}

.truck-lane {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  align-items: start;
  min-height: 180px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.58);
  overflow: visible;
}

.truck-lane.is-drag-over {
  outline: 3px solid rgba(47, 111, 159, 0.25);
  outline-offset: -3px;
  background: rgba(255, 255, 255, 0.86);
}

.truck-card {
  --accent: var(--routine);
  position: relative;
  display: grid;
  min-height: 0;
  border: 1px solid rgba(201, 57, 47, 0.18);
  border-top: 5px solid var(--accent);
  border-radius: 8px;
  padding: 7px;
  background: white;
  box-shadow: 0 7px 14px rgba(20, 33, 50, 0.08);
  overflow: visible;
  cursor: grab;
}

.truck-card:has(.actions-menu[open]),
.trailer-card:has(.actions-menu[open]) {
  z-index: 40;
}

.truck-card:active {
  cursor: grabbing;
}

.truck-card.is-dragging,
.trailer-card.is-dragging {
  opacity: 0.55;
}

.truck-card[data-urgency="critical"],
.trailer-card[data-urgency="critical"] {
  --accent: var(--critical);
  background: #fff1ee;
}

.truck-card[data-urgency="watch"],
.trailer-card[data-urgency="watch"] {
  --accent: var(--watch);
  background: #fff9e2;
}

.truck-card[data-urgency="routine"],
.trailer-card[data-urgency="routine"] {
  --accent: var(--routine);
  background: #effaf4;
}

.truck-card[data-urgency="na"],
.trailer-card[data-urgency="na"] {
  --accent: var(--na);
  background: #f7f8fa;
}

.trailer-section {
  min-width: 0;
  margin-bottom: 16px;
}

.trailer-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 8px;
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 8px 8px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.58);
  overflow: visible;
}

.trailer-card {
  --accent: var(--na);
  position: relative;
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--accent);
  border-radius: 8px;
  padding: 8px;
  background: white;
  box-shadow: 0 7px 14px rgba(20, 33, 50, 0.08);
  overflow: visible;
}

.trailer-card h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1;
}

.trailer-card .card-head {
  align-items: flex-start;
}

.trailer-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  margin: 0;
  font-size: 10px;
  font-weight: 850;
}

.trailer-card dt {
  color: var(--muted);
}

.trailer-card dd {
  margin: 0;
  color: var(--ink);
  text-align: right;
  overflow-wrap: anywhere;
}

.compact-card {
  gap: 6px;
  min-height: 0;
  padding: 8px;
}

.compact-card.truck-card {
  background: #f1f7fc;
  border-color: #c9ddeb;
}

.compact-card.trailer-card {
  background: #f4f8f1;
  border-color: #d3e2ca;
}

.compact-card .compact-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: flex-start;
}

.compact-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.asset-type {
  border-radius: 999px;
  padding: 3px 6px;
  color: white;
  background: #2f6f9f;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.compact-title {
  color: #081f45;
  font-size: 20px;
  line-height: 1;
  font-weight: 950;
}

.compact-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 7px;
  margin: 0;
  font-size: 10px;
  font-weight: 850;
}

.compact-card dt {
  color: var(--muted);
}

.compact-card dd {
  margin: 0;
  color: var(--ink);
  text-align: right;
  overflow-wrap: anywhere;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: flex-start;
}

.card-actions {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
  justify-content: flex-end;
}

.truck-identity {
  display: flex;
  gap: 6px;
  align-items: center;
}

.truck-number {
  margin: 0;
  color: #081f45;
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
}

.company-logo {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
}

.company-logo img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.company-logo-fallback {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 5px;
  color: #081f45;
  background: white;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.trailer-number {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.connection-line {
  display: inline-grid;
  grid-template-columns: auto auto auto;
  gap: 5px;
  align-items: center;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.connection-line strong {
  color: var(--ink);
}

.connection-line small {
  border-radius: 999px;
  padding: 2px 5px;
  color: white;
  background: #2f6f9f;
  font-size: 9px;
  font-weight: 900;
}

.connection-alert {
  margin: 4px 0 0;
  color: var(--critical);
  font-size: 10px;
  font-weight: 900;
}

.urgency-badge {
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 5px 7px;
  color: var(--accent);
  background: white;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.edit-card-button {
  min-height: 24px;
  border-color: var(--accent);
  border-radius: 8px;
  padding: 0 7px;
  color: var(--accent);
  background: white;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.actions-menu {
  position: relative;
}

.actions-menu summary {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0 8px;
  color: var(--accent);
  background: white;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
  list-style: none;
}

.actions-menu summary::-webkit-details-marker {
  display: none;
}

.actions-menu summary::after {
  content: "▾";
  margin-left: 5px;
  font-size: 8px;
}

.actions-menu[open] summary::after {
  content: "▴";
}

.actions-menu ul {
  position: absolute;
  right: 0;
  top: calc(100% - 1px);
  z-index: 20;
  display: grid;
  min-width: 118px;
  margin: 0;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 12px 30px rgba(20, 33, 50, 0.18);
  list-style: none;
}

.actions-menu button {
  width: 100%;
  justify-content: flex-start;
  border: 0;
  border-radius: 6px;
  padding: 7px 8px;
  color: var(--ink);
  background: white;
  font-size: 11px;
  font-weight: 900;
  text-align: left;
}

.actions-menu button:hover {
  background: #eef4fa;
}

.people {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px 13px;
  margin: 8px 0 6px;
}

.field span {
  display: block;
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  text-transform: uppercase;
}

.field strong,
.field a {
  display: block;
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  text-decoration: none;
}

.phone-field {
  grid-column: 1 / 2;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  align-items: center;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 6px 0 5px;
}

.status-pill {
  border-radius: 999px;
  padding: 5px 7px;
  color: white;
  background: #2f6f9f;
  font-size: 9px;
  font-weight: 900;
}

.age-pill {
  border-radius: 999px;
  padding: 5px 7px;
  color: #5a4500;
  background: #fff0ba;
  font-size: 9px;
  font-weight: 900;
  white-space: nowrap;
}

.updated {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-align: right;
}

.repair-list {
  margin: 5px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 3px;
}

.repair-list li {
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr) auto;
  gap: 5px;
  align-items: center;
  font-size: 10px;
  font-weight: 900;
}

.repair-list li::before {
  content: "";
  width: 5px;
  height: 5px;
  margin-top: 4px;
  border-radius: 2px;
  background: var(--accent);
}

.repair-list small,
.repair-status-badge {
  border-radius: 999px;
  padding: 2px 5px;
  color: #174e79;
  background: #d8ecfb;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.repair-status-select {
  min-height: 24px;
  width: 132px;
  border: 1px solid #c9d8e6;
  border-radius: 999px;
  padding: 2px 22px 2px 7px;
  color: #174e79;
  background-color: #eef6fc;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.last-update-note {
  margin: 7px 0 0;
  border: 1px solid #d7e4ef;
  border-radius: 8px;
  padding: 6px 7px;
  color: #31465c;
  background: rgba(255, 255, 255, 0.68);
  font-size: 10px;
  font-weight: 800;
}

.last-update-note strong,
.last-update-note span,
.last-update-note time,
.last-update-note small {
  display: block;
}

.last-update-note span {
  color: var(--muted);
  font-size: 9px;
}

.last-update-note time {
  margin: 2px 0;
  color: #5c6f84;
  font-size: 9px;
  font-weight: 900;
}

.last-update-note small {
  margin-top: 2px;
  color: #5c6f84;
  font-size: 9px;
  font-weight: 800;
}

.repair-list small[data-repair-status="completed"] {
  color: #1f6f4d;
  background: #dff3e8;
}

.repair-list small[data-repair-status="partsOrdered"] {
  color: #7b5a00;
  background: #fff0ba;
}

.repair-list small[data-repair-status="inProcess"] {
  color: #174e79;
  background: #d8ecfb;
}

.repair-list small[data-repair-status="waitingApproval"] {
  color: #5c3b85;
  background: #efe7fb;
}

.repair-list small[data-repair-status="waitingEstimate"] {
  color: #4d5562;
  background: #edf0f5;
}

.repair-list small[data-repair-status="searchingShops"] {
  color: #0f5d5e;
  background: #d8f1ef;
}

.repair-list small[data-repair-status="searchingParts"] {
  color: #6b4a00;
  background: #fff4cc;
}

.repair-list small[data-repair-status="partsOnWay"] {
  color: #6b3f00;
  background: #ffe2bf;
}

.repair-list small[data-repair-status="waitingPayment"] {
  color: #7a2e0e;
  background: #ffe8d8;
}

.repair-list small[data-repair-status="scheduleNext"] {
  color: #6b4ba3;
  background: #eee7fb;
}

.empty-state {
  grid-column: 1 / -1;
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: white;
  text-align: center;
  font-weight: 800;
}

.lane-empty {
  min-height: 92px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: white;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.truck-dialog {
  width: min(760px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  color: var(--ink);
  box-shadow: 0 24px 80px rgba(24, 33, 47, 0.35);
}

.truck-dialog::backdrop {
  background: rgba(24, 33, 47, 0.45);
}

.truck-dialog form {
  padding: 20px;
  background: white;
}

.dialog-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.dialog-head h2 {
  margin: 0;
  font-size: 28px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.repair-field {
  margin-top: 12px;
}

.check-row {
  display: flex;
  grid-template-columns: none;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  color: var(--ink);
  font-size: 13px;
  text-transform: none;
}

.check-row input {
  width: auto;
  min-height: 0;
}

.repair-update-section {
  margin-top: 14px;
}

.repair-update-section h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

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

.repair-update-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) 180px minmax(180px, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #f8fafc;
}

.repair-update-row strong,
.repair-update-row small {
  display: block;
}

.repair-update-row small,
.repair-update-empty {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.print-dialog {
  width: min(520px, calc(100% - 28px));
}

.print-options {
  display: grid;
  gap: 8px;
}

.radio-row {
  display: flex;
  grid-template-columns: none;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--ink);
  background: #f8fafc;
  font-size: 13px;
  text-transform: none;
}

.radio-row input {
  width: auto;
  min-height: 0;
}

.history-dialog {
  width: min(900px, calc(100% - 28px));
}

.history-panel {
  padding: 20px;
  background: white;
}

.history-list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  max-height: 62vh;
  overflow: auto;
}

.history-record {
  border: 1px solid var(--line);
  border-left: 5px solid #2f6f9f;
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.history-record-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.history-record-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.history-print-button,
.history-delete-button {
  min-height: 25px;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.history-print-button {
  border-color: #9fcef0;
  color: #0f4e78;
  background: #d7edfb;
}

.history-delete-button {
  border-color: rgba(201, 57, 47, 0.45);
  color: #b42318;
  background: #fff1ee;
}

.history-record h3,
.history-record h4 {
  margin: 0;
}

.history-record h4 {
  margin-top: 10px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.history-record p {
  margin: 4px 0 0;
}

.history-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.history-updates {
  display: grid;
  gap: 8px;
  margin: 6px 0 0;
  padding: 0;
  list-style: none;
}

.history-repair-section {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.history-repair-section + .history-repair-section {
  margin-top: 8px;
}

.history-repair-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.history-repair-head small {
  border-radius: 999px;
  padding: 3px 7px;
  color: #174e79;
  background: #d8ecfb;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.history-repair-head small[data-repair-status="completed"] {
  color: #1f6f4d;
  background: #dff3e8;
}

.history-repair-head small[data-repair-status="partsOrdered"] {
  color: #7b5a00;
  background: #fff0ba;
}

.history-repair-head small[data-repair-status="inProcess"] {
  color: #174e79;
  background: #d8ecfb;
}

.history-repair-head small[data-repair-status="waitingApproval"] {
  color: #5c3b85;
  background: #efe7fb;
}

.history-repair-head small[data-repair-status="waitingEstimate"] {
  color: #4d5562;
  background: #edf0f5;
}

.history-repair-head small[data-repair-status="searchingShops"] {
  color: #0f5d5e;
  background: #d8f1ef;
}

.history-repair-head small[data-repair-status="searchingParts"] {
  color: #6b4a00;
  background: #fff4cc;
}

.history-repair-head small[data-repair-status="partsOnWay"] {
  color: #6b3f00;
  background: #ffe2bf;
}

.history-repair-head small[data-repair-status="waitingPayment"] {
  color: #7a2e0e;
  background: #ffe8d8;
}

.history-repair-head small[data-repair-status="scheduleNext"] {
  color: #6b4ba3;
  background: #eee7fb;
}

.history-updates li {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: white;
  font-size: 12px;
  font-weight: 800;
}

.history-updates strong,
.history-updates span,
.history-updates small {
  display: block;
}

.dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 16px;
}

.dialog-actions .secondary-action {
  justify-self: end;
}

@media (max-width: 820px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .history-page-controls {
    grid-template-columns: 1fr;
  }

  .pm-controls {
    grid-template-columns: 1fr;
  }

  .pm-add-toolbar {
    grid-template-columns: 1fr;
  }

  .safety-controls {
    grid-template-columns: 1fr;
  }

  .safety-inspection-board {
    grid-template-columns: 1fr;
  }

  .safety-company-body {
    grid-template-columns: 1fr;
  }

  .safety-summary-bottom {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .safety-row-statuses {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .inspection-fields {
    grid-template-columns: 1fr;
  }

  .pm-item-controls {
    grid-template-columns: 1fr;
  }

  .app-tabs {
    flex-direction: column;
  }

  .tab-button {
    width: 100%;
    min-width: 0;
  }

  .search-group,
  .filter-group,
  .action-group,
  .sync-group {
    flex-wrap: wrap;
  }

  .filter-group,
  .action-group,
  .sync-group {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-top: 8px;
    padding-left: 0;
  }

  .filter-group select {
    width: auto;
    flex: 1 1 150px;
  }

  .summary-strip {
    width: 100%;
  }

  .truck-board {
    grid-template-columns: 1fr;
  }

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

  .repair-update-row {
    grid-template-columns: 1fr;
  }

  .dialog-actions .secondary-action {
    justify-self: stretch;
  }
}

@media (max-width: 460px) {
  .summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .safety-summary-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .safety-company-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .safety-company-counts {
    justify-content: flex-start;
  }

  .safety-row-statuses {
    grid-template-columns: 1fr;
  }

  .truck-lane {
    grid-template-columns: 1fr;
  }

  .truck-card {
    aspect-ratio: auto;
  }
}
