:root {
  --bg: #e7ebef;
  --panel: rgba(246, 248, 250, 0.94);
  --line: rgba(48, 66, 84, 0.16);
  --text: #1f2b36;
  --muted: #5f6f7f;
  --primary: #285a78;
  --primary-dark: #1f4a64;
  --accent: #b9782c;
  --danger: #a1492b;
  --shadow: 0 18px 40px rgba(31, 43, 54, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Franklin Gothic Medium", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(185, 120, 44, 0.09), transparent 28%),
    radial-gradient(circle at bottom right, rgba(40, 90, 120, 0.1), transparent 30%),
    linear-gradient(180deg, #edf1f4 0%, #dde4ea 100%);
}

.glow {
  position: fixed;
  width: 20rem;
  height: 20rem;
  border-radius: 999px;
  filter: blur(70px);
  opacity: 0.32;
  pointer-events: none;
}

.glow-a { top: -7rem; left: -4rem; background: rgba(185, 120, 44, 0.22); }
.glow-b { bottom: -7rem; right: -5rem; background: rgba(40, 90, 120, 0.24); }

.shell {
  position: relative;
  z-index: 1;
  max-width: 1600px;
  margin: 0 auto;
  padding: 18px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}

.app-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(210px, 1fr));
  gap: 12px;
  align-items: stretch;
}

.app-switcher-button {
  min-height: 58px;
  padding: 10px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f7fafc;
  color: var(--primary);
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 1.9vw, 2rem);
  font-weight: 700;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 12px 26px rgba(31, 43, 54, 0.08);
}

.app-switcher-button.active {
  background: rgba(238, 225, 214, 0.96);
  border-color: rgba(185, 120, 44, 0.32);
  color: var(--text);
}

.app-switcher-button:hover {
  transform: translateY(-1px);
  background: #fff;
  color: var(--text);
  box-shadow: 0 16px 32px rgba(31, 43, 54, 0.12);
}

.app-switcher-button:active {
  transform: translateY(0);
  background: #e7eef4;
  color: var(--primary);
}

.auth-brand {
  align-items: start;
  margin-top: 12px;
  gap: 18px;
}

.logo-shell {
  width: 78px;
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-shell-wide {
  width: 220px;
  height: 78px;
  padding: 0;
}

.logo-shell-header {
  width: 246px;
  height: 78px;
  padding: 0;
}

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

.brand-logo-wide {
  width: 100%;
  height: 100%;
}

.logo-fallback {
  display: none;
  width: 100%;
  height: 100%;
  place-items: center;
  text-align: center;
  padding: 8px;
  font-weight: 700;
  color: var(--primary);
}

.auth-panel {
  width: min(520px, 100%);
  margin: 5vh auto 0;
  padding: 28px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.76rem;
  color: var(--accent);
  font-weight: 700;
}

h1, h2, h3, p { margin: 0; }
h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(1.5rem, 2vw, 2rem); }
h2 { font-family: Georgia, "Times New Roman", serif; font-size: 1.35rem; }

.lead, .subtle, .message { color: var(--muted); }
.lead { margin-top: 8px; line-height: 1.5; }
.attention-summary {
  margin: 8px 0 0;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(185, 120, 44, 0.1);
  color: #815b25;
  border: 1px solid rgba(185, 120, 44, 0.16);
  font-size: 0.92rem;
}

.attention-link {
  border: 0;
  background: transparent;
  color: var(--primary);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  font: inherit;
}

.attention-link:hover {
  color: var(--primary-dark);
}

.attention-sep {
  color: var(--muted);
  padding: 0 4px;
}

.reminder-details {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.reminder-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(249, 251, 252, 0.84);
}

.reminder-card.late {
  border-color: rgba(161, 73, 43, 0.22);
  background: rgba(161, 73, 43, 0.06);
}

.reminder-card.follow-up {
  border-color: rgba(185, 120, 44, 0.22);
  background: rgba(185, 120, 44, 0.06);
}

.reminder-copy {
  margin-top: 4px;
  color: var(--text);
}

.follow-up-history {
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(40, 90, 120, 0.06);
  border: 1px solid rgba(40, 90, 120, 0.1);
  font-size: 0.88rem;
}

.saved-notes-box {
    min-height: calc(1.25em * 8 + 20px);
    max-height: calc(1.25em * 8 + 20px);
    padding: 10px 12px;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    white-space: pre-wrap;
    line-height: 1.25;
    overflow-y: auto;
  }

.saved-notes-box.empty::before {
  content: "No notes yet.";
  color: var(--muted);
}

.note-entry-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }

.form-actions.rental-form-actions {
  width: 100%;
  justify-content: flex-end;
}

.tool-parts-closeout-history {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.tool-parts-closeout-history-list {
  display: grid;
  gap: 12px;
}

.tool-parts-closeout-card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.tool-parts-closeout-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tool-parts-closeout-grid {
  display: grid;
  gap: 10px 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.tool-parts-closeout-grid div,
.tool-parts-closeout-parts {
  display: grid;
  gap: 4px;
}

.tool-parts-closeout-parts pre {
  margin: 0;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 0.95rem;
}

.reminder-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  margin-top: 10px;
  flex-wrap: wrap;
}

.reminder-inline-field {
  min-width: 180px;
}

.reminder-inline-field span {
  font-size: 0.8rem;
}

.reminder-inline-field input {
  padding: 10px 12px;
}

.stack, .repair-list, .activity-log, .user-list, .transition-panel { display: grid; gap: 12px; }
.stack { margin-top: 22px; }
.transition-panel { margin-top: 8px; }

label { display: grid; gap: 6px; }
label span { color: var(--muted); font-weight: 600; }
.action-field {
  align-self: end;
}

.action-field span {
  display: none;
}

.action-button {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1px solid rgba(57, 45, 31, 0.16);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.15;
}

.action-button:hover {
  background: rgba(255, 255, 255, 0.92);
  border-color: var(--primary);
  transform: none;
}

input, select, textarea, button { font: inherit; }
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(57, 45, 31, 0.16);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(15, 111, 102, 0.22);
  border-color: var(--primary);
}

textarea { resize: vertical; }

.button {
  border: 0;
  border-radius: 14px;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease;
}

.button:hover { transform: translateY(-1px); }
.button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.button.primary { background: var(--primary); color: white; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: rgba(212, 122, 51, 0.18); color: var(--text); }
.button.danger { background: var(--danger); color: white; }
.button.danger:hover { background: #8a3c23; }
.message.error { color: var(--danger); }

.hint {
  margin-top: 18px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(185, 120, 44, 0.1);
}

.hidden { display: none !important; }

.topbar, .toolbar, .list-panel, .detail-panel { padding: 14px 16px; }
.detail-panel { padding-bottom: 112px; }

.sticky-topbar {
  position: static;
}

.sticky-summary {
  position: static;
  background: transparent;
  padding-top: 0;
  margin-bottom: 4px;
}

.topbar, .panel-head, .toolbar-main, .topbar-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.list-panel .panel-head {
  margin-bottom: 8px;
  padding: 2px 6px 2px 2px;
}

#repairCount {
  white-space: nowrap;
}
.detail-actions {
  display: flex;
  gap: 8px;
  justify-items: end;
  justify-content: flex-end;
  align-items: center;
}

.detail-heading-row.rental-unit-heading {
  justify-content: space-between;
  gap: 14px;
}

.detail-actions-main {
  display: flex;
  gap: 22px;
  align-items: center;
  margin-top: 10px;
  padding-right: 4px;
}

.floating-action-dock {
  position: fixed;
  right: 24px;
  bottom: 20px;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(48, 66, 84, 0.14);
  border-radius: 16px;
  background: rgba(237, 241, 244, 0.96);
  box-shadow: 0 18px 34px rgba(41, 56, 70, 0.16);
  backdrop-filter: blur(8px);
}

.transition-quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}

.user-pill { display: grid; justify-items: end; }

.dashboard-grid {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  margin: 6px 0 6px;
  position: sticky;
  top: 8px;
  z-index: 20;
  padding: 6px 0 8px;
  background: linear-gradient(180deg, rgba(237, 241, 244, 0.98) 0%, rgba(237, 241, 244, 0.9) 82%, rgba(237, 241, 244, 0) 100%);
}

.rentals-dashboard {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

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

.rental-toolbar {
  margin-top: 8px;
  display: grid;
  gap: 8px;
}

.rentals-workspace {
  grid-template-columns: minmax(300px, 360px) minmax(560px, 1fr);
}

.detail-heading-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
}

.rental-start-form {
  margin-top: 18px;
}

.rental-start-form .form-actions {
  width: 100%;
  justify-content: flex-end;
}

.rental-return-date-grid {
  grid-template-columns: 220px;
}

.rental-return-date-field {
  width: 220px;
}

.rental-calibration-grid {
  grid-template-columns: 260px;
}

.rental-calibration-grid > label {
  width: 260px;
}

.rental-calibration-grid .checkbox-card span {
  white-space: nowrap;
}

.compact-hint {
  margin-top: 0;
  padding: 10px 12px;
}

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

.status-card {
  appearance: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  padding: 7px 9px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(236, 241, 245, 0.96));
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.status-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(58, 80, 102, 0.08);
}

.status-card.active {
  transform: translateY(-1px);
  border-color: rgba(40, 90, 120, 0.72);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(214, 227, 239, 0.99));
  box-shadow:
    0 0 0 4px rgba(40, 90, 120, 0.22),
    0 16px 30px rgba(41, 56, 70, 0.16);
}

.status-card.active .status-card-label,
.status-card.active .count {
  color: var(--text);
}

.status-card.active .status-card-label {
  font-weight: 700;
}

.status-card.active .count {
  font-size: 1.35rem;
}

.status-card-label {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.2;
}

.status-card .count {
  display: inline-block;
  margin-top: 2px;
  font-size: 1.25rem;
  font-weight: 700;
  white-space: nowrap;
}

.status-slate { border-top: 5px solid #56697c; }
.status-amber { border-top: 5px solid #a9792c; }
.status-orange { border-top: 5px solid #bd6f2c; }
.status-blue { border-top: 5px solid #3f6a8d; }
.status-red { border-top: 5px solid #a1492b; }
.status-green { border-top: 5px solid #537b5b; }

.toolbar-main { flex-wrap: nowrap; }
.toolbar-main input { flex: 1 1 260px; }

#searchInput {
  transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

#searchInput:focus,
#searchInput:not(:placeholder-shown) {
  transform: translateY(-1px);
  border-color: rgba(40, 90, 120, 0.72);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(214, 227, 239, 0.99));
  box-shadow:
    0 0 0 4px rgba(40, 90, 120, 0.18),
    0 14px 28px rgba(41, 56, 70, 0.12);
}

.search-scope-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  padding: 0 4px;
}

.search-scope-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.search-scope-toggle span {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(520px, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 12px;
}

.repair-item, .activity-item, .user-item, .transition-card, .empty-state {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 8px 10px;
  background: rgba(249, 251, 252, 0.8);
}

.history-events {
  display: grid;
  gap: 8px;
}

.history-event {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  background: rgba(249, 251, 252, 0.8);
}

.history-event header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.history-event > .subtle {
  margin: 1px 0 6px;
  font-size: 12px;
}

.history-event-details {
  margin-top: 4px;
}

.history-event-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 4px 12px;
}

.history-event-detail-pair {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px;
  min-width: 0;
  font-size: 13px;
  line-height: 1.25;
}

.history-event-detail-pair-wide {
  grid-column: 1 / -1;
}

.history-event-detail-pair-wide strong {
  max-width: 100%;
}

.history-event-detail-pair span {
  color: var(--muted);
  white-space: nowrap;
}

.history-event-detail-pair span::after {
  content: ":";
}

.history-event-detail-pair strong {
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.history-event-notes {
  margin-top: 6px;
  white-space: pre-wrap;
  line-height: 1.35;
}

.transition-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px 14px;
  align-items: start;
}

.transition-card-copy {
  min-width: 0;
}

.transition-card-copy .missing,
.transition-card-copy .subtle {
  overflow-wrap: anywhere;
}

.transition-card-actions {
  display: flex;
  justify-content: flex-end;
  align-self: start;
}

.transition-status-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 14px;
  border: 1px solid rgba(95, 111, 127, 0.16);
  background: rgba(95, 111, 127, 0.08);
  color: var(--muted);
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
}

.repair-item { cursor: pointer; transition: transform 0.15s ease, border-color 0.15s ease; }
.repair-item:hover, .repair-item.active {
  transform: translateY(-1px);
  border-color: rgba(40, 90, 120, 0.42);
  background: rgba(40, 90, 120, 0.08);
}

.repair-item.overdue {
  border-color: rgba(164, 60, 47, 0.35);
  background: rgba(164, 60, 47, 0.06);
}

.repair-item header, .activity-item header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.repair-item header {
  position: relative;
  display: block;
  min-height: 20px;
}

.repair-item.badge-count-3 {
  padding-bottom: 28px;
}

.repair-item header strong {
  display: block;
  padding-right: 142px;
}

.repair-item-badges {
  position: absolute;
  top: 0;
  right: 0;
  display: grid;
  gap: 4px;
  justify-items: end;
}

.repair-item p {
  font-size: 0.93rem;
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(48, 66, 84, 0.08);
  font-size: 0.74rem;
  font-weight: 700;
}

.badge.overdue {
  background: rgba(164, 60, 47, 0.14);
  color: var(--danger);
}

.badge.approved {
  background: rgba(66, 120, 84, 0.16);
  color: #2f6b49;
}

.badge.declined {
  background: rgba(164, 60, 47, 0.14);
  color: var(--danger);
}

.detail-form { display: grid; gap: 16px; }
.detail-form > .field-section:first-child { margin-top: 6px; }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(31, 43, 54, 0.38);
  display: grid;
  place-items: center;
  z-index: 60;
  padding: 24px;
}

.modal-card {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 18px;
}

.internal-service-modal-card {
  width: min(860px, 100%);
}

.modal-head-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.approval-decision-actions {
  margin-top: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(249, 251, 252, 0.78);
}

.approval-decision-copy {
  font-weight: 600;
  color: var(--text);
}

.approval-decision-buttons {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.approval-decision-missing {
  margin-top: 8px;
  color: var(--danger);
  font-size: 0.92rem;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  margin: 8px 0 14px;
}

.admin-tab.active {
  background: var(--primary);
  color: #fff;
}

.admin-panel-body {
  display: grid;
  gap: 14px;
}

.preview-actions {
  display: flex;
  justify-content: end;
}

.modal-form {
  margin-top: 10px;
}

.internal-service-summary {
  margin-top: 10px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid rgba(40, 90, 120, 0.14);
  background: rgba(40, 90, 120, 0.06);
  display: grid;
  gap: 10px;
}

.internal-service-summary-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.internal-service-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.internal-service-summary-card,
.internal-service-total-card {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(48, 66, 84, 0.12);
  background: rgba(255, 255, 255, 0.68);
  display: grid;
  gap: 4px;
}

.internal-service-summary-card span,
.internal-service-total-card span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.internal-service-summary-card strong,
.internal-service-total-card strong {
  color: var(--text);
}

.internal-service-total-row {
  display: flex;
  justify-content: flex-end;
}

.internal-service-total-card {
  min-width: 180px;
}

.backup-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

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

.backup-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(249, 251, 252, 0.8);
}

.field-section {
  display: grid;
  gap: 10px;
}
.section-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  font-weight: 700;
}
.field-section.minimized {
  opacity: 0.78;
}
.field-section.hidden-section {
  display: none;
}
.field-hidden {
  display: none;
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.estimate-workflow-grid:not(.field-grid-tool-parts) {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px 12px;
  align-items: start;
}

.estimate-workflow-grid:not(.field-grid-tool-parts) > label {
  align-self: start;
}

.field-grid > label.field-span-2 {
  grid-column: span 2;
}

.estimate-notes-field textarea {
  min-height: 70px;
}

.field-grid.field-grid-compact {
  grid-template-columns: 240px;
}

.field-grid.field-grid-compact > label {
  width: 240px;
}

.field-grid.field-grid-tool-parts {
  grid-template-columns: repeat(auto-fit, minmax(220px, 260px));
  align-items: start;
  margin-top: 4px;
}

.section-subtitle {
  margin-top: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

.checkbox-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(57, 45, 31, 0.16);
  background: rgba(255, 255, 255, 0.74);
  cursor: pointer;
}

.checkbox-card input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
  flex: 0 0 auto;
}

.checkbox-card span {
  color: var(--text);
  font-weight: 600;
}

.return-checklist-group {
  display: grid;
  gap: 8px;
}

.return-checklist-card {
  min-height: 48px;
}

.return-checklist-empty {
  text-align: left;
  padding: 12px 14px;
}

.inspection-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.inspection-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) 180px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(48, 66, 84, 0.12);
  background: rgba(255, 255, 255, 0.7);
}

.inspection-row-simple {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
}

.inspection-copy {
  font-weight: 600;
  color: var(--text);
}

.inspection-placeholder {
  padding: 12px 14px;
}

.inspection-spacer {
  min-height: 44px;
}

.inspection-select,
.inspection-part-input,
.inspection-wide-input {
  width: 100%;
}

.inspection-disabled {
  opacity: 0.5;
}

.additional-parts-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.additional-part-card {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(48, 66, 84, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.7);
}

.compact-part-number,
.compact-part-description,
.compact-part-notes {
  width: 100%;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(48, 66, 84, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font: inherit;
}

.compact-remove-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(164, 60, 47, 0.14);
  border-radius: 12px;
  background: rgba(164, 60, 47, 0.08);
  color: #8f3b31;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.compact-remove-button:hover {
  background: rgba(164, 60, 47, 0.14);
}

.locked-part-row input,
.locked-part-row label {
  opacity: 0.82;
}

.locked-part-spacer {
  width: 42px;
  min-width: 42px;
  height: 42px;
  display: block;
}

input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
textarea:-webkit-autofill,
textarea:-webkit-autofill:hover,
textarea:-webkit-autofill:focus,
select:-webkit-autofill,
select:-webkit-autofill:hover,
select:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.96) inset;
  transition: background-color 9999s ease-out 0s;
}

.preview-actions-start {
  justify-content: flex-start;
}

.minor { margin-top: 20px; }
.empty-state { text-align: center; color: var(--muted); }
.transition-card .missing { color: var(--danger); }
.carryover-title {
  font-weight: 700;
  color: var(--text);
}

.carryover-section {
  display: grid;
  gap: 8px;
}

.carryover-section + .carryover-section {
  margin-top: 18px;
}

.carryover-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}

.carryover-parts-list {
  display: grid;
  gap: 6px;
}

.carryover-part-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) minmax(0, 1fr) auto auto auto 42px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(48, 66, 84, 0.12);
  background: rgba(255, 255, 255, 0.72);
}

.carryover-tool-row {
  grid-template-columns: 130px minmax(0, 1fr) minmax(0, 1fr) auto auto 42px;
}

.tool-receipt-fields {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 8px;
}

.carryover-part-number,
.carryover-part-description,
.carryover-part-notes,
.carryover-tool-serial,
.carryover-tool-control-serial,
.carryover-tool-commission-date,
.carryover-tool-calibration-date,
.carryover-tool-calibration-link {
  width: 100%;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid rgba(48, 66, 84, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--text);
  font: inherit;
}

.carryover-check {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
}

.carryover-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: var(--primary);
}

.activity-toggle {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  background: rgba(242, 246, 249, 0.82);
}

.activity-toggle summary {
  cursor: pointer;
  font-weight: 700;
  list-style: none;
}

.activity-toggle summary::-webkit-details-marker {
  display: none;
}

.activity-toggle summary::after {
  content: "Show";
  float: right;
  color: var(--muted);
  font-weight: 600;
}

.activity-toggle[open] summary::after {
  content: "Hide";
}

.activity-toggle .activity-log {
  margin-top: 14px;
}

code {
  background: rgba(48, 66, 84, 0.08);
  padding: 2px 6px;
  border-radius: 8px;
}

@media (max-width: 1220px) {
  .dashboard-grid { grid-template-columns: repeat(3, minmax(120px, 1fr)); }
  .workspace { grid-template-columns: minmax(260px, 340px) 1fr; }
}

@media (max-width: 840px) {
  .shell { padding: 16px; }
  .topbar, .panel-head, .toolbar-main, .topbar-actions { flex-direction: column; align-items: stretch; }
  .workspace { grid-template-columns: 1fr; }
  .brand-lockup {
    align-items: flex-start;
  }
  .app-switcher {
    grid-template-columns: 1fr;
    width: 100%;
  }
  .logo-shell-wide,
  .logo-shell-header {
    width: 100%;
    max-width: 240px;
  }
  .dashboard-grid { grid-template-columns: repeat(2, minmax(120px, 1fr)); }
  .reminder-card {
    flex-direction: column;
    align-items: stretch;
  }
  .reminder-actions {
    align-items: stretch;
  }
  .detail-actions,
  .transition-quick-actions {
      justify-items: stretch;
      justify-content: stretch;
  }
  .approval-decision-buttons {
    flex-direction: column;
  }
  .detail-actions-main {
    flex-direction: column;
    align-items: stretch;
  }
  .floating-action-dock {
    left: 16px;
    right: 16px;
    bottom: 14px;
    flex-direction: column;
    align-items: stretch;
  }
  .floating-action-dock .button {
    width: 100%;
  }
  .additional-part-card {
    grid-template-columns: 1fr;
  }
  .compact-remove-button {
    width: 100%;
    min-width: 0;
  }
  .carryover-part-row {
    grid-template-columns: 1fr;
  }
  .carryover-head {
    flex-direction: column;
    align-items: stretch;
  }
}
