:root {
  color-scheme: light;
  --ink: #090a08;
  --surface: #ffffff;
  --ice: #eef0e9;
  --ice-strong: #e1e4da;
  --muted: #555b50;
  --line: #b8bdb3;
  --lime: #c7ff00;
  --lime-soft: #eeffbc;
  --on-ink: #d5d9d0;
  --radius: 10px;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  font-family: "industry", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--ice);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  scroll-padding-top: 5.5rem;
  background: var(--ice);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--ice);
  font-size: 0.9375rem;
  line-height: 1.5;
}

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

button {
  min-height: 44px;
  border: 1px solid var(--ink);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  color: var(--ink);
  background: var(--lime);
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  transition: color 180ms ease, background-color 180ms ease, transform 150ms var(--ease-out);
}

button:active,
.primary-nav a:active,
.app-header a:active {
  transform: scale(0.97);
}

button:disabled {
  cursor: progress;
  opacity: 0.5;
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface);
}

:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
  box-shadow: none;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline-color: var(--ink);
}

[hidden] {
  display: none !important;
}

a {
  color: inherit;
}

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

h1,
h2,
h3,
h4 {
  margin-bottom: 0;
  color: var(--ink);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.375rem;
}

h3 {
  font-size: 1rem;
}

h4 {
  font-size: 0.9375rem;
}

.skip-link {
  position: fixed;
  z-index: 30;
  top: 0.5rem;
  left: 0.5rem;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--ink);
  background: var(--lime);
  font-weight: 700;
  transform: translateY(-160%);
  transition: transform 180ms var(--ease-out);
}

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

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  border-bottom: 1px solid #252a2a;
  padding: 0.65rem clamp(1rem, 3vw, 2rem);
  color: var(--surface);
  background: var(--ink);
}

.brand-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  transition: opacity 180ms ease, transform 150ms var(--ease-out);
}

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

.header-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Persistent messaging entry: one tap from anywhere to the customer chat. */
.chat-button {
  display: inline-flex;
  position: relative;
  min-width: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--lime);
  background: transparent;
  cursor: pointer;
}

.chat-badge {
  display: inline-flex;
  position: absolute;
  top: 2px;
  right: 0;
  min-width: 18px;
  height: 18px;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  padding: 0 0.25rem;
  color: var(--ink);
  background: var(--lime);
  font-size: 0.6875rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Punch list: the hamburger is just the three lines — no text, no pill. */
.menu-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  border: 0;
  border-radius: 8px;
  padding: 0;
  color: var(--lime);
  background: transparent;
  cursor: pointer;
}

/* Three bars that morph into a close cross while the menu is open. */
.menu-icon,
.menu-icon::before,
.menu-icon::after {
  display: block;
  width: 24px;
  height: 3px;
  border-radius: 1.5px;
  background: currentcolor;
  transition: transform 200ms var(--ease-out), opacity 150ms var(--ease-out);
}

.menu-icon {
  position: relative;
}

.menu-icon::before,
.menu-icon::after {
  position: absolute;
  left: 0;
  content: "";
}

.menu-icon::before {
  top: -8px;
}

.menu-icon::after {
  top: 8px;
}

body.nav-open .menu-icon {
  background: transparent;
  transition: background-color 0ms 90ms;
}

body.nav-open .menu-icon::before {
  transform: translateY(8px) rotate(45deg);
}

body.nav-open .menu-icon::after {
  transform: translateY(-8px) rotate(-45deg);
}

@media (prefers-reduced-motion: reduce) {
  .menu-icon,
  .menu-icon::before,
  .menu-icon::after {
    transition: none;
  }
}

main {
  width: min(100%, 96rem);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

.access-panel,
.state-panel {
  width: min(100%, 44rem);
  margin: clamp(1rem, 6vw, 4.5rem) auto 0;
  border: 0.15rem solid var(--ink);
  border-top: 0.5rem solid var(--lime);
  border-radius: 0.8rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--surface);
  box-shadow: 0.5rem 0.5rem 0 var(--ink);
}

.access-panel {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1.25rem 1.75rem;
}

.login-mark {
  grid-row: 1 / 4;
  align-self: center;
  width: 100%;
  height: auto;
}

.access-copy p,
.state-panel p,
.privacy-note {
  color: var(--muted);
}

.access-copy p {
  margin: 0.4rem 0 0;
}

.access-panel form {
  min-width: 0;
}

label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.8125rem;
  font-weight: 700;
}

.access-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid #8d9a99;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  color: var(--ink);
  background: var(--surface);
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

::placeholder {
  color: #596563;
  opacity: 1;
}

.form-error {
  margin: 0.65rem 0 0;
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 700;
}

.privacy-note {
  margin: 0;
  font-size: 0.75rem;
}

.state-panel {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr);
  align-items: center;
  gap: 1.25rem;
}

.state-mark {
  width: 100%;
  height: auto;
}

.state-panel p {
  margin: 0.5rem 0 0;
}

.state-actions,
.dashboard-actions,
.record-actions,
.detail-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.state-actions {
  margin-top: 1rem;
}

.app-shell {
  min-width: 0;
}

.sidebar {
  display: none;
  min-width: 0;
  margin-bottom: 1rem;
}

/* Phone: the nav opens as a full-height ink sheet in the landing language —
   big type, lime current page, Log out pinned at the bottom. A link tap
   closes it. */
body.nav-open .sidebar {
  display: flex;
  position: fixed;
  z-index: 30;
  top: 64px;
  right: 0;
  bottom: 0;
  left: 0;
  flex-direction: column;
  overflow-y: auto;
  margin: 0;
  padding: 1.25rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom));
  background: var(--ink);
  animation: menu-enter 220ms var(--ease-out);
}

@keyframes menu-enter {
  from {
    opacity: 0;
    transform: translateY(-0.6rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.nav-open .sidebar {
    animation: none;
  }
}

@media (max-width: 63.9375rem) {
  body.nav-open .primary-nav {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }

  body.nav-open .primary-nav a {
    min-height: 52px;
    color: var(--surface);
    font-size: 1.2rem;
  }

  body.nav-open .primary-nav .nav-icon {
    width: 1.35rem;
    height: 1.35rem;
  }

  body.nav-open .primary-nav a[aria-current="page"] {
    padding-left: 1.05rem;
    color: var(--lime);
    background: transparent;
    box-shadow: inset 0.3rem 0 0 var(--lime);
  }

  body.nav-open .primary-nav .nav-notifications {
    min-height: 48px;
    color: var(--on-ink);
    font-size: 1.05rem;
  }

  body.nav-open .sidebar-logout {
    min-height: 48px;
    margin-top: auto;
    border: 2px solid var(--surface);
    color: var(--surface);
    background: transparent;
  }

  body.nav-open .sidebar-financials {
    border-color: var(--surface);
    box-shadow: 0.24rem 0.24rem 0 rgb(255 255 255 / 35%);
  }
}

.primary-nav {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.35rem;
}

.primary-nav a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 44px;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 700;
  text-decoration: none;
  transition: color 180ms ease, background-color 180ms ease, transform 150ms var(--ease-out);
}

.nav-icon {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.primary-nav .nav-notifications {
  grid-column: 1 / -1;
}

.primary-nav a[aria-current="page"] {
  background: var(--lime);
}

.sidebar-financials {
  border: 0.12rem solid var(--ink);
  border-radius: 0.5rem;
  margin-top: 0.85rem;
  padding: 0.75rem;
  background: var(--surface);
  box-shadow: 0.24rem 0.24rem 0 var(--ink);
}

.sidebar-logout {
  width: 100%;
  margin-top: 0.65rem;
}

.workspace-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.icon-button {
  display: inline-flex;
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.quiet-icon-button {
  border: 0;
  color: var(--ink);
  background: transparent;
}

.sidebar-financials header,
.sidebar-financials dl div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.sidebar-financials h2 {
  font-size: 0.875rem;
}

.sidebar-financials header span,
.sidebar-financials dt,
.sidebar-financials p {
  color: var(--muted);
  font-size: 0.6875rem;
}

.sidebar-financials dl {
  display: grid;
  gap: 0.35rem;
  margin: 0.65rem 0 0;
}

.sidebar-financials dt,
.sidebar-financials dd {
  margin: 0;
}

.sidebar-financials dd {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
}

.sidebar-financials p {
  margin: 0.65rem 0 0;
  line-height: 1.35;
}

.sidebar-financials button {
  width: 100%;
  margin-top: 0.65rem;
}

.owner-workspace {
  min-width: 0;
}

.dashboard-heading {
  display: grid;
  grid-template-columns: minmax(10rem, 0.7fr) minmax(16rem, 1.3fr) auto;
  align-items: start;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.25rem;
}

.dashboard-heading > div:first-child {
  min-width: 0;
}

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

.global-search,
.global-search form {
  position: relative;
  display: block;
  min-width: 0;
}

.global-search input {
  border-color: var(--line);
  padding-inline: 0.9rem;
  background: var(--surface);
}

.global-search-results {
  position: absolute;
  z-index: 10;
  top: calc(100% + 0.35rem);
  right: 0;
  left: 0;
  max-height: min(28rem, 65vh);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.global-search-result {
  display: grid;
  width: 100%;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.15rem 0.65rem;
  min-height: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0.7rem 0.8rem;
  background: var(--surface);
  font-weight: 400;
  text-align: left;
  transform: none;
}

.global-search-result:last-child {
  border-bottom: 0;
}

.global-search-result-type {
  grid-row: 1 / 3;
  align-self: start;
  min-width: 5.5rem;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 700;
}

.global-search-result strong,
.global-search-result > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.global-search-result > span:last-child,
.global-search-empty {
  color: var(--muted);
  font-size: 0.75rem;
}

.global-search-empty {
  margin: 0;
  padding: 0.85rem;
}

.sync-status {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

/* Fixed toast: action feedback must stay visible however far the owner has
   scrolled — header-anchored status read as a silent failure on mobile. */
.action-status {
  position: fixed;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 80;
  width: max-content;
  max-width: min(92vw, 30rem);
  margin: 0;
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius);
  border-left: 5px solid var(--lime);
  background: var(--ink);
  color: var(--surface);
  box-shadow: 0 10px 30px rgb(11 14 14 / 0.35);
  font-size: 0.9375rem;
  font-weight: 700;
}

.action-status[data-state="error"] {
  border-left-color: #ff5a5a;
}

.workspace-group {
  min-width: 0;
  padding-top: 1.5rem;
}

.group-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

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

.group-heading p {
  max-width: 64ch;
  margin: 0.3rem 0 0;
  color: var(--muted);
  text-wrap: pretty;
}

.empty-overview {
  border-radius: 8px;
  margin-bottom: 0.75rem;
  padding: 0.75rem 0.9rem;
  background: var(--lime-soft);
  font-weight: 700;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 0.12rem solid var(--ink);
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0.3rem 0.3rem 0 var(--ink);
}

.metric {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.75rem;
}

.metric:nth-child(2n) {
  border-right: 0;
}

.metric:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.metric span {
  min-width: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.25;
}

.metric strong {
  flex: 0 0 auto;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.summary-note {
  margin: -0.4rem 0 1rem;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.analytics-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.analytics-toolbar label {
  width: 100%;
  margin: 0;
}

.analytics-toolbar select {
  width: auto;
  min-width: 10rem;
}

.analytics-message {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.analytics-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.analytics-tabs button {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.analytics-tabs button[aria-pressed="true"] {
  border-color: var(--ink);
  background: var(--lime);
}

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

.analytics-detail-metric,
.analytics-regional-card {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 0.9rem;
}

.analytics-detail-metric:nth-child(2n),
.analytics-regional-card:nth-child(2n) {
  border-right: 0;
}

.analytics-detail-metric span,
.analytics-regional-card span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.analytics-detail-metric strong,
.analytics-regional-card strong {
  display: block;
  margin-top: 0.35rem;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.analytics-regional-card p {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.analytics-split {
  display: grid;
  min-width: 0;
}

.analytics-drilldown {
  min-width: 0;
  border-top: 1px solid var(--line);
}

.analytics-drilldown h4 {
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 0.9rem;
  font-size: 0.875rem;
}

.analytics-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.analytics-table {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.analytics-table th,
.analytics-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.7rem 0.8rem;
  text-align: right;
  white-space: nowrap;
}

.analytics-table th:first-child,
.analytics-table td:first-child {
  max-width: 20rem;
  text-align: left;
  white-space: normal;
}

.analytics-table th {
  color: var(--muted);
  background: var(--ice);
  font-size: 0.6875rem;
  text-transform: none;
}

.analytics-table tbody tr:last-child td {
  border-bottom: 0;
}

.analytics-city-button {
  width: 100%;
  min-height: 44px;
  justify-content: flex-start;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: inherit;
  background: transparent;
  text-align: left;
}

.analytics-city-button[aria-pressed="true"] {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2rem;
}

.analytics-empty {
  margin: 0;
  padding: 1rem 0.9rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.analytics-live-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.analytics-live-list li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.4rem 1rem;
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0.9rem;
}

.analytics-live-list li:last-child {
  border-bottom: 0;
}

.analytics-live-list small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.service-funnel-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  border-bottom: 1px solid var(--line);
  padding: 0.9rem;
}

.service-funnel-filters label {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.service-funnel-filters select {
  grid-row: 2;
  width: 100%;
}

.service-funnel-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
}

.service-funnel-summary div {
  display: grid;
  gap: 0.2rem;
  border-right: 1px solid var(--line);
  padding: 0.9rem;
}

.service-funnel-summary div:last-child {
  border-right: 0;
}

.service-funnel-summary dt {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.service-funnel-summary dd {
  margin: 0;
  font-size: 1.25rem;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.service-funnel-errors {
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 0.7rem 0.9rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.report-block {
  display: grid;
  min-width: 0;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.report-block:last-child {
  margin-bottom: 0;
}

.report-heading {
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.75rem;
}

.report-heading p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.accounting-table-panel,
.accounting-warnings {
  min-width: 0;
}

.business-export,
.business-export-panel {
  min-width: 0;
}

.business-export-confirmation {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.65rem;
  align-items: start;
  margin: 0;
  line-height: 1.45;
}

.business-export-confirmation input {
  width: auto;
  margin: 0.2rem 0 0;
}

.business-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

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

.report-table {
  width: 100%;
  min-width: 32rem;
  border-collapse: collapse;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.report-table th,
.report-table td {
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.75rem;
  text-align: right;
  white-space: nowrap;
}

.report-table th:first-child,
.report-table td:first-child {
  text-align: left;
}

.report-table tbody tr:last-child td {
  border-bottom: 0;
}

.analytics-chart {
  min-height: 14rem;
  overflow-x: auto;
  padding: 1rem 0.9rem;
}

.analytics-bars {
  display: grid;
  min-width: max-content;
  grid-auto-flow: column;
  grid-auto-columns: minmax(2.5rem, 1fr);
  gap: 0.5rem;
  align-items: end;
}

.analytics-column {
  display: grid;
  min-width: 2.5rem;
  grid-template-rows: 1.25rem 8rem 1.25rem 1.75rem;
  gap: 0.3rem;
  text-align: center;
}

.analytics-column-value,
.analytics-request-count,
.analytics-column-label {
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.analytics-column-value {
  align-self: end;
}

.analytics-bar-track {
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-radius: 5px 5px 2px 2px;
  background: var(--ice);
}

.analytics-bar-fill {
  width: 100%;
  min-height: 2px;
  height: var(--analytics-height, 0%);
  background: var(--ink);
}

.analytics-request-count {
  min-height: 1.25rem;
  border-radius: 4px;
  color: var(--ink);
  background: var(--lime-soft);
  font-weight: 700;
}

.analytics-request-count:empty {
  background: transparent;
}

.analytics-column-label {
  align-self: start;
  color: var(--muted);
  white-space: nowrap;
}

.analytics-breakdown {
  margin: 0;
  padding: 0;
  list-style: none;
}

.analytics-breakdown li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0.9rem;
}

.analytics-breakdown li:last-child {
  border-bottom: 0;
}

.analytics-breakdown span {
  overflow-wrap: anywhere;
}

.analytics-breakdown strong {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.analytics-breakdowns .empty-state {
  margin: 0;
  padding: 0.9rem;
}

/* Landing card grammar: thick ink border, hard offset shadow, no blur. */
.operations-panel {
  min-width: 0;
  border: 0.12rem solid var(--ink);
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0.3rem 0.3rem 0 var(--ink);
}

.today-queue {
  display: grid;
}

.today-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--line);
  padding: 0.85rem 0.9rem;
}

.today-item:last-child {
  border-bottom: 0;
}

.today-item-copy,
.today-item-copy strong {
  min-width: 0;
}

.today-item-copy strong {
  display: block;
  margin-top: 0.2rem;
  overflow-wrap: anywhere;
  font-size: 0.9375rem;
}

.today-item-copy p {
  margin: 0.2rem 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-item-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.65rem;
  color: var(--muted);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.today-item-kind {
  border-radius: 5px;
  padding: 0.15rem 0.35rem;
  color: var(--ink);
  background: var(--ice-strong);
  font-weight: 700;
}

.today-item-open {
  min-width: 4.5rem;
}

.today-item-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
}

.today-empty {
  margin: 0;
  padding: 1.25rem 0.9rem;
}

.record-filter {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.record-filter button,
.customer-tabs button {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--surface);
}

.record-filter button[aria-pressed="true"],
.customer-tabs button[aria-pressed="true"] {
  background: var(--lime);
}

.record-filter span {
  flex: 0 0 auto;
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

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

.panel-heading,
.detail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.5rem;
  border-bottom: 1px solid var(--line);
  padding: 0.75rem 0.9rem;
}

.panel-heading h3,
.detail-heading h4 {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Collapsible panels: the heading toggles its panel body. */
.panel-heading:has(.panel-toggle) {
  justify-content: flex-start;
  cursor: pointer;
  user-select: none;
}

.panel-heading:has(.panel-toggle) h3 {
  margin-right: auto;
}

.panel-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  margin: -0.5rem -0.5rem -0.5rem 0;
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.panel-toggle::before {
  display: block;
  width: 9px;
  height: 9px;
  border-right: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  content: "";
  transform: translateY(-2px) rotate(225deg);
}

.operations-panel[data-collapsed="true"] > .panel-heading .panel-toggle::before {
  transform: translateY(-3px) rotate(45deg);
}

.operations-panel[data-collapsed="true"] > :not(.panel-heading) {
  display: none;
}

.operations-panel[data-collapsed="true"] > .panel-heading {
  border-bottom: 0;
}

.panel-heading > span,
.status-label {
  display: inline-flex;
  min-width: 1.75rem;
  min-height: 1.75rem;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0.25rem 0.45rem;
  color: var(--ink);
  background: var(--ice-strong);
  font-size: 0.6875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  text-transform: none;
}

.status-label[data-tone="active"] {
  background: var(--lime-soft);
}

.status-label[data-tone="failure"] {
  color: var(--surface);
  background: var(--ink);
}

.two-column {
  display: grid;
  gap: 1rem;
}

.record {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.9rem;
}

.record:last-child {
  border-bottom: 0;
}

.record-heading {
  min-height: 1.75rem;
  margin: 0;
  cursor: pointer;
}

.record[open] > .record-heading {
  margin-bottom: 0.75rem;
}

.record-title {
  overflow-wrap: anywhere;
  font-size: 0.9375rem;
  font-weight: 700;
}

.record-heading .status-label {
  float: right;
  margin-left: 0.75rem;
}

.action-record > .record-heading {
  cursor: default;
}

.job-record > summary.record-heading {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  list-style: none;
}

.job-record > summary.record-heading::-webkit-details-marker {
  display: none;
}

.job-record > summary .record-title {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.record-service {
  font-weight: 400;
  font-size: 0.875rem;
  color: var(--muted);
}

.job-record > summary .status-label {
  float: none;
  margin-left: auto;
  flex-shrink: 0;
}

.job-stage {
  padding: 0.25rem 0 0.75rem;
}

.job-stage + .job-stage {
  border-top: 2px solid var(--ink);
  margin-top: 0.5rem;
}

.job-stage-heading {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0.75rem 0 0.25rem;
  padding: 0 0.9rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.job-stage-track {
  display: inline-flex;
  align-items: center;
}

.job-stage-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--surface);
}

.job-stage-dot[data-fill="done"] {
  border-color: var(--ink);
  background: var(--ink);
}

.job-stage-dot[data-fill="current"] {
  border-color: var(--ink);
  background: var(--lime);
}

.job-stage-dot + .job-stage-dot {
  margin-left: 0.55rem;
  position: relative;
}

.job-stage-dot + .job-stage-dot::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 0.55rem;
  height: 2px;
  margin-top: -1px;
  background: var(--line);
}

.job-stage-dot[data-fill] + .job-stage-dot[data-fill]::before {
  background: var(--ink);
}

.job-stage-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: var(--ice-strong);
  color: var(--ink);
  font-size: 0.75rem;
  line-height: 1.4rem;
  font-variant-numeric: tabular-nums;
}

/* Inside a stage the rows separate by rhythm, not rules; the stage rule above
   carries the structural separation. */
.job-stage .record,
.job-stage .record:not(:last-child) {
  border-bottom: 0;
  border-right: 0;
}

.job-stage .job-record {
  border-radius: 10px;
  transition: background-color 150ms var(--ease-out);
}

.job-stage .job-record[open] {
  background: var(--ice);
}

.job-record > summary.record-heading:active {
  background: var(--ice-strong);
  border-radius: 10px;
}

.job-chevron {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 160ms var(--ease-out);
}

.job-record[open] > summary .job-chevron {
  transform: rotate(90deg);
  stroke: var(--ink);
}

.job-record > summary + * {
  animation: job-record-reveal 180ms var(--ease-out);
}

@keyframes job-record-reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .job-chevron,
  .job-stage .job-record {
    transition: none;
  }

  .job-record > summary + * {
    animation: none;
  }
}

.job-record > .facts,
.action-record > .facts {
  margin-top: 0.75rem;
}

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.65rem 1rem;
  margin: 0;
}

.facts div {
  min-width: 0;
}

.facts dt {
  margin-bottom: 0.15rem;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 700;
}

.facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
}

#customer-records-list .facts dd,
.job-information-group .facts dd {
  white-space: pre-wrap;
}

.record-note {
  margin: 0.75rem 0 0;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.8125rem;
  line-height: 1.45;
  text-wrap: pretty;
}

.job-information-groups {
  display: grid;
  gap: 0.75rem;
}

.job-information-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  background: var(--ice);
}

.job-information-heading {
  margin: 0 0 0.65rem;
  color: var(--ink);
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.record-actions,
.detail-actions {
  margin-top: 0.75rem;
}

.job-actions {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.job-details {
  min-width: 0;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
}

.job-details > summary {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.75rem 0;
  cursor: pointer;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  list-style: none;
}

.job-details > summary::-webkit-details-marker {
  display: none;
}

.job-details > summary .job-chevron {
  width: 0.85rem;
  height: 0.85rem;
}

.job-details[open] > summary .job-chevron {
  transform: rotate(90deg);
}

.job-details[open] > summary {
  margin-bottom: 0.75rem;
}

.job-action-group {
  min-width: 0;
}

.job-action-heading {
  margin: 0 0 0.4rem;
  color: var(--muted);
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.job-action-group .record-actions {
  margin-top: 0;
}

.record-actions button,
.detail-actions button {
  flex: 0 1 auto;
  min-height: 44px;
  padding: 0.6rem 1.1rem;
}

.job-utility-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.icon-action {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.action-icon {
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.job-status-block {
  min-width: 0;
}

.job-status-line {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.job-status-text {
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ink);
}

.job-status-text:empty {
  display: none;
}

.job-help-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
}

.job-help-button[aria-expanded="true"] {
  color: var(--ink);
  background: var(--ice-strong);
}

.job-status-help {
  margin: 0.35rem 0 0;
}

.job-inline-help {
  align-self: center;
}

.job-inline-help .job-status-help {
  flex: 1 0 100%;
}

.job-cancel-action {
  margin-left: auto;
  color: var(--muted);
}

/* A quiet alternative path inside a dialog: reads as a sentence, not a button. */
.link-action {
  display: block;
  margin-top: 0.75rem;
  padding: 0.5rem 0;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (hover: hover) and (pointer: fine) {
  .link-action:hover {
    color: var(--ink);
    background: transparent;
  }
}

.record-actions .invoice-link {
  display: inline-flex;
  min-height: 44px;
  flex: 1 1 9rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  color: var(--ink);
  background: var(--surface);
  font-size: 0.875rem;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

.record-actions .action-note {
  flex: 1 0 100%;
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.mail-in-carrier-choice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.mail-in-carrier-choice label {
  grid-column: 1 / -1;
  margin: 0;
}

.mail-in-carrier-choice button {
  min-width: 12rem;
}

.repair-request-photos {
  margin-top: 1rem;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}

.repair-request-photos h4 {
  margin-bottom: 0.65rem;
  font-size: 0.8125rem;
}

.repair-photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.repair-photo-link {
  display: block;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--ice);
}

.repair-photo-thumbnail {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.invoice-job-picker {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
}

.invoice-job-picker label {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin-top: 0.5rem;
}

.invoice-job-picker input {
  width: auto;
  margin-top: 0.15rem;
}

.invoice-pending-job {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

.invoice-pending-job span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.invoice-pending-job button {
  flex: 0 0 auto;
}

.detail-actions .takeover-control {
  flex: 0 1 auto;
}

.empty-state {
  margin: 0;
  padding: 1.25rem 0.9rem;
  color: var(--muted);
  font-size: 0.8125rem;
}

.conversation-workspace,
.customer-workspace {
  display: block;
  min-width: 0;
}

.list-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.9rem;
  background: var(--ice);
}

.list-toolbar label {
  margin: 0;
}

.list-toolbar select {
  width: auto;
  min-width: min(12rem, 70vw);
}

.email-lead-toolbar button {
  margin-left: auto;
}

.email-lead-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.email-lead-row:last-child {
  border-bottom: 0;
}

.email-lead-row .conversation-button {
  border-bottom: 0;
}

.email-lead-selection {
  width: 1.1rem;
  height: 1.1rem;
  align-self: center;
  margin: 0 0 0 0.9rem;
  accent-color: var(--ink);
}

.conversation-back {
  margin-left: auto;
}

.conversation-workspace[data-detail-open="true"] .conversation-list {
  display: none;
}

.customer-workspace[data-detail-open="true"] .customer-list {
  display: none;
}

.conversation-list,
.customer-list {
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

.conversation-button,
.customer-button {
  display: grid;
  width: 100%;
  border: 0;
  border-radius: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.8rem 0.9rem;
  text-align: left;
  background: var(--surface);
}

.conversation-button:last-child,
.customer-button:last-child {
  border-bottom: 0;
}

.conversation-button[aria-current="true"],
.customer-button[aria-current="true"] {
  background: var(--lime-soft);
}

.conversation-button strong,
.conversation-button span,
.customer-button strong,
.customer-button span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.conversation-button strong,
.customer-button strong {
  font-size: 0.875rem;
}

.conversation-button span,
.customer-button span {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 400;
  line-height: 1.35;
}

/* Standard SMS-app unread grammar: a lime dot in line with the customer name. */
.conversation-button .conversation-name-unread::before {
  content: '';
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.45rem;
  border: 0.09rem solid var(--ink);
  border-radius: 50%;
  background: var(--lime);
  vertical-align: 0.02rem;
}

/* The chat header is the customer's name; tapping it opens their record. */
.resistance-phase {
  margin-top: 0.85rem;
  border: 0.12rem solid var(--ink);
  border-radius: 0.5rem;
  padding: 0.75rem;
}

.resistance-phase legend {
  padding: 0 0.35rem;
  font-size: 0.8125rem;
  font-weight: 700;
}

.resistance-grid input {
  margin-top: 0.35rem;
}

.resistance-direction {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* The notifications toggle sits in the flat nav and reads like a nav link. */
.nav-notifications {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 44px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.conversation-title-link {
  margin: 0;
  border: 0;
  padding: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--lime);
  text-decoration-thickness: 0.14rem;
  text-underline-offset: 0.2rem;
}

.conversation-button .conversation-needs-reply {
  width: max-content;
  border-radius: 5px;
  padding: 0.15rem 0.35rem;
  color: var(--ink);
  background: var(--lime);
  font-weight: 700;
}

.conversation-detail,
.customer-detail {
  min-width: 0;
}

#conversation-detail-content {
  min-width: 0;
  min-height: 0;
}

.conversation-context summary {
  min-height: 44px;
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 2.75rem;
}

.conversation-context > .facts,
.conversation-context > .detail-actions {
  margin-top: 0.75rem;
}

.chat-transcript {
  min-height: 16rem;
  padding: 1rem 0.9rem;
  background: var(--ice);
}

.chat-message-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chat-message {
  display: flex;
  min-width: 0;
}

.chat-message-owner,
.chat-message-bot {
  justify-content: flex-end;
}

.chat-bubble {
  max-width: min(82%, 36rem);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
  background: var(--surface);
}

.chat-message-owner .chat-bubble {
  border-color: var(--lime);
  background: var(--lime-soft);
}

.chat-message-bot .chat-bubble {
  background: var(--ice-strong);
}

.chat-message[data-delivery-status="failed"] .chat-bubble,
.chat-message[data-delivery-status="undelivered"] .chat-bubble,
.chat-message[data-delivery-status="canceled"] .chat-bubble {
  border-color: var(--ink);
  border-width: 2px;
}

.chat-bubble p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-message-meta {
  display: block;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
}

.customer-back {
  margin-left: auto;
}

.customer-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  padding: 0.65rem 0.9rem;
  background: var(--ice);
}

.customer-tabs button {
  min-width: max-content;
  justify-content: center;
}

.customer-history-controls {
  display: flex;
  min-width: 0;
  align-items: end;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
}

.customer-history-filter {
  display: grid;
  min-width: 0;
  flex: 1 1 14rem;
  gap: 0.35rem;
}

.customer-history-filter select {
  width: 100%;
  min-width: 0;
}

.customer-history-actions {
  padding: 0 0.9rem 0.9rem;
}

.customer-metrics {
  border-width: 0 0 1px;
  border-radius: 0;
  margin-bottom: 0;
}

.customer-tab-list > .record:last-child {
  border-bottom: 0;
}

.customer-message,
.customer-notes > p {
  border-bottom: 1px solid var(--line);
  margin: 0;
  padding: 0.75rem 0;
}

.direct-message {
  min-width: 0;
  border-bottom: 1px solid var(--line);
  padding: 0.9rem;
}

.message-composer {
  position: sticky;
  z-index: 2;
  bottom: 0;
  border-top: 1px solid var(--line);
  border-bottom: 0;
  background: var(--surface);
}

.direct-message textarea {
  min-height: 4.5rem;
}

.direct-message button {
  width: 100%;
}

.customer-message:first-child,
.customer-notes > p:first-child {
  padding-top: 0;
}

.customer-message:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.customer-message strong,
.customer-message span {
  display: block;
}

.customer-message strong {
  font-size: 0.8125rem;
}

.customer-message span {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.6875rem;
}

.customer-message p,
.customer-notes p,
.customer-notes .related-record span {
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.customer-message p {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.detail-section {
  padding: 0.9rem;
}

.detail-section + .detail-section {
  border-top: 1px solid var(--line);
}

.detail-section h3,
.detail-section h4 {
  margin: 0 0 0.75rem;
  font-size: 0.8125rem;
  letter-spacing: 0;
}

.detail-section .metrics {
  margin-bottom: 0;
}

.related-records {
  display: grid;
  gap: 0.65rem;
}

.related-record {
  border-top: 1px solid var(--line);
  padding-top: 0.65rem;
}

.related-record:first-child {
  border-top: 0;
  padding-top: 0;
}

.related-record strong,
.related-record span {
  display: block;
  overflow-wrap: anywhere;
}

.related-record strong {
  margin-bottom: 0.2rem;
  font-size: 0.8125rem;
}

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

.timeline-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline-event {
  border-top: 1px solid var(--line);
  padding: 0.75rem 0;
}

.timeline-event:first-child {
  border-top: 0;
  padding-top: 0;
}

.timeline-event:last-child {
  padding-bottom: 0;
}

.timeline-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.65rem;
  margin-bottom: 0.3rem;
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 700;
}

.timeline-event p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.email-lead-body {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.settings-status {
  margin: 0;
  padding: 1rem 0.9rem;
  color: var(--muted);
}

.email-monitor-status {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  border-top: 1px solid var(--line);
  padding: 0.8rem 0.9rem;
}

.email-monitor-status strong {
  margin-left: auto;
  font-size: 0.8125rem;
}

.email-monitor-light {
  flex: 0 0 0.65rem;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  background: var(--line);
}

.email-monitor-status[data-state="healthy"] .email-monitor-light {
  background: #16803f;
}

.email-monitor-status[data-state="unhealthy"] .email-monitor-light {
  background: #c53030;
}

.settings-grid {
  margin-top: 1rem;
}

.settings-content {
  padding: 1rem 0.9rem;
}

.settings-content .settings-status {
  padding: 0;
}

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

.telegram-recovery-list {
  border-top: 1px solid var(--line);
  margin: 1rem -0.9rem -1rem;
}

.settings-note {
  margin: 0.85rem 0 0;
  color: var(--muted);
  font-size: 0.75rem;
}

.settings-actions {
  border-top: 1px solid var(--line);
  padding: 0.75rem 0.9rem;
}

.settings-actions .invoice-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.review-candidate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 0.9rem;
}

.review-candidate > .record-actions {
  grid-column: 1 / -1;
  width: 100%;
  margin-top: 0;
}

.review-candidate:last-child {
  border-bottom: 0;
}

.review-candidate input {
  width: 1.25rem;
  height: 1.25rem;
}

.review-candidate-copy {
  min-width: 0;
}

.review-candidate-copy strong,
.review-candidate-copy span {
  display: block;
  overflow-wrap: anywhere;
}

.review-candidate-copy span,
.review-selection-note,
.review-message {
  color: var(--muted);
  font-size: 0.8125rem;
}

.review-message-opening {
  font-weight: 700;
}

.review-message-locked {
  color: var(--muted);
}

.review-opening-editor {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.9rem;
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
}

.review-opening-editor label {
  color: var(--muted);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.review-opening-editor textarea {
  width: 100%;
  min-height: 4.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.6rem 0.7rem;
  color: var(--ink);
  background: var(--surface);
  font: inherit;
  font-size: 0.9375rem;
  resize: vertical;
}

.review-opening-counter {
  margin: 0;
  color: var(--muted);
  font-size: 0.8125rem;
}

.review-opening-editor .record-actions {
  margin-top: 0.25rem;
}

.review-batch-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-top: 1px solid var(--line);
  padding: 0.75rem 0.9rem;
}

.review-batch-actions p {
  margin: 0;
}

.review-preview-recipient {
  min-width: 0;
  border-top: 1px solid var(--line);
  margin-top: 1rem;
  padding-top: 1rem;
}

.review-preview-recipient h3 {
  font-size: 1rem;
}

.review-message {
  margin: 0.5rem 0 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

#tax-settings-form {
  display: grid;
  gap: 0.625rem;
  margin-top: 1rem;
}

#tax-registration-numbers {
  display: grid;
  gap: 0.625rem;
}

#tax-settings-review {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

#tax-settings-confirm {
  margin-top: 0.75rem;
}

.settings-actions button {
  width: auto;
}

dialog {
  width: min(calc(100% - 2rem), 36rem);
  max-height: calc(100vh - 3rem);
  border: 0.15rem solid var(--ink);
  border-top: 0.5rem solid var(--lime);
  border-radius: 0.8rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  overflow: auto;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0.5rem 0.5rem 0 var(--ink);
}

dialog.wide-dialog {
  width: min(calc(100% - 2rem), 52rem);
}

dialog.receipt-preview-dialog {
  width: min(calc(100% - 2rem), 64rem);
}

.receipt-preview-meta {
  display: grid;
  grid-template-columns: 1fr 2fr;
  margin: 1rem 0;
  border: 1px solid var(--line);
}

.receipt-preview-meta div {
  min-width: 0;
  padding: 0.85rem;
}

.receipt-preview-meta div + div {
  border-left: 1px solid var(--line);
}

.receipt-preview-meta dt {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.receipt-preview-meta dd {
  margin: 0.25rem 0 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

#receipt-preview-frame {
  display: block;
  width: 100%;
  height: min(62vh, 54rem);
  min-height: 32rem;
  border: 1px solid var(--line);
  background: var(--surface-muted);
}

.receipt-preview-confirm {
  margin-top: 1rem;
}

dialog::backdrop {
  background: rgb(9 10 8 / 78%);
  backdrop-filter: blur(4px);
}

dialog p {
  margin-top: 0.75rem;
  line-height: 1.5;
}

.dialog-grid {
  display: grid;
  gap: 0.85rem;
  margin-top: 1rem;
}

.dialog-grid > div {
  min-width: 0;
}

.dialog-grid-wide {
  grid-column: 1 / -1;
}

.estimate-lines {
  display: grid;
  gap: 1rem;
  margin: 1rem 0;
}

.estimate-line {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
}

.estimate-line legend {
  padding: 0 0.35rem;
  font-weight: 700;
}

.estimate-remove-line {
  width: auto;
  margin-top: 0.85rem;
}

.estimate-record .related-records {
  margin-top: 0.75rem;
}

.checkbox-label {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
}

.checkbox-label input {
  width: auto;
  min-height: 0;
  margin: 0;
}

.dialog-note {
  color: var(--muted);
  font-size: 0.75rem;
}

.dialog-total {
  font-size: 1rem;
  font-weight: 700;
}

.sms-preview {
  margin-top: 1rem;
  padding: 0.85rem;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  font-size: 0.8rem;
}

.sms-preview p {
  margin: 0.45rem 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#confirm-message {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

#confirm-submit[data-tone="danger"],
#incident-close-submit {
  color: var(--surface);
  background: var(--ink);
}

.dialog-actions {
  justify-content: flex-end;
  margin-top: 1rem;
}

.intake-promotion-actions button {
  flex: 1 1 12rem;
}

@media (hover: hover) and (pointer: fine) {
  button:hover,
  .primary-nav a:hover {
    background: var(--lime-soft);
  }

  .menu-button:hover {
    color: var(--ink);
    background: var(--lime);
  }

  .secondary-button:hover,
  #confirm-submit[data-tone="danger"]:hover,
  #incident-close-submit:hover {
    color: var(--surface);
    background: var(--ink);
  }

  .brand-link:hover {
    opacity: 0.82;
  }

  .conversation-button:hover,
  .customer-button:hover,
  .global-search-result:hover {
    background: var(--ice);
  }
}

@media (min-width: 38rem) {
  .primary-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .metric {
    border-bottom: 0;
  }

  .metric:nth-child(2n) {
    border-right: 1px solid var(--line);
  }

  .metric:nth-child(4n) {
    border-right: 0;
  }

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

  #orders-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .wide-list .record:nth-child(odd) {
    border-right: 1px solid var(--line);
  }

  #orders-list .record {
    border-right: 0;
  }

  .wide-list .record:last-child,
  .wide-list .record:nth-last-child(2):nth-child(odd) {
    border-bottom: 0;
  }

  #orders-list .record:not(:last-child) {
    border-bottom: 1px solid var(--line);
  }

  .record-filter {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .analytics-tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

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

  .analytics-detail-metric:nth-child(2n) {
    border-right: 1px solid var(--line);
  }

  .analytics-detail-metric:nth-child(3n) {
    border-right: 0;
  }

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

  .analytics-regional-card:nth-child(2n) {
    border-right: 1px solid var(--line);
  }

  .analytics-regional-card:nth-child(3n) {
    border-right: 0;
  }

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

@media (min-width: 64rem) {
  .app-shell {
    display: grid;
    grid-template-columns: 13.5rem minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
  }

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

  .review-candidate > .record-actions {
    grid-column: auto;
    width: auto;
  }

  .menu-button {
    display: none;
  }

  .sidebar,
  body.nav-open .sidebar {
    display: block;
    position: sticky;
    z-index: auto;
    top: 5.5rem;
    right: auto;
    left: auto;
    max-height: none;
    overflow-y: visible;
    border-bottom: 0;
    border-radius: var(--radius);
    padding: 0.65rem;
    background: var(--surface);
    box-shadow: none;
  }

  .primary-nav {
    grid-template-columns: 1fr;
  }

  .job-information-groups {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .job-information-group .facts {
    grid-template-columns: minmax(0, 1fr);
  }

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

  .conversation-workspace[data-detail-open="true"],
  .customer-workspace[data-detail-open="true"] {
    grid-template-columns: minmax(15rem, 0.8fr) minmax(0, 2fr);
    display: grid;
  }

  .conversation-workspace[data-detail-open="true"] .conversation-list,
  .customer-workspace[data-detail-open="true"] .customer-list {
    display: block;
  }

  .conversation-list,
  .customer-list {
    max-height: 46rem;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .conversations-panel .conversation-detail {
    display: flex;
    max-height: 46rem;
    flex-direction: column;
    overflow: hidden;
  }

  #conversation-detail-content {
    overflow-y: auto;
  }

}

@media (max-width: 48rem) {
  .email-lead-toolbar {
    flex-wrap: wrap;
  }

  .email-lead-toolbar button {
    width: 100%;
    margin-left: 0;
  }

  /* Customer messages become compact rows on the phone: name + status only,
     the conversation itself opens on tap. */
  .conversations-panel .conversation-button {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: 0.6rem;
  }

  .conversations-panel .conversation-button span:nth-of-type(n + 2) {
    display: none;
  }

  .conversations-panel .conversation-button span:first-of-type {
    margin-top: 0;
    margin-left: auto;
  }

  #inbox .conversation-workspace[data-detail-open="true"] .conversation-detail {
    position: fixed;
    z-index: 40;
    inset: 0;
    display: flex;
    width: 100%;
    height: 100dvh;
    max-width: 100vw;
    flex-direction: column;
    overflow: hidden;
    padding-top: env(safe-area-inset-top);
    background: var(--surface);
  }

  #inbox .conversation-detail > .detail-heading {
    display: grid;
    flex: 0 0 auto;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 0.65rem;
    background: var(--surface);
  }

  #inbox .conversation-detail > .detail-heading h4 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #conversation-detail-content {
    flex: 1 1 auto;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .chat-transcript {
    min-height: 45dvh;
  }

  .message-composer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    padding-bottom: max(0.9rem, env(safe-area-inset-bottom));
  }

  .message-composer label,
  .message-composer .dialog-note {
    grid-column: 1 / -1;
    margin: 0;
  }

  .message-composer label {
    grid-row: 1;
  }

  .message-composer .dialog-note {
    grid-row: 3;
  }

  .message-composer textarea {
    grid-row: 2;
    height: 3.25rem;
    min-height: 3.25rem;
    resize: none;
  }

  .message-composer button {
    grid-column: 2;
    grid-row: 2;
    width: auto;
  }
}

@media (max-width: 35rem) {
  .service-funnel-filters,
  .service-funnel-summary {
    grid-template-columns: 1fr;
  }

  .service-funnel-filters select {
    grid-row: auto;
  }

  .service-funnel-summary div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .service-funnel-summary div:last-child {
    border-bottom: 0;
  }

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

  main {
    padding: 1rem;
  }

  .access-panel,
  .state-panel {
    grid-template-columns: 1fr;
  }

  .login-mark,
  .state-mark {
    grid-row: auto;
    width: 5.5rem;
  }

  .access-controls,
  .dashboard-heading {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .today-item-actions {
    width: 100%;
  }

  .today-item-actions button {
    flex: 1 1 auto;
    width: auto;
  }

  .dashboard-actions,
  .dashboard-actions button,
  .state-actions,
  .state-actions button {
    width: 100%;
  }

  .record-actions button:not(.icon-action):not(.job-help-button),
  .record-actions .invoice-link,
  .detail-actions button,
  .mail-in-carrier-choice button {
    width: 100%;
    flex-basis: 100%;
  }

  /* Icon chips stay compact rows even on phones. */
  .record-actions .icon-action {
    flex: 1 1 auto;
  }

  .mail-in-carrier-choice {
    grid-template-columns: 1fr;
  }

  .review-batch-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .review-batch-actions button,
  .settings-actions .invoice-link {
    width: 100%;
    justify-content: center;
  }

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

  .record-heading {
    align-items: flex-start;
  }

  .customer-history-controls,
  .customer-history-actions,
  .customer-history-actions button {
    width: 100%;
  }

  .receipt-preview-meta {
    grid-template-columns: 1fr;
  }

  .receipt-preview-meta div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  #receipt-preview-frame {
    height: 60vh;
    min-height: 28rem;
  }
}

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

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