:root {
  --color-primary: #111111;
  --color-on-primary: #ffffff;
  --color-secondary: #2b2b2b;
  --color-accent: #c1121f;
  --color-accent-dark: #990e19;
  --color-background: #f7f7f5;
  --color-foreground: #101010;
  --color-muted: #e7e7e4;
  --color-muted-foreground: #555550;
  --color-border: #d2d2ce;
  --color-destructive: #8b0000;
  --color-ring: #c1121f;
  --space-xs: 0.125rem;
  --space-sm: 0.25rem;
  --space-md: 0.5rem;
  --space-lg: 0.75rem;
  --space-xl: 1rem;
  --space-2xl: 1.5rem;
  --space-3xl: 2rem;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.1);
  --font-body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-utility: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--color-background);
  color: var(--color-foreground);
  font-family: var(--font-body);
  line-height: 1.5;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 20rem;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--color-background);
}

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

a,
button {
  -webkit-tap-highlight-color: rgba(193, 18, 31, 0.2);
}

a,
button,
[role="button"] {
  cursor: pointer;
}

:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  top: var(--space-md);
  left: var(--space-md);
  z-index: 100;
  padding: var(--space-lg) var(--space-xl);
  border-radius: 0.5rem;
  background: var(--color-on-primary);
  color: var(--color-primary);
  font-weight: 800;
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

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

h1,
h2,
h3 {
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.eyebrow {
  margin-bottom: var(--space-sm);
  color: var(--color-accent);
  font-family: var(--font-utility);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.button,
.header-action {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  border-radius: 0.5rem;
  font-weight: 750;
  text-decoration: none;
  transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.button:active,
.header-action:active {
  transform: translateY(1px);
}

.button--primary {
  border: 2px solid var(--color-accent);
  padding: 0.6875rem 1rem;
  background: var(--color-accent);
  color: var(--color-on-primary);
  box-shadow: var(--shadow-sm);
}

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

.button--service-ticket {
  min-height: 2.75rem;
  border: 2px solid var(--color-primary);
  padding: 0.6875rem 1rem;
  background: var(--color-on-primary);
  color: var(--color-primary);
}

.button--service-ticket:hover {
  border-color: var(--color-accent);
  color: var(--color-accent-dark);
}

.button--full {
  width: 100%;
}

/* Authentication */
.auth-page {
  background: var(--color-primary);
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  place-items: center;
  padding: max(var(--space-xl), env(safe-area-inset-top)) var(--space-xl) max(var(--space-xl), env(safe-area-inset-bottom));
  background: var(--color-primary);
}

.auth-card {
  width: min(100%, 27rem);
  overflow: hidden;
  border: 1px solid #3a3a3a;
  border-radius: 0.875rem;
  background: var(--color-on-primary);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.35);
}

.auth-brand {
  padding: var(--space-2xl) var(--space-2xl) var(--space-xl);
  background: var(--color-primary);
  color: var(--color-on-primary);
  text-align: center;
}

.auth-brand img {
  display: block;
  width: min(100%, 17.5rem);
  height: auto;
  margin: 0 auto var(--space-md);
}

.auth-brand p {
  margin-bottom: 0;
  color: #d8d8d5;
  font-family: var(--font-utility);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.auth-content {
  padding: var(--space-2xl);
}

.auth-heading {
  margin-bottom: var(--space-2xl);
}

.auth-heading h1 {
  margin-bottom: var(--space-sm);
  font-size: clamp(2rem, 10vw, 3rem);
  font-weight: 850;
}

.auth-heading > p:last-child,
.auth-help {
  color: var(--color-muted-foreground);
}

.auth-form {
  display: grid;
  gap: var(--space-xl);
}

.field {
  display: grid;
  gap: var(--space-md);
}

.field label {
  font-size: 0.875rem;
  font-weight: 750;
}

.field input {
  width: 100%;
  min-height: 3rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  background: #ffffff;
  color: var(--color-foreground);
  font-size: 1rem;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.field input:focus {
  border-color: var(--color-ring);
  outline: none;
  box-shadow: 0 0 0 3px rgba(193, 18, 31, 0.2);
}

.form-alert {
  margin-bottom: var(--space-xl);
  border-left: 0.25rem solid var(--color-destructive);
  padding: var(--space-lg) var(--space-xl);
  background: #fff0f0;
  color: #650000;
  font-weight: 650;
}

.auth-help {
  margin: var(--space-xl) 0 0;
  font-size: 0.8125rem;
  text-align: center;
}

/* Dashboard */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 0.1875rem solid var(--color-accent);
  padding-top: env(safe-area-inset-top);
  background: var(--color-primary);
  color: var(--color-on-primary);
  box-shadow: var(--shadow-md);
}

.app-header__inner {
  display: flex;
  width: min(100%, 75rem);
  min-height: 4.75rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  margin: 0 auto;
  padding: var(--space-md) var(--space-xl);
}

.brand-link {
  display: inline-flex;
  min-height: 2.75rem;
  min-width: 0;
  align-items: center;
  gap: var(--space-lg);
  color: var(--color-on-primary);
  text-decoration: none;
}

.brand-link img {
  display: block;
  width: min(38vw, 10rem);
  height: auto;
}

.brand-link span {
  display: none;
  border-left: 1px solid #555;
  padding-left: var(--space-lg);
  color: #d8d8d5;
  font-family: var(--font-utility);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-header form {
  margin: 0;
}

.header-action {
  min-width: 2.75rem;
  border: 1px solid #515151;
  padding: 0.6875rem;
  background: #222222;
  color: var(--color-on-primary);
}

.header-action:hover {
  border-color: #777;
  background: #333333;
}

.header-action span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.dashboard-shell {
  width: min(100%, 75rem);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-xl) calc(var(--space-3xl) + env(safe-area-inset-bottom));
}

.dashboard-intro {
  display: grid;
  gap: var(--space-xl);
  margin-bottom: var(--space-2xl);
}

.dashboard-intro h1 {
  margin-bottom: var(--space-sm);
  font-size: clamp(2.25rem, 10vw, 4rem);
  font-weight: 850;
}

.dashboard-intro__meta {
  margin-bottom: 0;
  color: var(--color-muted-foreground);
}

.quick-intake-link {
  width: 100%;
}

.dashboard-grid {
  display: grid;
  gap: var(--space-xl);
}

.work-section {
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-top: 0.3125rem solid var(--color-primary);
  border-radius: 0.75rem;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.work-section--needs-scheduling,
.work-section--overdue {
  border-top-color: var(--color-accent);
}

.work-section__header {
  display: flex;
  min-height: 3.5rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  border-bottom: 1px solid var(--color-muted);
  padding: var(--space-lg) var(--space-xl);
}

.work-section__header h2 {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 800;
}

.count-badge {
  display: inline-grid;
  min-width: 1.75rem;
  min-height: 1.75rem;
  place-items: center;
  border-radius: 999px;
  padding: 0 var(--space-md);
  background: var(--color-muted);
  color: var(--color-foreground);
  font-family: var(--font-utility);
  font-size: 0.75rem;
  font-weight: 700;
}

.work-section--overdue .count-badge {
  background: #f9dadd;
  color: var(--color-destructive);
}

.empty-state {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-lg);
  min-height: 8.5rem;
  align-content: center;
  padding: var(--space-2xl) var(--space-xl);
  color: var(--color-muted-foreground);
}

.empty-state svg {
  margin-top: 0.125rem;
  color: #777771;
}

.empty-state h3 {
  margin-bottom: var(--space-sm);
  color: var(--color-foreground);
  font-size: 0.9375rem;
  font-weight: 750;
  letter-spacing: 0;
}

.empty-state p {
  margin-bottom: 0;
  font-size: 0.875rem;
}

.work-order-list {
  display: grid;
}

.work-order-card {
  min-width: 0;
  padding: var(--space-xl);
}

.work-order-card + .work-order-card {
  border-top: 1px solid var(--color-muted);
}

.work-order-card__header {
  display: grid;
  gap: var(--space-md);
}

.work-order-card__number {
  margin-bottom: var(--space-xs);
  color: var(--color-primary);
  font-family: var(--font-utility);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.work-order-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.0625rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.work-order-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.status-badge {
  display: inline-flex;
  min-height: 1.75rem;
  align-items: center;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.1875rem var(--space-md);
  background: var(--color-background);
  color: var(--color-muted-foreground);
  font-size: 0.6875rem;
  font-weight: 750;
  line-height: 1.2;
  text-transform: uppercase;
}

.status-badge--high {
  border-color: #9d5d00;
  background: #fff0d8;
  color: #714100;
}

.status-badge--urgent {
  border-color: var(--color-destructive);
  background: #f9dadd;
  color: var(--color-destructive);
}

.work-order-card__request {
  margin: var(--space-lg) 0;
  overflow-wrap: anywhere;
  color: var(--color-foreground);
  font-size: 0.9375rem;
}

.work-order-card__details {
  display: grid;
  gap: var(--space-md);
  margin: 0;
}

.work-order-card__details div {
  min-width: 0;
}

.work-order-card__details dt {
  margin-bottom: var(--space-xs);
  color: var(--color-muted-foreground);
  font-size: 0.6875rem;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.work-order-card__details dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.schedule-window {
  display: block;
  margin-top: var(--space-xs);
  color: var(--color-foreground);
  font-family: var(--font-utility);
  font-weight: 700;
}

.intake-panel {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-xl);
  scroll-margin-top: 6rem;
  margin-top: var(--space-2xl);
  border-radius: 0.75rem;
  padding: var(--space-xl);
  background: var(--color-secondary);
  color: var(--color-on-primary);
}

.intake-panel__icon {
  display: grid;
  width: 3rem;
  height: 3rem;
  place-items: center;
  border-radius: 0.5rem;
  background: var(--color-accent);
}

.intake-panel .eyebrow {
  color: #ff7882;
}

.intake-panel h2 {
  margin-bottom: var(--space-sm);
  font-size: 1.375rem;
}

.intake-panel p:last-child {
  margin-bottom: 0;
  color: #dededb;
  font-size: 0.875rem;
}

.intake-panel a {
  color: #ffffff;
}

.app-nav {
  display: flex;
  min-width: 0;
  flex-shrink: 0;
  align-items: center;
  gap: var(--space-sm);
}

.app-nav__link {
  display: inline-flex;
  min-width: 2.75rem;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding: 0 var(--space-lg);
  color: #ffffff;
  font-size: 0.875rem;
  font-weight: 750;
  text-decoration: none;
}

.app-nav__link:hover {
  background: #292929;
}

.app-nav__icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-nav__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.message-stack {
  position: relative;
  z-index: 30;
  width: min(100%, 75rem);
  margin: var(--space-xl) auto 0;
  padding: 0 var(--space-xl);
}

.message {
  border-left: 0.25rem solid var(--color-primary);
  border-radius: 0.375rem;
  padding: var(--space-lg) var(--space-xl);
  background: #ffffff;
  box-shadow: var(--shadow-md);
  font-weight: 750;
}

.message--success {
  border-left-color: #237a31;
}

.page-shell {
  width: min(100%, 75rem);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-xl) calc(var(--space-3xl) + env(safe-area-inset-bottom));
}

.page-shell--narrow {
  width: min(100%, 58rem);
}

.page-heading {
  margin-bottom: var(--space-2xl);
}

.page-heading h1 {
  margin-bottom: var(--space-md);
  overflow-wrap: anywhere;
  font-size: clamp(2rem, 9vw, 3.5rem);
}

.page-heading > p:last-child,
.page-heading div > p:last-child {
  margin-bottom: 0;
  color: var(--color-muted-foreground);
}

.page-heading--split {
  display: grid;
  gap: var(--space-xl);
}

.panel {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-top: 0.25rem solid var(--color-primary);
  border-radius: 0.75rem;
  padding: var(--space-xl);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.panel h2 {
  margin-bottom: var(--space-lg);
  font-size: 1.25rem;
}

.panel > p {
  color: var(--color-muted-foreground);
}

.stack-form {
  display: grid;
  gap: var(--space-xl);
}

.form-section {
  display: grid;
  gap: var(--space-xl);
}

.form-section h2,
.form-section > p {
  margin-bottom: 0;
}

.record-mode {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.record-mode legend {
  margin-bottom: var(--space-md);
  font-size: 0.875rem;
  font-weight: 800;
}

.record-mode > div {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md) var(--space-xl);
}

.record-mode label {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: var(--space-md);
  font-weight: 750;
}

.record-mode input {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--color-accent);
}

.form-grid {
  display: grid;
  gap: var(--space-xl);
}

.form-field {
  display: grid;
  min-width: 0;
  gap: var(--space-md);
}

.form-field label,
.search-form label {
  color: var(--color-foreground);
  font-size: 0.875rem;
  font-weight: 800;
}

.form-field input,
.form-field select,
.form-field textarea,
.search-form input {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: 0.6875rem 0.75rem;
  background: #ffffff;
  color: var(--color-foreground);
}

.form-field textarea {
  min-height: 8rem;
  resize: vertical;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.search-form input:focus {
  border-color: var(--color-ring);
  outline: none;
  box-shadow: 0 0 0 3px rgba(193, 18, 31, 0.2);
}

.form-field--error input,
.form-field--error select,
.form-field--error textarea {
  border-color: var(--color-destructive);
}

.field-errors,
.errorlist {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--color-destructive);
  font-size: 0.875rem;
  font-weight: 700;
}

.review-warning {
  margin-bottom: var(--space-xl);
  border-left: 0.25rem solid var(--color-accent);
  padding: var(--space-lg) var(--space-xl);
  background: #fff0f0;
}

.review-warning strong {
  display: block;
}

.original-message {
  margin-bottom: var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  padding: var(--space-lg);
  background: #ffffff;
}

.original-message summary {
  min-height: 2.75rem;
  padding: var(--space-md);
  font-weight: 800;
  cursor: pointer;
}

.original-message pre,
.original-text {
  max-width: 100%;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-body);
}

.form-actions {
  display: grid;
  gap: var(--space-lg);
}

.button--secondary {
  border: 2px solid var(--color-primary);
  padding: 0.6875rem 1rem;
  background: #ffffff;
  color: var(--color-primary);
}

.manual-link {
  margin: var(--space-xl) 0 0;
}

.detail-grid {
  display: grid;
  gap: var(--space-xl);
}

.detail-list {
  display: grid;
  gap: var(--space-lg);
  margin: 0;
}

.detail-list dt {
  color: var(--color-muted-foreground);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.detail-list dd {
  margin: var(--space-xs) 0 0;
  overflow-wrap: anywhere;
}

.preserve-lines {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.history-panel {
  margin-top: var(--space-xl);
}

.history-list,
.customer-list,
.saved-location-list {
  display: grid;
  gap: var(--space-lg);
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-list li,
.customer-list li,
.saved-location-list li {
  display: grid;
  gap: var(--space-sm);
  border-bottom: 1px solid var(--color-muted);
  padding-bottom: var(--space-lg);
}

.history-list li:last-child,
.customer-list li:last-child,
.saved-location-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.history-list p {
  margin: 0;
}

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

.search-form {
  display: grid;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
}

.search-form > div {
  display: grid;
  gap: var(--space-md);
}

.work-order-card a,
.customer-list a,
.work-order-history a,
.page-heading a {
  color: inherit;
}

/* Billing */
.app-nav__link[aria-current="page"] {
  background: #353535;
  box-shadow: inset 0 -0.1875rem 0 var(--color-accent);
}

.billing-shell {
  width: min(100%, 68rem);
}

.billing-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  border-bottom: 2px solid var(--color-border);
}

.billing-tab {
  display: flex;
  min-width: 0;
  min-height: 3.25rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  border: 0;
  border-bottom: 0.25rem solid transparent;
  padding: var(--space-md);
  color: var(--color-muted-foreground);
  font-size: 0.8125rem;
  font-weight: 800;
  text-decoration: none;
  transition: border-color 180ms ease, color 180ms ease, background-color 180ms ease;
}

.billing-tab:hover {
  background: #ffffff;
  color: var(--color-foreground);
}

.billing-tab--current {
  border-bottom-color: var(--color-accent);
  color: var(--color-foreground);
}

.billing-search {
  margin-bottom: var(--space-2xl);
}

.billing-list {
  display: grid;
  gap: var(--space-xl);
}

.billing-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-top: 0.25rem solid var(--color-primary);
  border-radius: 0.75rem;
  padding: var(--space-xl);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.billing-card__header {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
}

.billing-card__header > div {
  min-width: 0;
}

.billing-card h2 {
  margin-bottom: var(--space-sm);
  overflow-wrap: anywhere;
  font-size: 1.25rem;
}

.billing-card a {
  color: inherit;
}

.billing-card__header a,
.billing-detail-back,
.detail-action-link {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
}

.billing-card__address {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  color: var(--color-muted-foreground);
  font-size: 0.875rem;
}

.status-badge--invoiced {
  border-color: #237a31;
  background: #e7f5e9;
  color: #155822;
}

.billing-card__details,
.invoice-meta {
  display: grid;
  gap: var(--space-lg);
  margin: var(--space-xl) 0 0;
}

.billing-card__details dt,
.invoice-meta dt {
  color: var(--color-muted-foreground);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.billing-card__details dd,
.invoice-meta dd {
  margin: var(--space-xs) 0 0;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
}

.billing-summary {
  margin-top: var(--space-xl);
  border-left: 0.1875rem solid var(--color-border);
  padding-left: var(--space-lg);
}

.billing-summary h3 {
  margin-bottom: var(--space-sm);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.billing-summary p {
  margin-bottom: 0;
}

.invoice-form {
  display: grid;
  min-width: 0;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
  border-top: 1px solid var(--color-muted);
  padding-top: var(--space-xl);
}

.invoice-toggle {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  gap: var(--space-md);
  font-weight: 800;
}

.invoice-toggle input {
  width: 1.375rem;
  height: 1.375rem;
  flex: none;
  accent-color: var(--color-accent);
}

.invoice-form__fields {
  display: grid;
  min-width: 0;
  gap: var(--space-lg);
}

.invoice-form textarea {
  min-height: 4.5rem;
}

.invoice-form .button {
  width: 100%;
}

.billing-empty {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-lg);
  align-items: start;
}

.billing-empty h2 {
  margin-bottom: var(--space-sm);
}

.billing-empty p {
  margin-bottom: 0;
}

.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: var(--space-lg);
  margin-top: var(--space-2xl);
}

.invoice-panel {
  margin-top: var(--space-xl);
}

.invoice-panel__heading {
  display: grid;
  gap: var(--space-lg);
}

.invoice-panel__heading h2 {
  margin-bottom: 0;
}

.billing-history strong,
.billing-history p {
  overflow-wrap: anywhere;
}

.auth-card--message h1 {
  overflow-wrap: anywhere;
}

/* Mobile field work */
.field-shell {
  width: min(100%, 75rem);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-xl) calc(var(--space-3xl) + env(safe-area-inset-bottom));
}

.field-backlinks {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-xl);
  color: var(--color-muted-foreground);
  font-size: 0.8125rem;
  font-weight: 750;
}

.field-backlinks a {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  color: var(--color-foreground);
  text-underline-offset: 0.2em;
}

.field-hero {
  display: grid;
  min-width: 0;
  gap: var(--space-xl);
  border-top: 0.375rem solid var(--color-accent);
  padding: var(--space-2xl) var(--space-xl);
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.field-hero h1 {
  margin-bottom: var(--space-sm);
  overflow-wrap: anywhere;
  font-family: var(--font-utility);
  font-size: clamp(1.75rem, 9vw, 3.25rem);
  letter-spacing: -0.04em;
}

.field-hero .eyebrow {
  color: #ff8b94;
}

.field-hero__customer {
  margin-bottom: var(--space-sm);
  overflow-wrap: anywhere;
  font-size: 1.125rem;
  font-weight: 800;
}

.field-hero__location {
  margin: 0;
  overflow-wrap: anywhere;
  color: #d8d8d5;
}

.field-hero .status-badge {
  border-color: #696969;
  background: #252525;
  color: #ffffff;
}

.field-hero .status-badge--urgent {
  border-color: #ff8b94;
  background: #4d070d;
}

.field-summary,
.timer-strip,
.field-panel,
.completion-panel {
  min-width: 0;
  border: 1px solid var(--color-border);
  background: #ffffff;
}

.field-summary {
  border-top: 0;
  padding: var(--space-xl);
}

.field-summary h2,
.timer-strip h2,
.field-panel h2,
.completion-panel h2 {
  margin-bottom: var(--space-lg);
  font-size: 1.375rem;
}

.field-request {
  margin-bottom: var(--space-xl);
  font-size: 1rem;
  font-weight: 650;
}

.field-summary__meta {
  display: grid;
  gap: var(--space-lg);
  margin: 0;
}

.field-summary__meta div {
  min-width: 0;
}

.field-summary__meta dt {
  color: var(--color-muted-foreground);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field-summary__meta dd {
  margin: var(--space-xs) 0 0;
  overflow-wrap: anywhere;
  font-weight: 750;
}

.field-warning,
.field-lock,
.field-note,
.history-notice {
  border-left: 0.25rem solid var(--color-accent);
  padding: var(--space-lg);
  background: #fff0f0;
  color: #650000;
}

.field-warning,
.field-lock {
  margin: var(--space-xl) 0 0;
}

.field-lock {
  border-left-color: var(--color-primary);
  background: var(--color-muted);
  color: var(--color-foreground);
}

.timer-strip {
  display: grid;
  gap: var(--space-xl);
  margin-top: var(--space-xl);
  border-top: 0.375rem solid var(--color-primary);
  padding: var(--space-xl);
}

.timer-strip--active {
  border-color: var(--color-accent);
  background: #fff8f8;
}

.timer-strip__status p:last-child {
  margin-bottom: 0;
}

.timer-strip__status a {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  color: var(--color-destructive);
  font-weight: 800;
}

.timer-value {
  margin: var(--space-md) 0 0;
  color: var(--color-destructive);
  font-family: var(--font-utility);
  font-size: clamp(2rem, 12vw, 3.75rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
}

.timer-action-form,
.field-form,
.complete-form {
  display: grid;
  min-width: 0;
  gap: var(--space-xl);
}

.timer-action-form textarea {
  min-height: 4.5rem;
}

.button--timer-start,
.button--timer-stop,
.button--destructive {
  min-height: 3.25rem;
  border: 2px solid var(--color-accent);
  padding: 0.75rem 1rem;
  background: var(--color-accent);
  color: #ffffff;
}

.button--timer-stop,
.button--destructive {
  border-color: var(--color-destructive);
  background: var(--color-destructive);
}

.field-grid {
  display: grid;
  align-items: start;
  gap: var(--space-xl);
  margin-top: var(--space-xl);
}

.field-panel {
  border-top: 0.3125rem solid var(--color-primary);
  border-radius: 0.75rem;
  padding: var(--space-xl);
  box-shadow: var(--shadow-sm);
}

.field-panel--visit,
.field-panel--wide {
  border-top-color: var(--color-accent);
}

.field-panel__heading,
.field-history-list__heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
}

.field-panel__heading h2,
.field-panel__heading p {
  margin-bottom: 0;
}

.field-panel h3 {
  margin: var(--space-2xl) 0 var(--space-lg);
  font-size: 1rem;
}

.field-form + .field-form {
  margin-top: var(--space-2xl);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2xl);
}

.field-form--finish {
  border-top-color: var(--color-primary);
}

.field-help,
.field-note,
.history-notice {
  margin: 0;
  color: var(--color-muted-foreground);
  font-size: 0.8125rem;
}

.field-note,
.history-notice {
  color: #650000;
}

.material-form__row,
.material-columns {
  display: grid;
  min-width: 0;
  gap: var(--space-xl);
}

.material-columns {
  margin-top: var(--space-2xl);
}

.material-columns > div + div {
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-xl);
}

.material-totals,
.field-history-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.material-totals li,
.field-history-list li {
  min-width: 0;
  border-bottom: 1px solid var(--color-muted);
  padding: var(--space-lg) 0;
  overflow-wrap: anywhere;
}

.material-totals li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-lg);
}

.material-totals li:first-child,
.field-history-list li:first-child {
  padding-top: 0;
}

.material-totals li:last-child,
.field-history-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.field-history-list p {
  margin: var(--space-sm) 0 0;
  color: var(--color-muted-foreground);
  font-size: 0.875rem;
}

.field-history-list__heading span {
  flex: none;
  color: var(--color-muted-foreground);
  font-family: var(--font-utility);
  font-size: 0.75rem;
  font-weight: 700;
}

.correction-box {
  margin-top: var(--space-2xl);
  border: 1px solid var(--color-primary);
  border-radius: 0.5rem;
  background: #f4f4f1;
}

.correction-box summary {
  display: flex;
  min-height: 3rem;
  align-items: center;
  padding: var(--space-lg) var(--space-xl);
  font-weight: 800;
  cursor: pointer;
}

.correction-box .field-form {
  border-top: 1px solid var(--color-border);
  padding: var(--space-xl);
  background: #ffffff;
}

.completion-panel {
  margin-top: var(--space-xl);
  border: 0.1875rem solid var(--color-primary);
  border-left: 0.5rem solid var(--color-accent);
  border-radius: 0.75rem;
  padding: var(--space-xl);
}

.confirmation-check {
  display: flex;
  min-height: 3rem;
  align-items: center;
  gap: var(--space-lg);
  font-weight: 800;
}

.confirmation-check input {
  width: 1.5rem;
  height: 1.5rem;
  flex: none;
  accent-color: var(--color-accent);
}

.work-order-card__field-link {
  width: 100%;
  margin-top: var(--space-xl);
}

.field-page .form-field input,
.field-page .form-field select {
  min-height: 3rem;
  font-size: 1rem;
}

.field-page .form-field textarea {
  min-height: 6rem;
  font-size: 1rem;
}

/* Scheduling */
.schedule-board,
.schedule-panel-shell {
  width: min(100%, 90rem);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-xl) calc(var(--space-3xl) + env(safe-area-inset-bottom));
}

.schedule-board__heading,
.schedule-panel-hero,
.schedule-history__heading {
  display: grid;
  min-width: 0;
  gap: var(--space-xl);
}

.schedule-board__heading {
  margin-bottom: var(--space-2xl);
}

.schedule-board__heading h1,
.schedule-panel-hero h1 {
  margin-bottom: var(--space-sm);
  font-size: clamp(2rem, 10vw, 4rem);
}

.schedule-board__heading p:last-child,
.schedule-panel-hero p:last-child {
  margin-bottom: 0;
  color: var(--color-muted-foreground);
}

.schedule-search {
  border: 1px solid var(--color-border);
  border-left: 0.3rem solid var(--color-accent);
  border-radius: 0.75rem;
  padding: var(--space-xl);
  background: #ffffff;
}

.schedule-board__grid,
.schedule-list,
.schedule-panel-grid,
.schedule-form,
.move-tomorrow-form {
  display: grid;
  min-width: 0;
  gap: var(--space-xl);
}

.schedule-lane {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-top: 0.3125rem solid var(--color-primary);
  border-radius: 0.75rem;
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.schedule-lane--needs-scheduling,
.schedule-lane--overdue {
  border-top-color: var(--color-accent);
}

.schedule-lane__header {
  display: flex;
  min-height: 3.5rem;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  border-bottom: 1px solid var(--color-muted);
  padding: var(--space-lg) var(--space-xl);
}

.schedule-lane__header h2 {
  margin: 0;
  font-size: 1rem;
}

.schedule-card {
  min-width: 0;
  padding: var(--space-xl);
}

.schedule-card + .schedule-card {
  border-top: 1px solid var(--color-muted);
}

.schedule-card__header {
  display: grid;
  min-width: 0;
  gap: var(--space-md);
}

.schedule-card .work-order-card__number a {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  color: inherit;
}

.schedule-card h3,
.schedule-card__request,
.schedule-card__meta dd {
  overflow-wrap: anywhere;
}

.schedule-card h3 {
  margin: 0;
  font-size: 1.125rem;
}

.schedule-card__request {
  margin: var(--space-lg) 0;
}

.schedule-card__meta {
  display: grid;
  gap: var(--space-lg);
  margin: 0;
}

.schedule-card__meta dt {
  color: var(--color-muted-foreground);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.schedule-card__meta dd {
  margin: var(--space-xs) 0 0;
  font-size: 0.875rem;
}

.schedule-card__links,
.work-order-card__actions {
  display: grid;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.move-tomorrow-form {
  margin-top: var(--space-xl);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-xl);
}

.move-tomorrow-form textarea {
  min-height: 4.5rem;
}

.schedule-empty,
.schedule-lane__truncation {
  margin: 0;
  padding: var(--space-xl);
  color: var(--color-muted-foreground);
}

.schedule-lane__truncation {
  border-top: 1px solid var(--color-muted);
  font-size: 0.8125rem;
  font-weight: 750;
}

.schedule-panel-hero {
  margin-bottom: var(--space-xl);
  border-top: 0.375rem solid var(--color-accent);
  padding: var(--space-2xl) var(--space-xl);
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.schedule-panel-hero .eyebrow {
  color: #ff8b94;
}

.schedule-panel-hero__customer {
  margin-bottom: var(--space-xs);
  font-size: 1.125rem;
  font-weight: 800;
}

.schedule-panel-hero .schedule-panel-hero__location {
  color: #d8d8d5;
}

.schedule-panel-hero .status-badge {
  border-color: #696969;
  background: #252525;
  color: #ffffff;
}

.schedule-form-panel {
  scroll-margin-top: 6rem;
  border-top-color: var(--color-accent);
}

.schedule-form__dates {
  display: grid;
  min-width: 0;
  gap: var(--space-xl);
}

.schedule-form textarea {
  min-height: 5rem;
}

.schedule-form .button,
.move-tomorrow-form .button,
.schedule-card__links .button,
.work-order-card__actions .button {
  width: 100%;
  min-height: 2.75rem;
}

.schedule-lock {
  border-left: 0.25rem solid var(--color-primary);
  padding: var(--space-lg);
  background: var(--color-muted);
  color: var(--color-foreground);
}

.schedule-history {
  margin-top: var(--space-xl);
}

.schedule-history__heading h2,
.schedule-history__heading p {
  margin-bottom: 0;
}

.schedule-history-list {
  display: grid;
  gap: 0;
  margin: var(--space-xl) 0 0;
  padding: 0;
  list-style: none;
}

.schedule-history-list li {
  min-width: 0;
  border-bottom: 1px solid var(--color-muted);
  padding: var(--space-lg) 0;
  overflow-wrap: anywhere;
}

.schedule-history-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.schedule-history-list p {
  margin: var(--space-sm) 0 0;
}

.schedule-history-list__heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-md);
}

.schedule-history-list time {
  color: var(--color-muted-foreground);
  font-family: var(--font-utility);
  font-size: 0.75rem;
}

@media (min-width: 32rem) {
  .brand-link span,
  .header-action span {
    position: static;
    display: inline;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
  }

  .header-action {
    padding-inline: var(--space-lg);
  }

  .billing-tab {
    padding-inline: var(--space-xl);
    font-size: 0.9375rem;
  }

  .billing-card__details,
  .invoice-meta,
  .invoice-form__fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .invoice-form .button {
    width: auto;
    justify-self: start;
  }

  .field-summary__meta,
  .material-form__row--two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .timer-action-form .button,
  .field-form .button,
  .complete-form .button {
    width: auto;
    justify-self: start;
  }
}

@media (min-width: 48rem) {
  .app-nav__label {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    clip-path: none;
    white-space: normal;
  }

  .app-nav__link {
    padding-inline: var(--space-lg);
  }

  .page-heading--split {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

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

  .form-grid--three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .form-actions,
  .search-form > div {
    grid-template-columns: 1fr auto;
  }

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

  .dashboard-shell {
    padding-top: var(--space-3xl);
  }

  .dashboard-intro {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .quick-intake-link {
    width: auto;
  }

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

  .intake-panel {
    padding: var(--space-2xl);
  }

  .field-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    padding: var(--space-3xl);
  }

  .field-hero .work-order-card__badges {
    justify-content: flex-end;
  }

  .field-summary,
  .timer-strip,
  .field-panel,
  .completion-panel {
    padding: var(--space-2xl);
  }

  .timer-strip {
    grid-template-columns: minmax(0, 1fr) minmax(18rem, 0.75fr);
    align-items: start;
  }

  .field-grid {
    grid-template-columns: minmax(0, 1.15fr) minmax(18rem, 0.85fr);
  }

  .field-panel--wide {
    grid-column: 1 / -1;
  }
}

@media (min-width: 64rem) {
  .app-header__inner,
  .dashboard-shell {
    padding-right: var(--space-3xl);
    padding-left: var(--space-3xl);
  }

  .dashboard-grid {
    gap: var(--space-2xl);
  }

  .field-shell {
    padding-right: var(--space-3xl);
    padding-left: var(--space-3xl);
  }

  .material-form__row {
    grid-template-columns: minmax(0, 1.5fr) minmax(8rem, 0.75fr) minmax(8rem, 0.75fr);
  }

  .material-form__row--two,
  .material-columns {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .material-columns > div + div {
    border-top: 0;
    border-left: 1px solid var(--color-border);
    padding-top: 0;
    padding-left: var(--space-2xl);
  }
}

@media (max-width: 31.99rem) {
  .app-header__inner {
    gap: var(--space-sm);
    padding-inline: var(--space-md);
  }

  .brand-link img {
    width: 4rem;
  }

  .app-nav {
    gap: 0;
  }

  .app-nav__link {
    padding-inline: var(--space-md);
  }
}

@media (min-width: 48rem) {
  .schedule-board,
  .schedule-panel-shell {
    padding-top: var(--space-3xl);
  }

  .schedule-board__heading,
  .schedule-panel-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .schedule-board__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule-search {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
  }

  .schedule-search > div {
    grid-template-columns: minmax(0, 1fr);
  }

  .schedule-search .button {
    min-width: 10rem;
  }

  .schedule-panel-grid {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    align-items: start;
  }

  .schedule-form__dates {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .schedule-card__header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
  }

  .schedule-card__links,
  .work-order-card__actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .schedule-form .button,
  .move-tomorrow-form .button {
    width: auto;
    justify-self: start;
  }
}

@media (min-width: 75rem) {
  .schedule-board__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
  }
}

/* Customer and location service history */
.customer-history-shell {
  width: min(100%, 90rem);
}

.customer-backlink {
  margin-bottom: var(--space-lg);
}

.customer-backlink a,
.location-history-card__actions > a {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  color: var(--color-foreground);
  font-weight: 800;
  text-underline-offset: 0.2em;
}

.record-filter-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: var(--space-xl);
  border-bottom: 2px solid var(--color-border);
}

.record-filter-tab {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  border-bottom: 0.25rem solid transparent;
  padding: var(--space-md) var(--space-lg);
  color: var(--color-muted-foreground);
  font-size: 0.875rem;
  font-weight: 800;
  text-decoration: none;
  transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease;
}

.record-filter-tab:hover {
  background: #ffffff;
  color: var(--color-foreground);
}

.record-filter-tab--current {
  border-bottom-color: var(--color-accent);
  color: var(--color-foreground);
}

.customer-search,
.history-filter-form {
  border: 1px solid var(--color-border);
  border-left: 0.3125rem solid var(--color-accent);
  border-radius: 0.75rem;
  padding: var(--space-xl);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.customer-results,
.customer-section {
  margin-top: var(--space-2xl);
}

.customer-results__heading,
.customer-section__heading {
  display: flex;
  min-width: 0;
  align-items: end;
  justify-content: space-between;
  gap: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.customer-results__heading h2,
.customer-section__heading h2,
.customer-section__heading p {
  margin-bottom: 0;
}

.customer-results__heading > span,
.customer-section__heading > span {
  flex: none;
  color: var(--color-muted-foreground);
  font-family: var(--font-utility);
  font-size: 0.75rem;
  font-weight: 700;
}

.customer-record-list,
.location-card-list,
.service-history-list {
  display: grid;
  gap: var(--space-xl);
  margin: 0;
  padding: 0;
  list-style: none;
}

.customer-record-card,
.location-history-card,
.service-history-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--color-border);
  border-top: 0.3125rem solid var(--color-primary);
  border-radius: 0.75rem;
  padding: var(--space-xl);
  background: #ffffff;
  box-shadow: var(--shadow-sm);
}

.customer-record-card__header,
.location-history-card__header,
.service-history-card__header,
.customer-detail-hero__title {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-lg);
}

.customer-record-card__header > div,
.location-history-card__header > div,
.service-history-card__header > div,
.customer-detail-hero__title h1 {
  min-width: 0;
}

.customer-record-card h3,
.location-history-card h3,
.service-history-card h3 {
  margin-bottom: var(--space-sm);
  overflow-wrap: anywhere;
  font-size: 1.25rem;
}

.customer-record-card h3 a,
.service-history-card__number a {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  color: inherit;
  text-underline-offset: 0.2em;
}

.customer-record-card__header .button {
  flex: none;
}

.status-badge--inactive {
  border-color: #777772;
  background: #ededeb;
  color: #3f3f3c;
}

.customer-contact-summary,
.customer-identity-list,
.location-contact-list,
.service-history-meta {
  display: grid;
  min-width: 0;
  gap: var(--space-lg);
  margin: var(--space-xl) 0 0;
}

.customer-contact-summary dt,
.customer-identity-list dt,
.location-contact-list dt,
.service-history-meta dt {
  color: var(--color-muted-foreground);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.customer-contact-summary dd,
.customer-identity-list dd,
.location-contact-list dd,
.service-history-meta dd {
  margin: var(--space-xs) 0 0;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
}

.record-stat-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin: var(--space-xl) 0 0;
  padding: 0;
  list-style: none;
}

.record-stat-list li {
  min-width: 0;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: var(--space-md) var(--space-lg);
  background: #f4f4f1;
  color: var(--color-muted-foreground);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.record-stat-list strong {
  color: var(--color-foreground);
}

.location-summary,
.access-note-details {
  margin-top: var(--space-xl);
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  background: #f7f7f5;
}

.location-summary summary,
.access-note-details summary {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  padding: var(--space-md) var(--space-lg);
  font-weight: 800;
  cursor: pointer;
}

.location-summary ul {
  display: grid;
  gap: var(--space-lg);
  margin: 0;
  border-top: 1px solid var(--color-border);
  padding: var(--space-lg);
  list-style: none;
  background: #ffffff;
}

.location-summary li {
  display: flex;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-md);
  overflow-wrap: anywhere;
}

.customer-empty {
  border: 1px dashed var(--color-border);
  border-radius: 0.75rem;
  padding: var(--space-2xl);
  background: #ffffff;
}

.customer-empty h3 {
  margin-bottom: var(--space-md);
}

.customer-empty p {
  margin-bottom: 0;
  color: var(--color-muted-foreground);
}

.customer-detail-hero {
  display: grid;
  min-width: 0;
  gap: var(--space-xl);
  border-top: 0.375rem solid var(--color-accent);
  padding: var(--space-2xl) var(--space-xl);
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.customer-detail-hero h1 {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  font-size: clamp(2rem, 10vw, 4rem);
}

.customer-detail-hero .eyebrow {
  color: #ff8b94;
}

.customer-detail-hero .status-badge {
  border-color: #696969;
  background: #252525;
  color: #ffffff;
}

.customer-detail-hero .status-badge--inactive {
  border-color: #b0b0ab;
  background: #ddddda;
  color: #20201e;
}

.customer-detail-hero .customer-identity-list dt {
  color: #bfbfbb;
}

.customer-detail-hero .customer-identity-list dd {
  color: #ffffff;
}

.customer-section {
  min-width: 0;
  scroll-margin-top: 5rem;
}

.location-history-card__header p,
.service-history-card__header p {
  margin-bottom: 0;
  overflow-wrap: anywhere;
  color: var(--color-muted-foreground);
  font-size: 0.875rem;
}

.location-history-card__actions {
  display: grid;
  min-width: 0;
  gap: var(--space-lg);
  margin-top: var(--space-lg);
}

.access-note-details {
  margin-top: 0;
}

.access-note-details p {
  margin: 0;
  border-top: 1px solid var(--color-border);
  padding: var(--space-lg);
  background: #ffffff;
  color: var(--color-foreground);
  overflow-wrap: anywhere;
}

.customer-service-history {
  margin-top: var(--space-3xl);
  border-top: 1px solid var(--color-border);
  padding-top: var(--space-2xl);
}

.history-filter-form {
  display: grid;
  min-width: 0;
  gap: var(--space-xl);
  margin-bottom: var(--space-xl);
}

.history-filter-form .form-field select,
.history-filter-form .form-field input {
  min-height: 2.75rem;
}

.history-filter-form .button {
  width: 100%;
}

.history-filter-summary {
  margin-bottom: var(--space-xl);
  border-left: 0.25rem solid var(--color-primary);
  padding: var(--space-lg);
  background: var(--color-muted);
}

.customer-service-history .history-notice {
  margin-bottom: var(--space-xl);
}

.service-history-card {
  border-top-color: var(--color-accent);
}

.service-history-card__number {
  margin-bottom: var(--space-sm);
  font-family: var(--font-utility);
  font-size: 0.8125rem;
  font-weight: 800;
}

.service-history-card__badges {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.service-history-copy {
  display: grid;
  min-width: 0;
  gap: var(--space-xl);
  margin-top: var(--space-xl);
  border-top: 1px solid var(--color-muted);
  padding-top: var(--space-xl);
}

.service-history-copy h4 {
  margin: 0 0 var(--space-md);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.service-history-copy p {
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.service-history-copy > div:last-child p {
  color: var(--color-muted-foreground);
}

.service-history-card__actions {
  display: grid;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}

.service-history-card__actions .button {
  width: 100%;
}

@media (min-width: 32rem) {
  .customer-contact-summary,
  .customer-identity-list,
  .location-contact-list,
  .service-history-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-filter-form .button {
    width: auto;
    justify-self: start;
  }
}

@media (min-width: 48rem) {
  .customer-history-shell {
    padding-top: var(--space-3xl);
  }

  .customer-detail-hero {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    padding: var(--space-3xl);
  }

  .location-card-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .history-filter-form {
    grid-template-columns: minmax(10rem, 0.8fr) minmax(10rem, 0.7fr) minmax(14rem, 1.5fr) auto;
    align-items: end;
  }

  .history-filter-form .button {
    width: auto;
  }

  .service-history-meta {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .service-history-copy {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (min-width: 64rem) {
  .customer-record-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .customer-record-card,
  .location-history-card,
  .service-history-card {
    padding: var(--space-2xl);
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
