:root {
  color-scheme: light;
  --ink: #16211f;
  --muted: #66736f;
  --line: #dce4df;
  --panel: #ffffff;
  --page: #f3f6f1;
  --dark: #1f312d;
  --green: #3a775d;
  --green-strong: #255f47;
  --amber: #c37a2a;
  --red: #b84f4a;
  --blue: #3975a6;
  --shadow: 0 18px 45px rgba(31, 49, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.cloud-locked {
  overflow: hidden;
}

.cloud-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 24px;
  background: #eef2ed;
}

.cloud-overlay[hidden] {
  display: none;
}

.cloud-panel {
  width: min(100%, 470px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
}

.cloud-panel[hidden] {
  display: none;
}

.cloud-panel h1 {
  margin: 4px 0 10px;
  font-size: 1.65rem;
}

.cloud-panel > p {
  color: var(--muted);
  line-height: 1.5;
}

.cloud-brand {
  display: flex;
  gap: 13px;
  align-items: center;
  margin-bottom: 16px;
}

.cloud-brand h1 {
  margin: 2px 0 0;
}

.cloud-form {
  display: grid;
  gap: 14px;
  margin: 22px 0 12px;
}

.cloud-form label {
  display: grid;
  gap: 7px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 700;
}

.cloud-form input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: white;
}

.cloud-wide {
  width: 100%;
  margin-top: 9px;
}

.cloud-status {
  min-height: 22px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.cloud-status.error {
  color: var(--red);
}

.cloud-status.success {
  color: var(--green-strong);
}

.cloud-sync-indicator {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: white;
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.cloud-sync-indicator.success {
  color: var(--green-strong);
  border-color: #b9d2c3;
  background: #f1f8f3;
}

.cloud-sync-indicator.error {
  color: var(--red);
  border-color: #efb2ad;
  background: #fff7f6;
}

.cloud-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 24px 0 12px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.cloud-divider::before,
.cloud-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.team-settings {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.team-settings > p {
  margin: 0;
  color: var(--muted);
}

.team-invite-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}

.team-invite-controls label {
  display: grid;
  min-width: 220px;
  gap: 7px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.team-invite-controls select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
}

.team-invite-result {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid #b9d2c3;
  border-radius: 8px;
  background: #f1f8f3;
}

.team-invite-result > span,
.team-invite-result > p {
  grid-column: 1;
}

.team-invite-result strong {
  grid-column: 1;
  font-size: 1.35rem;
  letter-spacing: 0.08em;
}

.team-invite-result button {
  grid-column: 2;
  grid-row: 1 / 3;
}

.team-invite-result p {
  margin: 0;
  color: var(--muted);
}

.team-member-section {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.team-member-section h3 {
  margin: 0;
}

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

.team-member-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(150px, 210px) auto auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcf9;
}

.team-member-row > div {
  display: grid;
  gap: 3px;
}

.team-member-row > div span {
  color: var(--muted);
  font-size: 0.76rem;
}

.team-member-role {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: white;
}

.team-active-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}

.team-active-toggle input {
  width: 18px;
  height: 18px;
}

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

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 20px;
  background: #1b2b27;
  color: white;
}

.mobile-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mobile-nav-toggle,
.mobile-nav-close,
.mobile-nav-backdrop {
  display: none;
}

.mobile-nav-toggle {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
}

.mobile-nav-toggle span {
  display: block;
  height: 2px;
  margin: 4px 0;
  border-radius: 2px;
  background: var(--ink);
}

.mobile-nav-close {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 1.1rem;
  font-weight: 800;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 8px;
  background: #f3b84c;
  color: #17231f;
  font-weight: 800;
}

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

.brand span,
.sidebar-panel span {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.82rem;
}

.nav-tabs {
  display: grid;
  gap: 3px;
}

.nav-section-label {
  margin: 11px 12px 3px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-section-label:first-child {
  margin-top: 0;
}

.nav-tab {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 39px;
  border: 0;
  border-radius: 7px;
  padding: 8px 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.84rem;
  font-weight: 600;
  text-align: left;
  transition: color 140ms ease, background 140ms ease, transform 140ms ease;
}

.nav-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
  transform: translateX(2px);
}

.nav-tab.active {
  background: rgba(255, 255, 255, 0.11);
  color: white;
  box-shadow: inset 3px 0 #f3b84c;
}

.nav-tab-start {
  min-height: 48px;
  margin-bottom: 5px;
  background: linear-gradient(135deg, #1f9d6b 0%, #176fc6 100%);
  color: white;
  box-shadow: 0 12px 22px rgba(23, 111, 198, 0.22);
}

.nav-tab-start:hover,
.nav-tab-start.active {
  background: linear-gradient(135deg, #22aa74 0%, #155caa 100%);
  color: white;
  transform: translateX(2px);
}

.nav-tab-start .nav-icon,
.nav-tab-start:hover .nav-icon,
.nav-tab-start.active .nav-icon {
  color: white;
}

.nav-tab.active::after {
  content: "";
  position: absolute;
  right: 12px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #f3b84c;
}

.nav-icon {
  width: 19px;
  height: 19px;
  flex: 0 0 19px;
  color: rgba(255, 255, 255, 0.58);
  stroke-width: 1.8;
}

.nav-tab:hover .nav-icon,
.nav-tab.active .nav-icon {
  color: #f3c76e;
}

.sidebar-panel {
  margin-top: auto;
  flex: 0 0 auto;
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.daily-verse {
  display: grid;
  gap: 6px;
  margin-top: 8px;
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar-panel .daily-verse-label {
  color: #f3c76e;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.daily-verse blockquote {
  margin: 0;
  color: rgba(255, 255, 255, 0.94);
  font-size: 0.82rem;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.daily-verse cite {
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 700;
}

.panel-label,
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.content {
  min-width: 0;
  padding: 30px;
}

.topbar,
.section-head,
.filter-row,
.calendar-actions,
.calendar-title-row,
.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 28px;
}

.topbar h1,
.section-head h2,
.modal-head h2 {
  margin: 0;
  line-height: 1.05;
}

.topbar h1 {
  font-size: clamp(2rem, 4vw, 3.3rem);
  font-weight: 800;
}

.section-head h2 {
  font-size: 1.2rem;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--green);
  font-size: 0.72rem;
}

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

.account-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  width: auto;
  justify-content: flex-end;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f1f5f2;
  color: var(--green-strong);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.account-sign-out {
  min-height: 26px;
  border: 0;
  padding: 3px 5px;
  color: var(--muted);
  background: transparent;
  font-size: 0.74rem;
  font-weight: 700;
}

.account-sign-out:hover {
  color: var(--red);
}

.data-backup-settings,
.settings-tool-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
}

.settings-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 14px;
  padding-bottom: 6px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.settings-tab {
  flex: 0 0 auto;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 12px;
  background: white;
  color: var(--muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 800;
  cursor: pointer;
}

.settings-tab:hover,
.settings-tab:focus-visible {
  border-color: #9bb7a4;
  color: var(--green-strong);
  outline: none;
}

.settings-tab.active {
  border-color: var(--green-strong);
  background: var(--green-strong);
  color: white;
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel.active {
  display: grid;
  gap: 14px;
}

.settings-panel .data-backup-settings,
.settings-panel .settings-tool-panel,
.settings-panel .team-settings {
  margin-top: 0;
}

.document-center,
.document-upload-form,
.document-library,
.document-packet-list {
  display: grid;
  gap: 14px;
}

.document-center .section-head p:last-child {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.document-upload-form {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9f7;
}

.document-upload-form .form-grid {
  margin: 0;
}

.document-defaults {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 8px;
}

.document-upload-note,
.document-packet-warning {
  padding: 11px 12px;
  border: 1px solid #d7b866;
  border-radius: 7px;
  background: #fff8df;
  color: #684f0d;
  font-size: 0.8rem;
  line-height: 1.45;
}

.document-library-item,
.document-packet-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.document-library-item > div:first-child,
.document-packet-item > div:first-child {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.document-library-item strong,
.document-packet-item strong {
  overflow-wrap: anywhere;
}

.document-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.document-tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f1f5f2;
  color: var(--green-strong);
  font-size: 0.7rem;
  font-weight: 800;
}

.document-tag.restricted {
  border-color: #d7b866;
  background: #fff8df;
  color: #684f0d;
}

.record-document-selector {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7f9f7;
}

.record-document-selector-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.record-document-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.record-document-option {
  align-items: flex-start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
}

.record-document-option span {
  display: grid;
  gap: 3px;
}

.document-packet-modal {
  padding: 20px;
}

.document-packet-summary {
  margin-bottom: 14px;
  color: var(--muted);
  line-height: 1.45;
}

#documentPacketDialog {
  width: min(760px, calc(100% - 28px));
}

.quickbooks-settings {
  display: grid;
  gap: 14px;
}

.quickbooks-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.quickbooks-settings-head h2 {
  margin: 0 0 6px;
}

.quickbooks-settings-head p:last-child,
.quickbooks-note {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.quickbooks-connection {
  display: grid;
  gap: 4px;
  padding: 13px;
  border: 1px solid var(--line);
  border-left: 4px solid #2ca01c;
  border-radius: 7px;
  background: #f7fbf6;
}

.quickbooks-connection span {
  color: var(--muted);
  font-size: 0.78rem;
}

.quickbooks-mode-setting {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid #b9d7b4;
  border-radius: 7px;
  background: #f7fbf6;
}

.quickbooks-mode-setting span {
  color: var(--muted);
  line-height: 1.5;
}

.quickbooks-support {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.quickbooks-support > div {
  display: grid;
  gap: 3px;
}

.quickbooks-support span,
.quickbooks-errors span {
  color: var(--muted);
  font-size: 0.82rem;
}

.quickbooks-errors {
  display: grid;
  gap: 8px;
}

.quickbooks-error-row {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fafbfa;
}

.quickbooks-error-row > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.quickbooks-error-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.quickbooks-invoice-state {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid #b9d7b4;
  border-radius: 7px;
  background: #f7fbf6;
}

.quickbooks-invoice-state div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 9px;
  border: 1px solid #dcebd8;
  border-radius: 6px;
  background: #fff;
}

.quickbooks-invoice-state span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.quickbooks-invoice-state strong {
  min-width: 0;
  font-size: 0.9rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.quickbooks-invoice-state div:nth-child(3) strong,
.quickbooks-invoice-state div:nth-child(4) strong {
  white-space: nowrap;
  overflow-wrap: normal;
  font-variant-numeric: tabular-nums;
}

.quickbooks-invoice-state strong.partial {
  color: #a66512;
}

.quickbooks-invoice-state strong.paid {
  color: var(--green-strong);
}

.quickbooks-payment-detail {
  display: grid;
  gap: 3px;
  padding: 9px 11px;
  border-left: 3px solid #2ca01c;
  background: #f7fbf6;
}

.quickbooks-payment-detail span {
  color: var(--muted);
  font-size: 0.75rem;
}

.fleet-header-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.fleet-header-actions button {
  min-height: 36px;
  padding: 7px 10px;
  font-size: 0.78rem;
}

.activity-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(180px, 260px);
  gap: 14px;
  margin-bottom: 16px;
}

.activity-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.activity-filters input,
.activity-filters select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: white;
}

.activity-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.activity-panel {
  display: grid;
  gap: 12px;
}

.activity-list,
.deleted-record-list {
  display: grid;
  gap: 9px;
}

.activity-entry,
.deleted-record {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.activity-entry {
  display: grid;
  gap: 7px;
}

.activity-entry-head,
.deleted-record {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.activity-entry-head time,
.deleted-record time,
.deleted-record span,
.activity-actor {
  color: var(--muted);
  font-size: 0.76rem;
}

.activity-action {
  display: inline-flex;
  width: fit-content;
  border-radius: 6px;
  padding: 4px 7px;
  background: #e7f0f9;
  color: var(--blue);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.activity-action.created,
.activity-action.restored {
  background: #e4f2e9;
  color: var(--green-strong);
}

.activity-action.deleted {
  background: #fbe8e6;
  color: var(--red);
}

.activity-details summary {
  width: fit-content;
  color: var(--green-strong);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 800;
}

.activity-details > div {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(100px, 1fr) minmax(100px, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid #edf1ee;
  font-size: 0.76rem;
}

.activity-details .activity-change-head {
  margin-top: 7px;
  color: var(--muted);
  font-weight: 800;
}

.deleted-record > div {
  display: grid;
  gap: 3px;
}

.deleted-record button {
  flex: 0 0 auto;
}

.data-backup-settings h2,
.settings-tool-panel h2 {
  margin: 0 0 7px;
  font-size: 1.1rem;
}

.data-backup-settings p:last-child,
.settings-tool-panel p:last-child {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.backup-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 9px;
}

.report-month {
  display: grid;
  gap: 6px;
}

.report-month span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.report-month input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: white;
  color: var(--ink);
}

.search {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(360px, 100%);
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.primary,
.secondary,
.chip,
.icon-btn,
.danger {
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 700;
}

.primary {
  background: var(--green-strong);
  color: white;
}

.secondary,
.chip,
.icon-btn {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.danger {
  background: #fff2f0;
  border-color: #f0c7c4;
  color: var(--red);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 38px;
  padding: 0;
}

.view {
  display: none;
}

.active-view {
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.surface,
.equipment-card,
.customer-card,
.invoice-card,
.service-column {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 0 rgba(31, 49, 45, 0.04);
}

.metric {
  padding: 18px;
}

.metric span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 9px;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
}

.dashboard-actions {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.dashboard-actions button {
  min-height: 46px;
}

.new-order-launcher {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px 20px;
  border: 1px solid #b9d2ec;
  border-radius: 8px;
  background: linear-gradient(135deg, #eff7ff 0%, #ffffff 64%);
  box-shadow: 0 16px 34px rgba(33, 102, 167, 0.12);
}

.new-order-launcher h2,
.new-order-launcher p {
  margin: 0;
}

.new-order-launcher span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.new-order-main-btn {
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid #155caa;
  border-radius: 8px;
  background: #176fc6;
  color: white;
  font-size: 1rem;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(23, 111, 198, 0.22);
}

.new-order-main-btn:hover {
  background: #115caa;
}

.dashboard-my-day {
  width: min(760px, 52vw);
  max-width: 100%;
  margin: 0 0 16px;
}

.dashboard-my-day-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  max-height: 360px;
  margin-top: 10px;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.dashboard-my-day-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 0;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-left: 4px solid #7792a8;
  border-radius: 8px;
  background: #ffffff;
}

.dashboard-my-day-item.urgent {
  border-left-color: var(--red);
  background: #fff8f7;
}

.dashboard-my-day-item.ready {
  border-left-color: var(--green);
  background: #f4f9f5;
}

.dashboard-my-day-item.money {
  border-left-color: #b8872f;
  background: #fffdf5;
}

.dashboard-my-day-item.service {
  border-left-color: #326d94;
}

.dashboard-my-day-item.scheduled,
.dashboard-my-day-item.crm {
  border-left-color: #7c8792;
}

.dashboard-my-day-type {
  display: inline-flex;
  align-items: center;
  padding: 3px 6px;
  border-radius: 6px;
  background: #f0f3f2;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
}

.dashboard-my-day-item.urgent .dashboard-my-day-type {
  background: #ffe9e6;
  color: var(--red);
}

.dashboard-my-day-item.ready .dashboard-my-day-type {
  background: #e6f3e9;
  color: var(--green);
}

.dashboard-my-day-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.dashboard-my-day-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.dashboard-my-day-item strong,
.dashboard-my-day-item span,
.dashboard-my-day-item small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.dashboard-my-day-item strong {
  font-size: 0.9rem;
  line-height: 1.2;
}

.dashboard-my-day-copy > span,
.dashboard-my-day-meta small {
  color: var(--muted);
  font-size: 0.76rem;
}

.dashboard-my-day-item button {
  min-height: 30px;
  padding: 0 12px;
}

.dashboard-command-row {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(340px, 1.05fr);
  gap: 16px;
  align-items: start;
  margin-bottom: 16px;
}

.dashboard-command-row .dashboard-my-day {
  width: 100%;
  margin: 0;
}

.dashboard-command-row .metrics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

#dashboard .dashboard-actions {
  grid-template-columns: 1.35fr repeat(4, minmax(118px, 0.72fr));
  align-items: stretch;
  gap: 10px;
  padding: 10px;
  border: 1px solid #cbdcd4;
  border-radius: 10px;
  background: linear-gradient(135deg, #f6fbf8 0%, #eef6f8 48%, #fff8e8 100%);
  box-shadow: 0 14px 34px rgba(25, 62, 50, 0.08);
}

#dashboard .dashboard-actions button {
  min-height: 42px;
  border-radius: 8px;
}

#dashboard .dashboard-actions .primary {
  border-color: #17674c;
  background: linear-gradient(135deg, #195f48, #21826a);
  color: #fff;
  box-shadow: 0 12px 22px rgba(25, 95, 72, 0.2);
}

#dashboard .dashboard-actions .secondary:nth-child(2) {
  border-color: #bed7ef;
  background: #f3f9ff;
  color: #164e7a;
}

#dashboard .dashboard-actions .secondary:nth-child(3) {
  border-color: #e8cf93;
  background: #fff8e7;
  color: #75500a;
}

#dashboard .dashboard-actions .secondary:nth-child(4) {
  border-color: #c4ded0;
  background: #f2fbf4;
  color: #1f6742;
}

#dashboard .dashboard-actions .secondary:nth-child(5) {
  border-color: #d4c4ea;
  background: #faf7ff;
  color: #553d73;
}

#dashboard .dashboard-my-day {
  border-color: #c9ddd1;
  background: linear-gradient(180deg, #ffffff 0%, #f6fbf7 100%);
  box-shadow: 0 16px 32px rgba(37, 73, 58, 0.1);
}

#dashboard .dashboard-my-day .section-head {
  padding-bottom: 8px;
  border-bottom: 1px solid #dce8e1;
}

#dashboard .metric {
  position: relative;
  min-height: 96px;
  padding: 14px 15px;
  overflow: hidden;
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(30, 53, 45, 0.07);
}

#dashboard .metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #23705a;
}

#dashboard .metric:nth-child(2)::before {
  background: #bb493b;
}

#dashboard .metric:nth-child(3)::before {
  background: #2f6f9f;
}

#dashboard .metric:nth-child(4)::before {
  background: #b8872f;
}

#dashboard .metric span {
  position: relative;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

#dashboard .metric strong {
  position: relative;
  margin-top: 7px;
  font-size: clamp(1.35rem, 2vw, 1.85rem);
}

#dashboard .dashboard-calendar,
#dashboard .dashboard-customer-service,
#dashboard .two-column .surface {
  border-radius: 10px;
  box-shadow: 0 12px 28px rgba(30, 53, 45, 0.06);
}

.dashboard-calendar {
  margin: 16px 0;
}

.dashboard-customer-service {
  margin: 16px 0;
}

.dashboard-service-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.dashboard-service-job {
  display: grid;
  min-width: 0;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 4px solid #b8872f;
  border-radius: 8px;
  padding: 12px;
  background: white;
}

.dashboard-service-job.overdue {
  border-left-color: #b94b45;
  background: #fff8f7;
}

.dashboard-service-job.work-completed {
  border-left-color: #2b7a55;
}

.dashboard-service-job.in-shop {
  border-left-color: #326d94;
}

.dashboard-service-job-head,
.dashboard-service-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dashboard-service-job h3,
.dashboard-service-job p {
  margin: 0;
  overflow-wrap: anywhere;
}

.dashboard-service-job h3 {
  font-size: 0.98rem;
}

.dashboard-service-job p,
.dashboard-service-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.dashboard-service-job button {
  width: 100%;
}

.dashboard-calendar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.schedule-chip {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
  align-items: center;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.schedule-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-chip > span:last-child {
  grid-column: 2;
  color: var(--muted);
  font-size: 0.82rem;
}

.report-detail {
  margin-top: 16px;
}

.report-dashboard-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.report-dashboard-head h2 {
  margin: 0;
}

.report-dashboard-head p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
}

.report-highlight {
  min-height: 116px;
}

.report-highlight small {
  color: var(--muted);
  font-size: 0.82rem;
}

.report-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.report-card {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.primary-report {
  display: grid;
  gap: 12px;
  background: #f8faf7;
}

.primary-report > strong {
  font-size: 2.2rem;
  color: var(--ink);
}

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

.report-card h3 {
  margin: 0;
  font-size: 1rem;
}

.report-card-head > span {
  color: var(--muted);
  font-size: 0.84rem;
  white-space: nowrap;
}

.report-lines {
  display: grid;
  border-top: 1px solid var(--line);
}

.report-line {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.report-line.clickable {
  align-items: center;
}

.report-line.clickable > span {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.report-line strong {
  color: var(--ink);
  text-align: right;
  white-space: nowrap;
}

.report-line.total {
  color: var(--ink);
  font-weight: 800;
}

.report-line.total strong {
  font-size: 1.05rem;
}

.report-highlight[data-action] {
  cursor: pointer;
}

.report-highlight[data-action]:hover,
.report-line.clickable:hover {
  background: #f4faf6;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--green-strong);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 0;
  text-decoration: underline;
  cursor: pointer;
}

.report-drilldown-dialog {
  width: min(900px, calc(100vw - 28px));
  max-height: min(760px, calc(100vh - 28px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  overflow: hidden;
}

.report-drilldown-summary {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: #edf6f0;
}

.report-drilldown-summary span {
  color: var(--muted);
}

.report-drilldown-summary strong {
  font-size: 1.4rem;
  white-space: nowrap;
}

.report-drilldown-list {
  display: grid;
  gap: 0;
  max-height: 54vh;
  overflow: auto;
}

.report-drilldown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
}

.report-drilldown-row > div {
  display: grid;
  gap: 4px;
}

.report-drilldown-row span,
.report-drilldown-row small {
  color: var(--muted);
}

.report-drilldown-row > strong {
  white-space: nowrap;
  text-align: right;
}

.report-breakdown {
  margin-top: 14px;
}

.report-note {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
  color: var(--muted);
}

.report-note strong {
  color: var(--ink);
}

.report-note.clean {
  border: 0;
  padding: 0;
  margin-top: 0;
  background: transparent;
}

.report-print-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.report-print-grid.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-print-grid div {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-print-grid span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.report-print-grid strong {
  font-size: 1.15rem;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

.surface {
  padding: 18px;
}

.flush {
  margin-bottom: 14px;
}

.filter-row {
  justify-content: flex-start;
  margin-bottom: 14px;
  overflow-x: auto;
}

.chip.active {
  background: #e4efe8;
  border-color: #b9d2c3;
  color: var(--green-strong);
}

.timeline,
.stack-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.timeline-item,
.stack-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

tr.overdue-rental td,
.timeline-item.overdue-rental,
.stack-item.overdue-rental,
.schedule-chip.overdue-rental {
  border-color: #efb2ad;
  background: #fff7f6;
  box-shadow: inset 4px 0 0 var(--red);
}

tr.overdue-rental td:first-child {
  border-left: 4px solid var(--red);
}

.date-pill,
.status,
.price-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.date-pill {
  background: #eff4f1;
}

.status.available,
.status.overpaid,
.status.paid,
.status.returned {
  background: #e4f2e9;
  color: var(--green-strong);
}

.status.rented,
.status.open,
.status.quote,
.status.reserved,
.status.partial_payment,
.status.out-on-rent,
.status.maintenance,
.status.soft_down {
  background: #fff1d7;
  color: #986017;
}

.status.service,
.status.hard_down,
.status.overdue,
.status.unpaid,
.status.not-invoiced {
  background: #fff0ee;
  color: var(--red);
}

.status.rental-invoice {
  background: #e5f0f8;
  color: var(--blue);
}

.status.sale-invoice {
  background: #fff1d7;
  color: #986017;
}

.status.service-invoice {
  background: #e4f2e9;
  color: var(--green-strong);
}

.status.manual-invoice {
  background: #eff4f1;
  color: var(--muted);
}

.status.scheduled,
.status.delivered,
.status.returned,
.status.invoiced {
  background: #e7f0f9;
  color: var(--blue);
}

.status.needs_delivery {
  background: #fff1d7;
  color: #986017;
}

.status.needs_pickup {
  background: #fde8e5;
  color: #b7382f;
}

.status.delivery-pill {
  display: inline-flex;
  white-space: nowrap;
}

.status.picked_up {
  background: #e4f2e9;
  color: var(--green-strong);
}

.status.canceled {
  background: #eceff1;
  color: #52605b;
}

.status.sold {
  background: #eceff1;
  color: #52605b;
}

.equipment-card.hard_down,
.repair-ticket-card.hard_down,
.history-item.hard_down {
  border-color: #efb2ad;
  background: #fff7f6;
  box-shadow: inset 4px 0 0 var(--red);
}

.equipment-card.soft_down,
.equipment-card.maintenance,
.repair-ticket-card.soft_down,
.repair-ticket-card.maintenance,
.history-item.soft_down,
.history-item.maintenance {
  border-color: #efd4a9;
  background: #fffdf6;
  box-shadow: inset 4px 0 0 var(--amber);
}

.shop-alert {
  margin-top: 10px;
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 0.82rem;
  font-weight: 800;
}

.shop-alert.hard_down {
  background: #fff0ee;
  color: var(--red);
}

.shop-alert.soft_down,
.shop-alert.maintenance {
  background: #fff1d7;
  color: #986017;
}

.returned-section {
  margin-top: 16px;
}

.completed-section {
  background: #f8faf7;
}

.completed-rental-item {
  background: #ffffff;
  border-color: #cbd9d0;
}

.completed-sale-item {
  background: #ffffff;
  border-color: #cbd9d0;
}

.repair-ticket-card {
  align-items: flex-start;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 10px;
  padding: 10px;
  background: #fffef9;
}

.repair-ticket-card > div:not(.card-actions) {
  min-width: 0;
}

.repair-ticket-card strong {
  display: block;
  overflow: hidden;
  font-size: 0.95rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-ticket-card .subtle {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.repair-ticket-card .subtle:last-child {
  -webkit-line-clamp: 2;
}

.repair-ticket-card .card-actions {
  display: grid;
  grid-column: 2;
  gap: 6px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  justify-content: stretch;
}

.repair-ticket-card .card-actions button {
  min-height: 32px;
  padding: 6px 9px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.service-workspace-section {
  display: grid;
  gap: 14px;
  margin-bottom: 24px;
}

.service-workspace-section + .service-workspace-section {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.service-workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.service-workspace-head h3 {
  margin: 2px 0 4px;
  font-size: 1.15rem;
}

.service-workspace-head p:last-child {
  margin: 0;
  color: var(--muted);
}

.customer-service-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.customer-service-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.customer-service-card .card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.customer-service-card .card-actions button {
  flex: 1 1 auto;
}

.customer-service-work-summary {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #cfe0d4;
  border-radius: 8px;
  background: #f6faf7;
}

.customer-service-work-summary span {
  color: var(--muted);
  font-size: 0.82rem;
}

.completed-customer-service {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.completed-service-item {
  background: #f8faf8;
}

.status.estimate,
.status.approved {
  background: #fff1d7;
  color: #986017;
}

.status.in-shop,
.status.work-completed,
.status.waiting-parts,
.status.waiting-customer,
.status.ready-pickup {
  background: #e7f0f9;
  color: var(--blue);
}

.status.complete {
  background: #e4f2e9;
  color: var(--green-strong);
}

.status.maintenance_due,
.equipment-card.maintenance_due {
  border-color: #efd4a9;
  background: #fffdf6;
  color: #986017;
}

.status.invoiced,
.status.paid {
  background: #e4f2e9;
  color: var(--green-strong);
}

.category-add-row,
.category-row,
.labor-rate-add-row,
.vendor-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.settings-section {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.category-add-row {
  margin: 18px 0;
}

.settings-section .category-add-row {
  margin: 0;
}

.category-row {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.category-add-row input,
.category-row input,
.labor-rate-add-row input,
.vendor-add-row input,
.vendor-row input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.labor-rate-add-row {
  grid-template-columns: minmax(0, 1fr) 150px auto;
}

.labor-rate-row {
  grid-template-columns: minmax(0, 1fr) 140px auto auto;
}

.vendor-add-row {
  grid-template-columns: minmax(0, 1fr) 140px 150px auto;
}

.vendor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 140px auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.equipment-grid,
.customer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.invoice-grid {
  display: grid;
  gap: 22px;
}

.invoice-business-section {
  display: grid;
  gap: 13px;
  padding-top: 4px;
}

.invoice-business-section + .invoice-business-section {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.invoice-business-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.invoice-business-head h3 {
  margin: 1px 0 3px;
  font-size: 1.18rem;
}

.invoice-business-head p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.invoice-business-counts {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.invoice-business-counts span {
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.invoice-business-counts strong {
  color: var(--ink);
}

.invoice-payment-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.invoice-status-lane {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.invoice-status-lane.unpaid-lane {
  border-color: #e4c56a;
  background: #fffdf5;
}

.invoice-status-lane.paid-lane {
  background: #f4f8f5;
}

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

.invoice-lane-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.invoice-lane-head > span {
  font-weight: 850;
}

.invoice-lane-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.unpaid-lane .invoice-lane-label,
.unpaid-lane .invoice-lane-head > span {
  color: #875d00;
}

.paid-lane .invoice-lane-label,
.paid-lane .invoice-lane-head > span {
  color: var(--green);
}

.invoice-lane-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 10px;
}

.invoice-lane-empty {
  padding: 18px 12px;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  text-align: center;
  font-size: 0.84rem;
}

.invoice-other-section {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.invoice-other-section > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  cursor: pointer;
}

.invoice-other-section > summary > span:first-child {
  display: grid;
  gap: 2px;
}

.invoice-other-section summary small {
  color: var(--muted);
  font-size: 0.76rem;
}

.invoice-other-group {
  display: grid;
  gap: 9px;
  margin-top: 14px;
}

.invoice-other-group h4 {
  margin: 0;
  font-size: 0.88rem;
}

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

.crm-hero-head {
  align-items: center;
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid #c9d9cf;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(31, 157, 107, 0.14), rgba(23, 111, 198, 0.11) 56%, rgba(255, 255, 255, 0.92)),
    #ffffff;
  box-shadow: 0 14px 30px rgba(30, 73, 53, 0.09);
}

.crm-hero-head h2,
.crm-phone-desk h2 {
  margin-bottom: 3px;
}

.crm-hero-head span,
.crm-phone-desk span {
  color: var(--muted);
  font-size: 0.92rem;
}

.crm-phone-desk {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
  border-color: #a7d3c2;
  background:
    radial-gradient(circle at top left, rgba(255, 191, 76, 0.22), transparent 30%),
    linear-gradient(135deg, rgba(23, 111, 198, 0.12), rgba(31, 157, 107, 0.19) 58%, #ffffff),
    #f5fbf8;
  box-shadow: 0 14px 28px rgba(23, 111, 198, 0.1);
}

.crm-phone-desk h2 {
  font-size: clamp(1.55rem, 2.6vw, 2.25rem);
}

.crm-phone-desk .eyebrow {
  color: #176f4f;
}

.crm-phone-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 8px;
}

.crm-phone-actions button {
  min-height: 48px;
  font-size: 0.96rem;
  box-shadow: 0 8px 18px rgba(25, 54, 45, 0.08);
}

.crm-phone-actions button:first-child {
  background: #176fc6;
  border-color: #176fc6;
  box-shadow: 0 10px 20px rgba(23, 111, 198, 0.18);
}

.crm-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 14px;
}

.crm-filter-bar,
.service-filter-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.crm-filter-bar-top {
  margin: -2px 0 14px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 22px rgba(31, 49, 45, 0.04);
}

.service-filter-bar {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crm-filter-bar label,
.service-filter-bar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.crm-filter-bar select,
.service-filter-bar select {
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: white;
}

.crm-my-day {
  margin-bottom: 14px;
  border-color: #f0d19a;
  background: linear-gradient(135deg, #fff8ea 0%, #ffffff 74%);
}

.crm-my-day-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 9px;
}

.crm-my-day-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  border: 1px solid #f0d19a;
  border-radius: 8px;
  padding: 12px;
  background: #fffdf8;
  border-left: 4px solid #d49b31;
  box-shadow: 0 8px 18px rgba(136, 91, 18, 0.08);
}

.crm-my-day-item > span {
  color: var(--red);
  font-size: 0.72rem;
  font-weight: 900;
}

.crm-my-day-item div {
  display: grid;
  min-width: 0;
}

.crm-my-day-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(70px, 1fr));
  gap: 6px;
}

.crm-my-day-actions button {
  min-height: 34px;
  padding: 5px 8px;
  font-size: 0.72rem;
}

.crm-my-day-item strong,
.crm-my-day-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-note.ready {
  color: var(--green-strong);
}

.crm-metric {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid #d7e5dc;
  border-radius: 8px;
  padding: 13px;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(30, 73, 53, 0.07);
}

.crm-metric:nth-child(1) {
  border-color: #b7d7ca;
  background: linear-gradient(135deg, #f0faf4 0%, #ffffff 72%);
}

.crm-metric:nth-child(2) {
  border-color: #c8d8f1;
  background: linear-gradient(135deg, #eef5ff 0%, #ffffff 72%);
}

.crm-metric:nth-child(3) {
  border-color: #f0d19a;
  background: linear-gradient(135deg, #fff7e5 0%, #ffffff 72%);
}

.crm-metric:nth-child(4) {
  border-color: #d8c7ec;
  background: linear-gradient(135deg, #f6efff 0%, #ffffff 72%);
}

.crm-metric:nth-child(5) {
  border-color: #bdd6e6;
  background: linear-gradient(135deg, #eef8fb 0%, #ffffff 72%);
}

.crm-metric:nth-child(6) {
  border-color: #f0bbb8;
  background: linear-gradient(135deg, #fff0ef 0%, #ffffff 72%);
}

.crm-metric span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.crm-metric strong {
  font-size: 1.3rem;
  overflow-wrap: anywhere;
}

.crm-calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
  gap: 14px;
  margin: 14px 0;
  align-items: start;
}

.crm-calendar-surface,
.crm-calendar-day-panel {
  display: grid;
  gap: 12px;
}

.crm-calendar-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.crm-calendar-head h2 {
  margin: 2px 0 3px;
}

.crm-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.crm-calendar-day {
  min-width: 0;
  min-height: 104px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 7px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.crm-calendar-day:hover,
.crm-calendar-day.selected {
  background: #edf5ef;
}

.crm-calendar-day.outside {
  background: #f7f8f6;
  color: var(--muted);
}

.crm-calendar-day.today .crm-calendar-day-number {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--green-strong);
  color: white;
}

.crm-calendar-day-number {
  display: block;
  font-size: 0.76rem;
  font-weight: 800;
}

.crm-calendar-day-items {
  display: grid;
  gap: 3px;
  margin-top: 6px;
}

.crm-calendar-item {
  overflow: hidden;
  border-left: 3px solid var(--blue);
  padding: 3px 4px;
  background: #edf4fa;
  color: #315d7e;
  font-size: 0.62rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.crm-calendar-item.opportunity {
  border-left-color: var(--amber);
  background: #fff5df;
  color: #8c5b15;
}

.crm-calendar-item.activity {
  border-left-color: var(--green);
  background: #eaf4ed;
  color: var(--green-strong);
}

.crm-calendar-details {
  display: grid;
  gap: 8px;
}

.crm-calendar-day-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.crm-calendar-detail {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcf9;
}

.crm-calendar-detail > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.crm-calendar-detail > div span {
  color: var(--muted);
  font-size: 0.7rem;
  overflow-wrap: anywhere;
}

.crm-calendar-detail-type {
  border-radius: 5px;
  padding: 3px 5px;
  background: #edf4fa;
  color: var(--blue);
  font-size: 0.62rem;
  font-weight: 800;
  text-transform: uppercase;
}

.crm-calendar-detail.opportunity .crm-calendar-detail-type {
  background: #fff1d7;
  color: #986017;
}

.crm-calendar-detail.activity .crm-calendar-detail-type {
  background: #e4f2e9;
  color: var(--green-strong);
}

.crm-workspace {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: start;
}

.crm-workspace > * {
  width: 100%;
}

.crm-workspace .crm-calendar-layout {
  margin-top: 0;
}

.owner-calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 16px;
  align-items: start;
}

.owner-calendar-surface,
.owner-calendar-day-panel {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
}

.owner-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.owner-calendar-day {
  min-width: 0;
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.owner-calendar-day:hover,
.owner-calendar-day.selected {
  border-color: #9fc4af;
  background: #f4faf6;
}

.owner-calendar-day.outside {
  background: #f7f8f6;
  color: var(--muted);
  opacity: 0.56;
}

.owner-calendar-day.today .owner-calendar-day-number {
  display: inline-grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--green-strong);
  color: #fff;
}

.owner-calendar-day-number {
  display: block;
  font-size: 0.78rem;
  font-weight: 900;
}

.owner-calendar-day-items {
  display: grid;
  gap: 4px;
  margin-top: 8px;
}

.owner-calendar-item,
.owner-calendar-more {
  overflow: hidden;
  border-left: 3px solid var(--green);
  border-radius: 5px;
  padding: 4px 5px;
  background: #eaf4ed;
  color: var(--green-strong);
  font-size: 0.68rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.owner-calendar-item.reminder {
  border-left-color: var(--amber);
  background: #fff4d8;
  color: #8a5a00;
}

.owner-calendar-item.personal {
  border-left-color: #5564b0;
  background: #eef2ff;
  color: #36428a;
}

.owner-calendar-more {
  border-left-color: #b8c5bd;
  background: #f1f5f2;
  color: var(--muted);
}

.owner-calendar-details {
  display: grid;
  gap: 8px;
}

.owner-calendar-detail {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafcf9;
}

.owner-calendar-detail > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.owner-calendar-detail span,
.owner-calendar-detail p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.owner-calendar-detail .card-actions {
  grid-column: 1 / -1;
  justify-content: flex-start;
}

.owner-calendar-detail-type {
  border-radius: 5px;
  padding: 4px 6px;
  background: #e4f2e9;
  color: var(--green-strong);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.owner-calendar-event-dialog {
  width: min(700px, calc(100vw - 28px));
  border: 0;
  border-radius: 10px;
  padding: 0;
}

.crm-workspace .crm-sidebar {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.crm-pipeline-wrap {
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 7px;
}

.crm-pipeline {
  display: grid;
  grid-template-columns: repeat(7, minmax(230px, 1fr));
  gap: 10px;
  min-width: 1670px;
}

.crm-column {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf2ee;
  overflow: hidden;
}

.crm-column-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 11px;
  border-bottom: 1px solid var(--line);
  background: #f8faf8;
}

.crm-column-head > div {
  display: grid;
  gap: 3px;
}

.crm-column-head span {
  color: var(--muted);
  font-size: 0.7rem;
}

.crm-column-head > span {
  color: var(--green-strong);
  font-weight: 800;
}

.crm-column-list {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 180px;
  padding: 8px;
}

.crm-column-empty {
  padding: 18px 8px;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.crm-opportunity {
  display: grid;
  gap: 7px;
  border: 1px solid #d8e1db;
  border-left: 4px solid var(--green);
  border-radius: 7px;
  padding: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfb 100%);
}

.crm-opportunity.overdue {
  border-left-color: var(--red);
}

.crm-opportunity h3,
.crm-opportunity p {
  margin: 0;
}

.crm-opportunity h3 {
  font-size: 0.92rem;
  line-height: 1.25;
}

.crm-opportunity p {
  color: var(--muted);
  font-size: 0.76rem;
}

.crm-opportunity-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}

.crm-type {
  border-radius: 5px;
  padding: 3px 6px;
  background: #e7f0f9;
  color: var(--blue);
  font-size: 0.63rem;
  font-weight: 800;
  text-transform: uppercase;
}

.crm-type.sale {
  background: #fff1d7;
  color: #986017;
}

.crm-type.service {
  background: #e4f2e9;
  color: var(--green-strong);
}

.crm-opportunity-meta {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 0.7rem;
}

.crm-card-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}

.crm-card-actions button {
  min-height: 34px;
  padding: 5px 6px;
  font-size: 0.72rem;
}

.crm-card-actions .primary:last-child {
  grid-column: 1 / -1;
}

.crm-sidebar {
  display: grid;
  gap: 14px;
}

.crm-side-panel {
  display: grid;
  gap: 10px;
}

.crm-task-list,
.crm-activity-list {
  display: grid;
  gap: 7px;
}

.crm-task,
.crm-activity {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 9px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.crm-task:last-child,
.crm-activity:last-child {
  border-bottom: 0;
}

.crm-task > div,
.crm-activity > div {
  display: grid;
  gap: 3px;
}

.crm-task span,
.crm-activity span,
.crm-activity p {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  line-height: 1.4;
}

.crm-task.overdue strong {
  color: var(--red);
}

.crm-task-check {
  width: 19px;
  height: 19px;
  border: 2px solid var(--green);
  border-radius: 50%;
  padding: 0;
  background: white;
}

.crm-task-check:hover {
  background: var(--green);
}

.crm-activity-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: #e7f0f9;
  color: var(--blue) !important;
  font-weight: 800;
}

.equipment-card,
.customer-card,
.invoice-card {
  display: grid;
  gap: 13px;
  padding: 16px;
}

.equipment-intake-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d9e2df;
  border-radius: 8px;
  background: #fbfcfa;
}

.equipment-intake-panel.complete {
  border-color: #bfd8c8;
  background: #f4f9f5;
}

.equipment-intake-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.equipment-intake-head > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.equipment-intake-head strong {
  font-size: 0.9rem;
}

.equipment-intake-head span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.equipment-intake-head > span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef4f1;
  color: var(--ink);
}

.equipment-intake-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.equipment-intake-step {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 6px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-align: left;
}

.equipment-intake-step span {
  display: grid;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  place-items: center;
  border: 1px solid #cdd8d2;
  border-radius: 4px;
  color: white;
  font-size: 0.68rem;
}

.equipment-intake-step.complete {
  border-color: #b9d5c4;
  background: #f3fbf5;
  color: var(--ink);
}

.equipment-intake-step.complete span {
  border-color: var(--green);
  background: var(--green);
}

.equipment-intake-step strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: inherit;
}

.equipment-intake-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.equipment-intake-summary span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f0f3f2;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.equipment-intake-summary .equipment-intake-issue {
  background: #fff4df;
  color: #8c5d12;
}

.equipment-intake-notes {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.equipment-intake-notes span {
  overflow-wrap: anywhere;
}

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

.equipment-intake-actions .secondary {
  min-height: 32px;
}

.fleet-checkin-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #bddccc;
  border-radius: 8px;
  background: linear-gradient(135deg, #edf9f1 0%, #f8fbff 100%);
  box-shadow: inset 4px 0 0 #2e7d5b;
}

.fleet-checkin-strip.complete {
  border-color: #bfd8c8;
  background: #f4f9f5;
  box-shadow: inset 4px 0 0 #78a55a;
}

.fleet-checkin-strip div {
  display: grid;
  gap: 2px;
}

.fleet-checkin-strip strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.fleet-checkin-strip span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.fleet-checkin-strip button {
  min-height: 30px;
  padding: 6px 10px;
  white-space: nowrap;
}

.fleet-checkin-action {
  background: #ffffff;
}

.checkin-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.checkin-summary-card {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.checkin-summary-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.checkin-summary-card strong {
  font-size: 1.5rem;
}

.checkin-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 12px;
}

.checkin-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 5px solid #7c8792;
  border-radius: 8px;
  background: #ffffff;
}

.checkin-card.urgent {
  border-left-color: var(--red);
}

.checkin-card.ready {
  border-left-color: var(--green);
}

.checkin-card.service {
  border-left-color: #326d94;
}

.checkin-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.checkin-card-head h3 {
  margin: 7px 0 3px;
}

.checkin-card-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.checkin-card-head > strong {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 7px 9px;
  border-radius: 999px;
  background: #eef4f1;
}

.checkin-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.checkin-progress span {
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
  text-align: center;
}

.checkin-progress span.complete {
  border-color: #b9d5c4;
  background: #f3fbf5;
  color: var(--ink);
}

.checkin-note-list {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.82rem;
}

.checkin-note-list span {
  overflow-wrap: anywhere;
}

.checkin-form-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #cde0d7;
  border-radius: 8px;
  background: linear-gradient(135deg, #f1fbf5 0%, #eef5ff 100%);
}

.checkin-form-intro div {
  display: grid;
  gap: 3px;
}

.checkin-form-intro span {
  color: var(--muted);
  font-size: 0.84rem;
}

.checkin-form-intro b {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  background: #ffffff;
  color: #1d6548;
}

.checkin-workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.checkin-workflow-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
  font-size: 0.82rem;
}

.checkin-workflow-step b {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: #edf0ee;
  color: var(--muted);
  font-size: 0.78rem;
}

.checkin-workflow-step.complete {
  border-color: #a7d5bb;
  background: #f2fbf5;
  color: #0f5132;
}

.checkin-workflow-step.complete b {
  background: #1f7a55;
  color: #ffffff;
}

.checkin-date-row {
  display: grid;
  grid-template-columns: minmax(220px, 0.45fr) minmax(260px, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.checkin-helper-card {
  display: grid;
  align-content: center;
  gap: 3px;
  min-height: 62px;
  padding: 11px 13px;
  border: 1px solid #e5d2a2;
  border-radius: 8px;
  background: #fff8e8;
}

.checkin-helper-card span {
  color: var(--muted);
  font-size: 0.84rem;
}

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

.checkin-story-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.checkin-story-card.attention {
  border-color: #f0c4bc;
  background: #fff8f6;
}

.checkin-story-card h3 {
  margin: 2px 0 0;
}

.checkin-story-card textarea {
  min-height: 132px;
}

.checkin-story-card.attention textarea {
  min-height: 88px;
}

.checkin-step-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.checkin-action-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: start;
  min-height: 82px;
  padding: 13px;
  border: 1px solid #d6dfdb;
  border-radius: 8px;
  background: #fbfcfa;
  cursor: pointer;
}

.checkin-action-card input {
  grid-row: span 2;
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.checkin-action-card span {
  font-weight: 900;
}

.checkin-action-card small {
  color: var(--muted);
  line-height: 1.25;
}

.missed-rentals-section {
  margin-top: 18px;
}

.missed-rental-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.missed-rental-summary-card {
  display: grid;
  gap: 5px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfa;
}

.missed-rental-summary-card span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.missed-rental-summary-card strong {
  font-size: 1rem;
  line-height: 1.25;
}

.invoice-card {
  border-left: 5px solid var(--line);
}

.invoice-card.rental-invoice {
  border-left-color: var(--blue);
}

.invoice-card.sale-invoice {
  border-left-color: var(--amber);
}

.invoice-card.service-invoice {
  border-left-color: var(--green);
}

.invoice-card.manual-invoice {
  border-left-color: var(--muted);
}

.invoice-card-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.card-top h3,
.customer-card h3,
.invoice-card h3 {
  margin: 0;
  font-size: 1rem;
}

.subtle,
.meta {
  color: var(--muted);
  font-size: 0.86rem;
}

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

.meta-box {
  padding: 10px;
  border-radius: 8px;
  background: #f6f8f5;
}

.meta-box span,
.meta-box strong {
  display: block;
}

.meta-box span {
  color: var(--muted);
  font-size: 0.75rem;
}

.equipment-pricing {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid #d6e1da;
  border-radius: 8px;
  background: #d6e1da;
}

.equipment-pricing > div {
  min-width: 0;
  padding: 10px;
  background: #f3f8f4;
}

.equipment-pricing span,
.equipment-pricing strong {
  display: block;
}

.equipment-pricing span {
  color: var(--muted);
  font-size: 0.72rem;
}

.equipment-pricing strong {
  margin-top: 2px;
  font-size: 0.94rem;
}

.equipment-pricing .positive {
  color: var(--green-strong);
}

.equipment-pricing .negative {
  color: var(--red);
}

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

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 850px;
}

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

th {
  background: #f7faf7;
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
}

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

.service-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 14px;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 14px;
}

.calendar-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.calendar-surface {
  min-width: 0;
}

.calendar-title-row {
  margin-bottom: 14px;
}

.calendar-title-row h3 {
  margin: 0;
  font-size: 1.4rem;
}

.calendar-weekdays {
  display: none;
}

.calendar-grid {
  overflow: auto;
  border: 0;
  border-radius: 8px;
  background: white;
}

.availability-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #fbfdfb;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.availability-legend span {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.availability-legend i {
  display: inline-block;
  width: 22px;
  height: 8px;
  border-radius: 999px;
  background: #dbeafe;
}

.availability-legend i.reserved {
  background: #fee8b7;
}

.availability-legend i.out_on_rent {
  background: #9ee6ad;
}

.availability-legend i.overdue {
  background: #fee2e2;
}

.availability-legend i.returned {
  background: #dbeafe;
}

.availability-board {
  display: grid;
  grid-template-columns: minmax(210px, 260px) repeat(var(--calendar-days), minmax(96px, 1fr));
  grid-auto-rows: minmax(72px, auto);
  min-width: calc(230px + var(--calendar-days) * 96px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: white;
  box-shadow: 0 16px 34px rgba(31, 49, 45, 0.06);
}

.availability-corner,
.availability-day-head,
.availability-machine,
.availability-cell {
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.availability-corner {
  position: sticky;
  left: 0;
  z-index: 5;
  grid-column: 1;
  grid-row: 1;
  padding: 13px 16px;
  background: #f7faf7;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.availability-day-head {
  position: sticky;
  top: 0;
  z-index: 4;
  min-height: 58px;
  padding: 8px 6px;
  background: #f7faf7;
  color: var(--ink);
  text-align: center;
}

.availability-day-head strong,
.availability-day-head span,
.availability-day-head small {
  display: block;
}

.availability-day-head strong {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.availability-day-head span {
  margin-top: 2px;
  font-size: 1rem;
  font-weight: 900;
}

.availability-day-head small {
  margin-top: 2px;
  color: #2f6f4f;
  font-size: 0.66rem;
  font-weight: 800;
}

.availability-day-head.today span {
  display: inline-grid;
  min-width: 26px;
  min-height: 26px;
  place-items: center;
  border-radius: 999px;
  background: var(--green-strong);
  color: white;
}

.availability-day-head.selected,
.availability-cell.selected {
  background: #eef5ef;
  box-shadow: inset 0 0 0 2px #9bc2aa;
}

.availability-machine {
  position: sticky;
  left: 0;
  z-index: 3;
  min-width: 0;
  padding: 8px;
  background: #fbfdfb;
  color: var(--ink);
  text-align: left;
}

.availability-machine strong,
.availability-machine span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.availability-machine strong {
  font-size: 0.84rem;
  font-weight: 900;
}

.availability-machine span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
}

.availability-cell {
  min-height: 72px;
  background: white;
}

.availability-cell.today {
  background: #f5fbf7;
}

.availability-machine:hover,
.availability-cell:hover,
.availability-day-head:hover {
  background: #eef5ef;
}

.availability-rental-bar {
  position: relative;
  z-index: 6;
  align-self: start;
  overflow: hidden;
  min-width: 0;
  height: 26px;
  margin: calc(8px + var(--bar-lane) * 28px) 5px 0;
  border: 0;
  border-radius: 6px;
  padding: 2px 8px;
  background: #d6f2df;
  color: #14532d;
  text-align: left;
  box-shadow: 0 4px 10px rgba(31, 49, 45, 0.12);
}

.availability-rental-bar strong,
.availability-rental-bar span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.availability-rental-bar strong {
  font-size: 0.72rem;
  font-weight: 800;
}

.availability-rental-bar span {
  color: rgba(20, 83, 45, 0.78);
  font-size: 0.62rem;
  font-weight: 800;
}

.availability-rental-bar:hover {
  filter: brightness(0.97);
}

.availability-rental-bar.open,
.availability-rental-bar.out-on-rent {
  background: #9ee6ad;
  color: #0f5132;
}

.availability-rental-bar.open span,
.availability-rental-bar.out-on-rent span {
  color: rgba(15, 81, 50, 0.8);
}

.availability-rental-bar.reserved,
.availability-rental-bar.quote {
  background: #fee8b7;
  color: #8a4b0f;
}

.availability-rental-bar.reserved span,
.availability-rental-bar.quote span {
  color: rgba(138, 75, 15, 0.78);
}

.availability-rental-bar.returned,
.availability-rental-bar.paid {
  background: #dbeafe;
  color: #1d4f7a;
}

.availability-rental-bar.overdue,
.availability-rental-bar.canceled {
  background: #fee2e2;
  color: #9f1239;
}

.calendar-detail-card {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
  box-shadow: 0 10px 24px rgba(31, 49, 45, 0.05);
}

.calendar-detail-card + .calendar-detail-card {
  margin-top: 10px;
}

.calendar-detail-card.overdue-rental {
  border-color: #f2b8b5;
  background: #fff7f6;
}

.calendar-detail-main {
  min-width: 0;
}

.calendar-detail-main strong,
.calendar-detail-main span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-detail-main span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.day-panel {
  align-self: start;
  position: sticky;
  top: 30px;
}

.service-column {
  min-height: 320px;
  padding: 14px;
}

.service-column h3 {
  margin: 0 0 12px;
}

dialog {
  width: min(760px, calc(100% - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: var(--shadow);
}

#invoiceDialog,
#repairTicketDialog {
  width: min(920px, calc(100% - 28px));
}

#signatureDialog {
  width: min(860px, calc(100% - 28px));
}

#returnDialog,
#workLogDialog {
  width: min(960px, calc(100% - 28px));
}

#machineCheckinDialog {
  width: min(920px, calc(100% - 40px));
  max-height: min(880px, calc(100dvh - 40px));
  overflow-y: auto;
}

#equipmentHistoryDialog {
  width: min(880px, calc(100% - 28px));
}

#expenseDialog {
  width: min(720px, calc(100% - 28px));
}

#serviceTypeDialog {
  width: min(880px, calc(100% - 28px));
}

.commerce-dialog {
  width: min(1120px, calc(100% - 28px));
  max-height: min(900px, calc(100dvh - 28px));
}

dialog::backdrop {
  background: rgba(11, 20, 18, 0.52);
}

#recordForm {
  padding: 20px;
}

#machineCheckinForm {
  padding: 30px;
}

#expenseForm {
  padding: 28px;
}

#returnForm,
#workLogForm {
  padding: 26px;
}

.invoice-modal {
  padding: 20px;
}

.history-modal {
  padding: 20px;
}

#expenseForm .form-grid {
  gap: 20px;
  margin: 26px 0;
}

#expenseForm .field {
  gap: 9px;
}

#expenseForm .field input,
#expenseForm .field textarea {
  min-height: 48px;
  padding: 11px 12px;
}

#expenseForm .field textarea {
  min-height: 140px;
}

#expenseForm .modal-actions {
  margin-top: 10px;
}

.history-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.history-item {
  grid-template-columns: auto minmax(0, 1fr) auto;
}

.print-invoice {
  margin: 18px 0;
}

.invoice-page {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.invoice-header,
.invoice-parties,
.invoice-totals,
.invoice-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
}

.invoice-header {
  align-items: flex-start;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--ink);
}

.invoice-brand {
  font-size: 1.8rem;
  font-weight: 800;
}

.invoice-status {
  display: grid;
  gap: 5px;
  text-align: right;
}

.invoice-status span,
.invoice-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.invoice-status strong {
  font-size: 1.4rem;
}

.invoice-parties {
  margin: 26px 0;
}

.invoice-parties > div {
  flex: 1;
  line-height: 1.45;
}

.invoice-parties strong,
.invoice-label {
  display: block;
}

.invoice-table {
  min-width: 0;
  margin: 20px 0;
  border: 1px solid var(--line);
}

.invoice-table th,
.invoice-table td {
  font-size: 0.92rem;
}

.invoice-totals {
  flex-direction: column;
  align-items: flex-end;
  margin-left: auto;
  width: min(360px, 100%);
}

.invoice-totals div {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.invoice-totals .grand-total {
  font-size: 1.15rem;
  border-bottom: 0;
}

.invoice-footer {
  display: grid;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.invoice-terms {
  margin-top: 30px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
}

.invoice-terms p {
  margin: 10px 0 0;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
}

.service-ticket-page {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}

.service-ticket-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 4px solid var(--ink);
}

.service-ticket-brand {
  font-size: 1.7rem;
  font-weight: 900;
}

.service-ticket-subtitle,
.service-ticket-label,
.service-ticket-number span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.service-ticket-number {
  display: grid;
  gap: 5px;
  text-align: right;
}

.service-ticket-number strong {
  font-size: 1.5rem;
}

.service-ticket-number em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 800;
}

.service-estimate-notice {
  display: grid;
  gap: 4px;
  margin-top: 14px;
  border: 1px solid #d8bd83;
  border-left: 5px solid var(--amber);
  border-radius: 6px;
  padding: 12px 14px;
  background: #fff9e9;
}

.service-estimate-notice strong {
  color: #7b4b0c;
}

.service-estimate-notice span,
.service-estimate-authorization p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
}

.service-estimate-authorization {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 18px;
  margin-top: 24px;
}

.service-estimate-authorization p {
  grid-column: 1 / -1;
  margin: 0;
}

.service-ticket-grid,
.service-parts-section {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 14px;
  margin-top: 18px;
}

.service-ticket-panel,
.service-writeup-box,
.service-work-section,
.service-parts-section > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcfa;
}

.service-ticket-panel > strong {
  display: block;
  margin-top: 4px;
  font-size: 1.18rem;
}

.service-ticket-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin-top: 14px;
}

.service-ticket-facts div,
.service-cost-summary div {
  display: grid;
  gap: 3px;
}

.service-ticket-facts span,
.service-cost-summary span,
.service-labor-line,
.service-parts-list {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.service-writeup-box {
  min-height: 150px;
  margin-top: 14px;
}

.service-writeup-box p,
.service-work-entry p,
.service-parts-section p {
  margin: 10px 0 0;
  line-height: 1.55;
}

.service-work-section {
  min-height: 220px;
  margin-top: 14px;
}

.service-section-title,
.service-work-entry-head,
.service-parts-section li,
.service-cost-summary div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.service-work-entry {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.service-work-entry-head {
  font-weight: 900;
}

.service-work-entry-head span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.service-parts-list,
.service-labor-line {
  margin-top: 8px;
}

.service-blank-lines {
  display: grid;
  gap: 32px;
  margin-top: 22px;
}

.service-blank-lines div {
  border-bottom: 1px solid var(--line);
}

.service-parts-section ul {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.service-parts-section li {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.service-cost-summary {
  align-self: start;
}

.service-cost-summary div {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.service-cost-summary .service-ticket-total {
  border-bottom: 0;
  font-size: 1.05rem;
}

.service-signoff {
  display: grid;
  grid-template-columns: 1fr 160px 1fr;
  gap: 22px;
  margin-top: 42px;
}

.service-signoff div {
  border-top: 2px solid var(--ink);
  padding-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.service-captured-signatures {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.service-captured-signatures .captured-signature {
  margin-top: 0;
}

.service-captured-signatures .captured-signature.declined {
  border-color: #efb2ad;
  background: #fff7f6;
}

.service-signature-blank {
  min-height: 118px;
  display: flex;
  align-items: flex-end;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.signature-grid {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 24px;
  margin-top: 44px;
}

.signature-grid div {
  border-top: 2px solid var(--ink);
  padding-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.signature-modal {
  padding: 24px;
}

.signature-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.signature-summary div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9f7;
}

.signature-summary span,
.signature-existing-meta span {
  color: var(--muted);
  font-size: 0.72rem;
}

.signature-summary strong {
  overflow-wrap: anywhere;
}

.signature-details {
  margin: 0 0 16px;
}

.signature-terms {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9f7;
}

.signature-terms summary {
  padding: 12px;
  cursor: pointer;
  font-weight: 800;
}

.signature-terms > div {
  max-height: 210px;
  overflow-y: auto;
  padding: 0 12px 12px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
}

.signature-terms p {
  margin: 8px 0 0;
}

.signature-pad-wrap {
  display: grid;
  gap: 9px;
  margin: 16px 0;
}

.signature-pad-head,
.signature-existing-head,
.captured-signature-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.signature-pad-head > div,
.signature-existing-head > div {
  display: grid;
  gap: 3px;
}

.signature-pad-head span,
.signature-existing-head span,
.signature-pad-wrap p {
  margin: 0;
  color: var(--muted);
  font-size: 0.74rem;
}

#signatureCanvas {
  display: block;
  width: 100%;
  height: 220px;
  border: 2px solid #9daba4;
  border-radius: 7px;
  background: white;
  cursor: crosshair;
  touch-action: none;
}

.signature-consent {
  align-items: flex-start;
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9f7;
}

.signature-existing {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.signature-existing img {
  width: min(100%, 520px);
  height: 120px;
  object-fit: contain;
  object-position: left center;
  border-bottom: 1px solid var(--line);
  background: white;
}

.signature-existing-meta,
.captured-signature-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 18px;
}

.signature-action.signed {
  border-color: #79a98a;
  background: #e5f2e9;
  color: var(--green-strong);
}

.signature-action.needs-signature {
  border-color: #d19d45;
  background: #fff3dc;
  color: #8a5711;
}

.signature-recorded {
  color: var(--green-strong);
  font-weight: 700;
}

.signature-outdated {
  color: #a66512;
  font-weight: 700;
}

.captured-signature {
  display: grid;
  gap: 10px;
  margin-top: 28px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.captured-signature.outdated {
  border: 2px solid #c68328;
  background: #fffaf0;
}

.captured-signature img {
  width: min(100%, 520px);
  height: 105px;
  object-fit: contain;
  object-position: left center;
}

.captured-signature-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

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

.commerce-form {
  display: block;
  margin: 18px 0 0;
}

.commerce-workflow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f3f6f4;
}

.commerce-workflow > div {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 7px 8px;
}

.commerce-workflow span,
.commerce-section-head > span {
  display: grid;
  flex: 0 0 auto;
  width: 27px;
  height: 27px;
  place-items: center;
  border-radius: 50%;
  background: var(--green-strong);
  color: white;
  font-size: 0.76rem;
  font-weight: 800;
}

.commerce-workflow strong {
  min-width: 0;
  color: #40514b;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.commerce-form-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  align-items: start;
}

.commerce-form-main {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.commerce-form-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  overflow: visible;
}

.commerce-section-head {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 15px 16px 13px;
  border-bottom: 1px solid var(--line);
  background: #f8faf8;
}

.commerce-section-head h3,
.commerce-section-head p {
  margin: 0;
}

.commerce-section-head h3 {
  font-size: 0.98rem;
}

.commerce-section-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.77rem;
  line-height: 1.4;
}

.commerce-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
}

.commerce-section-grid > .full,
.commerce-section-grid > .parts-editor,
.commerce-section-grid > .record-document-selector,
.commerce-section-grid > .standard-terms {
  grid-column: 1 / -1;
}

.commerce-form-summary {
  position: sticky;
  top: 14px;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.commerce-summary-label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.commerce-form-summary p {
  margin: 0;
  color: #52635d;
  font-size: 0.82rem;
  line-height: 1.5;
}

.commerce-form-summary .price-preview {
  width: 100%;
  border-color: #9fc2ab;
  background: white;
}

.commerce-summary-facts {
  display: grid;
  gap: 9px;
  padding: 12px;
  border: 1px solid #c8d8ce;
  border-radius: 7px;
  background: white;
}

.commerce-summary-facts > strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.commerce-summary-facts > div {
  display: grid;
  gap: 2px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.commerce-summary-facts span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.commerce-summary-facts b {
  color: var(--ink);
  font-size: 0.8rem;
}

.commerce-dialog .modal-actions {
  justify-content: flex-end;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.commerce-dialog .modal-actions button {
  min-height: 44px;
}

.rental-builder-dialog {
  width: min(1480px, calc(100% - 18px));
  max-height: min(940px, calc(100dvh - 18px));
}

.rental-builder-dialog .modal-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.rental-order-builder-form {
  margin-top: 12px;
}

.rental-order-builder-form .commerce-workflow {
  margin-bottom: 12px;
  padding: 7px;
  background: #f7faf7;
}

.rental-order-builder-form .commerce-workflow > div {
  min-height: 38px;
  border-radius: 7px;
  background: white;
}

.rental-order-builder-form .commerce-form-body {
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.rental-order-builder-form .commerce-form-main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.rental-order-builder-form .commerce-form-section {
  box-shadow: 0 8px 22px rgba(31, 49, 45, 0.05);
}

.rental-order-builder-form .commerce-form-section[data-section="items"],
.rental-order-builder-form .commerce-form-section[data-section="charges"],
.rental-order-builder-form .commerce-form-section[data-section="advanced"],
.rental-order-builder-form .commerce-form-section[data-section="terms"] {
  grid-column: 1 / -1;
}

.rental-order-builder-form .commerce-form-section[data-section="items"] .commerce-section-grid {
  grid-template-columns: minmax(260px, 1.1fr) minmax(0, 1fr);
}

.rental-order-builder-form .commerce-form-section[data-section="charges"] .commerce-section-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.rental-order-builder-form .commerce-section-head {
  min-height: 72px;
  background: #fbfdfb;
}

.rental-order-builder-form .commerce-section-head h3 {
  font-size: 1.02rem;
}

.rental-order-builder-form [data-field="customerId"],
.rental-order-builder-form [data-field="equipmentId"],
.rental-order-builder-form .parts-editor,
.rental-order-builder-form .record-document-selector,
.rental-order-builder-form .standard-terms {
  grid-column: 1 / -1;
}

.rental-order-builder-form .parts-editor {
  border-color: #d6e3db;
  background: #fbfdfb;
}

.rental-order-builder-form .part-row {
  align-items: stretch;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.rental-order-builder-form .part-row input:first-child {
  flex: 1 1 auto;
}

.rental-order-builder-form .commerce-form-summary {
  top: 10px;
  gap: 12px;
  border-color: #bcd3c5;
  background: #eef7f1;
  box-shadow: 0 12px 28px rgba(31, 49, 45, 0.1);
}

.rental-order-builder-form .commerce-form-summary .price-preview {
  border-color: #83ae92;
  box-shadow: 0 8px 18px rgba(31, 49, 45, 0.08);
}

.rental-order-builder-form .calculation-details > summary {
  min-height: 82px;
}

.rental-order-builder-form .calculation-details > summary strong {
  font-size: 1.55rem;
}

.rental-builder-action-note {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #c8d8ce;
  border-radius: 8px;
  background: white;
}

.rental-builder-action-note strong {
  color: var(--green-strong);
  font-size: 0.86rem;
}

.rental-builder-action-note span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.45;
}

.rental-builder-dialog .modal-actions {
  position: sticky;
  bottom: 0;
  z-index: 8;
  margin: 0 -24px -24px;
  padding: 14px 24px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.rental-builder-dialog .modal-actions button {
  min-width: 132px;
}

.orders-workspace {
  display: grid;
  gap: 16px;
}

.orders-hero {
  display: grid;
  grid-template-columns: minmax(260px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
  align-items: stretch;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 12px 30px rgba(31, 49, 45, 0.06);
}

.orders-hero h2 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.orders-type-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.orders-type-tabs button {
  display: grid;
  gap: 5px;
  min-height: 84px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: white;
  color: var(--ink);
  text-align: left;
}

.orders-type-tabs button.active {
  border-color: var(--green-strong);
  background: #eef7f1;
  box-shadow: inset 0 0 0 1px #b7d1c1;
}

.orders-type-tabs strong {
  font-size: 0.94rem;
}

.orders-type-tabs span {
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.order-builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}

.rental-new-order-builder {
  grid-template-columns: minmax(420px, 1.2fr) minmax(300px, 0.8fr) 330px;
}

.order-panel,
.order-summary-card,
.orders-coming-soon {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 10px 26px rgba(31, 49, 45, 0.06);
}

.order-panel {
  min-width: 0;
  padding: 0;
}

.order-customer-panel,
.order-date-panel,
.order-items-panel,
.order-notes-panel,
.order-builder-actions {
  grid-column: 1;
}

.rental-new-order-builder .order-customer-panel {
  grid-column: 1;
}

.rental-new-order-builder .order-date-panel {
  grid-column: 2;
}

.rental-new-order-builder .order-items-panel,
.rental-new-order-builder .order-builder-actions {
  grid-column: 1 / span 2;
}

.rental-new-order-builder .order-notes-panel {
  grid-column: 1;
}

.rental-new-order-builder .order-compact-totals-panel {
  grid-column: 2;
  justify-self: end;
  width: min(100%, 640px);
}

.order-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
  background: #fbfdfb;
}

.order-panel-head h3,
.order-panel-head p {
  margin: 0;
}

.order-panel-head h3 {
  font-size: 1.04rem;
}

.order-search-field,
.order-panel label {
  display: grid;
  gap: 7px;
  padding: 16px;
}

.order-search-field span,
.order-panel label span,
.order-summary-card label span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
}

.order-search-field select,
.order-panel input,
.order-panel select,
.order-panel textarea,
.order-summary-card input,
.order-summary-card select {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: white;
  color: var(--ink);
  font: inherit;
}

.order-panel textarea {
  min-height: 92px;
  resize: vertical;
}

.order-date-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 40px minmax(0, 1fr);
  gap: 10px;
  padding: 16px;
}

.departure-form {
  padding: 20px;
}

.order-date-grid label,
.order-summary-card label {
  padding: 0;
}

.order-date-arrow {
  align-self: end;
  display: grid;
  height: 46px;
  place-items: center;
  color: var(--green-strong);
  font-size: 1.3rem;
  font-weight: 900;
}

.order-line-table {
  display: grid;
  gap: 0;
  padding: 16px;
}

.order-line-head,
.order-main-line,
.order-custom-line,
.order-standard-line {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 150px 84px 120px 120px 42px;
  gap: 10px;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.order-standard-line {
  grid-template-columns: minmax(170px, 1fr) 58px 76px 108px 96px 74px;
  gap: 8px;
}

.order-line-head {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.order-main-line strong,
.order-main-line span,
.order-standard-line strong,
.order-standard-line span {
  display: block;
}

.order-main-line div span,
.order-standard-line div span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
}

.order-main-line input,
.order-main-line select,
.order-standard-line input,
.order-custom-line input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  width: 100%;
}

.order-main-line > strong,
.order-standard-line > strong,
.order-custom-line > strong {
  text-align: right;
}

.compact-delivery-details-btn {
  min-width: 0;
  min-height: 30px;
  padding: 5px 8px;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.order-standard-line [data-order-delivery-summary].needs-attention {
  color: #875700;
  font-weight: 850;
}

.order-rate-breakdown {
  display: grid;
  gap: 6px;
  margin: 2px 0 10px;
  padding: 10px 12px;
  border: 1px solid #cfe0d4;
  border-radius: 8px;
  background: #f6faf7;
  color: var(--ink);
  font-size: 0.82rem;
}

.order-rate-breakdown > span {
  color: var(--muted);
}

.order-rate-breakdown ul {
  display: grid;
  gap: 5px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.order-rate-breakdown li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(47, 72, 63, 0.12);
  padding-top: 5px;
}

.order-availability {
  display: inline-flex !important;
  width: fit-content;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.72rem !important;
  font-weight: 850;
}

.order-availability.success {
  border-color: #9bd3ad;
  background: #edf8f0;
  color: #11622b;
}

.order-availability.warning {
  border-color: #e7ca7c;
  background: #fff8df;
  color: #684f0d;
}

.order-availability.danger {
  border-color: #efb2ad;
  background: #fff1f0;
  color: #9f231a;
}

.order-availability.waiting {
  border-color: #cbd5da;
  background: #f4f7f8;
  color: #53646b;
}

#addOrderCustomLineBtn {
  justify-self: start;
  margin-top: 14px;
}

.order-totals-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.42fr) minmax(360px, 0.58fr);
  gap: 16px;
  padding: 0 16px 16px;
  align-items: start;
}

.order-totals-controls {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.order-totals-controls label {
  padding: 0;
}

.order-totals-panel .price-preview {
  grid-column: 2;
  margin: 0;
}

.order-totals-panel .price-preview:only-child {
  grid-column: 1 / -1;
}

.order-compact-totals-panel {
  display: block;
  align-self: start;
  padding: 0;
  background: #eef7f1;
  overflow: hidden;
}

.order-compact-totals-panel .price-preview,
.order-compact-totals-panel .price-preview:only-child {
  grid-column: auto;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.order-compact-totals-panel .order-calculation-static .calculation-breakdown {
  padding: 0 10px 10px;
}

.order-compact-totals-panel .order-calculation-static .calculation-breakdown > div {
  grid-template-columns: minmax(0, 1fr) minmax(96px, auto);
  column-gap: 10px;
  padding: 6px 0;
}

.order-compact-totals-panel .order-calculation-control-row {
  min-height: 0;
  padding: 7px 0;
}

.order-compact-totals-panel .order-ldw-adjust-link,
.order-compact-totals-panel select {
  min-height: 34px;
}

.order-compact-totals-panel .order-calculation-static .calculation-breakdown strong {
  min-width: 96px;
}

.order-calculation-details > summary {
  min-height: 86px;
}

.order-calculation-details > summary > strong {
  font-size: 1.55rem;
}

.order-calculation-static {
  display: block;
}

.order-calculation-static .calculation-breakdown {
  padding: 0 10px 10px;
}

.order-calculation-static .calculation-breakdown > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, auto);
  column-gap: 28px;
  align-items: center;
}

.order-calculation-static .calculation-breakdown strong {
  justify-self: end;
  min-width: 150px;
  text-align: right;
}

.order-calculation-static .calculation-breakdown > div:first-child {
  border-top: 0;
}

.order-calculation-static .calculation-total {
  margin-top: 2px;
  border-top: 1px solid #9fc2ab;
  padding-top: 8px;
  font-size: 1.05rem;
}

.order-calculation-control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border-top: 1px solid rgba(47, 72, 63, 0.13);
  padding-top: 5px;
}

.order-calculation-control-row label {
  display: grid;
  gap: 4px;
  padding: 0;
}

.order-calculation-control-row select,
.order-mini-select {
  width: min(100%, 190px);
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 7px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
}

.order-calculation-control-row input[type="number"] {
  width: 108px;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 3px 7px;
  background: white;
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
}

.order-calculation-control-row.compact label {
  grid-template-columns: auto auto;
  align-items: center;
  justify-content: start;
  gap: 8px;
}

.order-calculation-control-row .check-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-calculation-control-row.compact-card-fee {
  padding-top: 4px;
}

.order-calculation-control-row.compact-card-fee .check-field {
  min-height: 24px;
  font-size: 0.82rem;
}

.order-ldw-adjustment {
  display: grid;
  gap: 3px;
  justify-items: start;
}

.order-inline-adjustment {
  width: fit-content;
}

.order-inline-adjustment > summary {
  display: inline-flex;
  align-items: center;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0 !important;
  max-width: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px !important;
  background: white;
  cursor: pointer;
  list-style: none;
  color: var(--green-strong);
  font-weight: 900;
  font-size: 0.74rem;
  line-height: 1.15;
  white-space: nowrap;
}

.order-inline-adjustment > summary::-webkit-details-marker {
  display: none;
}

.order-inline-adjustment > summary small {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.order-inline-adjustment label {
  display: grid;
  gap: 4px;
  margin-top: 5px;
  padding: 0;
}

.order-inline-adjustment input[type="number"] {
  width: 108px;
}

.tax-rate-settings {
  display: grid;
  gap: 14px;
}

.tax-rate-settings-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(110px, 160px) auto;
  gap: 10px;
  align-items: end;
}

.tax-rate-settings-form input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
}

.tax-rate-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tax-rate-row div {
  display: grid;
  gap: 2px;
}

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

.mini-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  margin-left: 6px;
  border-radius: 999px;
  padding: 2px 7px;
  background: #e7f5ed;
  color: var(--green-strong);
  font-size: 0.68rem;
  font-weight: 900;
  vertical-align: middle;
}

.order-fulfillment-panel {
  display: grid;
  gap: 14px;
}

.order-fulfillment-choice,
.order-fulfillment-compact {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 10px;
  align-items: end;
  padding: 16px;
}

.order-fulfillment-compact label {
  padding: 0;
}

.order-delivery-summary {
  grid-column: 1 / -1;
  min-height: 32px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #f6faf7;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.3;
}

.order-delivery-summary.needs-attention {
  border-color: #d89a3a;
  background: #fff8e8;
  color: #875700;
  font-weight: 850;
}

.delivery-detail-modal .modal-body {
  padding: 18px;
}

.order-summary-rail {
  position: sticky;
  top: 14px;
  grid-column: 2;
  grid-row: 1 / span 5;
}

.rental-new-order-builder .order-summary-rail {
  grid-column: 3;
}

.order-summary-card {
  display: grid;
  gap: 12px;
  padding: 15px;
  background: #f6faf7;
}

.order-rail-title {
  display: block;
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.25;
}

.order-summary-card > .subtle {
  line-height: 1.35;
}

.order-summary-card button {
  width: 100%;
  justify-content: center;
}

.order-summary-card .price-preview {
  margin: 0;
  background: white;
}

.order-rail-divider {
  height: 1px;
  background: var(--line);
  margin: 2px 0;
}

.order-advanced {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.order-advanced summary {
  cursor: pointer;
  color: var(--green-strong);
  font-weight: 900;
}

.order-advanced label {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.order-builder-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
}

.orders-coming-soon {
  display: grid;
  gap: 10px;
  padding: 24px;
}

@media (max-width: 980px) {
  .commerce-form-body {
    grid-template-columns: 1fr;
  }

  .commerce-form-summary {
    position: static;
    grid-row: 1;
  }

  .rental-order-builder-form .commerce-form-body,
  .rental-order-builder-form .commerce-form-main,
  .rental-order-builder-form .commerce-form-section[data-section="items"] .commerce-section-grid,
  .rental-order-builder-form .commerce-form-section[data-section="charges"] .commerce-section-grid {
    grid-template-columns: 1fr;
  }

  .orders-hero,
  .order-builder,
  .delivery-summary-grid,
  .delivery-board,
  .order-totals-panel,
  .order-date-grid,
  .order-delivery-contact-grid,
  .order-line-head,
  .order-main-line,
  .order-custom-line,
  .order-standard-line {
    grid-template-columns: 1fr;
  }

  .orders-type-tabs {
    grid-template-columns: 1fr;
  }

  .order-summary-rail,
  .order-customer-panel,
  .order-date-panel,
  .order-items-panel,
  .order-notes-panel,
  .order-builder-actions {
    grid-column: 1;
  }

  .rental-new-order-builder .order-summary-rail,
  .rental-new-order-builder .order-customer-panel,
  .rental-new-order-builder .order-date-panel,
  .rental-new-order-builder .order-items-panel,
  .rental-new-order-builder .order-notes-panel,
  .rental-new-order-builder .order-compact-totals-panel,
  .rental-new-order-builder .order-builder-actions {
    grid-column: 1;
  }

  .order-summary-rail {
    position: static;
    grid-row: auto;
  }

  .order-totals-panel .price-preview {
    grid-column: 1;
  }

  .order-builder-actions {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  .commerce-workflow {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px;
    padding: 7px;
  }

  .commerce-workflow > div {
    padding: 6px;
  }

  .commerce-section-grid {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .commerce-section-grid > .field,
  .commerce-section-grid > .full,
  .commerce-section-grid > .parts-editor,
  .commerce-section-grid > .record-document-selector,
  .commerce-section-grid > .standard-terms {
    grid-column: 1;
  }

  .commerce-dialog .modal-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .commerce-dialog .modal-actions .primary {
    grid-column: 1 / -1;
  }
}

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

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

[data-field="newCustomerCompany"] {
  align-self: start;
}

[data-field="newCustomerCompany"] input {
  height: 42px;
  min-height: 42px;
}

.field[hidden] {
  display: none;
}

.field label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: white;
  color: var(--ink);
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  color: var(--ink);
  font-weight: 800;
}

.check-field input {
  width: 18px;
  min-height: 18px;
}

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

.dictation-btn {
  justify-self: start;
  min-height: 40px;
  margin-top: 6px;
  border: 1px solid #b9c8bf;
  border-radius: 7px;
  padding: 6px 11px;
  background: #f6f8f6;
  color: #29463d;
  font-size: 0.76rem;
  font-weight: 800;
}

.dictation-btn:hover {
  background: #e9f0eb;
}

.dictation-btn.listening {
  border-color: #b94b45;
  background: #fff0ee;
  color: #9c302b;
}

.customer-combobox {
  position: relative;
}

.customer-combobox-input {
  padding-right: 34px !important;
  background:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 17px) 17px / 5px 5px no-repeat,
    linear-gradient(135deg, var(--muted) 50%, transparent 50%) calc(100% - 12px) 17px / 5px 5px no-repeat,
    white !important;
}

.customer-combobox-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 5px;
  background: white;
  box-shadow: 0 14px 32px rgba(31, 49, 45, 0.16);
}

.customer-combobox-menu[hidden] {
  display: none;
}

.customer-combobox-option {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 8px 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.customer-combobox-option:hover,
.customer-combobox-option:focus-visible {
  background: #eef5f0;
  outline: none;
}

.customer-combobox-option span {
  color: var(--muted);
  font-size: 0.76rem;
}

.customer-combobox-option.add-option {
  color: var(--green-strong);
  font-weight: 800;
}

.customer-combobox-empty {
  padding: 12px 10px;
  color: var(--muted);
  font-size: 0.82rem;
}

.price-preview {
  grid-column: 1 / -1;
  border: 1px solid #b9d2c3;
  border-radius: 8px;
  background: #eef7f1;
  overflow: hidden;
}

.calculation-details > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 62px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

.calculation-details > summary::-webkit-details-marker {
  display: none;
}

.calculation-details > summary > span {
  display: grid;
  gap: 3px;
}

.calculation-details > summary small {
  color: var(--green-strong);
  font-size: 0.75rem;
  font-weight: 800;
}

.calculation-details > summary small::after {
  content: " +";
}

.calculation-details[open] > summary small::after {
  content: " -";
}

.calculation-label,
.calculation-breakdown span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.calculation-details > summary > strong {
  font-size: 1.3rem;
  white-space: nowrap;
}

.calculation-breakdown {
  display: grid;
  padding: 0 14px 14px;
}

.calculation-breakdown > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 0;
  border-top: 1px solid #cfe0d4;
}

.calculation-breakdown strong {
  text-align: right;
  white-space: nowrap;
}

.calculation-breakdown .calculation-total {
  color: var(--ink);
  font-size: 1.02rem;
}

.calculation-breakdown .calculation-total span {
  color: var(--ink);
}

.parts-editor {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
}

.attachment-selector {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
}

.attachment-selector .subtle {
  margin: 0;
}

.attachment-checklist {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffef9;
}

.parts-editor-head,
.parts-total,
.part-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.parts-editor-head,
.parts-total {
  justify-content: space-between;
}

.parts-editor-head label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

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

.part-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 38px;
}

.part-row input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.service-part-headings,
.customer-service-part-row {
  display: grid;
  grid-template-columns: minmax(180px, 1.8fr) minmax(95px, 0.75fr) minmax(95px, 0.7fr) minmax(110px, 0.85fr) 36px;
  gap: 8px;
  align-items: center;
}

.service-part-headings {
  padding: 0 2px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.customer-service-part-row input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}

.percent-input {
  position: relative;
}

.percent-input input {
  padding-right: 28px;
}

.percent-input span {
  position: absolute;
  top: 50%;
  right: 10px;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

@media (max-width: 760px) {
  .service-part-headings {
    display: none;
  }

  .customer-service-part-row {
    grid-template-columns: 1fr 1fr 36px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
  }

  .customer-service-part-row .service-part-description {
    grid-column: 1 / 3;
  }

  .customer-service-part-row .service-part-price {
    grid-column: 1 / 3;
  }

  .customer-service-part-row .remove-customer-service-part {
    grid-column: 3;
    grid-row: 1;
  }
}

.parts-total {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.parts-total span,
.parts-total strong {
  font-weight: 800;
}

.return-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f5;
}

#returnDialog .return-summary,
#workLogDialog .return-summary {
  gap: 18px;
  margin: 22px 0;
  padding: 18px;
}

#returnDialog .return-guidance-card {
  grid-column: 1 / -1;
  padding: 12px 14px;
  border: 1px solid #b8dbc7;
  border-radius: 8px;
  background: #eef8f1;
}

#returnDialog .return-guidance-card strong,
#returnDialog .return-guidance-card span {
  display: block;
}

#returnDialog .return-guidance-card strong {
  color: var(--green-strong);
  font-size: 0.95rem;
}

#returnDialog .return-guidance-card span {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.35;
}

#returnDialog .deposit-refund-callout,
#returnDialog .return-balance-callout {
  grid-column: 1 / -1;
}

#returnDialog .form-grid,
#workLogDialog .form-grid {
  gap: 18px;
  margin: 24px 0;
}

#returnDialog .field,
#workLogDialog .field {
  gap: 9px;
}

#returnDialog .field input,
#returnDialog .field textarea,
#workLogDialog .field input,
#workLogDialog .field select,
#workLogDialog .field textarea {
  min-height: 48px;
  padding: 11px 12px;
}

#returnDialog .field textarea,
#workLogDialog .field textarea {
  min-height: 130px;
}

#workLogDialog .parts-editor {
  gap: 14px;
  padding: 18px;
}

.work-status-field {
  align-self: stretch;
}

.work-status-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.work-status-choice {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid #d7e4dc;
  border-radius: 8px;
  background: #fbfdfb;
  color: var(--ink);
  text-align: left;
  box-shadow: 0 6px 14px rgba(31, 49, 45, 0.04);
}

.work-status-choice strong {
  font-size: 0.92rem;
}

.work-status-choice span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.25;
}

.work-status-choice.active {
  border-color: var(--brand);
  background: #eaf5ef;
  box-shadow: inset 4px 0 0 var(--brand), 0 8px 18px rgba(31, 49, 45, 0.08);
}

.work-status-choice.active strong {
  color: var(--brand-dark);
}

.work-log-history {
  display: grid;
  gap: 12px;
  margin: 22px 0;
}

.work-log-history-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.work-log-history-head h3 {
  margin: 2px 0 0;
  font-size: 1rem;
}

.work-log-history-list {
  display: grid;
  gap: 8px;
}

.work-log-history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.work-log-history-item.active {
  border-color: #9ebfa9;
  box-shadow: inset 4px 0 0 var(--green-strong);
  background: #f8faf7;
}

.work-log-history-item p {
  margin: 5px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.work-log-history-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.work-log-empty {
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
}

@media (max-width: 680px) {
  .work-log-history-head,
  .work-log-history-item {
    align-items: stretch;
  }

  .work-log-history-item {
    grid-template-columns: 1fr;
  }
}

#returnDialog .modal-actions,
#workLogDialog .modal-actions {
  margin-top: 8px;
}

.return-summary div {
  display: grid;
  gap: 4px;
}

.return-summary span {
  color: var(--muted);
  font-size: 0.84rem;
}

.empty-state {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 140px;
  padding: 24px;
  border: 1px dashed #bfcac5;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .two-column,
  .calendar-layout,
  .service-board {
    grid-template-columns: 1fr;
  }

  .day-panel {
    position: static;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .report-section-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  #invoicePaymentDialog {
    width: min(520px, calc(100vw - 20px));
  }

  .payment-dialog-layout {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .payment-dialog-side,
  .payment-dialog-main {
    padding: 18px;
  }

  .payment-dialog-side > strong {
    font-size: 1.55rem;
  }

  .payment-processing-options,
  .payment-dialog-form {
    grid-template-columns: 1fr;
  }

  .quickbooks-support,
  .quickbooks-error-row > div {
    align-items: stretch;
    flex-direction: column;
  }

  .quickbooks-support button {
    width: 100%;
  }

  .content,
  .sidebar {
    padding: 18px;
  }

  .topbar,
  .section-head,
  .calendar-actions,
  .calendar-title-row,
  .modal-head,
  .modal-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .search {
    width: 100%;
  }

  .dashboard-actions {
    grid-template-columns: 1fr;
  }

  .dashboard-my-day-list {
    grid-template-columns: 1fr;
  }

  .dashboard-my-day-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .dashboard-my-day-type {
    width: max-content;
  }

  .nav-tabs,
  .metrics-grid,
  .history-summary,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .timeline-item,
  .stack-item {
    grid-template-columns: 1fr;
  }

  .calendar-day {
    min-height: 116px;
  }

  .report-dashboard-head,
  .report-card-head,
  .report-line {
    flex-direction: column;
    align-items: stretch;
  }

  .report-line strong {
    text-align: left;
  }
}

/* Workspace polish */
:root {
  --line-strong: #cbd7d0;
  --panel-soft: #f8faf8;
  --panel-hover: #fbfcfb;
  --focus-ring: rgba(37, 95, 71, 0.16);
  --shadow-soft: 0 8px 24px rgba(31, 49, 45, 0.07);
  --shadow-hover: 0 12px 30px rgba(31, 49, 45, 0.11);
}

.content {
  max-width: 1800px;
  width: 100%;
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  margin: -12px -10px 28px;
  padding: 12px 10px 14px;
  border-bottom: 1px solid rgba(203, 215, 208, 0.78);
  background: rgba(243, 246, 241, 0.94);
  backdrop-filter: blur(12px);
}

.topbar-title {
  min-width: 0;
}

.topbar h1 {
  font-size: clamp(1.8rem, 3vw, 2.65rem);
}

.topbar .eyebrow {
  margin-bottom: 5px;
}

.search {
  border-color: var(--line-strong);
  box-shadow: 0 1px 0 rgba(31, 49, 45, 0.03);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.search:focus-within {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.section-head.flush {
  min-height: 58px;
  margin-bottom: 18px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.section-head h2 {
  font-size: 1.25rem;
}

.section-head .eyebrow {
  margin-bottom: 5px;
}

.metric,
.surface,
.equipment-card,
.customer-card,
.invoice-card,
.service-column,
.customer-service-card,
.crm-column,
.report-card {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-soft);
}

.surface,
.equipment-card,
.customer-card,
.invoice-card,
.customer-service-card,
.crm-opportunity,
.timeline-item,
.stack-item,
.schedule-chip,
.document-library-item,
.activity-entry,
.deleted-record {
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease, background 150ms ease;
}

.equipment-card:hover,
.customer-card:hover,
.invoice-card:hover,
.customer-service-card:hover,
.crm-opportunity:hover,
.schedule-chip:hover {
  border-color: #aec2b6;
  background: var(--panel-hover);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.metric {
  position: relative;
  overflow: hidden;
  min-height: 112px;
  padding: 17px 18px;
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--green);
}

.metric:nth-child(2)::before {
  background: var(--amber);
}

.metric:nth-child(3)::before {
  background: var(--blue);
}

.metric:nth-child(4)::before {
  background: #7b6ba8;
}

.metric span {
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.metric strong {
  margin-top: 12px;
  font-size: clamp(1.55rem, 2.6vw, 2.15rem);
  font-variant-numeric: tabular-nums;
}

.primary,
.secondary,
.danger,
.chip,
.icon-btn,
.settings-tab {
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 100ms ease;
}

.primary {
  border-color: var(--green-strong);
  box-shadow: 0 4px 10px rgba(37, 95, 71, 0.16);
}

.primary:hover {
  background: #1e533d;
  box-shadow: 0 6px 15px rgba(37, 95, 71, 0.22);
  transform: translateY(-1px);
}

.secondary:hover,
.icon-btn:hover,
.chip:hover {
  border-color: #a9beb2;
  background: #f5f8f6;
  color: var(--green-strong);
}

.danger:hover {
  border-color: #dfaaa6;
  background: #ffe9e7;
}

.primary:active,
.secondary:active,
.danger:active,
.chip:active,
.icon-btn:active {
  transform: translateY(0);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 0;
  box-shadow: 0 0 0 4px var(--focus-ring);
}

.filter-row {
  gap: 7px;
  padding: 2px 0 7px;
  scrollbar-width: thin;
}

.chip {
  min-height: 34px;
  border-radius: 999px;
  padding-inline: 13px;
  color: var(--muted);
  font-size: 0.76rem;
}

.chip.active {
  border-color: #9fc0ad;
  background: #dfeee4;
  box-shadow: inset 0 0 0 1px rgba(37, 95, 71, 0.05);
}

.equipment-grid,
.customer-grid,
.invoice-grid,
.customer-service-board {
  gap: 16px;
}

.equipment-card,
.customer-card,
.invoice-card,
.customer-service-card {
  overflow: hidden;
}

.card-top {
  padding-bottom: 12px;
  border-bottom: 1px solid #e6ece8;
}

.card-top h3 {
  margin-top: 5px;
}

.meta-grid {
  gap: 7px;
}

.meta-box {
  min-height: 58px;
  border: 1px solid #e2e9e5;
  border-radius: 7px;
  padding: 9px 10px;
  background: var(--panel-soft);
}

.meta-box span {
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.meta-box strong {
  margin-top: 4px;
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}

.card-actions {
  padding-top: 11px;
  border-top: 1px solid #edf1ee;
}

.card-actions button {
  min-height: 34px;
  font-size: 0.76rem;
}

.status,
.date-pill,
.price-pill {
  min-height: 25px;
  padding: 3px 8px;
  font-size: 0.68rem;
  letter-spacing: 0.02em;
}

.timeline,
.stack-list {
  gap: 8px;
}

.timeline-item,
.stack-item {
  border-color: var(--line-strong);
  background: #fff;
}

.timeline-item:hover,
.stack-item:hover {
  border-color: #afc2b7;
  background: var(--panel-soft);
}

.table-wrap {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow-soft);
}

.table-wrap table {
  margin: 0;
}

.table-wrap thead {
  background: #eef3ef;
}

.table-wrap th {
  color: #53625d;
  font-size: 0.69rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.table-wrap th,
.table-wrap td {
  padding: 12px 13px;
}

.table-wrap tbody tr {
  transition: background 120ms ease;
}

.table-wrap tbody tr:hover {
  background: #f7faf8;
}

.settings-tabs {
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eaf0ec;
}

.settings-tab {
  border-color: transparent;
  background: transparent;
}

.settings-tab.active {
  border-color: var(--line-strong);
  background: #fff;
  color: var(--green-strong);
  box-shadow: 0 2px 7px rgba(31, 49, 45, 0.09);
}

.crm-relationship-center,
.crm-insights-center {
  margin-top: 14px;
}

.crm-relationship-center {
  border-color: #b8d9ca;
  background:
    linear-gradient(180deg, rgba(242, 250, 246, 0.92), rgba(255, 255, 255, 0.98)),
    #fff;
  opacity: 0.96;
}

.crm-relationship-center .section-head {
  margin-bottom: 8px;
}

.crm-ops-grid {
  align-items: start;
}

.crm-section-title {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.crm-section-title h3 {
  margin: 2px 0 0;
}

.crm-section-title span {
  color: var(--muted);
  font-size: 0.9rem;
}

.crm-relationship-list,
.crm-insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.crm-relationship-card,
.crm-insight-card,
.crm-inbox-item,
.crm-template-card,
.crm-record-row,
.crm-timeline-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.crm-relationship-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  box-shadow: 0 8px 22px rgba(15, 35, 28, 0.06);
}

.crm-relationship-top,
.crm-record-row,
.crm-template-card > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.crm-relationship-top h3,
.crm-insight-card h3 {
  margin: 2px 0 0;
}

.crm-relationship-top span,
.crm-template-card span,
.crm-timeline-item span,
.crm-record-row span {
  color: var(--muted);
  font-size: 0.84rem;
}

.crm-relationship-stats,
.crm-customer-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.crm-relationship-stats div,
.crm-customer-metrics div {
  border-radius: 8px;
  background: var(--soft);
  padding: 8px;
}

.crm-relationship-stats span,
.crm-insight-card span,
.crm-customer-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.crm-relationship-stats strong,
.crm-insight-card strong,
.crm-customer-metrics strong {
  display: block;
  margin-top: 3px;
}

.crm-relationship-actions,
.crm-customer-actions,
.crm-quick-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.crm-insight-card {
  min-height: 118px;
  padding: 14px;
  background: linear-gradient(145deg, #ffffff, #f5faf7);
}

.crm-insight-card.warning {
  border-color: #f6c96b;
  background: #fff8e8;
}

.crm-insight-card.good {
  border-color: #9bd6b7;
  background: #effaf3;
}

.crm-ops-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 14px 0;
}

.crm-inbox-center {
  max-height: 330px;
  overflow: auto;
}

.crm-inbox-list,
.crm-template-list,
.crm-customer-grid,
.crm-timeline-list,
.crm-record-list {
  display: grid;
  gap: 10px;
}

.crm-inbox-item,
.crm-template-card {
  padding: 12px;
}

.crm-inbox-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.crm-inbox-item p,
.crm-template-card p,
.crm-timeline-item p {
  margin: 4px 0 0;
  color: var(--muted);
}

.crm-customer-modal {
  width: min(1080px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
}

.crm-customer-body {
  display: grid;
  gap: 14px;
}

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

.crm-customer-summary > div,
.crm-customer-grid > article,
.crm-record-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.crm-customer-summary span,
.crm-mini-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.crm-customer-summary strong {
  display: block;
  margin-top: 3px;
}

.crm-customer-summary small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.crm-customer-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 14px;
}

.crm-customer-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.crm-customer-panel h3 {
  margin-top: 0;
}

.crm-record-row {
  align-items: center;
  padding: 10px;
}

.crm-template-recommendations,
.crm-customer-timeline {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.crm-timeline-item {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
}

.crm-timeline-item time {
  color: var(--muted);
  font-size: 0.85rem;
}

.crm-empty-note {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
}

.crm-fast-dialog {
  width: min(430px, calc(100vw - 24px));
  max-width: 430px;
  max-height: min(92vh, 760px);
  overflow: hidden;
}

.crm-fast-dialog #recordForm {
  padding: 14px 16px 16px;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: calc(min(92vh, 760px) - 28px);
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.crm-fast-dialog .modal-head {
  padding-bottom: 10px;
}

.crm-fast-dialog .modal-head h2 {
  font-size: 1.25rem;
}

.crm-fast-form {
  display: flex !important;
  flex-direction: column !important;
  gap: 9px;
  width: 100%;
  min-width: 0;
}

.crm-fast-helper {
  display: none;
}

.crm-fast-helper strong {
  font-size: 0.92rem;
}

.crm-fast-helper span {
  color: var(--muted);
  font-size: 0.82rem;
}

.crm-fast-fields {
  display: flex !important;
  flex-direction: column !important;
  gap: 9px;
  width: 100%;
  min-width: 0;
}

.crm-fast-customer-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-top: 6px;
}

.crm-fast-customer-mode button {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid #cfdad3;
  border-radius: 7px;
  background: #fff;
  color: #15231f;
  font-weight: 800;
}

.crm-fast-customer-mode button.active {
  border-color: #144f3c;
  background: #144f3c;
  color: #fff;
  box-shadow: 0 8px 16px rgba(20, 79, 60, 0.14);
}

.crm-fast-form > *,
.crm-fast-fields > * {
  width: 100%;
  min-width: 0;
  grid-column: 1 / -1;
}

.crm-fast-dialog .field {
  gap: 4px;
}

.crm-fast-dialog .field label {
  color: #53625d;
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.crm-fast-dialog input,
.crm-fast-dialog select,
.crm-fast-dialog textarea {
  box-sizing: border-box;
  width: 100%;
  min-height: 37px;
  border-radius: 7px;
}

.crm-fast-dialog textarea {
  min-height: 94px;
}

.crm-fast-hidden-select {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.crm-fast-choice-grid {
  display: grid;
  gap: 6px;
}

.crm-fast-choice-grid.columns-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.crm-fast-choice {
  min-height: 33px;
  padding: 6px;
  border: 1px solid #cfdad3;
  border-radius: 7px;
  background: #fff;
  color: #15231f;
  font-weight: 800;
  line-height: 1.1;
  white-space: normal;
}

.crm-fast-choice.active {
  border-color: #144f3c;
  background: #144f3c;
  color: #fff;
  box-shadow: 0 8px 16px rgba(20, 79, 60, 0.16);
}

.crm-fast-dialog .modal-actions {
  margin-top: 10px;
  padding-top: 12px;
  position: sticky;
  bottom: -16px;
  background: #fff;
  z-index: 2;
}

.crm-fast-dialog .modal-actions button {
  min-height: 38px;
}

@media (max-width: 900px) {
  .crm-ops-grid,
  .crm-customer-hero,
  .crm-timeline-item {
    grid-template-columns: 1fr;
  }

  .crm-relationship-stats,
  .crm-customer-metrics {
    grid-template-columns: 1fr;
  }
}

dialog {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(18, 32, 28, 0.24);
}

dialog::backdrop {
  background: rgba(15, 27, 24, 0.52);
  backdrop-filter: blur(3px);
}

.modal-head {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.modal-actions {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.form-grid {
  gap: 15px;
}

.field {
  gap: 7px;
}

.field label {
  color: #4e5d58;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}

.field input,
.field select,
.field textarea,
.activity-filters input,
.activity-filters select,
.category-add-row input,
.category-row input,
.labor-rate-add-row input,
.vendor-add-row input,
.vendor-row input {
  border-color: var(--line-strong);
  background: #fff;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
  border-color: #aec1b6;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px var(--focus-ring);
  outline: 0;
}

.price-preview {
  border-color: #bad3c4;
  background: #f1f8f3;
}

.empty-state {
  border-color: #c5d1ca;
  background: #fafcfb;
}

.empty-state strong {
  color: #465650;
}

.crm-column {
  background: #f1f5f2;
}

.crm-column-head {
  padding: 13px;
  background: #fff;
}

.crm-opportunity {
  border-color: var(--line-strong);
}

.report-card,
.primary-report {
  background: #fff;
}

.report-line {
  padding-block: 11px;
}

.crm-workspace {
  background:
    radial-gradient(circle at top left, rgba(31, 157, 107, 0.1), transparent 28%),
    radial-gradient(circle at top right, rgba(23, 111, 198, 0.08), transparent 30%);
}

.crm-workspace .section-title h2 {
  color: #17392c;
}

.crm-workspace .section-title p {
  color: #4d625a;
}

.crm-workspace .activity-filters {
  border: 1px solid #d5e5dc;
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(135deg, #ffffff 0%, #f3faf6 100%);
  box-shadow: 0 10px 20px rgba(30, 73, 53, 0.06);
}

.crm-column {
  overflow: hidden;
  border-color: #d3e3d8;
  border-top: 4px solid #7da18d;
  background: linear-gradient(180deg, #fbfdfb 0%, #eef6f0 100%);
  box-shadow: 0 14px 26px rgba(30, 73, 53, 0.08);
}

.crm-column-head {
  border-bottom: 1px solid rgba(31, 49, 45, 0.1);
  background: linear-gradient(135deg, #ffffff 0%, #f5fbf7 100%);
}

.crm-column-head strong {
  color: #183c2d;
}

.crm-column-head span {
  color: #4f665c;
}

.crm-stage-lead {
  border-top-color: #1f78c8;
}

.crm-stage-contacted {
  border-top-color: #1f9d6b;
}

.crm-stage-quoted {
  border-top-color: #d89b31;
}

.crm-stage-converted {
  border-top-color: #8b6be8;
}

.crm-stage-awaiting_customer {
  border-top-color: #e4a029;
}

.crm-stage-won {
  border-top-color: #176f4f;
}

.crm-stage-lost {
  border-top-color: #c24d48;
}

.crm-opportunity {
  border-color: #d4e2d9;
  border-left: 4px solid #b7ccb9;
  background: linear-gradient(180deg, #ffffff 0%, #fbfffc 100%);
  box-shadow: 0 10px 18px rgba(30, 73, 53, 0.07);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.crm-stage-lead .crm-opportunity {
  border-left-color: #1f78c8;
}

.crm-stage-contacted .crm-opportunity {
  border-left-color: #1f9d6b;
}

.crm-stage-quoted .crm-opportunity {
  border-left-color: #d89b31;
}

.crm-stage-converted .crm-opportunity {
  border-left-color: #8b6be8;
}

.crm-stage-awaiting_customer .crm-opportunity {
  border-left-color: #e4a029;
}

.crm-stage-won .crm-opportunity {
  border-left-color: #176f4f;
}

.crm-stage-lost .crm-opportunity {
  border-left-color: #c24d48;
}

.crm-opportunity:hover {
  border-color: #9fc6ad;
  box-shadow: 0 16px 28px rgba(30, 73, 53, 0.12);
  transform: translateY(-1px);
}

.crm-opportunity.overdue {
  border-color: #efb2ad;
  background: linear-gradient(180deg, #fffafa 0%, #fff4f3 100%);
}

.crm-opportunity-top strong {
  color: #183c2d;
}

.crm-type {
  border-radius: 999px;
  padding: 4px 7px;
  font-size: 0.68rem;
  font-weight: 850;
}

.crm-type.rental {
  background: #e9f3ff;
  color: #176fc6;
}

.crm-type.sale {
  background: #fff1d8;
  color: #9a6418;
}

.crm-type.service {
  background: #e7f4ec;
  color: #176f4f;
}

.crm-card-actions .primary {
  border-color: #176f4f;
  background: #176f4f;
  color: #fff;
}

.crm-card-actions .primary:hover {
  background: #10583e;
}

.crm-column-empty {
  border: 1px dashed #cbdcd1;
  border-radius: 8px;
  padding: 18px 12px;
  color: #60746b;
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.crm-calendar-surface,
.crm-calendar-day-panel,
.crm-touchpoints-panel {
  border-color: #d5e5dc;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf8 100%);
  box-shadow: 0 10px 20px rgba(30, 73, 53, 0.06);
}

.crm-touchpoints-panel > summary {
  background: linear-gradient(135deg, #f7fbf8 0%, #ffffff 100%);
}

@media (max-width: 720px) {
  .topbar {
    position: relative;
    margin: 0 0 20px;
    padding: 0 0 14px;
    backdrop-filter: none;
  }

  .metric {
    min-height: 98px;
  }

  .surface {
    padding: 15px;
  }

  .card-actions {
    gap: 6px;
  }
}

@media (max-width: 1040px) {
  body.mobile-nav-open {
    overflow: hidden;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 500;
    width: min(340px, 88vw);
    height: 100dvh;
    padding: max(20px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
    overflow-y: auto;
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: 18px 0 45px rgba(11, 20, 18, 0.26);
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0) !important;
    left: 0 !important;
    right: auto !important;
  }

  .mobile-nav-backdrop:not([hidden]) {
    position: fixed;
    inset: 0;
    z-index: 490;
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(11, 20, 18, 0.52);
  }

  .mobile-nav-toggle,
  .mobile-nav-close {
    display: block;
    flex: 0 0 auto;
  }

  .nav-tabs {
    grid-template-columns: 1fr;
  }

  .nav-tab {
    min-height: 50px;
    font-size: 0.95rem;
  }

  .nav-section-label {
    margin-top: 12px;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
    gap: 12px;
  }

  .topbar-title {
    min-width: 0;
  }

  .topbar-actions {
    grid-column: 1 / -1;
  }

  .account-controls {
    position: absolute;
    top: 14px;
    right: 14px;
    width: auto;
  }

  .topbar {
    position: relative;
    padding-top: 30px;
  }

  .activity-layout {
    grid-template-columns: 1fr;
  }

  .crm-workspace {
    grid-template-columns: 1fr;
  }

  .crm-calendar-layout {
    grid-template-columns: 1fr;
  }

  .crm-sidebar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  body {
    -webkit-text-size-adjust: 100%;
  }

  .content {
    padding: 14px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .topbar {
    margin-bottom: 20px;
  }

  .topbar h1 {
    font-size: 2rem;
  }

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

  .topbar-actions > *,
  .calendar-actions > *,
  .section-head > button {
    min-width: 0;
  }

  .topbar-actions .search,
  .account-controls {
    grid-column: 1 / -1;
  }

  .search,
  .report-month input,
  .team-invite-controls select,
  input,
  select,
  textarea {
    font-size: 16px;
  }

  .account-controls {
    top: 9px;
    right: 7px;
    gap: 2px;
  }

  .role-badge {
    min-height: 22px;
    padding: 3px 6px;
    border: 0;
    background: #e7f0e9;
    font-size: 0.62rem;
  }

  .account-sign-out {
    min-height: 24px;
    padding: 2px 4px;
    font-size: 0.66rem;
  }

  .cloud-sync-indicator {
    width: 10px;
    min-width: 10px;
    height: 10px;
    min-height: 10px;
    overflow: hidden;
    border: 0;
    border-radius: 50%;
    padding: 0;
    background: var(--amber);
    color: transparent;
    font-size: 0;
  }

  .cloud-sync-indicator.success {
    background: var(--green);
  }

  .cloud-sync-indicator.error {
    background: var(--red);
  }

  .data-backup-settings {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .settings-tabs {
    margin-inline: -14px;
    padding-inline: 14px;
    scroll-snap-type: x proximity;
  }

  .settings-tab {
    min-height: 42px;
    scroll-snap-align: start;
  }

  .quickbooks-settings-head {
    align-items: stretch;
    flex-direction: column;
  }

  .quickbooks-invoice-state {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .settings-tool-panel {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
  }

  .fleet-header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 7px;
  }

  .fleet-header-actions button {
    min-height: 38px;
    padding: 6px 8px;
    font-size: 0.74rem;
  }

  .activity-filters {
    grid-template-columns: 1fr;
  }

  .activity-entry-head,
  .deleted-record {
    align-items: flex-start;
    flex-direction: column;
  }

  .activity-details > div {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .team-member-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .team-member-row .status {
    width: fit-content;
  }

  .backup-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary,
  .secondary,
  .chip,
  .icon-btn,
  .danger {
    min-height: 44px;
  }

  .section-head {
    gap: 12px;
  }

  .section-head.flush .calendar-actions,
  .section-head.flush .topbar-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .calendar-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
  }

  .calendar-actions .primary {
    grid-column: 1 / -1;
  }

  .filter-row {
    margin-inline: -14px;
    padding: 0 14px 5px;
    scroll-snap-type: x proximity;
  }

  .filter-row .chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
  }

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

  .metric {
    min-width: 0;
    padding: 14px;
  }

  .metric strong {
    font-size: 1.55rem;
    overflow-wrap: anywhere;
  }

  .dashboard-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dashboard-my-day {
    width: 100%;
  }

  .dashboard-my-day-list {
    grid-template-columns: 1fr;
  }

  .dashboard-my-day-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .dashboard-my-day-type {
    width: max-content;
  }

  .crm-header-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .crm-calendar-head {
    align-items: stretch;
    flex-direction: column;
  }

  .crm-calendar-day {
    min-height: 80px;
    padding: 5px;
  }

  .crm-calendar-item {
    border-left-width: 2px;
    padding: 2px 3px;
    font-size: 0.56rem;
  }

  .crm-header-actions .primary {
    grid-column: 1 / -1;
  }

  .crm-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .crm-metric {
    padding: 11px;
  }

  .crm-metric strong {
    font-size: 1.05rem;
  }

  .crm-pipeline-wrap {
    margin-inline: -14px;
    padding-inline: 14px;
    scroll-snap-type: x proximity;
  }

  .crm-pipeline {
    grid-template-columns: repeat(5, minmax(82vw, 82vw));
    min-width: max-content;
  }

  .crm-column {
    scroll-snap-align: start;
  }

  .crm-sidebar {
    grid-template-columns: 1fr;
  }

  .dashboard-actions button:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }

  .surface {
    padding: 14px;
  }

  .equipment-grid,
  .customer-grid,
  .invoice-grid,
  .customer-service-board {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .invoice-business-section + .invoice-business-section {
    padding-top: 18px;
  }

  .invoice-business-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .invoice-business-counts {
    width: 100%;
  }

  .invoice-business-counts span {
    flex: 1;
    text-align: center;
  }

  .invoice-payment-columns {
    grid-template-columns: 1fr;
  }

  .invoice-status-lane {
    padding: 10px;
  }

  .invoice-lane-head {
    align-items: flex-start;
  }

  .invoice-lane-head > div {
    display: grid;
    gap: 1px;
  }

  .equipment-card,
  .customer-card,
  .invoice-card,
  .customer-service-card {
    padding: 14px;
  }

  .equipment-intake-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .equipment-intake-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .checkin-summary-grid,
  .checkin-board,
  .checkin-date-row,
  .checkin-story-grid,
  .checkin-step-fields,
  .missed-rental-summary {
    grid-template-columns: 1fr;
  }

  .checkin-form-intro,
  .fleet-checkin-strip {
    align-items: flex-start;
    flex-direction: column;
  }

  .checkin-workflow-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .checkin-card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .checkin-progress {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-top {
    align-items: flex-start;
  }

  .meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .card-actions > * {
    min-width: 0;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .table-wrap table,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tbody {
    display: grid;
    gap: 12px;
  }

  .table-wrap tr {
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: white;
    box-shadow: 0 1px 0 rgba(31, 49, 45, 0.04);
  }

  .table-wrap td {
    display: grid;
    grid-template-columns: minmax(88px, 0.34fr) minmax(0, 0.66fr);
    gap: 12px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: anywhere;
  }

  .table-wrap td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
  }

  .table-wrap td:last-child {
    grid-template-columns: 1fr;
    border-bottom: 0;
    background: #f8faf7;
  }

  .table-wrap td:last-child::before {
    content: "";
    display: none;
  }

  .table-wrap tr.empty-table-row,
  .table-wrap tr.empty-table-row td {
    display: block;
  }

  .table-wrap tr.empty-table-row td::before {
    display: none;
  }

  tr.overdue-rental td,
  tr.overdue-rental td:first-child {
    border-left: 0;
  }

  .table-wrap tr.overdue-rental {
    border-color: #efb2ad;
    box-shadow: inset 4px 0 0 var(--red);
  }

  .timeline-item,
  .stack-item,
  .history-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .stack-item > .status,
  .timeline-item > .date-pill {
    justify-self: start;
  }

  .repair-ticket-card {
    grid-template-columns: 1fr;
  }

  .repair-ticket-card .card-actions {
    grid-column: 1;
  }

  .service-column {
    min-height: 0;
  }

  .service-workspace-head p:last-child {
    line-height: 1.45;
  }

  .calendar-layout {
    gap: 10px;
  }

  .calendar-surface {
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    -webkit-overflow-scrolling: touch;
  }

  .calendar-title-row {
    position: sticky;
    left: 0;
    width: min(100%, calc(100vw - 56px));
  }

  .calendar-grid {
    width: 100%;
    min-width: 0;
  }

  .availability-board {
    grid-template-columns: minmax(170px, 200px) repeat(var(--calendar-days), minmax(82px, 1fr));
    min-width: calc(190px + var(--calendar-days) * 82px);
  }

  .availability-rental-bar {
    margin-top: calc(8px + var(--bar-lane) * 28px);
  }

  .day-panel {
    width: 100%;
  }

  dialog,
  #invoiceDialog,
  #repairTicketDialog,
  #signatureDialog,
  #documentPacketDialog,
  #machineCheckinDialog,
  #returnDialog,
  #workLogDialog,
  #equipmentHistoryDialog,
  #expenseDialog,
  #serviceTypeDialog {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    border-radius: 0;
    overflow-y: auto;
  }

  #recordForm,
  .signature-modal,
  .document-packet-modal,
  #machineCheckinForm,
  #expenseForm,
  #returnForm,
  #workLogForm,
  .invoice-modal,
  .history-modal {
    min-height: 100%;
    padding: 16px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .document-library-item,
  .document-packet-item {
    grid-template-columns: 1fr;
  }

  .record-document-options {
    grid-template-columns: 1fr;
  }

  dialog .modal-head {
    position: sticky;
    top: 0;
    z-index: 20;
    flex-direction: row;
    align-items: center;
    margin: -16px -16px 16px;
    padding: max(14px, env(safe-area-inset-top)) 16px 14px;
    border-bottom: 1px solid var(--line);
    background: white;
  }

  dialog .modal-head .icon-btn {
    flex: 0 0 44px;
  }

  dialog .modal-actions {
    position: sticky;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr 1fr;
    margin: 18px -16px -16px;
    padding: 12px 16px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: white;
    box-shadow: 0 -8px 18px rgba(31, 49, 45, 0.08);
  }

  .form-grid,
  #returnDialog .form-grid,
  #workLogDialog .form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin: 16px 0;
  }

  .field.full,
  .parts-editor,
  .price-preview {
    grid-column: 1;
  }

  .calculation-details > summary {
    min-height: 68px;
    padding: 14px;
  }

  .calculation-details > summary > strong {
    font-size: 1.18rem;
  }

  .calculation-breakdown > div {
    align-items: flex-start;
  }

  .field input,
  .field select,
  .field textarea,
  .cloud-form input {
    min-height: 48px;
  }

  .check-field {
    min-height: 48px;
    padding: 8px 0;
  }

  .check-field input {
    width: 22px;
    min-height: 22px;
  }

  .return-summary,
  #returnDialog .return-summary,
  #workLogDialog .return-summary {
    grid-template-columns: 1fr;
    gap: 10px;
    margin: 14px 0;
    padding: 14px;
  }

  .parts-editor,
  #workLogDialog .parts-editor {
    padding: 12px;
  }

  .work-status-buttons {
    grid-template-columns: 1fr;
  }

  .work-status-choice {
    min-height: 64px;
  }

  .parts-editor-head {
    align-items: stretch;
    flex-direction: column;
  }

  .part-row,
  .customer-service-part-row {
    grid-template-columns: minmax(0, 1fr) 92px 44px;
  }

  .customer-service-part-row .service-part-description,
  .customer-service-part-row .service-part-price {
    grid-column: 1 / 3;
  }

  .work-log-history-head {
    flex-direction: column;
  }

  .work-log-history-head button {
    width: 100%;
  }

  .history-summary,
  .report-print-grid,
  .report-print-grid.compact,
  .service-ticket-grid,
  .service-parts-section,
  .service-signoff,
  .service-captured-signatures,
  .signature-grid {
    grid-template-columns: 1fr;
  }

  .signature-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #signatureCanvas {
    height: 240px;
  }

  #signatureDialog .modal-actions {
    grid-template-columns: 1fr 1fr;
  }

  #signatureDialog .modal-actions .danger {
    grid-column: 1 / -1;
  }

  .invoice-page,
  .service-ticket-page {
    padding: 16px;
  }

  .invoice-header,
  .invoice-parties,
  .invoice-footer,
  .service-ticket-header {
    flex-direction: column;
  }

  .invoice-status,
  .service-ticket-number {
    text-align: left;
  }

  .print-invoice {
    overflow-x: auto;
  }

  .invoice-table {
    min-width: 620px;
  }

  .category-add-row,
  .category-row,
  .labor-rate-add-row,
  .labor-rate-row,
  .vendor-add-row,
  .vendor-row {
    grid-template-columns: 1fr;
  }

  .team-invite-controls,
  .team-invite-controls label {
    width: 100%;
    min-width: 0;
  }

  .team-invite-result {
    grid-template-columns: 1fr;
  }

  .team-invite-result button,
  .team-invite-result > span,
  .team-invite-result > p,
  .team-invite-result strong {
    grid-column: 1;
    grid-row: auto;
  }

  .cloud-overlay {
    align-items: start;
    padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom));
  }

  .cloud-panel {
    padding: 20px;
  }
}

.qa-workspace-banner {
  position: sticky;
  top: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 18px;
  color: #fff;
  background: #8b2c22;
  box-shadow: 0 2px 8px rgba(37, 20, 16, 0.22);
}

.qa-workspace-banner div {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.qa-workspace-banner strong {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
}

.qa-workspace-banner span {
  font-size: 0.82rem;
  opacity: 0.9;
}

.qa-workspace-banner button {
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 5px;
  padding: 7px 11px;
  color: #fff;
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 680px) {
  .qa-workspace-banner {
    align-items: flex-start;
    padding: 9px 12px;
  }

  .qa-workspace-banner div {
    display: block;
  }

  .qa-workspace-banner span {
    display: block;
    margin-top: 2px;
  }
}

.standard-terms,
.estimate-fields,
.estimate-breakdown {
  grid-column: 1 / -1;
  align-self: start;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.56);
}

.standard-terms > summary,
.estimate-fields > summary,
.estimate-breakdown > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 14px;
  font-weight: 800;
  cursor: pointer;
}

.standard-terms > summary small,
.customer-service-simple-estimate > summary small {
  color: var(--muted);
  font-weight: 600;
}

.standard-terms[open] > summary,
.estimate-fields[open] > summary,
.estimate-breakdown[open] > summary {
  border-bottom: 1px solid var(--line);
}

.standard-terms .field {
  padding: 14px;
}

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

.estimate-breakdown-body {
  display: grid;
  gap: 8px;
  padding: 14px;
}

.estimate-breakdown-body > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.estimate-breakdown-body p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

.record-admin-menu,
.secondary-action-menu {
  position: relative;
}

.record-admin-menu > summary,
.secondary-action-menu > summary {
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 9px 12px;
  color: var(--ink);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.record-admin-menu > summary::-webkit-details-marker,
.secondary-action-menu > summary::-webkit-details-marker {
  display: none;
}

.record-admin-menu[open],
.secondary-action-menu[open] {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.record-admin-menu[open] > summary,
.secondary-action-menu[open] > summary {
  width: 100%;
}

.workflow-note {
  align-self: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.workflow-click-row,
.workflow-click-card {
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, box-shadow 140ms ease, transform 120ms ease;
}

.workflow-click-row:hover {
  background: #f7faf6;
}

.workflow-click-card:hover {
  border-color: #b8c9bf;
  box-shadow: 0 12px 28px rgba(31, 49, 45, 0.1);
  transform: translateY(-1px);
}

.workflow-detail-view {
  padding-bottom: 24px;
}

.workflow-page {
  display: grid;
  gap: 16px;
}

.workflow-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(31, 49, 45, 0.08);
}

.workflow-header h1 {
  margin: 5px 0 4px;
  font-size: clamp(1.25rem, 2vw, 1.8rem);
  letter-spacing: 0;
}

.workflow-header span {
  color: var(--muted);
  font-weight: 650;
}

.workflow-back {
  margin-bottom: 10px;
}

.workflow-header-status {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 150px;
}

.workflow-header-status strong {
  font-size: 1.45rem;
}

.workflow-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
  gap: 16px;
  align-items: start;
}

.workflow-main,
.workflow-rail,
.workflow-rail-actions,
.workflow-inline-actions {
  display: grid;
  gap: 12px;
}

.workflow-panel {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 22px rgba(31, 49, 45, 0.06);
}

.workflow-panel h3 {
  margin: 4px 0 10px;
  font-size: 1rem;
}

.workflow-step-help {
  margin: -2px 0 10px;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.rental-step-panel {
  display: grid;
  gap: 14px;
}

.rental-step-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.rental-step-header h3 {
  margin-bottom: 0;
  font-size: 1.08rem;
}

.rental-step-header > span {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: #eef7f1;
  color: var(--green-strong);
  font-size: 0.74rem;
  font-weight: 900;
}

.rental-step-list {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

.rental-step-card {
  min-width: 0;
  min-height: 82px;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf7;
}

.rental-step-number {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #e8eee9;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
}

.rental-step-card strong,
.rental-step-card small {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.rental-step-card strong {
  color: var(--ink);
  font-size: 0.82rem;
}

.rental-step-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.25;
}

.rental-step-card.complete {
  border-color: #a7d7b6;
  background: #effaf2;
}

.rental-step-card.complete .rental-step-number {
  background: #1f6b4b;
  color: #fff;
}

.rental-step-card.current {
  border-color: #d99a26;
  background: #fff8e8;
  box-shadow: inset 0 0 0 1px rgba(217, 154, 38, 0.2);
}

.rental-step-card.current .rental-step-number {
  background: #d99a26;
  color: #fff;
}

.rental-step-card.blocked {
  border-color: #e6b2a9;
  background: #fff1ef;
}

.rental-step-card.blocked .rental-step-number {
  background: #c9493d;
  color: #fff;
}

.workflow-focus-pulse {
  outline: 3px solid rgba(31, 105, 77, 0.28);
  box-shadow: 0 0 0 6px rgba(31, 105, 77, 0.12), var(--shadow-soft);
  transition: box-shadow 0.2s ease, outline-color 0.2s ease;
}

.payment-action-modal {
  width: 100%;
  max-width: 820px;
  display: grid;
  padding: 0;
  overflow: hidden;
}

#invoicePaymentDialog {
  width: min(820px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: 0;
  overflow: hidden;
}

.payment-dialog-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: 390px;
  width: 100%;
  max-width: 100%;
}

.payment-dialog-side {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 24px 20px;
  background: #eff5f8;
  color: #263f49;
  min-width: 0;
}

.payment-dialog-side > span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.payment-dialog-side > strong {
  color: #111;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  line-height: 1;
  overflow-wrap: anywhere;
}

.payment-side-lines {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.payment-side-lines div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  font-size: 0.9rem;
}

.payment-side-lines span,
.payment-dialog-context,
.payment-method-card small {
  color: var(--muted);
}

.payment-dialog-main {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 24px 20px;
  background: #fff;
  min-width: 0;
  overflow: hidden;
}

.payment-dialog-title-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.payment-dialog-title-row h3 {
  margin: 0;
  font-size: clamp(1rem, 2.2vw, 1.22rem);
  overflow-wrap: anywhere;
}

.payment-dialog-title-row p {
  margin: 4px 0 0;
}

.payment-dialog-context {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  font-size: 0.82rem;
  min-width: 0;
}

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

.payment-method-card {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  min-width: 0;
}

.payment-method-card:hover {
  border-color: var(--green);
  box-shadow: 0 8px 18px rgba(17, 24, 39, 0.08);
}

.payment-method-icon {
  min-width: 38px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 6px;
  background: #eef7f1;
  color: var(--green);
  font-size: 0.64rem;
  font-weight: 900;
  padding: 0 4px;
}

.payment-method-card span:nth-child(2) {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.payment-method-card strong,
.payment-method-card small {
  overflow-wrap: anywhere;
}

.payment-method-card strong {
  font-size: 0.96rem;
}

.payment-method-card small {
  font-size: 0.82rem;
  line-height: 1.25;
}

.payment-warning {
  padding: 14px 16px;
  border-radius: 8px;
  background: #ffb547;
  color: #2c1d00;
  font-weight: 800;
}

.subtle-warning {
  background: #eef7f1;
  color: #274235;
  border: 1px solid #c8dfd0;
}

.payment-processing-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.payment-choice {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 800;
}

.payment-choice span {
  width: 18px;
  height: 18px;
  border: 2px solid #cdd6de;
  border-radius: 50%;
}

.payment-choice.active {
  border-color: #1c6cf2;
  background: #eaf2ff;
}

.payment-choice.active span {
  border: 5px solid #1c6cf2;
  background: #fff;
}

.payment-description-field {
  display: grid;
  gap: 8px;
  font-weight: 800;
}

.payment-description-field textarea {
  width: 100%;
  min-height: 70px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.payment-dialog-form {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.payment-dialog-paid {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid #c8dfd0;
  border-radius: 8px;
  background: #f8fcf9;
}

.payment-dialog-paid h3 {
  margin: 0;
  color: var(--green);
  font-size: 1.8rem;
}

.payment-dialog-actions {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.quiet-action {
  opacity: 0.78;
}

.workflow-edit-panel {
  border: 1px solid #d8e5dd;
  border-radius: 8px;
  background: #f8fbf8;
  overflow: hidden;
}

.workflow-edit-panel summary {
  cursor: pointer;
  padding: 12px 14px;
  color: var(--green-strong);
  font-weight: 900;
}

.workflow-edit-panel[open] summary {
  border-bottom: 1px solid #d8e5dd;
  background: #eef7f1;
}

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

.workflow-edit-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.workflow-edit-form input,
.workflow-edit-form select,
.workflow-edit-form textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
  background: white;
}

.workflow-edit-form .wide {
  grid-column: 1 / -1;
}

.workflow-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.workflow-progress span {
  min-height: 38px;
  display: grid;
  place-items: center;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8faf7;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.workflow-progress span.active {
  border-color: #8fb79d;
  background: #e9f6ed;
  color: var(--green-strong);
}

.workflow-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.workflow-tabs button {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.workflow-tabs button.active {
  border-color: #b9d2c3;
  background: #eef7f1;
  color: var(--green-strong);
}

@media (max-width: 1180px) {
  .rental-step-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.workflow-tab-body {
  display: grid;
  gap: 14px;
  padding-top: 14px;
}

.workflow-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.workflow-facts.compact {
  grid-template-columns: 1fr;
}

.workflow-facts > div {
  min-width: 0;
  padding: 11px;
  border: 1px solid #e2e9e4;
  border-radius: 7px;
  background: #fbfcfa;
}

.workflow-facts span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.workflow-facts strong {
  display: block;
  overflow-wrap: anywhere;
}

.workflow-note {
  align-self: stretch;
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #e2e9e4;
  border-radius: 7px;
  background: #fbfcfa;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.workflow-note strong {
  color: var(--ink);
}

.workflow-note span {
  color: var(--muted);
  line-height: 1.45;
}

.workflow-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.workflow-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

.workflow-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

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

.workflow-table td:last-child {
  text-align: right;
  font-weight: 800;
}

.workflow-table .total-row td {
  background: #f4f8f5;
  color: var(--green-strong);
  font-weight: 900;
}

.workflow-timeline {
  display: grid;
  gap: 10px;
}

.workflow-timeline article {
  display: grid;
  gap: 3px;
  padding: 12px;
  border-left: 4px solid var(--green);
  border-radius: 7px;
  background: #fbfcfa;
}

.workflow-timeline span {
  color: var(--muted);
}

.workflow-empty {
  display: grid;
  gap: 10px;
  justify-items: start;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.rental-orders-head {
  align-items: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(31, 49, 45, 0.07);
}

.rental-orders-head h2 {
  margin-bottom: 10px;
}

.rental-orders-wrap {
  margin-top: 14px;
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(31, 49, 45, 0.08);
}

.rental-orders-wrap table {
  min-width: 1040px;
}

.delivery-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.delivery-summary-grid article {
  display: grid;
  gap: 6px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.delivery-summary-grid span,
.delivery-facts span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  text-transform: uppercase;
}

.delivery-summary-grid strong {
  font-size: 1.55rem;
}

.delivery-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: start;
}

.delivery-lane {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf9;
}

.delivery-lane-head {
  display: grid;
  gap: 2px;
}

.delivery-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #dce7df;
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 20px rgba(31, 49, 45, 0.05);
}

.delivery-card.delivered {
  border-color: #c9ddef;
  background: #f7fbff;
}

.delivery-card.picked_up {
  border-color: #bfe0cb;
  background: #f4faf6;
}

.delivery-card-main {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.delivery-card-main h3 {
  margin: 0;
}

.delivery-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.delivery-facts > div,
.delivery-address {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #e3ebe6;
  border-radius: 7px;
  background: #fbfdfb;
}

.delivery-address span {
  white-space: pre-wrap;
}

.delivery-map-link {
  color: var(--green-strong);
  font-weight: 800;
  line-height: 1.35;
  text-decoration: none;
  white-space: pre-wrap;
}

.delivery-map-link:hover {
  text-decoration: underline;
}

.rental-order-row td {
  padding-top: 15px;
  padding-bottom: 15px;
  vertical-align: top;
}

.rental-order-row strong {
  letter-spacing: 0;
}

.rental-order-row:hover td {
  background: #f6faf7;
}

.rental-filter-bar {
  display: flex;
  gap: 8px;
  margin: 14px 0 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.rental-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
}

.rental-filter-chip strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef4ef;
  color: var(--muted);
  font-size: 0.78rem;
}

.rental-filter-chip.active {
  border-color: var(--brand);
  background: #eaf5ef;
  color: var(--brand-dark);
}

.rental-filter-chip.active strong {
  background: var(--brand);
  color: white;
}

.machine-financing-card {
  align-items: stretch;
  gap: 18px;
}

.machine-financing-card > div {
  flex: 1;
}

.machine-financing-grid {
  margin-top: 12px;
}

.machine-financing-grid div {
  min-width: 150px;
}

.delivery-handoff-panel .workflow-note {
  margin-top: 10px;
}

.delivery-workflow-card {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #b7d6c3;
  border-radius: 8px;
  background: #eef8f1;
}

.delivery-workflow-card h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.delivery-workflow-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.return-workflow-guide {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.return-workflow-guide article {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: start;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.return-workflow-guide article > span {
  display: inline-grid;
  grid-row: span 2;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #eef4ef;
  color: var(--muted);
  font-weight: 900;
}

.return-workflow-guide strong {
  font-size: 0.9rem;
}

.return-workflow-guide small {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.35;
}

.return-workflow-guide article.current {
  border-color: #f2c46f;
  background: #fff8e8;
}

.return-workflow-guide article.current > span {
  background: #f0a922;
  color: white;
}

.return-workflow-guide article.complete {
  border-color: #a8d7b8;
  background: #ecf8f0;
}

.return-workflow-guide article.complete > span {
  background: var(--brand);
  color: white;
}

.return-workflow {
  display: grid;
  gap: 14px;
}

.return-workflow-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.return-workflow-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.return-workflow-head > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--brand);
  color: white;
  font-weight: 900;
  font-size: 0.8rem;
}

.return-workflow-head h3 {
  margin: 0 0 3px;
  font-size: 1rem;
}

.return-workflow-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.settlement-section {
  background: #fffdf6;
}

.workflow-warning,
.workflow-settlement-alert,
.deposit-refund-callout,
.return-balance-callout,
.settlement-alert {
  border-radius: 8px;
  font-weight: 850;
  letter-spacing: 0;
}

.workflow-warning {
  padding: 9px 10px;
  border: 1px solid #f2c46f;
  background: #fff8e8;
  color: #8a5200;
}

.workflow-settlement-alert {
  margin: 14px 0;
  padding: 14px 16px;
  border: 1px solid #f2c46f;
  background: #fff8e8;
  color: #7a4900;
  box-shadow: 0 10px 24px rgba(138, 82, 0, 0.08);
}

.deposit-refund-callout {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 7px 0;
  padding: 10px 12px;
  border: 1px solid #d6b35f;
  background: #fff4cb;
  color: #6f4300;
}

.deposit-refund-callout.wide,
.return-balance-callout.wide {
  display: flex;
  width: 100%;
  margin: 0 0 14px;
}

.return-balance-callout {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 7px 0;
  padding: 10px 12px;
  border: 1px solid #e6a0a0;
  background: #fff0f0;
  color: #9d2727;
}

.return-settlement-preview-head {
  grid-column: 1 / -1;
  padding-bottom: 4px;
}

.return-settlement-preview-head strong,
.return-settlement-preview-head span {
  display: block;
}

@media (max-width: 760px) {
  .owner-calendar-layout {
    grid-template-columns: 1fr;
  }

  .owner-calendar-grid {
    gap: 4px;
  }

  .owner-calendar-day {
    min-height: 86px;
    padding: 6px;
  }

  .owner-calendar-item,
  .owner-calendar-more {
    font-size: 0.58rem;
  }
}

.return-settlement-item {
  border-left: 4px solid #c8d4cc;
}

.return-settlement-item.refund-due {
  border-left-color: #d6b35f;
}

.return-settlement-item.balance-due {
  border-left-color: #c94747;
}

.settlement-alert {
  display: inline-block;
  margin: 6px 0;
  padding: 7px 9px;
  background: #f7efe1;
  color: #6f4300;
}

.inline-sort-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: min(100%, 310px);
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.inline-sort-control span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  white-space: nowrap;
}

.inline-sort-control select {
  width: 100%;
  min-width: 145px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 800;
}

.billing-status-table {
  display: grid;
  gap: 10px;
}

.billing-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.billing-table {
  width: 100%;
  min-width: 940px;
  border-collapse: collapse;
}

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

.billing-table th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

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

.billing-row:hover td,
.sales-order-row:hover td {
  background: #f6faf7;
}

.billing-order-card-list {
  display: grid;
  gap: 10px;
}

.billing-order-card {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.billing-order-card:hover {
  background: #f8fbf8;
}

.billing-order-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.billing-order-main h4 {
  margin: 1px 0 4px;
  font-size: 1.05rem;
}

.billing-order-main p {
  margin: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.billing-order-total {
  display: grid;
  justify-items: end;
  gap: 4px;
  flex: 0 0 auto;
  text-align: right;
}

.billing-order-total strong {
  font-size: 1.12rem;
}

.billing-order-total small,
.billing-order-foot {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.billing-order-details {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.billing-order-details span {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 8px;
  border: 1px solid #e4ebe6;
  border-radius: 7px;
  background: #fbfdfb;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.billing-order-details strong {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.billing-order-foot {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.billing-order-foot span:last-child {
  color: var(--green-strong);
  text-transform: uppercase;
}

.commerce-form-section-collapsed {
  padding: 0;
}

.commerce-form-section-collapsed > summary {
  cursor: pointer;
  list-style: none;
  padding: 14px;
}

.commerce-form-section-collapsed > summary::-webkit-details-marker {
  display: none;
}

.commerce-form-section-collapsed > summary::after {
  content: "Show";
  margin-left: auto;
  color: var(--green-strong);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.commerce-form-section-collapsed[open] > summary::after {
  content: "Hide";
}

.commerce-form-section-collapsed .commerce-section-grid {
  padding: 0 14px 14px;
}

.sales-order-row,
.repair-ticket-card.workflow-click-card,
.customer-service-card.workflow-click-card,
.equipment-card.workflow-click-card {
  cursor: pointer;
}

.fleet-card-footer {
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.machine-detail-actions {
  align-items: flex-start;
  border-color: #bdd5c6;
  background: #f7fbf8;
}

.crm-touchpoints-panel {
  padding: 0;
}

.crm-touchpoints-panel > summary {
  cursor: pointer;
  list-style: none;
  padding: 14px;
}

.crm-touchpoints-panel > summary::-webkit-details-marker {
  display: none;
}

.crm-touchpoints-panel > summary .subtle {
  font-weight: 850;
  text-transform: uppercase;
}

.crm-touchpoints-panel[open] > summary .subtle {
  color: var(--green-strong);
}

.crm-touchpoints-panel > .crm-activity-list {
  padding: 0 14px 14px;
}

@media (max-width: 980px) {
  .workflow-layout,
  .workflow-header {
    grid-template-columns: 1fr;
  }

  .workflow-layout {
    display: grid;
  }

  .workflow-header {
    display: grid;
  }

  .workflow-header-status {
    justify-items: start;
  }

  .workflow-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .inline-sort-control {
    width: 100%;
  }
}

@media (max-width: 620px) {
  .workflow-header,
  .workflow-panel {
    padding: 13px;
  }

  .return-workflow-guide {
    grid-template-columns: 1fr;
  }

  .delivery-workflow-card,
  .calendar-detail-card {
    align-items: stretch;
    flex-direction: column;
  }

  .workflow-progress {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rental-step-header {
    display: grid;
  }

  .rental-step-list {
    grid-template-columns: 1fr;
  }

  .rental-step-card {
    min-height: 0;
  }

  .workflow-facts {
    grid-template-columns: 1fr;
  }

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

  .delivery-facts {
    grid-template-columns: 1fr;
  }

  .rental-orders-wrap {
    box-shadow: none;
    background: transparent;
  }

  .rental-orders-wrap table {
    min-width: 0;
  }

  .rental-orders-wrap thead {
    display: none;
  }

  .rental-orders-wrap table,
  .rental-orders-wrap tbody,
  .rental-orders-wrap tr,
  .rental-orders-wrap td {
    display: block;
    width: 100%;
  }

  .rental-orders-wrap tbody {
    display: grid;
    gap: 10px;
  }

  .rental-orders-wrap .rental-order-row {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 8px 20px rgba(31, 49, 45, 0.07);
  }

  .rental-orders-wrap .rental-order-row td {
    padding: 7px 0;
    border-bottom: 1px solid #edf1ee;
  }

  .rental-orders-wrap .rental-order-row td:last-child {
    border-bottom: 0;
  }

  .billing-order-card {
    padding: 12px;
  }

  .billing-order-main,
  .billing-order-foot {
    display: grid;
    justify-items: stretch;
  }

  .billing-order-total {
    justify-items: start;
    text-align: left;
  }

  .billing-order-details {
    grid-template-columns: 1fr;
  }

  .report-line.clickable {
    align-items: flex-start;
    cursor: pointer;
  }
}

@media (max-width: 680px) {
  .estimate-fields-grid {
    grid-template-columns: 1fr;
  }

  .service-estimate-authorization {
    grid-template-columns: 1fr;
  }

  .crm-filter-bar,
  .service-filter-bar {
    grid-template-columns: 1fr 1fr;
  }

  .crm-pipeline {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .crm-column {
    flex: 0 0 min(86vw, 340px);
    scroll-snap-align: start;
  }

  .crm-header-actions {
    position: sticky;
    bottom: 0;
    z-index: 15;
    width: 100%;
    padding: 8px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -6px 18px rgba(31, 49, 45, 0.1);
  }

  .crm-header-actions button {
    flex: 1 1 120px;
  }

  .new-order-launcher,
  .crm-phone-desk {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 14px;
  }

  .new-order-main-btn,
  .crm-phone-actions {
    width: 100%;
  }

  .crm-phone-actions {
    grid-template-columns: 1fr;
  }

  .crm-my-day-item {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .crm-my-day-actions {
    grid-template-columns: 1fr 1fr;
  }
}

@page {
  size: letter portrait;
  margin: 0.32in;
}

@media print {
  html,
  body {
    width: auto !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    background: white !important;
  }

  body > * {
    display: none !important;
  }

  body > dialog[open] {
    display: block !important;
  }

  #invoiceDialog,
  #repairTicketDialog,
  #reportDialog {
    position: static !important;
    inset: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
  }

  #invoiceDialog::backdrop,
  #repairTicketDialog::backdrop,
  #reportDialog::backdrop,
  .no-print {
    display: none !important;
  }

  .invoice-modal,
  .print-invoice,
  .invoice-page,
  .service-ticket-page {
    box-sizing: border-box !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
  }

  .invoice-page {
    color: #111 !important;
    font-size: 8.5pt;
    line-height: 1.2;
    padding: 0.18in !important;
  }

  .invoice-header {
    gap: 0.18in;
    padding-bottom: 0.1in;
  }

  .invoice-brand {
    font-size: 16pt;
  }

  .invoice-parties {
    gap: 0.18in;
    margin: 0.1in 0;
  }

  .invoice-parties > div {
    line-height: 1.25;
  }

  .invoice-table {
    width: 100% !important;
    min-width: 0 !important;
    margin: 0.1in 0 !important;
    table-layout: fixed;
    page-break-inside: auto;
  }

  .invoice-table th,
  .invoice-table td {
    padding: 4px 5px !important;
    overflow-wrap: anywhere;
    font-size: 7.7pt !important;
    line-height: 1.18;
  }

  .invoice-table th:first-child,
  .invoice-table td:first-child {
    width: 42%;
  }

  .invoice-table thead {
    display: table-header-group;
  }

  .invoice-table tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .invoice-totals {
    width: 3.25in;
  }

  .invoice-totals div {
    padding: 3px 0;
  }

  .invoice-terms {
    margin-top: 0.1in;
    padding: 0.07in;
  }

  .invoice-terms p {
    margin-top: 3px;
    font-size: 6.8pt;
    line-height: 1.18;
  }

  .invoice-footer {
    gap: 4px;
    margin-top: 0.1in;
    padding-top: 0.07in;
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .signature-grid,
  .captured-signature,
  .service-estimate-notice,
  .service-estimate-authorization,
  .service-work-entry,
  .service-parts-section,
  .service-signoff {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .captured-signature img {
    max-height: 0.65in;
  }
}

/* v5.17 dashboard focus cleanup overrides. Keep these after legacy dashboard styles. */
#dashboard .dashboard-actions {
  margin-bottom: 12px;
  padding: 8px;
  gap: 8px;
}

#dashboard .dashboard-actions button {
  min-height: 38px;
  padding: 9px 12px;
}

#dashboard .dashboard-actions .primary {
  min-height: 46px;
  font-size: 1rem;
}

#dashboard .dashboard-command-row {
  grid-template-columns: minmax(420px, 0.86fr) minmax(420px, 1.14fr);
  gap: 14px;
  margin-bottom: 14px;
}

#dashboard .dashboard-my-day {
  align-self: start;
}

#dashboard .dashboard-my-day .section-head {
  margin-bottom: 6px;
}

#dashboard .dashboard-my-day-list {
  max-height: 270px;
  gap: 5px;
}

#dashboard .dashboard-my-day-item {
  min-height: 58px;
  padding: 9px 10px;
}

#dashboard .dashboard-my-day-copy strong {
  font-size: 0.98rem;
}

.dashboard-my-day-more {
  border: 1px dashed #bdd3c6;
  border-radius: 8px;
  padding: 8px 10px;
  background: #f7fbf8;
  color: #486158;
  font-weight: 700;
  font-size: 0.86rem;
}

.dashboard-focus-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 14px;
  align-items: start;
}

#dashboard .dashboard-calendar,
#dashboard .dashboard-customer-service {
  margin: 0;
}

#dashboard .dashboard-calendar-grid,
#dashboard .dashboard-service-grid {
  margin-top: 10px;
}

@media (max-width: 1120px) {
  #dashboard .dashboard-command-row,
  .dashboard-focus-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  #dashboard .dashboard-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #dashboard .dashboard-actions .primary,
  #dashboard .dashboard-actions button:last-child {
    grid-column: 1 / -1;
  }

  #dashboard .dashboard-my-day-list {
    max-height: 250px;
  }
}

/* v5.18 operations readiness cleanup: keep daily-use screens calmer. */
@media (max-width: 900px) {
  .sidebar {
    width: min(310px, 84vw);
    padding: 14px;
  }

  .nav-tabs {
    gap: 2px;
  }

  .nav-section-label {
    margin-top: 10px;
    margin-bottom: 3px;
    font-size: 0.64rem;
  }

  .nav-tab,
  .nav-tab-start {
    min-height: 42px;
    padding: 9px 10px;
    gap: 10px;
    font-size: 0.9rem;
  }

  .sidebar-panel {
    margin-top: 12px;
    padding: 12px;
    gap: 5px;
  }

  .sidebar-panel blockquote {
    max-height: 92px;
    overflow: hidden;
  }
}

#dashboard .metric {
  min-height: 88px;
}

#dashboard .surface {
  border-color: #d7e4dc;
}

#dashboard .dashboard-my-day {
  box-shadow: 0 14px 30px rgba(31, 49, 45, 0.08);
}

#dashboard .dashboard-my-day-list::-webkit-scrollbar,
.crm-fast-dialog #recordForm::-webkit-scrollbar {
  width: 8px;
}

#dashboard .dashboard-my-day-list::-webkit-scrollbar-thumb,
.crm-fast-dialog #recordForm::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #b9cbc2;
}

.crm-fast-dialog {
  width: min(430px, calc(100vw - 18px));
  max-height: min(88vh, 720px);
}

.crm-fast-dialog #recordForm {
  max-height: calc(min(88vh, 720px) - 18px);
  padding: 12px 14px 14px;
}

.crm-fast-dialog .modal-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #fff;
  border-bottom: 1px solid #e4ebe6;
}

.crm-fast-dialog textarea {
  min-height: 76px;
}

.crm-fast-choice-grid {
  gap: 5px;
}

.crm-fast-choice,
.crm-fast-customer-mode button {
  min-height: 31px;
  padding: 5px 6px;
}

.crm-fast-dialog input,
.crm-fast-dialog select,
.crm-fast-dialog textarea {
  min-height: 34px;
}

@media (max-width: 520px) {
  .crm-fast-dialog {
    width: calc(100vw - 12px);
    max-height: 90vh;
  }

  .crm-fast-dialog #recordForm {
    max-height: calc(90vh - 12px);
    padding: 10px 12px 12px;
  }

  .crm-fast-choice-grid.columns-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* v5.19 CRM daily-use cleanup: fewer repeated choices, calmer quick-call flow. */
.crm-card-actions-clean {
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
}

.crm-card-actions-clean .primary:last-child,
.crm-card-actions-clean .primary {
  grid-column: auto;
}

#crm .crm-my-day-list {
  max-height: 250px;
  overflow-y: auto;
  padding-right: 4px;
}

#crm .crm-my-day-list::-webkit-scrollbar {
  width: 8px;
}

#crm .crm-my-day-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #b9cbc2;
}

#crm .crm-my-day-item {
  min-height: 54px;
}

#crm .crm-my-day-item .primary,
#crm .crm-my-day-item .secondary {
  min-height: 34px;
  padding: 7px 10px;
}

#crm .crm-relationship-card {
  gap: 9px;
}

#crm .crm-relationship-next {
  font-size: 0.82rem;
  line-height: 1.35;
}

/* v5.23 CRM simplified workflow: focused phone desk, pipeline, calendar, optional history. */
#crm .crm-phone-desk {
  grid-template-columns: minmax(0, 1fr) minmax(360px, auto);
  gap: 14px;
  padding: 14px 16px;
  margin-bottom: 10px;
  border-color: #a9d7c4;
  background:
    linear-gradient(135deg, rgba(233, 247, 239, 0.96), rgba(239, 247, 255, 0.9)),
    #f8fcfa;
  box-shadow: 0 10px 22px rgba(30, 73, 53, 0.07);
}

#crm .crm-phone-desk h2 {
  margin: 0;
  font-size: clamp(1.32rem, 2vw, 1.78rem);
  line-height: 1.1;
}

#crm .crm-phone-desk span {
  font-size: 0.86rem;
}

#crm .crm-phone-actions button {
  min-height: 40px;
  padding: 8px 12px;
  font-size: 0.86rem;
}

#crm .crm-filter-bar-top {
  margin: 0 0 10px;
  padding: 8px;
  background: #ffffff;
}

#crm .crm-filter-bar-top select {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 0.84rem;
}

#crm .crm-metrics {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 10px;
}

#crm .crm-metric {
  min-height: 78px;
  padding: 11px 12px;
  border-radius: 8px;
}

#crm .crm-metric strong {
  font-size: 1.16rem;
}

#crm .crm-workspace {
  gap: 12px;
  margin-bottom: 12px;
  background:
    radial-gradient(circle at 8% 0, rgba(31, 157, 107, 0.1), transparent 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(247, 251, 248, 0.8));
}

#crm .crm-pipeline {
  grid-template-columns: repeat(7, minmax(210px, 1fr));
  min-width: 1510px;
}

#crm .crm-column-list {
  min-height: 136px;
}

#crm .crm-sidebar {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

#crm .crm-calendar-layout {
  margin: 10px 0 12px;
}

#crm .crm-optional-section {
  margin-top: 10px;
  padding: 0;
  overflow: hidden;
}

#crm .crm-optional-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  list-style: none;
}

#crm .crm-optional-section summary::-webkit-details-marker {
  display: none;
}

#crm .crm-optional-section .secondary {
  display: inline-grid;
  place-items: center;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  background: #fff;
  color: var(--green-strong);
  font-size: 0.78rem;
  font-weight: 900;
}

#crm .crm-optional-section[open] .crm-relationship-list {
  padding: 0 14px 14px;
}

#crm .crm-optional-section:not([open]) {
  background: #fbfdfb;
}

/* v5.24 owner dashboard polish: brighter command center without hiding features. */
#dashboard {
  position: relative;
}

#dashboard .dashboard-actions {
  grid-template-columns: minmax(210px, 1.3fr) repeat(4, minmax(120px, 0.75fr));
  gap: 8px;
  margin-bottom: 14px;
  padding: 9px;
  border: 1px solid rgba(151, 185, 166, 0.82);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(241, 250, 244, 0.98), rgba(239, 247, 255, 0.96) 52%, rgba(255, 248, 230, 0.96)),
    #ffffff;
  box-shadow: 0 14px 34px rgba(31, 73, 56, 0.08);
}

#dashboard .dashboard-actions button {
  min-height: 40px;
  padding: 8px 10px;
  border-radius: 7px;
  font-size: 0.86rem;
}

#dashboard .dashboard-actions .primary {
  min-height: 44px;
  background: linear-gradient(135deg, #176fc6, #22896a);
  border-color: transparent;
  box-shadow: 0 12px 24px rgba(23, 111, 198, 0.18);
}

#dashboard .dashboard-command-row {
  grid-template-columns: minmax(360px, 0.9fr) minmax(420px, 1.1fr);
  gap: 14px;
  margin-bottom: 14px;
}

#dashboard .dashboard-my-day {
  border: 1px solid rgba(180, 205, 190, 0.9);
  border-radius: 8px;
  background:
    radial-gradient(circle at top left, rgba(255, 193, 77, 0.18), transparent 34%),
    linear-gradient(180deg, #ffffff 0%, #f5fbf6 100%);
  box-shadow: 0 16px 34px rgba(35, 72, 56, 0.08);
}

#dashboard .dashboard-my-day .section-head {
  padding-bottom: 8px;
  border-bottom: 1px solid #dbe8e0;
}

#dashboard .dashboard-my-day-list {
  max-height: 235px;
  gap: 6px;
}

#dashboard .dashboard-my-day-item {
  min-height: 52px;
  padding: 8px 10px;
  border-radius: 7px;
  box-shadow: 0 7px 16px rgba(31, 49, 45, 0.04);
}

#dashboard .dashboard-my-day-item strong {
  font-size: 0.94rem;
}

#dashboard .dashboard-my-day-item button {
  min-height: 32px;
  border-radius: 6px;
}

#dashboard .dashboard-command-row .metrics-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

#dashboard .metric {
  position: relative;
  min-height: 96px;
  overflow: hidden;
  border: 0;
  border-radius: 8px;
  padding: 14px 16px;
  color: #163228;
  box-shadow: 0 14px 30px rgba(31, 49, 45, 0.08);
}

#dashboard .metric::before {
  content: "";
  position: absolute;
  inset: auto -24px -28px auto;
  width: 82px;
  height: 82px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
}

#dashboard .metric::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 14px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: rgba(22, 50, 40, 0.28);
}

#dashboard .dashboard-metric-1 {
  background: linear-gradient(135deg, #eaf8f0, #ffffff);
}

#dashboard .dashboard-metric-2 {
  background: linear-gradient(135deg, #fff0ed, #ffffff);
}

#dashboard .dashboard-metric-3 {
  background: linear-gradient(135deg, #eef6ff, #ffffff);
}

#dashboard .dashboard-metric-4 {
  background: linear-gradient(135deg, #fff7df, #ffffff);
}

#dashboard .metric span,
#dashboard .metric strong {
  position: relative;
}

#dashboard .metric span {
  color: #52685f;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

#dashboard .metric strong {
  margin-top: 8px;
  font-size: clamp(1.35rem, 2.1vw, 1.9rem);
}

#dashboard .dashboard-focus-grid {
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  gap: 14px;
}

#dashboard .dashboard-calendar,
#dashboard .dashboard-customer-service {
  border: 1px solid rgba(209, 226, 216, 0.95);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(31, 49, 45, 0.06);
}

#dashboard .dashboard-calendar .section-head,
#dashboard .dashboard-customer-service .section-head {
  margin: -4px -4px 8px;
  padding: 10px 10px 12px;
  border-radius: 7px;
  background: linear-gradient(135deg, #f6fbf8, #eff7ff);
}

#dashboard .dashboard-calendar-grid,
#dashboard .dashboard-service-grid {
  gap: 8px;
}

#dashboard .schedule-chip {
  min-height: 62px;
  border-color: #dbe8e1;
  border-radius: 7px;
  background: linear-gradient(135deg, #ffffff, #f7fbf8);
  box-shadow: 0 7px 16px rgba(31, 49, 45, 0.04);
}

#dashboard .schedule-chip.overdue-rental {
  border-color: #efbeb9;
  background: #fff7f5;
}

#dashboard .dashboard-service-job {
  border-color: #dce8e1;
  border-radius: 7px;
  background: linear-gradient(135deg, #ffffff, #fbfdfb);
  box-shadow: 0 7px 16px rgba(31, 49, 45, 0.04);
}

@media (max-width: 1120px) {
  #dashboard .dashboard-command-row,
  #dashboard .dashboard-focus-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  #dashboard .dashboard-actions {
    grid-template-columns: 1fr 1fr;
  }

  #dashboard .dashboard-actions .primary {
    grid-column: 1 / -1;
  }

  #dashboard .dashboard-command-row .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  #dashboard .dashboard-actions,
  #dashboard .dashboard-command-row .metrics-grid {
    grid-template-columns: 1fr;
  }
}

/* v5.25 dashboard layout tighten: keep all features, but quiet the owner screen. */
#dashboard .dashboard-metrics-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

#dashboard .dashboard-metrics-strip .metric {
  min-height: 82px;
  padding: 12px 14px;
}

#dashboard .dashboard-metrics-strip .metric-clickable {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, outline-color 0.16s ease;
}

#dashboard .dashboard-metrics-strip .metric-clickable:hover,
#dashboard .dashboard-metrics-strip .metric-clickable:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 16px 34px rgba(31, 49, 45, 0.13);
  outline: 2px solid rgba(34, 122, 87, 0.26);
  outline-offset: 2px;
}

#dashboard .dashboard-metrics-strip .metric-clickable small {
  position: relative;
  display: block;
  margin-top: 4px;
  color: #557067;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

#dashboard .dashboard-my-day {
  width: 100%;
  margin: 0 0 14px;
}

#dashboard .dashboard-my-day-list {
  max-height: 220px;
  gap: 5px;
}

#dashboard .dashboard-my-day-item {
  min-height: 46px;
  padding: 7px 10px;
}

#dashboard .dashboard-my-day-copy {
  gap: 1px;
}

#dashboard .dashboard-my-day-copy > span,
#dashboard .dashboard-my-day-meta small {
  line-height: 1.15;
}

#dashboard .dashboard-focus-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 14px;
}

#dashboard .dashboard-calendar,
#dashboard .dashboard-customer-service {
  min-height: 360px;
  display: flex;
  flex-direction: column;
}

#dashboard .dashboard-calendar-grid,
#dashboard .dashboard-service-grid {
  flex: 1;
  align-content: start;
}

@media (max-width: 900px) {
  #dashboard .dashboard-metrics-strip,
  #dashboard .dashboard-focus-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  #dashboard .dashboard-metrics-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 460px) {
  #dashboard .dashboard-metrics-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  #crm .crm-phone-desk,
  #crm .crm-sidebar,
  #crm .crm-calendar-layout {
    grid-template-columns: 1fr;
  }

  #crm .crm-phone-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  #crm .crm-phone-desk {
    padding: 12px;
  }

  #crm .crm-phone-actions,
  #crm .crm-metrics,
  #crm .crm-filter-bar-top {
    grid-template-columns: 1fr;
  }

  #crm .crm-phone-actions button {
    min-height: 42px;
  }
}

@media (max-width: 520px) {
  .crm-fast-dialog {
    width: calc(100vw - 20px);
    max-width: 390px;
    margin: auto;
  }

  .crm-fast-dialog .modal-head {
    padding-bottom: 8px;
  }

  .crm-fast-dialog .modal-head h2 {
    font-size: 1.08rem;
  }

  .crm-fast-dialog #recordForm {
    padding: 9px 10px 12px;
  }

  .crm-fast-dialog .field label {
    font-size: 0.62rem;
  }

  .crm-fast-choice,
  .crm-fast-customer-mode button {
    min-height: 30px;
    font-size: 0.82rem;
  }

  #crm .crm-card-actions-clean {
    grid-template-columns: 1fr;
  }
}

/* v5.27 CRM polished workspace: keep calendar full-width and remove noisy CRM clutter. */
#crm .crm-phone-desk {
  grid-template-columns: minmax(0, 1fr) minmax(330px, auto);
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
  padding: 12px 14px;
  border-radius: 8px;
  border-color: rgba(151, 185, 166, 0.82);
  background:
    linear-gradient(135deg, rgba(241, 250, 244, 0.98), rgba(239, 247, 255, 0.96) 58%, rgba(255, 248, 230, 0.9)),
    #ffffff;
  box-shadow: 0 12px 28px rgba(31, 73, 56, 0.08);
}

#crm .crm-phone-desk h2 {
  font-size: clamp(1.28rem, 1.8vw, 1.66rem);
}

#crm .crm-phone-desk span {
  font-size: 0.84rem;
}

#crm .crm-phone-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

#crm .crm-phone-actions button {
  min-height: 38px;
  padding: 7px 10px;
  border-radius: 7px;
  font-size: 0.84rem;
}

#crm .crm-filter-bar-top {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px;
  border-color: rgba(209, 226, 216, 0.95);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 9px 22px rgba(31, 49, 45, 0.04);
}

#crm .crm-filter-bar-top label {
  gap: 3px;
  font-size: 0.7rem;
}

#crm .crm-filter-bar-top select {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 0.82rem;
}

#crm .crm-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 0 0 12px;
}

#crm .crm-metric {
  min-height: 76px;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  color: #163228;
  box-shadow: 0 12px 26px rgba(31, 49, 45, 0.07);
}

#crm .crm-metric:nth-child(1) {
  background: linear-gradient(135deg, #eaf8f0, #ffffff);
}

#crm .crm-metric:nth-child(2) {
  background: linear-gradient(135deg, #eef6ff, #ffffff);
}

#crm .crm-metric:nth-child(3) {
  background: linear-gradient(135deg, #fff7df, #ffffff);
}

#crm .crm-metric:nth-child(4) {
  background: linear-gradient(135deg, #fff0ed, #ffffff);
}

#crm .crm-metric span {
  color: #52685f;
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

#crm .crm-metric strong {
  margin-top: 7px;
  font-size: clamp(1.16rem, 1.8vw, 1.55rem);
}

#crm .crm-workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 14px;
  background: transparent;
}

#crm .crm-workspace > * {
  width: auto;
}

#crm .crm-pipeline-wrap,
#crm .crm-side-panel,
#crm .crm-calendar-surface,
#crm .crm-calendar-day-panel {
  border: 1px solid rgba(209, 226, 216, 0.95);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(31, 49, 45, 0.06);
}

#crm .crm-pipeline-wrap {
  padding: 10px;
}

#crm .crm-pipeline {
  grid-template-columns: repeat(7, minmax(142px, 1fr));
  min-width: 0;
}

#crm .crm-column {
  border-radius: 7px;
  background: #f5faf6;
}

#crm .crm-column-head {
  padding: 9px;
  background: linear-gradient(135deg, #f8fbf8, #eff7ff);
}

#crm .crm-column-list {
  min-height: 168px;
  gap: 7px;
  padding: 7px;
}

#crm .crm-opportunity {
  gap: 5px;
  padding: 8px;
  border-radius: 7px;
}

#crm .crm-opportunity h3 {
  font-size: 0.86rem;
}

#crm .crm-opportunity p,
#crm .crm-opportunity-meta {
  font-size: 0.7rem;
}

#crm .crm-card-actions button {
  min-height: 30px;
  padding: 5px 6px;
  font-size: 0.69rem;
}

#crm .crm-sidebar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-content: start;
}

#crm .crm-side-panel {
  padding: 12px;
}

#crm .crm-side-panel .section-head {
  padding-bottom: 8px;
  border-bottom: 1px solid #dbe8e0;
}

#crm .crm-task-list,
#crm .crm-activity-list {
  max-height: 245px;
  overflow: auto;
  padding-right: 3px;
}

#crm .crm-task,
#crm .crm-activity {
  padding: 7px 0;
}

#crm .crm-calendar-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 2px 0 12px;
}

#crm .crm-calendar-surface,
#crm .crm-calendar-day-panel {
  padding: 12px;
}

#crm .crm-calendar-day-panel {
  min-height: 0;
}

#crm .crm-calendar-head {
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

#crm .crm-calendar-day {
  min-height: 98px;
}

#crm .crm-calendar-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
}

#crm .crm-calendar-detail {
  border: 1px solid #dbe8e0;
  border-radius: 7px;
  padding: 9px;
  background: #fbfdfb;
}

#crm .crm-calendar-day-actions {
  display: none;
}

#crm .crm-optional-section {
  margin-top: 10px;
}

@media (max-width: 1120px) {
  #crm .crm-pipeline-wrap {
    overflow-x: auto;
  }

  #crm .crm-pipeline {
    grid-template-columns: repeat(7, minmax(190px, 1fr));
    min-width: 1340px;
  }

  #crm .crm-sidebar {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  #crm .crm-phone-desk {
    grid-template-columns: 1fr;
  }

  #crm .crm-filter-bar-top,
  #crm .crm-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  #crm .crm-phone-actions,
  #crm .crm-filter-bar-top,
  #crm .crm-metrics {
    grid-template-columns: 1fr;
  }
}

/* v5.29 CRM pre-integration cleanup: clearer quick-entry, tighter empty stages, and explicit document routing. */
#crm .crm-calendar-layout {
  margin: 4px 0 14px;
}

#crm .crm-pipeline {
  align-items: start;
}

#crm .crm-column.empty {
  align-self: start;
  background: #f8fbf9;
  opacity: 0.86;
}

#crm .crm-column.empty .crm-column-head {
  padding: 8px;
}

#crm .crm-column.empty .crm-column-list {
  min-height: 52px;
  padding: 6px;
}

#crm .crm-column.empty .crm-column-empty {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  border: 1px dashed #cfe0d6;
  border-radius: 7px;
  color: #6b7d74;
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.crm-fast-dialog #recordForm {
  overscroll-behavior: contain;
}

.crm-fast-dialog [data-field^="newCustomer"] {
  border-left: 3px solid #d6eadf;
  padding-left: 8px;
}

.crm-fast-dialog [data-field="newCustomerCompany"] {
  margin-top: -2px;
}

.document-routing-plan {
  display: grid;
  gap: 4px;
  margin: 10px 0;
  border: 1px solid #d7e5dc;
  border-radius: 8px;
  padding: 10px 12px;
  background: linear-gradient(135deg, #f4fbf7, #ffffff);
}

.document-routing-plan strong {
  color: #144f3c;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.document-routing-plan span {
  color: #52685f;
  font-size: 0.86rem;
  line-height: 1.35;
}

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

/* v5.30 technician view and service intake polish */
body[data-role="technician"] .nav-tab-start,
body[data-role="technician"] .nav-tab[data-view="ownerCalendar"],
body[data-role="technician"] .nav-tab[data-view="sales"],
body[data-role="technician"] .nav-tab[data-view="crm"],
body[data-role="technician"] .nav-tab[data-view="customers"],
body[data-role="technician"] .nav-tab[data-view="invoices"],
body[data-role="technician"] .nav-tab[data-view="signatures"],
body[data-role="technician"] .nav-tab[data-view="reports"],
body[data-role="technician"] .nav-tab[data-view="activity"],
body[data-role="technician"] .nav-tab[data-view="settings"],
body[data-role="technician"] #globalNewOrderBtn,
body[data-role="technician"] #dashboardNewRentalBtn,
body[data-role="technician"] #dashboardNewSaleBtn,
body[data-role="technician"] #dashboardAddInventoryBtn {
  display: none !important;
}

.nav-tab[hidden],
.nav-section-label[hidden] {
  display: none !important;
}

.technician-readonly-row {
  cursor: default;
}

.technician-readonly-row:hover {
  background: transparent;
  transform: none;
  box-shadow: none;
}

.technician-readonly-row td:last-child strong {
  color: #51615b;
}

.service-intake-dialog {
  width: min(1160px, calc(100% - 24px));
}

.service-intake-form .commerce-workflow {
  border-color: #c9ded2;
  background: linear-gradient(135deg, #eef8f2 0%, #f9fbf7 100%);
}

.service-intake-form .commerce-workflow > div {
  min-height: 50px;
  border: 1px solid #d8e5dc;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.85);
}

.service-intake-form .commerce-workflow span {
  background: #1f6f4a;
}

.service-intake-form .commerce-form-section {
  border-color: #d6e4dc;
  box-shadow: 0 10px 24px rgba(26, 48, 41, 0.05);
}

.service-intake-form .commerce-section-head {
  align-items: center;
  background: #fbfdf9;
}

.service-intake-form .commerce-section-head > span {
  background: #f1b83f;
  color: #17211d;
}

.service-intake-form .commerce-section-head h3 {
  font-size: 1.02rem;
}

.service-intake-form .commerce-section-grid {
  gap: 12px;
}

.service-intake-form .estimate-fields {
  border: 1px dashed #b7cfc0;
  border-radius: 8px;
  background: #f7fbf8;
}

.service-intake-form .estimate-fields > summary {
  padding: 13px 15px;
  color: #174935;
  font-weight: 800;
  cursor: pointer;
}

.service-intake-form .commerce-form-summary {
  border-color: #b7d5c2;
  background: #eef8f1;
}

.service-intake-form .commerce-summary-facts {
  border-color: #a8cbb7;
}

/* v5.31 Customer history detail cleanup */
.customer-card.workflow-click-card {
  cursor: pointer;
}

.customer-card.workflow-click-card .card-actions {
  position: relative;
  z-index: 2;
}

.customer-card-footer {
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

#crmCustomerDialog {
  width: min(1080px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  padding: 0;
  overflow: hidden;
}

#crmCustomerDialog .crm-customer-modal {
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  max-height: calc(100dvh - 24px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

#crmCustomerDialog .modal-head {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--line);
  gap: 14px;
}

#crmCustomerDialog .modal-head > div {
  min-width: 0;
}

#crmCustomerDialog .modal-head h2 {
  overflow-wrap: anywhere;
}

#crmCustomerDialog .crm-customer-body {
  box-sizing: border-box;
  min-width: 0;
  max-height: calc(100dvh - 116px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 16px 18px 20px;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

#crmCustomerDialog .crm-customer-summary,
#crmCustomerDialog .crm-customer-grid,
#crmCustomerDialog .crm-customer-records {
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  min-width: 0;
}

#crmCustomerDialog .crm-customer-hero {
  grid-template-columns: minmax(0, 1.15fr) minmax(min(280px, 100%), 0.85fr);
  min-width: 0;
}

#crmCustomerDialog .crm-customer-panel,
#crmCustomerDialog .crm-record-panel,
#crmCustomerDialog .crm-template-recommendations,
#crmCustomerDialog .crm-customer-timeline,
#crmCustomerDialog .crm-timeline-item,
#crmCustomerDialog .crm-record-row {
  min-width: 0;
}

#crmCustomerDialog .crm-customer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#crmCustomerDialog .crm-record-row {
  gap: 10px;
}

#crmCustomerDialog .crm-record-row > *,
#crmCustomerDialog .crm-timeline-item > * {
  min-width: 0;
}

#crmCustomerDialog .crm-record-row strong,
#crmCustomerDialog .crm-record-row span,
#crmCustomerDialog .crm-timeline-item strong,
#crmCustomerDialog .crm-timeline-item span,
#crmCustomerDialog .crm-timeline-item p {
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  #crmCustomerDialog {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
    max-height: calc(100dvh - 12px);
  }

  #crmCustomerDialog .crm-customer-modal {
    max-height: calc(100dvh - 12px);
  }

  #crmCustomerDialog .modal-head {
    flex-direction: row;
    align-items: center;
    padding: 14px 14px 12px;
  }

  #crmCustomerDialog .crm-customer-body {
    max-height: calc(100dvh - 92px);
    padding: 12px;
  }

  #crmCustomerDialog .crm-customer-hero,
  #crmCustomerDialog .crm-timeline-item {
    grid-template-columns: 1fr;
  }

  #crmCustomerDialog .crm-timeline-item time {
    grid-column: 1 / -1;
  }
}
/* v5.35 Secure Signature Packet */
body.secure-signing-portal {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(36, 100, 75, 0.14), transparent 34rem),
    linear-gradient(135deg, #f3f8f4, #e7f0ed);
}

body.secure-signing-portal > :not(dialog):not(script):not(.secure-signing-complete-card):not(.secure-public-signed-copy) {
  display: none !important;
}

body.secure-signing-portal dialog:not(#secureSignerDialog) {
  display: none !important;
}

body.secure-signing-portal::before {
  content: "Loading secure signature packet...";
  position: fixed;
  inset: 0;
  z-index: 1;
  display: grid;
  place-items: center;
  padding: 28px;
  color: #173b2c;
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
}

body.secure-signing-portal.secure-signer-ready::before {
  display: none;
}

body.secure-signing-portal.secure-signing-closed::before {
  content: "Signature session closed. You may close this browser tab.";
  display: grid;
}

body.secure-signing-portal.secure-signing-error::before {
  content: "This secure signing link could not be opened. Please contact 2M Machinery for a new link.";
  display: grid;
}

body.secure-signing-portal.secure-signing-completed::before {
  display: none;
}

.secure-signing-complete-card {
  position: fixed;
  inset: 50%;
  z-index: 20;
  display: none;
  width: min(620px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  padding: 28px;
  border: 1px solid rgba(20, 83, 45, 0.18);
  border-radius: 20px;
  background: #ffffff;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.28);
}

body.secure-signing-portal.secure-signing-completed .secure-signing-complete-card {
  display: grid !important;
  gap: 18px;
}

.secure-signing-complete-card h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.25rem);
  letter-spacing: 0;
}

.secure-complete-summary {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 8px 14px;
  padding: 14px;
  border: 1px solid #d8e2dc;
  border-radius: 12px;
  background: #f8fbf9;
}

.secure-complete-summary span {
  color: var(--text-muted);
  font-weight: 800;
}

.secure-complete-summary strong {
  overflow-wrap: anywhere;
}

.secure-complete-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

body.secure-signing-portal #secureSignerDialog {
  position: fixed;
  inset: 18px;
  width: min(1180px, calc(100vw - 36px));
  max-width: calc(100vw - 36px);
  height: min(940px, calc(100dvh - 36px));
  max-height: calc(100dvh - 36px);
  margin: auto;
  border-radius: 18px;
  box-shadow: 0 30px 90px rgba(15, 23, 42, 0.28);
}

body.secure-signing-portal #secureSignerDialog::backdrop {
  background: transparent;
  backdrop-filter: none;
}

body.secure-signing-portal .secure-signer-modal {
  height: 100%;
  max-height: 100%;
  border-radius: 18px;
}

#secureSignatureDialog {
  width: min(1180px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  padding: 0;
}

#secureSignerDialog {
  width: min(1180px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  padding: 0;
}

.secure-signature-modal,
.secure-signer-modal {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  max-height: min(92vh, 920px);
  overflow: auto;
  background: #fbfffb;
  border-radius: 14px;
}

.secure-signer-modal {
  width: 100%;
  max-width: 100%;
}

.secure-packet-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(34, 112, 80, 0.18);
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(233, 248, 239, 0.96), rgba(238, 247, 255, 0.82));
  color: var(--text-muted);
  font-weight: 700;
}

.secure-packet-notice {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(251, 191, 36, 0.35);
  border-radius: 12px;
  background: #fff8df;
  color: #5c4400;
}

.secure-packet-stepper {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.secure-packet-stepper button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(20, 83, 45, 0.16);
  border-radius: 12px;
  background: #ffffff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.secure-packet-stepper button span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: #eef7f0;
  color: #14532d;
  font-weight: 900;
}

.secure-packet-stepper button strong,
.secure-packet-stepper button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.secure-packet-stepper button small {
  color: var(--text-muted);
  font-size: 0.72rem;
}

.secure-packet-stepper button.active {
  border-color: #14532d;
  background: linear-gradient(135deg, #eef8f1, #ffffff);
  box-shadow: 0 12px 28px rgba(20, 83, 45, 0.12);
}

.secure-packet-stepper button.active span,
.secure-packet-stepper button.complete span {
  background: #14532d;
  color: #ffffff;
}

.secure-packet-step-panel {
  display: none;
}

#secureSignatureDialog[data-secure-step="documents"] [data-step-panel="documents"],
#secureSignatureDialog[data-secure-step="recipient"] [data-step-panel="recipient"],
#secureSignatureDialog[data-secure-step="fields"] [data-step-panel="fields"],
#secureSignatureDialog[data-secure-step="review"] [data-step-panel="review"] {
  display: grid;
  gap: 14px;
}

.secure-packet-step-panel .secure-packet-panel {
  min-height: 0;
}

.step-actions {
  justify-content: space-between;
}

.secure-review-list,
.secure-review-actions {
  display: grid;
  gap: 10px;
}

.secure-review-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(20, 83, 45, 0.12);
}

.secure-review-list span {
  color: var(--text-muted);
  font-weight: 800;
}

.secure-review-list strong {
  overflow-wrap: anywhere;
  text-align: right;
}

.secure-review-actions button {
  width: 100%;
}

.secure-packet-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.78fr);
  gap: 16px;
  min-width: 0;
}

[data-step-panel="fields"] .secure-packet-grid {
  grid-template-columns: minmax(260px, 0.36fr) minmax(0, 1fr);
}

.secure-packet-panel {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(20, 83, 45, 0.14);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.05);
}

.secure-packet-panel h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.secure-doc-list,
.secure-field-list,
.secure-signer-documents {
  display: grid;
  gap: 8px;
}

.secure-packet-upload-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px dashed rgba(20, 83, 45, 0.34);
  border-radius: 12px;
  background: linear-gradient(135deg, #f6fbf7, #eef7ff);
}

.secure-packet-upload-box > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.secure-packet-upload-button {
  cursor: pointer;
  white-space: nowrap;
}

.secure-doc-option {
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f8fbf8;
}

.secure-doc-option.selected {
  border-color: rgba(20, 83, 45, 0.28);
  background: #f7fbf7;
}

.secure-doc-option.active-preview {
  border-color: #14532d;
  background: #edf8f0;
  box-shadow: 0 10px 22px rgba(20, 83, 45, 0.1);
}

.secure-doc-option small,
.secure-signer-document span {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.secure-active-preview-label {
  color: #14532d !important;
  font-weight: 900;
}

.secure-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 8px;
}

.secure-field-row {
  display: grid;
  grid-template-columns: minmax(82px, 0.65fr) minmax(88px, 0.7fr) minmax(0, 1fr) auto auto 34px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f9fcf9;
}

.secure-field-row.active-placement {
  border-color: rgba(34, 112, 80, 0.55);
  box-shadow: 0 0 0 2px rgba(34, 112, 80, 0.1);
}

.secure-field-row select,
.secure-field-row input {
  min-width: 0;
  max-width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  font-size: 0.9rem;
}

.secure-packet-panel .field input,
.secure-packet-panel .field textarea {
  min-width: 0;
  max-width: 100%;
}

.secure-signature-modal .modal-actions {
  flex-wrap: wrap;
  gap: 10px;
}

.secure-document-workspace {
  display: grid;
  gap: 12px;
  margin-top: 0;
  padding: 14px;
  border: 1px solid rgba(20, 83, 45, 0.14);
  border-radius: 14px;
  background: #f6fbf7;
}

.secure-document-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.secure-document-head h3 {
  margin: 0;
  font-size: 1rem;
}

.secure-document-head span {
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.secure-document-page {
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  background: #e7ede9;
}

.secure-document-sheet {
  position: relative;
  min-height: 820px;
  width: min(1060px, 100%);
  margin: 0 auto;
  padding: 34px;
  border: 1px solid #d1dbd5;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.12);
}

.secure-document-sheet header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 14px;
  border-bottom: 2px solid #111827;
}

.secure-document-sheet header div {
  display: grid;
  gap: 4px;
}

.secure-document-sheet header strong {
  font-size: 1.1rem;
}

.secure-document-sheet header span,
.secure-document-sheet section span {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.secure-document-sheet section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.secure-document-sheet section div {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid #dbe7df;
  border-radius: 8px;
  background: #fbfdfb;
}

.secure-document-sheet article {
  display: grid;
  gap: 10px;
  color: #18211d;
  line-height: 1.45;
}

.secure-document-sheet h4 {
  margin: 4px 0 0;
}

.secure-document-legal {
  margin-top: 20px;
  padding: 12px;
  border: 1px solid #dbe7df;
  border-radius: 8px;
  background: #f8fbf8;
  font-weight: 700;
}

.secure-pdf-preview-band {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid rgba(29, 78, 216, 0.18);
  border-radius: 10px;
  background: #f4f8ff;
}

.secure-pdf-preview-band > div:first-child {
  display: grid;
  gap: 3px;
}

.secure-pdf-preview-band strong {
  color: #102a56;
}

.secure-pdf-frame {
  width: 100%;
  min-height: 640px;
  border: 1px solid #c8d7ea;
  border-radius: 8px;
  background: #ffffff;
}

.secure-pdf-canvas-stack {
  display: grid;
  gap: 16px;
  justify-items: center;
}

.secure-pdf-canvas-page {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 10px;
  border: 1px solid #c8d7ea;
  border-radius: 10px;
  background: #dfe8f5;
}

.secure-pdf-canvas {
  width: min(100%, 980px);
  height: auto;
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.16);
}

.secure-pdf-preview-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

.secure-pdf-open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.secure-pdf-more-pages {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #c8d7ea;
  border-radius: 8px;
  background: #ffffff;
  color: #40516a;
  font-weight: 800;
  text-align: center;
}

.secure-pdf-placeholder {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 540px;
  padding: 22px;
  border: 1px dashed #9cb4d8;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f6f9ff);
  color: #40516a;
  text-align: center;
}

.secure-document-field {
  position: absolute;
  z-index: 2;
  width: 170px;
  min-height: 46px;
  transform: translate(-50%, -50%);
  padding: 7px 9px;
  border: 2px solid #1d4ed8;
  border-radius: 8px;
  background: rgba(219, 234, 254, 0.92);
  color: #102a56;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
  cursor: grab;
  user-select: none;
  touch-action: none;
}

.secure-document-field.dragging {
  z-index: 8;
  cursor: grabbing;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.24);
}

.secure-document-field.company {
  border-color: #b45309;
  background: rgba(254, 243, 199, 0.94);
  color: #5f3305;
}

.secure-document-field span {
  display: block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.secure-document-field strong {
  display: block;
  margin-top: 4px;
  font-size: 0.94rem;
}

.secure-document-field em {
  display: block;
  margin-top: 4px;
  color: rgba(16, 42, 86, 0.68);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 800;
  text-transform: uppercase;
}

.secure-document-field.inline-signature-field {
  width: 260px;
  min-height: 104px;
  padding: 8px;
}

.secure-inline-signature-target {
  min-height: 76px;
  margin-top: 6px;
}

.secure-inline-signature-target #secureSignerCanvas {
  height: 76px;
  border-radius: 6px;
  border-color: rgba(29, 78, 216, 0.45);
}

.mini-check {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
}

.compact-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.86rem;
}

.secure-signer-document {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #f7fbf9;
}

#secureSignerCanvas {
  display: block;
  width: 100%;
  height: 210px;
  touch-action: none;
  border: 1px dashed rgba(20, 83, 45, 0.35);
  border-radius: 12px;
  background: #ffffff;
}

.secure-packet-preview-modal {
  width: 100%;
  max-height: min(92vh, 920px);
  overflow: auto;
  padding: 0;
}

#securePacketPreviewDialog {
  width: min(1240px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  max-height: min(94vh, 960px);
  overflow: hidden;
  padding: 0;
}

.secure-packet-preview-area {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

.secure-certificate {
  display: grid;
  gap: 16px;
  width: min(1080px, 100%);
  max-width: 100%;
  margin: 0 auto;
  padding: 28px;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

.secure-certificate header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 2px solid #111827;
  padding-bottom: 12px;
}

.secure-certificate h2,
.secure-certificate h3 {
  margin: 0;
}

.secure-certificate-section {
  min-width: 0;
  padding: 12px;
  border: 1px solid #d8e2dc;
  border-radius: 10px;
  background: #ffffff;
}

.secure-certificate-document-preview {
  padding: 14px;
  background: #f8fbf9;
}

.secure-certificate-document-preview .secure-document-page {
  margin-top: 12px;
  max-height: 680px;
  overflow: auto;
}

.secure-certificate-document-preview .secure-document-sheet {
  width: min(940px, 100%);
  min-height: 720px;
}

.secure-certificate-document-preview .secure-document-field {
  pointer-events: none;
  cursor: default;
}

.secure-certificate-document-preview .secure-document-field em {
  display: none;
}

.secure-certificate-signature {
  max-width: 320px;
  width: 100%;
  margin-top: 10px;
  border: 1px solid #d8e2dc;
  border-radius: 8px;
  background: #ffffff;
}

.secure-certificate table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
  table-layout: fixed;
  word-break: break-word;
}

.secure-certificate th,
.secure-certificate td {
  padding: 8px;
  border-bottom: 1px solid #d8e2dc;
  text-align: left;
  vertical-align: top;
}

@media (max-width: 820px) {
  #secureSignatureDialog,
  #secureSignerDialog {
    width: calc(100vw - 18px);
    max-width: calc(100vw - 18px);
  }

  .secure-packet-grid,
  .secure-field-row {
    grid-template-columns: 1fr;
  }

  .secure-packet-stepper {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .secure-document-head,
  .secure-document-sheet header {
    align-items: flex-start;
    flex-direction: column;
  }

  .secure-document-sheet {
    min-height: 700px;
    padding: 22px;
  }

  .secure-pdf-frame,
  .secure-pdf-placeholder {
    min-height: 420px;
  }

  .secure-document-sheet section {
    grid-template-columns: 1fr;
  }

  .secure-packet-status {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* v5.36 Signature Center */
.signature-center-view {
  display: none;
  gap: 16px;
}

.signature-center-view.active-view {
  display: grid;
}

.signature-center-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.signature-settings-callout {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 0 0 16px;
  padding: 16px;
  border: 1px solid rgba(20, 83, 45, 0.14);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(35, 116, 83, 0.1), rgba(248, 191, 72, 0.13));
}

.signature-settings-callout div {
  display: grid;
  gap: 4px;
}

.signature-settings-callout span {
  color: var(--text-muted);
}

.billing-order-foot-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.billing-order-foot-actions .secondary,
.billing-order-foot-actions .secure-packet-action {
  min-height: 30px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.78rem;
  line-height: 1.1;
}

.signature-center-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.signature-metric {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid rgba(20, 83, 45, 0.12);
  border-radius: 14px;
  background: linear-gradient(145deg, #ffffff, #eff8f1);
  box-shadow: 0 16px 34px rgba(15, 23, 42, 0.05);
}

.signature-metric span,
.signature-backend-card span {
  color: var(--text-muted);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.signature-metric strong {
  color: #10231d;
  font-size: 2rem;
  line-height: 1;
}

.signature-metric small,
.signature-backend-card small,
.signature-record-card small,
.signature-packet-main small {
  color: var(--text-muted);
  line-height: 1.35;
}

.signature-center-hub {
  display: grid;
  gap: 14px;
}

.signature-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.signature-filter-chip {
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(20, 83, 45, 0.16);
  border-radius: 999px;
  background: #ffffff;
  color: #21433a;
  font-weight: 800;
}

.signature-filter-chip.active {
  border-color: #1f6f50;
  background: #e8f6ed;
  color: #164734;
}

.signature-filter-chip span {
  margin-left: 4px;
  color: #6f837b;
}

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

.signature-packet-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(20, 83, 45, 0.14);
  border-radius: 14px;
  background: #fbfffc;
}

.signature-packet-main {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.signature-packet-main strong {
  color: #10231d;
  font-size: 1.05rem;
}

.signature-packet-main .status {
  width: fit-content;
}

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

.signature-record-grid,
.signature-backend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.signature-record-card,
.signature-backend-card {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid rgba(20, 83, 45, 0.14);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.04);
}

.signature-record-card > div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.signature-record-card strong {
  color: #10231d;
}

.signature-record-card button {
  width: fit-content;
  margin-top: 4px;
}

.signature-backend-panel {
  display: grid;
  gap: 14px;
  background: linear-gradient(145deg, #fffaf0, #f7fbf9);
}

@media (max-width: 900px) {
  .signature-center-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .signature-packet-card {
    grid-template-columns: 1fr;
  }

  .signature-packet-actions,
  .signature-center-actions,
  .signature-filter-bar {
    justify-content: flex-start;
  }
}

@media (max-width: 560px) {
  .signature-center-metrics,
  .signature-record-grid,
  .signature-backend-grid {
    grid-template-columns: 1fr;
  }

  .signature-packet-actions {
    flex-direction: column;
  }
}

/* v5.45 Secure Signature Packet polish */
html.secure-signing-boot body {
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at top left, rgba(36, 100, 75, 0.14), transparent 34rem),
    linear-gradient(135deg, #f3f8f4, #e7f0ed);
}

html.secure-signing-boot body > * {
  visibility: hidden;
}

html.secure-signing-boot body::before {
  content: "Opening secure signing page...";
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 28px;
  color: #173b2c;
  font-size: 1.15rem;
  font-weight: 900;
  text-align: center;
  visibility: visible;
}

.secure-field-row {
  grid-template-columns: minmax(0, 1fr);
  gap: 9px;
  padding: 10px;
  border-radius: 12px;
}

.secure-field-row-main {
  display: grid;
  grid-template-columns: minmax(112px, 0.8fr) minmax(120px, 0.8fr) minmax(160px, 1.4fr) 58px 58px;
  gap: 8px;
  align-items: end;
}

.secure-field-row-main label,
.secure-field-row-value {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.secure-field-row-main label span,
.secure-field-row-value span {
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.secure-field-row-main select,
.secure-field-row-main input,
.secure-field-row-value input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 0.88rem;
}

.secure-field-size-input input {
  text-align: center;
}

.secure-field-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.secure-field-row-actions .compact-button {
  min-height: 32px;
  padding: 5px 10px;
}

.secure-document-field {
  box-sizing: border-box;
  min-width: 78px;
  min-height: 42px;
  overflow: visible;
}

.secure-document-field strong.secure-field-value {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.secure-document-field .secure-field-resize-handle {
  position: absolute;
  right: -8px;
  bottom: -8px;
  width: 17px;
  height: 17px;
  min-height: 17px;
  padding: 0;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: #14532d;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.2);
  cursor: nwse-resize;
}

.secure-inline-text-input {
  width: 100%;
  min-height: 44px;
  resize: vertical;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
}

.secure-linked-invoice {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(20, 83, 45, 0.22);
  border-radius: 10px;
  background: linear-gradient(135deg, #f7fbf7, #ffffff);
}

.secure-linked-invoice-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.secure-linked-invoice-head div {
  display: grid;
  gap: 2px;
}

.secure-linked-invoice-head span,
.secure-linked-invoice-meta {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.secure-linked-invoice-head strong {
  font-size: 1.08rem;
}

.secure-linked-invoice-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.secure-linked-invoice table {
  width: 100%;
  border-collapse: collapse;
}

.secure-linked-invoice td {
  padding: 7px 0;
  border-top: 1px solid #d8e2dc;
}

.secure-linked-invoice td:last-child {
  text-align: right;
  font-weight: 900;
}

.secure-linked-invoice tr.total td {
  font-size: 1rem;
  font-weight: 900;
}

body.secure-signing-portal > :not(dialog):not(script):not(.secure-signing-complete-card):not(.secure-public-signed-copy) {
  display: none !important;
}

body.secure-signing-portal.secure-signing-copy-open::before {
  display: none;
}

.secure-public-signed-copy {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  overflow: auto;
  padding: 24px;
  background: #f3f6f2;
}

body.secure-signing-portal.secure-signing-copy-open .secure-public-signed-copy {
  display: block !important;
}

.secure-public-copy-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 22px;
  border: 1px solid #d8e2dc;
  border-radius: 18px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.16);
}

.secure-public-copy-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #d8e2dc;
}

.secure-public-copy-actions h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2.35rem);
}

.secure-public-copy-actions > div:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

#securePacketPreviewDialog {
  width: min(1140px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  padding: 0;
}

.secure-certificate {
  overflow-x: hidden;
}

.secure-certificate .signature-summary,
.secure-certificate header,
.secure-certificate-section {
  min-width: 0;
}

.secure-certificate-document-preview .secure-document-sheet {
  width: min(1000px, 100%);
}

@media (max-width: 820px) {
  .secure-field-row-main {
    grid-template-columns: 1fr 1fr;
  }

  .secure-field-label-input {
    grid-column: 1 / -1;
  }

  .secure-field-row-actions {
    justify-content: flex-start;
  }

  .secure-public-signed-copy {
    padding: 10px;
  }

  .secure-public-copy-shell {
    padding: 14px;
    border-radius: 12px;
  }

  .secure-public-copy-actions {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media print {
  .secure-public-signed-copy {
    position: static;
    display: block !important;
    padding: 0;
    background: #ffffff;
  }

  .secure-public-copy-shell {
    width: 100%;
    padding: 0;
    border: 0;
    box-shadow: none;
  }

  .secure-public-copy-actions {
    display: none;
  }
}

/* v5.46 Secure signing room stability */
.secure-document-page {
  box-sizing: border-box;
  overflow-x: hidden;
}

.secure-document-page *,
.secure-document-sheet,
.secure-pdf-preview-band,
.secure-pdf-canvas-page,
.secure-packet-invoice-page {
  box-sizing: border-box;
}

.secure-document-sheet {
  width: 100%;
  max-width: 960px;
  padding: clamp(18px, 2.4vw, 30px);
  overflow-x: hidden;
}

.secure-pdf-preview-band,
.secure-pdf-canvas-stack,
.secure-pdf-canvas-page {
  max-width: 100%;
  overflow-x: hidden;
}

.secure-pdf-canvas-page {
  padding: 8px;
}

.secure-pdf-canvas {
  display: block;
  max-width: 100%;
}

.secure-document-field {
  min-width: 54px !important;
  min-height: 0 !important;
  padding: 4px 6px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 1px;
  overflow: visible;
  line-height: 1.05;
  touch-action: none;
}

.secure-document-field span {
  font-size: 0.55rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.secure-document-field strong {
  margin-top: 0;
  font-size: 0.74rem;
  line-height: 1.05;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.secure-document-field em {
  display: none;
}

.secure-document-field.inline-signature-field {
  min-height: 0 !important;
  padding: 5px;
}

.secure-inline-signature-target {
  min-height: 30px;
  height: calc(100% - 14px);
  margin-top: 2px;
}

.secure-inline-signature-target #secureSignerCanvas {
  height: 100%;
  min-height: 30px;
}

.secure-inline-text-input {
  height: 100%;
  min-height: 30px;
  padding: 4px 6px;
  font-size: 0.78rem;
  resize: none;
}

.secure-document-field .secure-field-resize-handle {
  right: -7px;
  bottom: -7px;
  width: 14px;
  height: 14px;
  min-height: 14px;
  touch-action: none;
}

.secure-packet-invoice-page {
  display: block;
  width: 100%;
  margin: 0 0 14px;
  padding: clamp(14px, 2vw, 22px);
  border: 1px solid #16251d;
  border-radius: 4px;
  background: #ffffff;
  color: #0f172a;
}

.secure-packet-invoice-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 2px solid #111827;
}

.secure-packet-invoice-header div {
  display: grid;
  gap: 2px;
}

.secure-packet-invoice-header strong {
  font-size: 1rem;
}

.secure-packet-invoice-header span,
.secure-packet-invoice-parties span,
.secure-packet-invoice-parties small,
.secure-packet-invoice-lines small {
  color: #475569;
  font-size: 0.76rem;
  line-height: 1.25;
}

.secure-packet-invoice-number {
  min-width: 170px;
  text-align: right;
}

.secure-packet-invoice-number strong {
  font-size: clamp(1.25rem, 2.3vw, 1.7rem);
}

.secure-packet-invoice-parties {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin: 14px 0;
}

.secure-packet-invoice-parties > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.secure-packet-invoice-parties span {
  text-transform: uppercase;
  font-weight: 900;
}

.secure-packet-invoice-lines {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.82rem;
}

.secure-packet-invoice-lines th,
.secure-packet-invoice-lines td {
  padding: 7px 6px;
  border-top: 1px solid #d8e2dc;
  text-align: left;
  vertical-align: top;
}

.secure-packet-invoice-lines th:last-child,
.secure-packet-invoice-lines td:last-child {
  width: 26%;
  text-align: right;
  font-weight: 900;
}

.secure-packet-invoice-lines td:first-child {
  width: 48%;
}

.secure-packet-invoice-lines td strong,
.secure-packet-invoice-lines td small {
  display: block;
}

.secure-packet-invoice-totals {
  width: min(360px, 100%);
  margin: 12px 0 0 auto;
  display: grid;
  gap: 0;
  font-size: 0.84rem;
}

.secure-packet-invoice-totals div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 0;
  border-top: 1px solid #d8e2dc;
}

.secure-packet-invoice-totals .total {
  font-size: 1rem;
  font-weight: 900;
}

.secure-certificate,
.secure-certificate-document-preview,
.secure-certificate-document-preview .secure-document-page {
  max-width: 100%;
  overflow-x: hidden;
}

/* v5.47 Secure signature placement polish */
#secureSignatureDialog,
#secureSignerDialog,
#securePacketPreviewDialog {
  width: min(1360px, calc(100vw - 36px));
  max-width: calc(100vw - 36px);
}

.secure-signature-modal,
.secure-signer-modal {
  overflow-x: hidden;
}

[data-step-panel="fields"] .secure-packet-grid {
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

[data-step-panel="fields"] .secure-packet-panel {
  max-height: min(68vh, 720px);
  overflow: auto;
  padding: 12px;
}

.secure-field-list {
  gap: 7px;
}

.secure-field-row {
  gap: 7px;
  padding: 8px;
  border-radius: 10px;
  overflow: hidden;
}

.secure-field-row-main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px;
}

.secure-field-label-input {
  grid-column: 1 / -1;
}

.secure-field-size-input {
  max-width: 72px;
}

.secure-field-row-main label span,
.secure-field-row-value span {
  font-size: 0.62rem;
  letter-spacing: 0.03em;
}

.secure-field-row-main select,
.secure-field-row-main input,
.secure-field-row-value input {
  min-height: 28px;
  height: 28px;
  padding: 4px 6px;
  font-size: 0.76rem;
}

.secure-field-row-actions {
  justify-content: space-between;
  gap: 6px;
}

.secure-field-row-actions .mini-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 26px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.secure-field-row-actions .compact-button,
.secure-field-row-actions .icon-btn {
  min-height: 26px;
  padding: 3px 8px;
  font-size: 0.72rem;
}

.secure-field-row-actions .icon-btn {
  width: 28px;
  min-width: 28px;
}

.secure-document-workspace {
  min-width: 0;
  padding: 10px;
  overflow: hidden;
}

.secure-document-head {
  align-items: center;
}

.secure-document-head h3 {
  font-size: 0.95rem;
}

.secure-document-head span {
  max-width: 360px;
  font-size: 0.76rem;
  line-height: 1.25;
  text-align: right;
}

.secure-document-page {
  max-width: 100%;
  overflow: auto;
  padding: 10px;
}

.secure-document-sheet {
  width: min(920px, 100%);
  max-width: 100%;
  min-height: 1040px;
  padding: clamp(16px, 2vw, 28px);
  overflow: visible;
}

.secure-pdf-preview-band,
.secure-pdf-canvas-stack,
.secure-pdf-canvas-page,
.secure-packet-invoice-page {
  width: 100%;
  max-width: 100%;
  overflow: visible;
}

.secure-pdf-canvas {
  width: 100%;
  max-width: 760px;
}

.secure-document-field {
  min-width: 36px !important;
  min-height: 0 !important;
  padding: 2px 4px !important;
  border-width: 1.5px;
  border-radius: 5px;
  gap: 0;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

.secure-document-field span {
  font-size: 0.43rem;
  line-height: 1;
  max-height: 0.55rem;
}

.secure-document-field strong {
  font-size: 0.58rem;
  line-height: 1;
}

.secure-document-field.inline-signature-field {
  padding: 3px !important;
}

.secure-inline-signature-target {
  min-height: 18px;
  height: calc(100% - 8px);
}

.secure-inline-signature-target #secureSignerCanvas {
  min-height: 18px;
}

.secure-inline-text-input {
  min-height: 18px;
  padding: 2px 4px;
  font-size: 0.62rem;
}

.secure-document-field .secure-field-resize-handle {
  right: -5px;
  bottom: -5px;
  width: 10px;
  height: 10px;
  min-height: 10px;
  border-width: 1px;
}

.secure-certificate,
.secure-certificate-document-preview,
.secure-certificate-document-preview .secure-document-page {
  overflow-x: auto;
}

.secure-certificate-document-preview .secure-document-sheet {
  width: min(920px, 100%);
  max-width: 100%;
  overflow: visible;
}

@media (max-width: 980px) {
  [data-step-panel="fields"] .secure-packet-grid {
    grid-template-columns: 1fr;
  }

  [data-step-panel="fields"] .secure-packet-panel {
    max-height: none;
  }

  .secure-document-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .secure-document-head span {
    max-width: 100%;
    text-align: left;
  }
}

@media (max-width: 780px) {
  .secure-packet-invoice-header,
  .secure-packet-invoice-parties {
    grid-template-columns: 1fr;
    display: grid;
    text-align: left;
  }

  .secure-packet-invoice-number {
    min-width: 0;
    text-align: left;
  }
}

/* Local preview - v5.48 DocuSign-style signature packet polish */
#secureSignatureDialog {
  width: min(1420px, calc(100vw - 28px));
  max-width: calc(100vw - 28px);
  padding: 0;
  border: 0;
  border-radius: 18px;
  box-shadow: 0 28px 80px rgba(6, 35, 28, 0.3);
}

#secureSignatureDialog::backdrop {
  background: rgba(17, 35, 31, 0.66);
  backdrop-filter: blur(7px);
}

#secureSignatureDialog .secure-signature-modal {
  max-height: min(94vh, 960px);
  padding: 0;
  background:
    radial-gradient(circle at 88% 8%, rgba(243, 193, 71, 0.18), transparent 24rem),
    linear-gradient(180deg, #f8fbf8 0%, #edf4ef 100%);
  border-radius: 18px;
}

#secureSignatureDialog .modal-head {
  position: sticky;
  top: 0;
  z-index: 8;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid rgba(20, 83, 45, 0.14);
  background: linear-gradient(135deg, #123f32 0%, #217655 62%, #f3c147 140%);
  color: #ffffff;
}

#secureSignatureDialog .modal-head .eyebrow,
#secureSignatureDialog .modal-head h2 {
  color: #ffffff;
}

#secureSignatureDialog .modal-head .eyebrow {
  opacity: 0.84;
}

#secureSignatureDialog .modal-head h2 {
  margin: 2px 0 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
  letter-spacing: 0;
}

#secureSignatureDialog .modal-head .icon-btn {
  border-color: rgba(255, 255, 255, 0.36);
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

#secureSignatureDialog .secure-packet-status,
#secureSignatureDialog .signature-summary,
#secureSignatureDialog .secure-packet-stepper,
#secureSignatureDialog .secure-packet-step-panel {
  margin-left: 20px;
  margin-right: 20px;
}

#secureSignatureDialog .secure-packet-status {
  margin-top: 16px;
  border-color: rgba(15, 92, 62, 0.18);
  background: linear-gradient(135deg, #ffffff, #f2faf5);
  box-shadow: 0 12px 26px rgba(23, 83, 60, 0.08);
}

#secureSignatureDialog .signature-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

#secureSignatureDialog .signature-summary div {
  border: 1px solid rgba(20, 83, 45, 0.12);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: none;
}

#secureSignatureDialog .signature-summary span {
  color: #537168;
  font-size: 0.64rem;
}

#secureSignatureDialog .signature-summary strong {
  font-size: 0.92rem;
}

#secureSignatureDialog .secure-packet-stepper {
  position: sticky;
  top: 72px;
  z-index: 7;
  padding: 10px;
  border: 1px solid rgba(20, 83, 45, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 40px rgba(9, 49, 37, 0.1);
  backdrop-filter: blur(8px);
}

#secureSignatureDialog .secure-packet-stepper button {
  position: relative;
  min-height: 68px;
  padding: 10px 12px;
  border-color: rgba(20, 83, 45, 0.13);
  border-radius: 15px;
  background: #ffffff;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

#secureSignatureDialog .secure-packet-stepper button:hover {
  transform: translateY(-1px);
  border-color: rgba(33, 118, 85, 0.34);
  box-shadow: 0 10px 24px rgba(16, 74, 53, 0.1);
}

#secureSignatureDialog .secure-packet-stepper button span {
  width: 32px;
  height: 32px;
  background: #e9f5ee;
  color: #14532d;
}

#secureSignatureDialog .secure-packet-stepper button.active {
  border-color: rgba(33, 118, 85, 0.58);
  background: linear-gradient(135deg, #e6f7ef, #fff8dc);
  box-shadow: 0 14px 30px rgba(33, 118, 85, 0.16);
}

#secureSignatureDialog .secure-packet-stepper button.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 7px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #217655, #f3c147);
}

#secureSignatureDialog .secure-packet-stepper button strong {
  font-size: 0.9rem;
}

#secureSignatureDialog .secure-packet-stepper button small {
  color: #58756b;
  font-size: 0.7rem;
}

#secureSignatureDialog .secure-packet-step-panel {
  padding-bottom: 20px;
}

#secureSignatureDialog .secure-packet-panel,
#secureSignatureDialog .secure-document-workspace {
  border-color: rgba(20, 83, 45, 0.13);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 18px 45px rgba(15, 52, 42, 0.08);
}

#secureSignatureDialog .secure-packet-panel {
  padding: 18px;
}

#secureSignatureDialog .secure-packet-panel h3,
#secureSignatureDialog .secure-document-head h3 {
  letter-spacing: 0;
}

#secureSignatureDialog .secure-packet-upload-box {
  min-height: 92px;
  border: 1.5px dashed rgba(33, 118, 85, 0.35);
  border-radius: 17px;
  background:
    linear-gradient(135deg, rgba(232, 248, 239, 0.95), rgba(238, 247, 255, 0.95)),
    #ffffff;
}

#secureSignatureDialog .secure-packet-upload-box strong {
  font-size: 1rem;
}

#secureSignatureDialog .secure-packet-upload-button,
#secureSignatureDialog .step-actions .primary,
#secureSignatureDialog .secure-review-actions .primary {
  border-color: #1d6f52;
  background: linear-gradient(135deg, #1d6f52, #13513e);
  color: #ffffff;
  box-shadow: 0 10px 22px rgba(19, 81, 62, 0.18);
}

#secureSignatureDialog .secure-doc-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 15px;
  background: #fbfdfb;
}

#secureSignatureDialog .secure-doc-option.selected {
  border-color: rgba(33, 118, 85, 0.34);
  background: #eff9f3;
}

#secureSignatureDialog .secure-doc-option.active-preview {
  border-color: #1d6f52;
  background: linear-gradient(135deg, #e9f8f0, #fff7df);
}

[data-step-panel="fields"] .secure-packet-grid {
  grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid rgba(20, 83, 45, 0.1);
  border-radius: 20px;
  background: linear-gradient(180deg, #eaf2ed, #dfeae4);
}

[data-step-panel="fields"] .secure-packet-panel {
  position: sticky;
  top: 176px;
  max-height: calc(94vh - 220px);
  padding: 14px;
  border-radius: 16px;
}

#secureSignatureDialog .secure-field-head {
  margin-top: 4px;
  padding: 9px 10px;
  border-radius: 12px;
  background: #f1f8f4;
}

#secureSignatureDialog .secure-field-head strong {
  font-size: 0.84rem;
}

#secureSignatureDialog .secure-field-row {
  padding: 8px;
  border-radius: 14px;
  border-color: rgba(20, 83, 45, 0.13);
  border-left: 4px solid rgba(33, 118, 85, 0.62);
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 52, 42, 0.055);
}

#secureSignatureDialog .secure-field-row.active-placement {
  border-color: rgba(243, 193, 71, 0.92);
  border-left-color: #f3c147;
  background: #fffaf0;
  box-shadow: 0 0 0 2px rgba(243, 193, 71, 0.2), 0 10px 22px rgba(15, 52, 42, 0.08);
}

#secureSignatureDialog .secure-field-row-main {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

#secureSignatureDialog .secure-field-label-input {
  grid-column: 1 / -1;
}

#secureSignatureDialog .secure-field-row-main select,
#secureSignatureDialog .secure-field-row-main input,
#secureSignatureDialog .secure-field-row-value input {
  border-radius: 9px;
  background: #fbfdfc;
}

#secureSignatureDialog .secure-field-row-actions .compact-button {
  border-color: rgba(33, 118, 85, 0.3);
  background: #edf8f1;
  color: #14532d;
}

#secureSignatureDialog .secure-field-row-actions .icon-btn {
  border-color: rgba(220, 38, 38, 0.16);
  background: #fff4f4;
  color: #9f1239;
}

#secureSignatureDialog .secure-document-workspace {
  padding: 12px;
  background: linear-gradient(180deg, #f7fbf8, #edf4ef);
}

#secureSignatureDialog .secure-document-head {
  position: sticky;
  top: 176px;
  z-index: 3;
  padding: 12px 14px;
  border: 1px solid rgba(20, 83, 45, 0.12);
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 10px 24px rgba(12, 52, 39, 0.08);
  backdrop-filter: blur(6px);
}

#secureSignatureDialog .secure-document-head span {
  max-width: 420px;
  color: #48675d;
}

#secureSignatureDialog .secure-document-page {
  padding: 16px;
  border: 1px solid rgba(20, 83, 45, 0.1);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(20, 83, 45, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(20, 83, 45, 0.04) 1px, transparent 1px),
    #dfe8e3;
  background-size: 26px 26px;
}

#secureSignatureDialog .secure-document-sheet {
  border: 1px solid #c8d7d0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 55px rgba(9, 49, 37, 0.18);
}

#secureSignatureDialog .secure-document-field {
  background: rgba(235, 245, 255, 0.96);
  border-color: #2563eb;
  color: #17306a;
}

#secureSignatureDialog .secure-document-field.company {
  background: rgba(255, 247, 221, 0.96);
  border-color: #b45309;
  color: #6f3600;
}

#secureSignatureDialog .secure-document-field .secure-field-resize-handle {
  background: #2563eb;
}

#secureSignatureDialog .secure-document-field.company .secure-field-resize-handle {
  background: #b45309;
}

#secureSignatureDialog .step-actions {
  position: sticky;
  bottom: 0;
  z-index: 8;
  margin: 0 -20px -20px;
  padding: 12px 20px;
  border-top: 1px solid rgba(20, 83, 45, 0.12);
  background: rgba(248, 251, 248, 0.94);
  backdrop-filter: blur(8px);
}

#secureSignatureDialog .review-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
}

@media (max-width: 980px) {
  #secureSignatureDialog .secure-packet-stepper {
    position: static;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #secureSignatureDialog .signature-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  [data-step-panel="fields"] .secure-packet-grid,
  #secureSignatureDialog .review-grid {
    grid-template-columns: 1fr;
  }

  [data-step-panel="fields"] .secure-packet-panel,
  #secureSignatureDialog .secure-document-head {
    position: static;
    max-height: none;
  }
}

@media (max-width: 620px) {
  #secureSignatureDialog {
    width: calc(100vw - 12px);
    max-width: calc(100vw - 12px);
  }

  #secureSignatureDialog .secure-packet-status,
  #secureSignatureDialog .signature-summary,
  #secureSignatureDialog .secure-packet-stepper,
  #secureSignatureDialog .secure-packet-step-panel {
    margin-left: 10px;
    margin-right: 10px;
  }

  #secureSignatureDialog .secure-packet-stepper,
  #secureSignatureDialog .signature-summary {
    grid-template-columns: 1fr;
  }
}

/* Local preview refinement - keep field tools compact enough to use */
[data-step-panel="fields"] .secure-packet-grid {
  grid-template-columns: minmax(330px, 360px) minmax(0, 1fr);
}

#secureSignatureDialog .secure-field-row {
  gap: 6px;
  padding: 7px;
}

#secureSignatureDialog .secure-field-row-main {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.15fr) 54px 54px;
  gap: 6px;
}

#secureSignatureDialog .secure-field-label-input {
  grid-column: 1 / -1;
}

#secureSignatureDialog .secure-field-row-main label span,
#secureSignatureDialog .secure-field-row-value span {
  display: none;
}

#secureSignatureDialog .secure-field-row-main select,
#secureSignatureDialog .secure-field-row-main input,
#secureSignatureDialog .secure-field-row-value input {
  min-height: 27px;
  height: 27px;
  padding: 3px 6px;
  font-size: 0.73rem;
}

#secureSignatureDialog .secure-field-size-input {
  max-width: none;
}

#secureSignatureDialog .secure-field-row-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 28px;
  align-items: center;
}

#secureSignatureDialog .secure-field-row-actions .mini-check,
#secureSignatureDialog .secure-field-row-actions .compact-button,
#secureSignatureDialog .secure-field-row-actions .icon-btn {
  min-height: 25px;
  height: 25px;
}

#secureSignatureDialog .secure-field-row-actions .compact-button {
  padding: 2px 8px;
}

@media (max-width: 980px) {
  [data-step-panel="fields"] .secure-packet-grid {
    grid-template-columns: 1fr;
  }

  [data-step-panel="fields"] .secure-packet-panel {
    width: 100%;
    max-width: none;
  }

  #secureSignatureDialog .secure-document-workspace,
  #secureSignatureDialog .secure-document-page,
  #secureSignatureDialog .secure-document-sheet,
  #secureSignatureDialog .secure-printable-invoice .invoice-page {
    width: 100%;
    max-width: 100%;
  }

  #secureSignatureDialog .secure-document-workspace {
    padding: 8px;
  }

  #secureSignatureDialog .secure-document-page {
    padding: 8px;
  }
}

/* Local preview refinement - use the real printable invoice inside signature packets */
#secureSignatureDialog .secure-printable-invoice,
.secure-public-signing-page .secure-printable-invoice,
#securePacketPreviewDialog .secure-printable-invoice {
  width: 100%;
  max-width: 100%;
  margin: 0 0 16px;
  overflow: visible;
}

#secureSignatureDialog .secure-printable-invoice .invoice-page,
.secure-public-signing-page .secure-printable-invoice .invoice-page,
#securePacketPreviewDialog .secure-printable-invoice .invoice-page {
  width: 100%;
  max-width: 100%;
  min-height: auto;
  margin: 0;
  padding: clamp(16px, 2vw, 26px);
  border-radius: 6px;
  box-shadow: none;
}

#secureSignatureDialog .secure-printable-invoice .invoice-brand,
.secure-public-signing-page .secure-printable-invoice .invoice-brand,
#securePacketPreviewDialog .secure-printable-invoice .invoice-brand {
  font-size: clamp(1.2rem, 2vw, 1.65rem);
}

#secureSignatureDialog .secure-printable-invoice .invoice-table,
.secure-public-signing-page .secure-printable-invoice .invoice-table,
#securePacketPreviewDialog .secure-printable-invoice .invoice-table {
  width: 100%;
  table-layout: fixed;
  font-size: 0.84rem;
}

#secureSignatureDialog .secure-printable-invoice .invoice-table th,
#secureSignatureDialog .secure-printable-invoice .invoice-table td,
.secure-public-signing-page .secure-printable-invoice .invoice-table th,
.secure-public-signing-page .secure-printable-invoice .invoice-table td,
#securePacketPreviewDialog .secure-printable-invoice .invoice-table th,
#securePacketPreviewDialog .secure-printable-invoice .invoice-table td {
  padding: 7px 6px;
  font-size: 0.8rem;
  vertical-align: top;
  word-break: normal;
  overflow-wrap: anywhere;
}

#secureSignatureDialog .secure-printable-invoice .invoice-totals,
.secure-public-signing-page .secure-printable-invoice .invoice-totals,
#securePacketPreviewDialog .secure-printable-invoice .invoice-totals {
  width: min(340px, 100%);
}

#secureSignatureDialog .secure-printable-invoice .invoice-terms,
#secureSignatureDialog .secure-printable-invoice .captured-signature,
#secureSignatureDialog .secure-printable-invoice .signature-grid,
.secure-public-signing-page .secure-printable-invoice .invoice-terms,
.secure-public-signing-page .secure-printable-invoice .captured-signature,
.secure-public-signing-page .secure-printable-invoice .signature-grid,
#securePacketPreviewDialog .secure-printable-invoice .invoice-terms,
#securePacketPreviewDialog .secure-printable-invoice .captured-signature,
#securePacketPreviewDialog .secure-printable-invoice .signature-grid {
  margin-top: 18px;
}

.secure-built-in-contract {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 12px 14px;
  border: 1px solid rgba(20, 83, 45, 0.18);
  border-radius: 12px;
  background: linear-gradient(135deg, #eefaf1, #ffffff);
}

.secure-built-in-contract div {
  display: grid;
  gap: 3px;
}

.secure-built-in-contract strong {
  color: #143d2d;
}

.secure-built-in-contract span:not(.status) {
  color: #4b675d;
  font-size: 0.86rem;
  font-weight: 750;
}

.secure-contract-document {
  display: grid;
  gap: 14px;
}

.secure-contract-document .secure-printable-invoice {
  margin-bottom: 0;
}

.secure-optional-documents {
  display: grid !important;
  grid-template-columns: 1fr !important;
  gap: 10px !important;
  margin: 10px 0 0 !important;
  padding: 12px !important;
  border: 1px dashed rgba(20, 83, 45, 0.22);
  border-radius: 10px;
  background: #fbfdfb;
}

#secureSignatureDialog .secure-document-sheet .secure-optional-documents div,
.secure-public-signing-page .secure-document-sheet .secure-optional-documents div,
#securePacketPreviewDialog .secure-document-sheet .secure-optional-documents div {
  padding: 0;
  border: 0;
  background: transparent;
}

#secureSignatureDialog .secure-printable-invoice .invoice-page,
.secure-public-signing-page .secure-printable-invoice .invoice-page,
#securePacketPreviewDialog .secure-printable-invoice .invoice-page {
  border: 1px solid #d1dbd5;
}

.secure-document-sheet .secure-printable-invoice .invoice-header,
.secure-document-sheet .secure-printable-invoice .invoice-parties,
.secure-document-sheet .secure-printable-invoice .invoice-totals,
.secure-document-sheet .secure-printable-invoice .invoice-footer {
  display: flex;
}

.secure-document-sheet .secure-printable-invoice .invoice-header {
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--ink);
}

.secure-document-sheet .secure-printable-invoice .invoice-parties {
  grid-template-columns: none;
  justify-content: space-between;
  gap: 24px;
  margin: 26px 0;
}

.secure-document-sheet .secure-printable-invoice .invoice-parties > div {
  display: block;
  flex: 1;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.secure-document-sheet .secure-printable-invoice .invoice-totals {
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
  width: min(360px, 100%);
  margin: 0 0 0 auto;
}

.secure-document-sheet .secure-printable-invoice .invoice-totals div {
  display: flex;
  justify-content: space-between;
  width: 100%;
  padding: 9px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

.secure-document-sheet .secure-printable-invoice .invoice-terms {
  display: block;
  grid-template-columns: none;
  margin: 30px 0 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fbf8;
}

.secure-document-sheet .secure-printable-invoice .signature-grid {
  display: grid;
  grid-template-columns: 1fr 0.45fr;
  gap: 28px;
  margin-top: 30px;
}

.secure-document-sheet .secure-printable-invoice .signature-grid > div {
  display: block;
  min-height: 52px;
  padding: 0;
  border: 0;
  border-radius: 0;
  border-top: 2px solid var(--ink);
  background: transparent;
}

.secure-document-sheet .secure-printable-invoice .invoice-footer {
  display: grid;
  gap: 4px;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
/* v5.48 placement header fix: keep instructions out of the contract page. */
#secureSignatureDialog [data-step-panel="fields"] .secure-document-workspace {
  align-content: start;
  gap: 8px;
}

#secureSignatureDialog [data-step-panel="fields"] .secure-document-head {
  position: static !important;
  inset: auto !important;
  z-index: auto !important;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 0;
  margin: 0;
  padding: 10px 12px;
  border: 1px solid rgba(20, 83, 45, 0.12);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(15, 43, 33, 0.06);
}

#secureSignatureDialog [data-step-panel="fields"] .secure-document-head .eyebrow {
  margin: 0 0 2px;
  font-size: 0.68rem;
}

#secureSignatureDialog [data-step-panel="fields"] .secure-document-head h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.1;
}

#secureSignatureDialog [data-step-panel="fields"] .secure-document-head span {
  flex: 0 1 360px;
  max-width: 360px;
  font-size: 0.76rem;
  line-height: 1.2;
  text-align: right;
}

#secureSignatureDialog [data-step-panel="fields"] .secure-document-page {
  padding-top: 14px;
}

@media (max-width: 980px) {
  #secureSignatureDialog [data-step-panel="fields"] .secure-document-head {
    align-items: flex-start;
    flex-direction: column;
  }

  #secureSignatureDialog [data-step-panel="fields"] .secure-document-head span {
    flex-basis: auto;
    max-width: 100%;
    text-align: left;
  }
}

/* v5.49 Signature Center: standalone packets and DocuSign-style field tools. */
#secureSignatureDialog .secure-link-record-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(20, 83, 45, 0.14);
  border-radius: 16px;
  background: linear-gradient(135deg, #fbfdfb, #eef7f3);
}

#secureSignatureDialog .secure-link-record-panel h4 {
  margin: 0 0 4px;
  font-size: 1rem;
}

#secureSignatureDialog .secure-field-toolbox {
  display: grid;
  gap: 12px;
  margin: 10px 0 14px;
  padding: 12px;
  border: 1px solid rgba(20, 83, 45, 0.14);
  border-radius: 16px;
  background: linear-gradient(135deg, #f7fbf8, #eef7f3);
}

#secureSignatureDialog .secure-field-toolbox .field {
  margin: 0;
}

#secureSignatureDialog .secure-field-tool-grid {
  display: grid;
  gap: 8px;
}

#secureSignatureDialog .secure-field-tool {
  display: grid;
  gap: 2px;
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid rgba(20, 83, 45, 0.16);
  border-radius: 13px;
  background: #fff;
  color: #14211e;
  text-align: left;
  cursor: pointer;
}

#secureSignatureDialog .secure-field-tool:hover {
  border-color: rgba(29, 111, 82, 0.5);
  background: #ecf8f0;
}

#secureSignatureDialog .secure-field-tool strong {
  font-size: 0.9rem;
}

#secureSignatureDialog .secure-field-tool span {
  color: #557064;
  font-size: 0.76rem;
}

#secureSignatureDialog .secure-field-row {
  overflow: hidden;
}

#secureSignatureDialog .secure-field-row-main {
  min-width: 0;
}

#secureSignatureDialog .secure-company-sign-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(20, 83, 45, 0.14);
  border-radius: 16px;
  background: linear-gradient(135deg, #fffaf0, #f7fbf8);
}

#secureSignatureDialog .secure-company-sign-panel canvas {
  width: 100%;
  height: 132px;
  border: 1px solid rgba(20, 83, 45, 0.2);
  border-radius: 13px;
  background: #fff;
  touch-action: none;
}

#secureSignatureDialog .secure-company-sign-panel p {
  margin: 0;
  color: #557064;
  font-size: 0.82rem;
}

#secureSignatureDialog .secure-company-sign-panel .primary {
  min-height: 40px;
}

#secureSignatureDialog .secure-field-signature-image {
  display: block;
  width: 100%;
  max-height: 100%;
  object-fit: contain;
}

#secureSignatureDialog .secure-document-field {
  min-height: 28px;
  padding: 4px 7px;
}

#secureSignatureDialog .secure-document-field span {
  font-size: 0.62rem;
}

#secureSignatureDialog .secure-document-field strong {
  font-size: 0.72rem;
}
