/*
 * Responsive contract
 * compact: <= 620px | narrow: <= 760px | shell: <= 860px
 * content: <= 980px | wide: <= 1180px
 * JavaScript mirrors these names in assets/app.js. Component-specific
 * breakpoints must be documented in docs/responsive-contract.md.
 */
:root {
  --font-sans: "Inter", "Aptos", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "Cascadia Code", "SFMono-Regular", Consolas, Monaco, monospace;
  --ink: #142033;
  --muted: #647083;
  --line: #dce4ee;
  --paper: #ffffff;
  --surface: #f6f8fb;
  --surface-warm: #eef3f7;
  --surface-raised: rgba(255, 255, 255, 0.82);
  --charcoal: #101722;
  --charcoal-2: #182233;
  --red: #0d6ec6;
  --red-dark: #084985;
  --gold: #b88a35;
  --green: #20725c;
  --blue: #245e83;
  --teal: #16837a;
  --danger: #b42318;
  --danger-soft: #fff0ec;
  --focus: rgba(13, 110, 198, 0.2);
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --shadow: 0 22px 60px rgba(17, 27, 43, 0.18);
  --shadow-soft: 0 12px 34px rgba(18, 32, 51, 0.09);
  --shadow-hairline: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82) 0%, rgba(246, 248, 251, 0.96) 38%, var(--surface-warm) 100%),
    repeating-linear-gradient(90deg, rgba(20, 32, 51, 0.025) 0 1px, transparent 1px 72px);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  font-feature-settings: "cv02", "cv03", "cv04", "ss01";
  text-rendering: optimizeLegibility;
}

body::before {
  position: fixed;
  z-index: 120;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: linear-gradient(90deg, var(--red), var(--teal), var(--gold));
  content: "";
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: opacity 0.16s ease, transform 0.34s ease;
}

body.is-soft-loading::before {
  opacity: 1;
  transform: scaleX(0.82);
}

a {
  color: inherit;
}

@keyframes content-enter {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes chart-fill {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

code,
pre,
.token-box,
.blog-editor-main textarea[name="content"] {
  font-family: var(--font-mono);
}

button,
.button,
input,
select,
textarea {
  touch-action: manipulation;
}

.auth-body {
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(8, 73, 133, 0.94) 0%, rgba(16, 23, 34, 0.96) 52%, rgba(22, 131, 122, 0.9) 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 86px);
}

.auth-shell {
  width: min(460px, 100%);
}

.auth-panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 38px);
  backdrop-filter: blur(18px);
}

.auth-panel h1,
.topbar h1,
.panel h2 {
  margin: 0;
  line-height: 1.1;
}

.auth-panel h1 {
  font-size: 2.7rem;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--red);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.stacked-form,
.form-grid {
  display: grid;
  gap: 14px;
}

.stacked-form {
  margin-top: 22px;
}

.auth-links {
  margin-top: 16px;
  text-align: center;
}

.auth-links a {
  color: var(--red-dark);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.auth-links a:hover {
  text-decoration: underline;
}

.payment-public-shell {
  width: min(720px, 100%);
}

.payment-public-panel {
  display: grid;
  gap: 16px;
}

.payment-public-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.payment-public-summary div {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  box-shadow: var(--shadow-hairline);
}

.payment-public-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.payment-public-summary strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.stacked-form.compact {
  margin-top: 0;
}

.form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.field-group {
  display: grid;
  gap: 7px;
}

.field-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
  box-shadow: var(--shadow-hairline);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--red);
  background: #fff;
  box-shadow: 0 0 0 3px var(--focus);
}

a:focus-visible,
button:focus-visible,
.button:focus-visible,
.section-tab:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.native-searchable-select {
  position: absolute;
  width: 1px;
  min-height: 1px;
  margin: 0;
  border: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.searchable-select {
  position: relative;
  min-width: 0;
}

.searchable-select::after {
  position: absolute;
  top: 18px;
  right: 14px;
  width: 0;
  height: 0;
  border-right: 5px solid transparent;
  border-left: 5px solid transparent;
  border-top: 6px solid var(--muted);
  content: "";
  pointer-events: none;
}

.searchable-select-input {
  padding-right: 34px;
}

.searchable-select-list {
  position: absolute;
  z-index: 35;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: min(280px, 54vh);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  padding: 6px;
  backdrop-filter: blur(14px);
}

.searchable-select-option {
  display: block;
  width: 100%;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
  cursor: pointer;
}

.searchable-select-option:hover,
.searchable-select-option:focus-visible,
.searchable-select-option.is-active {
  background: #eef6fb;
  outline: none;
}

.searchable-select-option[aria-selected="true"] {
  color: var(--red-dark);
  font-weight: 900;
}

.searchable-select-empty {
  color: var(--muted);
  padding: 10px;
  font-weight: 800;
}

.span-2 {
  grid-column: span 2;
}

.form-actions {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 68px;
}

.field-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  align-items: end;
  gap: 8px;
  min-width: 0;
}

.field-with-action label {
  min-width: 0;
}

.add-client-button {
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  font-size: 1.4rem;
  line-height: 1;
}

.form-message {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f9fc;
  color: var(--muted);
  padding: 10px 12px;
  font-weight: 800;
}

.form-message[data-message-type="error"] {
  border-color: rgba(190, 44, 36, 0.28);
  background: #fff1f0;
  color: var(--red-dark);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border: 1px solid rgba(185, 198, 214, 0.92);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 9px 14px;
  font-size: 0.9rem;
  font-weight: 760;
  text-decoration: none;
  cursor: pointer;
  box-shadow: var(--shadow-hairline), 0 1px 2px rgba(18, 32, 51, 0.04);
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.button:hover {
  border-color: rgba(13, 110, 198, 0.38);
  background: #fff;
  box-shadow: var(--shadow-hairline), 0 8px 18px rgba(18, 32, 51, 0.08);
  transform: translateY(-1px);
}

.button.is-disabled {
  cursor: not-allowed;
  opacity: 0.58;
  pointer-events: none;
}

.button.primary {
  border-color: var(--red-dark);
  background: var(--red);
  color: #fff;
  box-shadow: var(--shadow-hairline), 0 10px 20px rgba(13, 110, 198, 0.2);
}

.button.primary:hover {
  background: var(--red-dark);
}

.button.danger {
  border-color: #efb3a9;
  background: var(--danger-soft);
  color: var(--danger);
}

.button.danger:hover {
  border-color: var(--danger);
  background: #ffe2dc;
}

.button.ghost {
  background: rgba(255, 255, 255, 0.56);
  box-shadow: none;
}

.button.small {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.bizos-ai-bubble {
  position: fixed;
  z-index: 72;
  right: 22px;
  bottom: 22px;
  width: 56px;
  height: 56px;
  border: 1px solid rgba(13, 110, 198, 0.32);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--red), #0d6ec6);
  color: #fff;
  font-weight: 950;
  letter-spacing: 0;
  box-shadow: 0 18px 38px rgba(18, 32, 51, 0.24);
  cursor: pointer;
}

.bizos-ai-bubble:hover {
  transform: translateY(-2px);
}

.bizos-voice-bubble {
  align-items: center;
  background: linear-gradient(135deg, #075ca8, #0f9f70);
  border: 1px solid rgba(7, 92, 168, 0.38);
  border-radius: 999px;
  bottom: 22px;
  box-shadow: 0 18px 38px rgba(18, 32, 51, 0.24);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 900;
  gap: 7px;
  height: 56px;
  justify-content: center;
  padding: 0 17px;
  position: fixed;
  right: 90px;
  z-index: 72;
}

.bizos-voice-bubble:hover {
  transform: translateY(-2px);
}

.bizos-voice-bubble[aria-pressed="true"] {
  background: linear-gradient(135deg, #0b704f, #0f9f70);
  box-shadow: 0 0 0 4px rgba(15, 159, 112, 0.16), 0 18px 38px rgba(18, 32, 51, 0.24);
}

.bizos-voice-bubble-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.bizos-ai-sidecar {
  position: fixed;
  z-index: 140;
  top: 18px;
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  width: min(420px, calc(100vw - 24px));
  min-width: min(340px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  border: 1px solid rgba(185, 198, 214, 0.82);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 24px 70px rgba(18, 32, 51, 0.28);
  overflow: hidden;
}

.bizos-ai-sidecar-resize {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -4px;
  width: 10px;
  border: 0;
  background: transparent;
  cursor: ew-resize;
  padding: 0;
  z-index: 2;
}

.bizos-ai-sidecar-resize::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 4px;
  width: 2px;
  height: 58px;
  border-radius: 999px;
  background: rgba(13, 110, 198, 0.24);
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity 0.16s ease, background 0.16s ease;
}

.bizos-ai-sidecar:hover .bizos-ai-sidecar-resize::after,
.bizos-ai-sidecar.is-resizing .bizos-ai-sidecar-resize::after {
  opacity: 1;
}

.bizos-ai-sidecar.is-resizing .bizos-ai-sidecar-resize::after {
  background: rgba(13, 110, 198, 0.75);
}

body.bizos-ai-resizing {
  cursor: ew-resize;
  user-select: none;
}

.bizos-ai-sidecar[hidden] {
  display: none;
}

.bizos-ai-sidecar-head,
.bizos-ai-sidecar-actions,
.bizos-ai-prompt {
  border-bottom: 1px solid var(--line);
  padding: 14px;
}

.bizos-ai-sidecar-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.bizos-ai-sidecar-head strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
}

.bizos-ai-sidecar-body {
  display: flex;
  flex-direction: column;
  align-content: start;
  gap: 12px;
  min-width: 0;
  overflow: auto;
  padding: 16px;
}

.bizos-ai-sidecar-body p,
.bizos-ai-sidecar-body ul,
.bizos-ai-sidecar-body ol {
  margin: 0;
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.55;
}

.bizos-ai-sidecar-body ul,
.bizos-ai-sidecar-body ol {
  padding-left: 20px;
}

.bizos-ai-sidecar-body h3,
.bizos-ai-sidecar-body h4 {
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.3;
  margin: 4px 0 2px;
}

.bizos-ai-sidecar-body code {
  background: rgba(20, 32, 51, 0.07);
  border-radius: 5px;
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 1px 4px;
}

.bizos-ai-message {
  display: grid;
  gap: 5px;
  max-width: 96%;
  min-width: 0;
}

.bizos-ai-message.from-user {
  align-self: flex-end;
  justify-items: end;
  max-width: 88%;
}

.bizos-ai-message.from-ai {
  align-self: flex-start;
}

.bizos-ai-message-label {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bizos-ai-message-body {
  background: rgba(246, 248, 251, 0.94);
  border: 1px solid rgba(31, 41, 55, 0.09);
  border-radius: 8px;
  display: grid;
  gap: 9px;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 11px 12px;
}

.bizos-ai-message-body h3,
.bizos-ai-message-body h4 {
  font-size: 0.94rem;
  line-height: 1.35;
  margin: 5px 0 0;
}

.bizos-ai-message-body hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 5px 0;
  width: 100%;
}

.bizos-ai-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.bizos-ai-message-body table {
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 100%;
}

.bizos-ai-message-body th,
.bizos-ai-message-body td {
  border: 1px solid var(--line);
  padding: 6px 7px;
  text-align: left;
  vertical-align: top;
}

.bizos-ai-message.from-user .bizos-ai-message-body {
  background: rgba(13, 110, 198, 0.12);
  border-color: rgba(13, 110, 198, 0.22);
}

.bizos-ai-muted {
  color: var(--muted) !important;
}

.bizos-ai-error {
  color: var(--danger) !important;
}

.bizos-ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}

.bizos-ai-loading span {
  display: inline-block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(13, 110, 198, 0.18);
  border-top-color: var(--red);
  border-radius: 999px;
  animation: bizos-ai-loading-spin 0.8s linear infinite;
  will-change: transform;
}

@keyframes bizos-ai-loading-spin {
  to {
    transform: rotate(1turn);
  }
}

.bizos-ai-response-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  padding-top: 4px;
}

.bizos-ai-response-actions .button {
  flex: 1 1 132px;
  justify-content: center;
}

.bizos-ai-response-status {
  flex: 1 0 100%;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.bizos-ai-sidecar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.bizos-ai-sidecar-actions[hidden],
.bizos-ai-sidecar-actions > [hidden] {
  display: none !important;
}

.bizos-ai-prompt {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
  background: rgba(246, 248, 251, 0.92);
}

.bizos-ai-prompt-utilities {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.bizos-ai-context-toggle {
  display: flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
}

.bizos-ai-context-toggle input {
  width: auto;
  min-height: auto;
}

.bizos-ai-open-chat {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 9px;
  font-size: 0.72rem;
  line-height: 1.1;
  white-space: nowrap;
}

.bizos-ai-prompt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
  align-items: end;
}

.bizos-ai-prompt-row textarea {
  min-height: 48px;
  max-height: 132px;
  overflow-y: hidden;
  resize: none;
}

.bizos-ai-composer-actions {
  display: grid;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 4px;
  height: var(--bizos-ai-composer-height, 48px);
}

.bizos-ai-voice-launch,
.bizos-ai-send {
  width: 46px;
  min-width: 46px;
  min-height: 0;
  padding: 0;
}

.bizos-ai-voice-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(7, 92, 168, 0.48);
  background: linear-gradient(135deg, #075ca8, #0f9f70);
  color: #fff;
}

.bizos-ai-voice-launch:hover,
.bizos-ai-voice-launch[aria-pressed="true"] {
  border-color: rgba(15, 159, 112, 0.72);
  background: linear-gradient(135deg, #0b704f, #0f9f70);
  color: #fff;
}

.button.wide {
  width: 100%;
}

.booking-hero {
  align-items: center;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.booking-hero h2 {
  margin: 0;
}

.booking-hero p {
  color: var(--muted);
  margin: 6px 0 0;
  max-width: 760px;
}

.booking-hero-metrics {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(90px, 1fr));
}

.booking-hero-metrics div {
  background: rgba(13, 110, 198, 0.07);
  border: 1px solid rgba(13, 110, 198, 0.12);
  border-radius: 8px;
  padding: 12px;
}

.booking-hero-metrics strong {
  color: var(--ink);
  display: block;
  font-size: 1.45rem;
  line-height: 1;
}

.booking-hero-metrics span,
.booking-card-grid span,
.booking-public-details dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.booking-layout {
  align-items: start;
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
}

.booking-main,
.booking-side,
.booking-form,
.booking-card-list,
.booking-service-grid,
.booking-toggle-list {
  display: grid;
  gap: 14px;
}

.booking-card {
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(31, 41, 55, 0.1);
  border-radius: 8px;
  display: grid;
  grid-template-columns: 6px minmax(0, 1fr);
  overflow: hidden;
}

.booking-card-stripe {
  min-height: 100%;
}

.booking-card-body {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.booking-card-head {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.booking-card-head h3,
.booking-service-card h3,
.booking-public-card h2,
.booking-public-card h3 {
  margin: 0;
}

.booking-card-head p,
.booking-card-note,
.booking-service-card p,
.booking-public-card p {
  color: var(--muted);
  margin: 4px 0 0;
}

.booking-card-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.booking-card-grid div {
  background: rgba(246, 248, 251, 0.92);
  border: 1px solid rgba(31, 41, 55, 0.07);
  border-radius: 8px;
  padding: 10px;
}

.booking-card-grid strong {
  color: var(--ink);
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.booking-card-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.booking-form label {
  display: grid;
  gap: 6px;
}

.booking-form-row {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.booking-toggle-list {
  background: rgba(246, 248, 251, 0.92);
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 8px;
  padding: 10px;
}

.booking-toggle-list label {
  align-items: center;
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.booking-toggle-list input[type="checkbox"] {
  width: auto;
}

.booking-service-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.booking-service-card {
  background: rgba(246, 248, 251, 0.88);
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 14px;
}

.booking-service-color {
  border-radius: 999px;
  height: 10px;
  width: 56px;
}

.booking-service-card dl,
.booking-public-details {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.booking-service-card dt,
.booking-public-details dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.booking-service-card dd,
.booking-public-details dd {
  color: var(--ink);
  font-weight: 800;
  margin: 2px 0 0;
}

.booking-service-edit {
  border-top: 1px solid rgba(31, 41, 55, 0.08);
  padding-top: 10px;
}

.booking-service-edit summary {
  color: var(--red);
  cursor: pointer;
  font-weight: 900;
}

.booking-form.compact {
  margin-top: 12px;
}

.portal-booking-panel {
  border-top: 3px solid rgba(13, 110, 198, 0.72);
}

.booking-public-body {
  background:
    linear-gradient(180deg, rgba(13, 110, 198, 0.08), rgba(181, 138, 58, 0.06)),
    #f6f8fb;
  color: var(--ink);
  min-height: 100vh;
}

.booking-public-shell {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: 1120px;
  padding: clamp(18px, 4vw, 48px);
}

.booking-public-hero {
  padding: 18px 0;
}

.booking-public-hero h1 {
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 1;
  margin: 0;
}

.booking-public-hero p {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 680px;
}

.booking-public-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
}

.public-funnel-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.public-stepper {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}

.public-stepper span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.76);
  color: var(--muted);
  padding: 7px 11px;
  font-size: 0.84rem;
  font-weight: 900;
}

.public-stepper span.is-active {
  border-color: var(--red-dark);
  background: var(--red);
  color: #fff;
}

.booking-public-card {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(31, 41, 55, 0.1);
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(18, 32, 51, 0.12);
  display: grid;
  gap: 14px;
  padding: clamp(16px, 3vw, 24px);
}

.public-flow-summary {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 18px;
}

.public-flow-summary h2 {
  margin: 0;
  font-size: clamp(1.1rem, 2.4vw, 1.45rem);
  line-height: 1.15;
}

.public-flow-summary p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 750;
}

.booking-slot-list {
  display: grid;
  gap: 8px;
}

.booking-slot-source,
.booking-slot-selected {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
  margin: -2px 0 10px;
}

.booking-slot-selected {
  color: var(--ink);
  font-weight: 800;
  margin: 10px 0 0;
  min-height: 1.3em;
}

.booking-slot-list button {
  background: rgba(13, 110, 198, 0.08);
  border: 1px solid rgba(13, 110, 198, 0.16);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font-weight: 850;
  padding: 10px 12px;
  text-align: left;
}

.booking-slot-list button:hover {
  background: rgba(13, 110, 198, 0.14);
}

.booking-slot-list button.is-selected {
  background: rgba(47, 107, 87, 0.16);
  border-color: rgba(47, 107, 87, 0.48);
  box-shadow: inset 3px 0 0 rgba(47, 107, 87, 0.9);
}

.booking-honeypot {
  left: -9999px;
  position: absolute;
}

.notice {
  margin: 16px 0;
  border: 1px solid #dccba3;
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  background: #fff8e9;
  color: #5f4820;
  padding: 12px 14px;
  font-weight: 700;
}

.notice[data-flash-notice] {
  max-height: 220px;
  overflow: hidden;
  transition: opacity 0.28s ease, transform 0.28s ease, margin 0.28s ease, padding 0.28s ease, max-height 0.28s ease;
}

.notice[data-flash-notice].is-dismissing {
  max-height: 0;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-6px);
}

.notice.compact {
  margin: 12px 0 0;
}

.notice.success {
  border-color: #9fc7ae;
  border-left-color: var(--green);
  background: #edf8f0;
  color: #174c33;
}

.notice.danger {
  border-color: #efb3a9;
  border-left-color: var(--danger);
  background: var(--danger-soft);
  color: #7a2017;
}

.visualizer-shell {
  max-width: 1060px;
}

.visualizer-form {
  gap: 16px;
}

.visualizer-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.visualizer-upload {
  position: relative;
  overflow: hidden;
  border: 1px dashed rgba(31, 41, 55, 0.28);
  border-radius: 8px;
  background: rgba(13, 110, 198, 0.05);
  padding: 16px;
}

.visualizer-upload::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(47, 107, 87, 0.12), rgba(197, 138, 58, 0.12));
  opacity: 0;
  transition: opacity 180ms ease;
}

.visualizer-upload:focus-within::before {
  opacity: 1;
}

.visualizer-upload label,
.visualizer-upload small {
  position: relative;
  z-index: 1;
}

.visualizer-upload-wide {
  grid-column: 1 / -1;
}

.visualizer-upload small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 700;
}

.visualizer-upload input[type="file"] {
  width: 100%;
  min-height: 46px;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.visualizer-form.is-submitting {
  pointer-events: none;
  opacity: 0.72;
}

.visualizer-loading[hidden] {
  display: none;
}

.visualizer-loading {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 18px;
  min-height: 100dvh;
  padding: 24px;
  color: #f8fafc;
  text-align: center;
  background:
    radial-gradient(circle at 50% 36%, rgba(47, 107, 87, 0.92), transparent 0 170px),
    rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(12px);
}

.visualizer-loading strong {
  font-size: clamp(1.45rem, 4vw, 2.4rem);
  line-height: 1.05;
}

.visualizer-loading p {
  max-width: 420px;
  margin: 0;
  color: rgba(248, 250, 252, 0.82);
  font-weight: 750;
}

.visualizer-loading-orbit {
  position: relative;
  width: 104px;
  height: 104px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
  animation: visualizerSpin 1500ms linear infinite;
}

.visualizer-loading-orbit::before {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
}

.visualizer-loading-orbit span {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f8fafc;
  box-shadow: 0 0 24px rgba(255, 255, 255, 0.72);
}

.visualizer-loading-orbit span:nth-child(1) {
  top: -8px;
  left: calc(50% - 8px);
}

.visualizer-loading-orbit span:nth-child(2) {
  right: 8px;
  bottom: 12px;
  background: #c58a3a;
}

.visualizer-loading-orbit span:nth-child(3) {
  bottom: 12px;
  left: 8px;
  background: #7dd3fc;
}

@keyframes visualizerSpin {
  to {
    transform: rotate(360deg);
  }
}

.visualizer-disclaimer {
  border-left: 4px solid var(--gold);
  padding: 10px 12px;
  background: #fff8e9;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 750;
}

.visualizer-result-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 22px;
  align-items: start;
}

.visualizer-result-media {
  overflow: hidden;
  border: 1px solid rgba(31, 41, 55, 0.1);
  border-radius: 8px;
  background: #111827;
}

.visualizer-result-media img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.visualizer-result-copy {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.visualizer-result-copy h2 {
  color: var(--ink);
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1;
}

.visualizer-assumptions {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-weight: 750;
}

.visualizer-chat {
  display: grid;
  gap: 16px;
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid rgba(31, 41, 55, 0.12);
}

.visualizer-chat-log {
  display: grid;
  gap: 10px;
}

.visualizer-chat-message {
  max-width: min(720px, 88%);
  padding: 12px 14px;
  border: 1px solid rgba(31, 41, 55, 0.1);
  border-radius: 8px;
  background: #f8fafc;
}

.visualizer-chat-message.is-ai {
  justify-self: end;
  background: rgba(47, 107, 87, 0.08);
}

.visualizer-chat-message strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
}

.visualizer-chat-message p {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
}

.visualizer-revision-form {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(31, 41, 55, 0.12);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.72);
}

.visualizer-revision-form .button {
  justify-self: start;
}

/* Public project preview / RFP experience */
.booking-public-body {
  position: relative;
  overflow-x: hidden;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.74) 0 38%, rgba(232, 240, 248, 0.42) 38% 62%, rgba(255, 244, 224, 0.56) 62% 100%),
    linear-gradient(180deg, #eef6f8 0%, #f8fafc 46%, #fff7ea 100%);
}

.booking-public-body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(13, 110, 198, 0.08) 1px, transparent 1px),
    linear-gradient(180deg, rgba(47, 107, 87, 0.07) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.78), transparent 76%);
}

.booking-public-body::after {
  content: "";
  position: fixed;
  inset: auto 0 0;
  z-index: -1;
  height: 42vh;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(47, 107, 87, 0.12));
}

.booking-public-shell {
  gap: clamp(16px, 2.4vw, 26px);
  padding-top: clamp(28px, 5vw, 68px);
}

.visualizer-shell {
  max-width: 1180px;
}

.booking-public-hero {
  position: relative;
  display: grid;
  gap: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0.58)),
    linear-gradient(135deg, rgba(13, 110, 198, 0.16), rgba(197, 138, 58, 0.14));
  box-shadow: 0 26px 70px rgba(31, 41, 55, 0.12);
  padding: clamp(22px, 4vw, 42px);
}

.booking-public-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(120deg, transparent 0 58%, rgba(255, 255, 255, 0.5) 58% 63%, transparent 63%),
    repeating-linear-gradient(135deg, rgba(13, 110, 198, 0.08) 0 1px, transparent 1px 16px);
  opacity: 0.65;
}

.booking-public-hero > * {
  position: relative;
  z-index: 1;
}

.booking-public-hero .eyebrow,
.public-flow-summary .eyebrow,
.booking-public-card .eyebrow {
  color: #0b6e69;
}

.booking-public-hero h1 {
  max-width: 820px;
  color: #112238;
  text-wrap: balance;
}

.booking-public-hero p {
  color: #42566f;
  font-size: clamp(1rem, 1.8vw, 1.18rem);
  line-height: 1.6;
}

.public-stepper {
  gap: 10px;
  margin: 0;
}

.public-stepper span {
  position: relative;
  min-height: 42px;
  border-color: rgba(13, 110, 198, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #52657d;
  box-shadow: 0 12px 24px rgba(31, 41, 55, 0.08);
  padding: 9px 14px;
}

.public-stepper span::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(13, 110, 198, 0.28);
  margin-right: 9px;
}

.public-stepper span.is-active {
  border-color: rgba(11, 110, 105, 0.62);
  background: linear-gradient(135deg, #0b6e69, #1778c4);
  box-shadow: 0 18px 32px rgba(13, 110, 198, 0.25);
}

.public-stepper span.is-active::before {
  background: #f9d27c;
  box-shadow: 0 0 0 4px rgba(249, 210, 124, 0.24);
}

.booking-public-card {
  position: relative;
  overflow: hidden;
  border-color: rgba(255, 255, 255, 0.82);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 255, 255, 0.86)),
    linear-gradient(135deg, rgba(13, 110, 198, 0.08), rgba(197, 138, 58, 0.08));
  box-shadow: 0 28px 80px rgba(31, 41, 55, 0.16);
}

.booking-public-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  background: linear-gradient(90deg, #0b6e69, #1678c2, #c58a3a);
}

.booking-public-card h2 {
  color: #14243a;
  line-height: 1.16;
}

.booking-public-card p {
  line-height: 1.55;
}

.booking-form {
  gap: 18px;
}

.booking-form label {
  color: #42566f;
  font-weight: 850;
}

.booking-form input,
.booking-form select,
.booking-form textarea {
  border-color: rgba(74, 94, 118, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 8px 18px rgba(31, 41, 55, 0.06);
  font-weight: 750;
}

.booking-form input:hover,
.booking-form select:hover,
.booking-form textarea:hover {
  border-color: rgba(13, 110, 198, 0.34);
  background: #fff;
}

.booking-form input:focus,
.booking-form select:focus,
.booking-form textarea:focus {
  border-color: #0b6e69;
  box-shadow: 0 0 0 4px rgba(11, 110, 105, 0.16), 0 16px 28px rgba(31, 41, 55, 0.1);
}

.booking-form textarea {
  min-height: 118px;
}

.booking-form input:-webkit-autofill,
.booking-form textarea:-webkit-autofill,
.booking-form select:-webkit-autofill {
  -webkit-text-fill-color: #14243a;
  box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.92) inset, 0 8px 18px rgba(31, 41, 55, 0.06);
}

.booking-form .button.primary,
.visualizer-revision-form .button.primary {
  min-height: 52px;
  border-color: rgba(11, 110, 105, 0.3);
  background: linear-gradient(135deg, #0b6e69, #1479c9);
  box-shadow: 0 18px 32px rgba(13, 110, 198, 0.26);
}

.booking-form .button.primary:hover,
.visualizer-revision-form .button.primary:hover {
  background: linear-gradient(135deg, #095e5a, #0d6ec6);
  transform: translateY(-1px);
}

.visualizer-upload {
  border-color: rgba(11, 110, 105, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.88), rgba(238, 247, 244, 0.84)),
    repeating-linear-gradient(135deg, rgba(13, 110, 198, 0.08) 0 1px, transparent 1px 14px);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.74);
  padding: clamp(16px, 2.8vw, 24px);
}

.visualizer-upload::after {
  content: "Upload";
  position: absolute;
  top: 18px;
  right: 18px;
  border-radius: 999px;
  background: rgba(11, 110, 105, 0.12);
  color: #0b6e69;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 6px 10px;
  text-transform: uppercase;
}

.visualizer-upload input[type="file"] {
  border-color: rgba(13, 110, 198, 0.16);
  background: rgba(255, 255, 255, 0.92);
}

.visualizer-upload input[type="file"]::file-selector-button {
  border: 0;
  border-radius: 7px;
  background: linear-gradient(135deg, #0b6e69, #1479c9);
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  margin-right: 10px;
  padding: 9px 12px;
}

.visualizer-upload input[type="file"]::file-selector-button:hover {
  background: linear-gradient(135deg, #095e5a, #0d6ec6);
}

.visualizer-upload-preview {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.visualizer-upload-preview[hidden] {
  display: none;
}

.visualizer-upload-preview-item {
  display: grid;
  gap: 7px;
  min-width: 0;
  border: 1px solid rgba(13, 110, 198, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: #42566f;
  cursor: pointer;
  padding: 8px;
  text-align: left;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.visualizer-upload-preview-item:hover,
.visualizer-upload-preview-item.is-primary {
  border-color: rgba(11, 110, 105, 0.54);
  box-shadow: 0 16px 30px rgba(31, 41, 55, 0.12);
}

.visualizer-upload-preview-item.is-primary {
  background: linear-gradient(135deg, rgba(238, 247, 244, 0.96), rgba(255, 248, 233, 0.9));
}

.visualizer-upload-thumb {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 7px;
  background: #0f172a;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
}

.visualizer-upload-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.visualizer-upload-preview-item strong,
.visualizer-upload-preview-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visualizer-upload-preview-item strong {
  color: #14243a;
  font-size: 0.88rem;
}

.visualizer-upload-preview-item small {
  color: #52657d;
  font-size: 0.76rem;
}

.virtual-design-session {
  display: grid;
  gap: 18px;
}

.virtual-design-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.virtual-design-head h2 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.45rem);
}

.virtual-design-head p:last-child {
  max-width: 720px;
  margin-bottom: 0;
}

.status-pill[data-tone="success"] {
  border-color: rgba(11, 110, 105, 0.24);
  background: rgba(11, 110, 105, 0.11);
  color: #0b6e69;
}

.status-pill[data-tone="warn"] {
  border-color: rgba(197, 138, 58, 0.3);
  background: rgba(197, 138, 58, 0.12);
  color: #8a5a18;
}

.virtual-design-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 16px;
  align-items: stretch;
}

.virtual-design-camera {
  position: relative;
  display: grid;
  overflow: hidden;
  min-height: 430px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.92), rgba(11, 110, 105, 0.72)),
    #0f172a;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.virtual-design-camera video {
  width: 100%;
  height: 100%;
  min-height: 430px;
  object-fit: cover;
}

.virtual-design-camera-empty {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 6px;
  min-height: 430px;
  padding: 24px;
  color: #fff;
  text-align: center;
  background:
    linear-gradient(120deg, transparent 0 54%, rgba(255, 255, 255, 0.08) 54% 58%, transparent 58%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 18px);
}

.virtual-design-camera-empty strong {
  font-size: 1.25rem;
}

.virtual-design-camera-empty span {
  color: rgba(255, 255, 255, 0.72);
  font-weight: 750;
}

.virtual-design-primary-capture {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 12px;
  max-width: calc(100% - 24px);
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.28);
  cursor: pointer;
  font-weight: 900;
  line-height: 1.15;
  padding: 10px 12px;
  text-align: left;
}

.virtual-design-primary-capture:hover,
.virtual-design-primary-capture:focus-visible {
  background: rgba(11, 110, 105, 0.92);
  outline: none;
}

.virtual-design-primary-capture:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.virtual-design-frames {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px;
}

.virtual-design-frame-button {
  position: relative;
  flex: 0 0 72px;
  width: 72px;
  height: 54px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 7px;
  background: rgba(15, 23, 42, 0.82);
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.36);
  cursor: pointer;
  padding: 0;
}

.virtual-design-frame-button.is-primary {
  border-color: #f5c66a;
  box-shadow: 0 0 0 2px rgba(245, 198, 106, 0.52), 0 12px 24px rgba(15, 23, 42, 0.36);
}

.virtual-design-frame-button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.virtual-design-frame-button span {
  position: absolute;
  right: 4px;
  bottom: 4px;
  border-radius: 6px;
  background: rgba(15, 23, 42, 0.86);
  color: #fff;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
  padding: 4px 5px;
}

.virtual-design-panel {
  display: grid;
  grid-template-rows: minmax(250px, 1fr) auto auto;
  gap: 12px;
  min-width: 0;
}

.virtual-design-log {
  display: grid;
  align-content: start;
  gap: 10px;
  overflow-y: auto;
  max-height: 430px;
  border: 1px solid rgba(11, 110, 105, 0.14);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(238, 247, 244, 0.76)),
    #f8fafc;
  padding: 12px;
}

.virtual-design-message {
  max-width: 88%;
  border: 1px solid rgba(31, 41, 55, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 22px rgba(31, 41, 55, 0.08);
  padding: 11px 12px;
}

.virtual-design-message.is-ai {
  justify-self: end;
  border-color: rgba(11, 110, 105, 0.16);
  background: linear-gradient(135deg, rgba(11, 110, 105, 0.12), rgba(13, 110, 198, 0.1));
}

.virtual-design-message strong {
  display: block;
  margin-bottom: 4px;
  color: #14243a;
}

.virtual-design-message p {
  margin: 0;
  color: #52657d;
  font-weight: 750;
}

.virtual-design-text textarea {
  min-height: 92px;
}

.virtual-design-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.virtual-design-actions .button {
  min-height: 46px;
}

.virtual-design-actions .button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  transform: none;
}

.virtual-design-note {
  border: 1px solid rgba(11, 110, 105, 0.16);
  border-left: 5px solid #0b6e69;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(238, 247, 244, 0.84), rgba(255, 248, 233, 0.74));
  color: #42566f;
  padding: 12px 14px;
  font-weight: 800;
}

.visualizer-disclaimer {
  border: 1px solid rgba(197, 138, 58, 0.22);
  border-left: 5px solid #c58a3a;
  background: linear-gradient(135deg, #fff8e9, #fffdfa);
  color: #5f4820;
}

.public-flow-summary {
  border-color: rgba(11, 110, 105, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(238, 247, 244, 0.9)),
    linear-gradient(135deg, rgba(11, 110, 105, 0.1), rgba(197, 138, 58, 0.08));
}

.public-flow-summary .button.primary {
  background: linear-gradient(135deg, #0b6e69, #1479c9);
}

.public-funnel-grid .booking-public-card {
  min-height: 230px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.public-funnel-grid .booking-public-card:hover {
  border-color: rgba(11, 110, 105, 0.28);
  box-shadow: 0 34px 90px rgba(31, 41, 55, 0.2);
  transform: translateY(-3px);
}

.visualizer-result-media {
  border-color: rgba(255, 255, 255, 0.78);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.2);
}

.visualizer-before-after {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 8px;
  background:
    linear-gradient(135deg, rgba(15, 23, 42, 0.88), rgba(11, 110, 105, 0.5)),
    #111827;
}

.visualizer-before-after.has-generated {
  grid-template-columns: minmax(0, 1.45fr) minmax(180px, 0.65fr);
  align-items: stretch;
}

.visualizer-image-frame {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  background: #0f172a;
}

.visualizer-image-frame span {
  position: absolute;
  z-index: 1;
  top: 10px;
  left: 10px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #ffffff;
  padding: 5px 9px;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0;
  backdrop-filter: blur(10px);
}

.visualizer-image-frame img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #0f172a;
  object-fit: contain;
}

.visualizer-image-frame.is-after {
  order: -1;
  border-color: rgba(249, 210, 124, 0.4);
  box-shadow: 0 18px 38px rgba(15, 23, 42, 0.32);
}

.visualizer-image-frame.is-after img {
  aspect-ratio: 16 / 11;
}

.visualizer-image-frame.is-before img {
  height: 100%;
  min-height: 100%;
}

.visualizer-original-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 8px;
  padding: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.92);
}

.visualizer-original-strip figure {
  min-width: 0;
  margin: 0;
}

.visualizer-original-strip img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 7px;
}

.visualizer-original-strip figcaption {
  overflow: hidden;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.72rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.visualizer-chat {
  border-top-color: rgba(11, 110, 105, 0.14);
}

.visualizer-chat-message {
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 26px rgba(31, 41, 55, 0.08);
}

.visualizer-chat-message.is-ai {
  background: linear-gradient(135deg, rgba(11, 110, 105, 0.12), rgba(13, 110, 198, 0.1));
}

.public-preview-review {
  display: grid;
  gap: 18px;
}

.public-preview-review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.public-preview-review-head h2 {
  margin: 0;
}

.public-preview-review-head .status-pill {
  flex: 0 0 auto;
}

.public-preview-review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.public-preview-media {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
}

.public-preview-media figure {
  position: relative;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgba(11, 110, 105, 0.16);
  border-radius: 8px;
  background: #0f172a;
  box-shadow: 0 16px 30px rgba(31, 41, 55, 0.12);
}

.public-preview-media img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.public-preview-media figcaption {
  position: absolute;
  left: 8px;
  bottom: 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.78);
  color: #fff;
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 850;
  backdrop-filter: blur(10px);
}

.public-preview-conversation {
  display: grid;
  gap: 8px;
}

.public-preview-conversation article {
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  padding: 10px 12px;
  box-shadow: 0 10px 22px rgba(31, 41, 55, 0.07);
}

.public-preview-conversation strong {
  display: block;
  color: #112238;
  font-size: 0.82rem;
  font-weight: 900;
  margin-bottom: 4px;
}

.public-preview-conversation p {
  margin: 0;
  color: #52657d;
  font-size: 0.9rem;
  line-height: 1.45;
}

.token-box {
  display: block;
  margin-top: 8px;
  overflow-x: auto;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.check-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.76);
  padding: 10px;
  box-shadow: var(--shadow-hairline);
}

.check-row input {
  width: auto;
  min-height: 0;
  margin-top: 3px;
}

.check-row strong {
  display: block;
  color: var(--ink);
}

.quickbooks-material-policy {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.quickbooks-material-policy .field-label {
  color: var(--ink);
}

.quickbooks-material-option {
  padding: 10px 12px;
}

.quickbooks-material-option input[type="checkbox"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  padding: 0;
  accent-color: var(--red);
}

.quickbooks-material-option small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

.quickbooks-supplier-field {
  margin-top: 2px;
}
.app-shell {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  background:
    linear-gradient(180deg, rgba(24, 34, 51, 0.97) 0%, var(--charcoal) 58%, #121016 100%),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 72px);
  color: #fff;
  padding: 24px 16px;
  overflow-y: auto;
  box-shadow: 18px 0 44px rgba(16, 23, 34, 0.13);
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none;  /* IE and Edge */
}

.sidebar-edge-reveal {
  display: none;
}

.sidebar::-webkit-scrollbar {
  display: none; /* Chrome, Safari, Opera */
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 24px;
  padding: 2px 4px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #1b8fe8 0%, var(--red-dark) 62%, var(--teal) 100%);
  color: #fff;
  box-shadow: 0 16px 28px rgba(13, 110, 198, 0.26);
  font-weight: 900;
  overflow: hidden;
}

.brand-logo {
  background: #fff;
  padding: 3px;
}

.brand-logo img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 5px;
  object-fit: cover;
  object-position: 50% 18%;
}

.brand-block strong,
.brand-block span {
  display: block;
}

.brand-block span:not(.brand-mark) {
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.82rem;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-group {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.035);
  overflow: hidden;
}

.nav-group summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 11px;
  color: rgba(255, 255, 255, 0.62);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  list-style: none;
  text-transform: uppercase;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-group summary:hover,
.nav-group summary.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
}

.nav-group-chevron {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  transform: rotate(-90deg);
  transition: transform 0.16s ease;
}

.nav-group[open] .nav-group-chevron {
  transform: rotate(0deg);
}

.nav-submenu {
  display: grid;
  gap: 4px;
  padding: 0 6px 6px;
}

.nav-list a {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  color: rgba(255, 255, 255, 0.74);
  padding: 8px 10px;
  font-weight: 780;
  text-decoration: none;
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.075);
  color: rgba(255, 255, 255, 0.76);
  transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  fill: currentColor;
}

.nav-label {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.nav-coming-soon {
  display: inline-flex;
  align-items: center;
  min-height: 17px;
  padding: 2px 5px;
  border: 1px solid rgba(255, 196, 87, 0.35);
  border-radius: 999px;
  background: rgba(255, 196, 87, 0.12);
  color: #ffd98a;
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  white-space: nowrap;
}

.nav-list a:hover,
.nav-list a.active {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.nav-list a:hover {
  transform: translateX(2px);
}

.nav-list a.active .nav-icon {
  background: var(--red);
  color: #fff;
  box-shadow: 0 8px 18px rgba(13, 110, 198, 0.28);
}

.nav-list a:hover .nav-icon {
  color: #fff;
}

.sidebar-backdrop {
  position: fixed;
  z-index: 18;
  inset: 0;
  display: none;
  border: 0;
  background: rgba(18, 16, 14, 0.48);
  padding: 0;
}

.sidebar-account {
  display: none;
}

.mobile-quick-nav {
  display: none;
}

.content-shell {
  min-width: 0;
  padding: 28px;
}

.page-content {
  animation: content-enter 180ms ease both;
}

.page-content.is-leaving {
  opacity: 0.72;
  transform: translateY(2px);
  transition: opacity 90ms ease, transform 90ms ease;
}

.page-content.is-entering {
  animation: content-enter 220ms ease both;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  position: sticky;
  z-index: 12;
  top: 0;
  margin: -28px -28px 24px;
  border-bottom: 1px solid rgba(220, 228, 238, 0.78);
  background: rgba(246, 248, 251, 0.86);
  padding: 20px 28px;
  backdrop-filter: blur(18px);
}

.topbar h1 {
  font-size: 2rem;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.topbar-title {
  min-width: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.global-search {
  position: relative;
  flex: 1 1 360px;
  max-width: 520px;
  margin-left: auto;
}

.global-search label {
  display: block;
}

.global-search input[type="search"] {
  min-height: 46px;
  border-color: rgba(185, 198, 214, 0.9);
  background: rgba(255, 255, 255, 0.86);
  font-weight: 800;
  box-shadow: var(--shadow-hairline), 0 8px 18px rgba(18, 32, 51, 0.05);
}

.global-search-results {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  width: min(520px, 86vw);
  max-height: min(420px, 70vh);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
  padding: 6px;
  backdrop-filter: blur(16px);
}

.global-search-result {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 10px;
  border-radius: 6px;
  padding: 10px;
  text-decoration: none;
}

.global-search-result:hover,
.global-search-result:focus-visible {
  background: #eef6fb;
  outline: none;
}

.search-result-label {
  align-self: start;
  border-radius: 999px;
  background: #e7eff8;
  color: var(--ink);
  padding: 4px 8px;
  font-size: 0.72rem;
  font-weight: 900;
  text-align: center;
}

.search-result-body,
.search-result-body strong,
.search-result-body small {
  display: block;
  min-width: 0;
}

.search-result-body strong,
.search-result-body small {
  overflow-wrap: anywhere;
}

.search-result-body small,
.global-search-empty {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.global-search-empty {
  padding: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  border: 1px solid rgba(220, 228, 238, 0.9);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  padding: 7px 8px 7px 16px;
  font-weight: 800;
  box-shadow: var(--shadow-hairline), 0 8px 18px rgba(18, 32, 51, 0.06);
}

.user-chip a {
  border-radius: 999px;
  background: var(--charcoal);
  color: #fff;
  padding: 7px 11px;
  text-decoration: none;
}

.release-notes-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  border: 1px solid rgba(13, 110, 198, 0.22);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  color: var(--red-dark);
  padding: 0 12px;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: var(--shadow-hairline);
  cursor: pointer;
}

.release-notes-button:hover {
  border-color: var(--red);
  background: #fff;
  transform: translateY(-1px);
}

.release-demo-shell[hidden],
.release-demo-step[hidden] {
  display: none;
}

.release-demo-shell {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
}

.release-demo-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(11, 16, 24, 0.68);
  backdrop-filter: blur(8px);
}

.release-demo-dialog {
  position: relative;
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 32px));
  overflow-y: auto;
  border: 1px solid rgba(13, 110, 198, 0.28);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 248, 251, 0.96));
  box-shadow: 0 30px 90px rgba(14, 30, 54, 0.34);
  padding: 22px;
}

.release-demo-topline,
.release-demo-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.release-demo-topline span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  background: rgba(13, 110, 198, 0.1);
  color: var(--red-dark);
  padding: 0 10px;
  font-weight: 900;
}

.release-demo-x {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
}

.release-demo-x span {
  position: absolute;
  width: 16px;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
}

.release-demo-x span:first-child {
  transform: rotate(45deg);
}

.release-demo-x span:last-child {
  transform: rotate(-45deg);
}

.release-demo-progress {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.release-demo-progress span {
  height: 5px;
  border-radius: 999px;
  background: rgba(13, 110, 198, 0.16);
}

.release-demo-progress span.is-active {
  background: var(--red);
  box-shadow: 0 0 16px rgba(13, 110, 198, 0.24);
}

.release-demo-step h2 {
  margin: 4px 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  line-height: 1.05;
}

.release-demo-step p {
  max-width: 58ch;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.6;
}

.release-demo-step ul {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.release-demo-step li {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  font-weight: 900;
}

.release-demo-notes {
  margin: 20px 0;
  border: 1px solid rgba(13, 110, 198, 0.16);
  border-radius: var(--radius-md);
  background: rgba(13, 110, 198, 0.06);
  padding: 14px;
}

.release-demo-notes h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.release-demo-notes p {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.55;
}

.release-demo-actions > div {
  display: inline-flex;
  gap: 8px;
}

.icon-button {
  display: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  padding: 10px;
  box-shadow: var(--shadow-hairline);
}

.icon-button span {
  display: block;
  width: 100%;
  height: 2px;
  margin: 4px 0;
  background: var(--ink);
}

@media (min-width: 861px) {
  .app-shell {
    transition: grid-template-columns 180ms ease;
  }

  .sidebar {
    box-sizing: border-box;
    width: 268px;
    transition: transform 180ms ease, visibility 0s linear 180ms;
  }

  body.sidebar-collapsed .app-shell {
    grid-template-columns: 0 minmax(0, 1fr);
  }

  body.sidebar-collapsed .sidebar {
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-100%);
  }

  .sidebar-edge-reveal {
    position: fixed;
    z-index: 30;
    top: 0;
    bottom: 0;
    left: 0;
    width: 14px;
    border: 0;
    background: transparent;
    cursor: e-resize;
    padding: 0;
  }

  body.sidebar-collapsed .sidebar-edge-reveal {
    display: block;
  }

  body.sidebar-collapsed .sidebar-edge-reveal:hover,
  body.sidebar-collapsed .sidebar-edge-reveal:focus-visible {
    background: rgba(13, 110, 198, 0.22);
    outline: 0;
  }

  .topbar > [data-menu-toggle] {
    position: absolute;
    z-index: 21;
    top: 16px;
    left: -23px;
    display: inline-grid;
    width: 28px;
    height: 52px;
    min-height: 52px;
    place-items: center;
    border: 1px solid rgba(56, 232, 255, 0.34);
    border-radius: 0 9px 9px 0;
    background: linear-gradient(180deg, rgba(24, 34, 51, 0.98), rgba(18, 16, 22, 0.98));
    color: #e7faff;
    box-shadow: 7px 8px 20px rgba(5, 12, 20, 0.26);
    padding: 0;
    transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
  }

  .topbar > [data-menu-toggle] span {
    display: none;
  }

  .topbar > [data-menu-toggle]::before {
    content: '\2039';
    font-size: 32px;
    font-weight: 400;
    line-height: 1;
    transform: translateY(-1px);
  }

  .topbar > [data-menu-toggle]:hover,
  .topbar > [data-menu-toggle]:focus-visible {
    border-color: rgba(56, 232, 255, 0.78);
    background: rgba(21, 67, 88, 0.98);
    outline: 0;
    transform: translateX(2px);
  }

  body.sidebar-collapsed .topbar > [data-menu-toggle] {
    left: 0;
  }

  body.sidebar-collapsed .topbar > [data-menu-toggle]::before {
    content: '\203A';
  }
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

/* Hallmark · pre-emit critique: P5 H5 E5 S5 R5 V4 */
/* Hallmark · component: compliance evidence panel · genre: modern-minimal · theme: existing BizOS
 * states: default · hover · focus · active · disabled · loading · error · success
 * contrast: pass (40–41) · mobile: pass (34, 49, 50–57) · motion: none
 */
.subcontractor-compliance-panel .panel-head p {
  max-width: 72ch;
}

.subcontractor-compliance-gates {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-block: 4px 24px;
  border-block: 1px solid var(--line);
  background: var(--surface);
}

.subcontractor-compliance-gate {
  min-width: 0;
  padding: 18px;
}

.subcontractor-compliance-gate + .subcontractor-compliance-gate {
  border-inline-start: 1px solid var(--line);
}

.subcontractor-compliance-gate-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.subcontractor-compliance-gate h3,
.subcontractor-compliance-form-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.35;
}

.subcontractor-compliance-gate .status-pill {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.subcontractor-compliance-reasons,
.subcontractor-compliance-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.subcontractor-compliance-reasons {
  display: grid;
  gap: 5px;
  padding-inline-start: 18px;
}

.subcontractor-compliance-form-head {
  display: grid;
  gap: 4px;
  margin: 24px 0 14px;
}

.subcontractor-compliance-form-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.subcontractor-compliance-form input[type="file"] {
  padding: 5px;
}

.subcontractor-compliance-form input[type="file"]::file-selector-button {
  min-height: 34px;
  margin-inline-end: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 6px 10px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.content-grid {
  display: grid;
  gap: 16px;
  margin-bottom: 20px;
}

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

.section-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

/* Set by app.js only when this row genuinely overflows. The trailing padding
   leaves part of the next tab in view, while the directional mask makes the
   remaining horizontal content apparent on touch devices. */
.section-tabs[data-tab-scrollable] {
  flex-wrap: nowrap;
  padding-inline-end: 32px;
  scrollbar-width: thin;
  scrollbar-color: rgba(43, 54, 66, 0.42) transparent;
}

.section-tabs[data-tab-scrollable]::-webkit-scrollbar {
  height: 6px;
}

.section-tabs[data-tab-scrollable]::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(43, 54, 66, 0.42);
}

.section-tabs[data-tab-more-right] {
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 34px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 34px), transparent 100%);
}

.section-tabs[data-tab-more-left] {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 34px, #000 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 34px, #000 100%);
}

.section-tabs[data-tab-more-left][data-tab-more-right] {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 34px, #000 calc(100% - 34px), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 34px, #000 calc(100% - 34px), transparent 100%);
}

.section-tab-clusters {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}

.finance-section-picker {
  display: none;
}

.finance-section-heading {
  margin: 0 0 16px;
}

.finance-section-content {
  scroll-margin-top: 20px;
}

.finance-section-heading .eyebrow {
  margin-bottom: 4px;
}

.finance-section-heading h2 {
  margin: 0;
}

.finance-section-heading p:not(.eyebrow) {
  margin: 5px 0 0;
  color: var(--muted);
}

.finance-filter-disclosure > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 900;
}

.finance-filter-disclosure[open] > summary {
  margin-bottom: 12px;
}

.section-tab-group > span {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.section-tab-group .section-tabs {
  margin-bottom: 0;
}

.section-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  padding: 8px 12px;
  font-size: 0.9rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: var(--shadow-hairline);
}

.section-tab:hover,
.section-tab:focus-visible,
.section-tab.is-active {
  border-color: var(--red-dark);
  background: var(--red);
  color: #fff;
  box-shadow: var(--shadow-hairline), 0 10px 20px rgba(13, 110, 198, 0.18);
}

.onboarding-checklist {
  border: 1px solid rgba(47, 107, 87, 0.2);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, rgba(47, 107, 87, 0.08), rgba(197, 138, 58, 0.1));
  padding: 18px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-hairline);
}

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

.onboarding-checklist-head h2 {
  margin: 2px 0 0;
  font-size: 1.2rem;
}

.onboarding-checklist-head p:not(.eyebrow) {
  max-width: 720px;
  margin: 6px 0 0;
  color: var(--muted);
}

.onboarding-progress {
  display: inline-flex;
  margin-top: 9px;
  border-radius: 999px;
  background: rgba(47, 107, 87, 0.12);
  color: #245342;
  padding: 4px 9px;
  font-size: 0.78rem;
  font-weight: 900;
}

.onboarding-checklist-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.onboarding-checklist-grid a {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 9px;
  align-items: start;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 12px;
  text-decoration: none;
  box-shadow: var(--shadow-hairline);
}

.onboarding-checklist-grid a span {
  display: inline-grid;
  place-items: center;
  width: 13px;
  height: 13px;
  border: 2px solid var(--red-dark);
  border-radius: 50%;
  margin-top: 3px;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 900;
}

.onboarding-checklist-grid a.is-done {
  border-color: rgba(47, 107, 87, 0.34);
  background: rgba(255, 255, 255, 0.92);
}

.onboarding-checklist-grid a.is-done span {
  border-color: #2f6b57;
  background: #2f6b57;
}

.onboarding-checklist-grid a strong {
  font-size: 0.9rem;
  line-height: 1.25;
}

.onboarding-checklist-grid a small {
  grid-column: 2;
  color: var(--muted);
  font-weight: 800;
}

.onboarding-checklist-grid a em {
  grid-column: 2;
  color: var(--red-dark);
  font-size: 0.76rem;
  font-style: normal;
  font-weight: 900;
}

.onboarding-checklist-grid a.is-done em {
  color: #2f6b57;
}

.dashboard-action-section {
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  padding: 18px;
  box-shadow: var(--shadow-hairline);
}

.dashboard-action-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.dashboard-action-heading h2 {
  margin: 2px 0 0;
}

.dashboard-action-heading p:not(.eyebrow) {
  margin: 6px 0 0;
  color: var(--muted);
}

.dashboard-action-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.dashboard-action-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 4px 10px;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--ink);
  padding: 14px;
  text-decoration: none;
  box-shadow: var(--shadow-soft);
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.dashboard-action-card:hover,
.dashboard-action-card:focus-visible {
  border-color: rgba(13, 110, 198, 0.42);
  box-shadow: 0 14px 28px rgba(18, 32, 51, 0.12);
  transform: translateY(-2px);
}

.dashboard-action-count {
  display: inline-grid;
  grid-row: 1 / span 3;
  place-items: center;
  min-width: 36px;
  min-height: 36px;
  border-radius: 10px;
  background: rgba(13, 110, 198, 0.1);
  color: var(--red-dark);
  font-size: 1.08rem;
  font-weight: 950;
}

.dashboard-action-card strong,
.dashboard-action-card small,
.dashboard-action-card em {
  grid-column: 2;
}

.hub-contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-top: 8px;
  color: var(--muted);
}

.hub-contact-links a {
  color: var(--red-dark);
  font-weight: 900;
}

.job-field-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.78);
  padding: 10px;
  box-shadow: var(--shadow-hairline);
}

.job-mobile-actions {
  display: none;
}

.setup-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.setup-hero h2 {
  margin: 4px 0 8px;
}

.setup-hero p:not(.eyebrow) {
  max-width: 720px;
  margin: 0;
  color: var(--muted);
}

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

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

.notification-setting-card {
  display: grid;
  gap: 12px;
  align-content: start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.notification-setting-card p {
  margin: 0;
  color: var(--muted);
}

.notification-setting-toggle {
  margin: 0;
}

.notification-setting-card textarea {
  min-height: 76px;
  resize: vertical;
}

.setup-readiness-card {
  display: flex;
  min-width: 0;
  min-height: 190px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

.setup-readiness-card.is-ready {
  border-color: rgba(47, 107, 87, 0.28);
}

.setup-readiness-card.needs-attention {
  border-color: rgba(180, 83, 9, 0.3);
}

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

.setup-readiness-head h3,
.setup-readiness-card p {
  margin: 0;
}

.setup-readiness-card p {
  margin-top: 10px;
  color: var(--muted);
}

.setup-readiness-card .form-actions {
  margin-top: auto;
  padding-top: 14px;
}

@media (max-width: 620px) {
  .setup-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .setup-readiness-grid {
    grid-template-columns: 1fr;
  }

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

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

.dashboard-action-card em {
  align-self: end;
  margin-top: 5px;
  color: var(--red-dark);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 900;
}

.quickbooks-migration-guide {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
  margin-bottom: 18px;
}

.quickbooks-migration-guide h2 {
  margin: 4px 0 8px;
}

.quickbooks-migration-guide p {
  color: var(--muted);
}

.quickbooks-migration-guide ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 24px;
}

.quickbooks-migration-guide li {
  padding-left: 4px;
}

.quickbooks-migration-guide li strong,
.quickbooks-migration-guide li span {
  display: block;
}

.quickbooks-migration-guide li span,
.quickbooks-help,
.form-help {
  color: var(--muted);
  font-size: 0.86rem;
}

.quickbooks-help {
  grid-column: 1 / -1;
  margin: 0;
  border-radius: var(--radius-md);
  background: rgba(13, 110, 198, 0.07);
  padding: 10px 12px;
}

.advanced-options {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(246, 248, 251, 0.72);
  padding: 10px 12px;
}

.advanced-options summary {
  min-height: 44px;
  cursor: pointer;
  color: var(--muted);
  font-weight: 900;
  line-height: 44px;
}

.advanced-options[open] summary {
  margin-bottom: 10px;
}

.lead-request-summary {
  margin: 0 0 6px;
  line-height: 1.45;
}

.lead-request-details {
  width: 100%;
  min-width: 0;
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.lead-request-details summary {
  min-height: 44px;
  cursor: pointer;
  color: var(--red-dark);
  font-weight: 900;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.lead-request-details-body {
  display: grid;
  gap: 12px;
  max-width: 100%;
  border-radius: var(--radius-md);
  background: rgba(246, 248, 251, 0.72);
  padding: 12px;
  overflow-wrap: anywhere;
}

.lead-request-details:not([open]) > .lead-request-details-body {
  display: none;
}

.lead-request-details-body p,
.lead-request-details-body h3 {
  margin: 0;
}

.receipt-upload small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.receipt-details {
  min-width: 150px;
  max-width: 240px;
}

.receipt-details > summary {
  min-height: 44px;
  color: var(--blue);
  cursor: pointer;
  font-weight: 900;
  line-height: 44px;
}

.receipt-details .photo-grid {
  grid-template-columns: minmax(140px, 1fr);
}

.receipt-upload-status:empty {
  display: none;
}

.receipt-upload-status:not(:empty) {
  border-left: 3px solid var(--blue);
  border-radius: var(--radius-sm);
  background: rgba(36, 94, 131, 0.08);
  padding: 9px 11px;
}

[data-expense-receipt-upload-form].is-auto-enabled > button[type="submit"] {
  display: none;
}

.receipt-task-status,
.receipt-review-panel {
  scroll-margin-top: 116px;
}

.receipt-task-status-copy,
.receipt-review-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.receipt-task-status h2,
.receipt-review-heading h2,
.receipt-review-heading p {
  margin: 0;
}

.receipt-task-status-copy p,
.receipt-review-heading > div > p:last-child {
  margin-top: 6px;
  color: var(--muted);
}

.receipt-review-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.6fr);
  align-items: start;
  gap: 18px;
  margin-top: 16px;
}

.receipt-preview {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
}

.receipt-preview > summary {
  min-height: 44px;
  cursor: pointer;
  color: var(--ink);
  font-weight: 900;
  line-height: 44px;
}

.receipt-preview img {
  display: block;
  width: 100%;
  max-height: 620px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  object-fit: contain;
}

.receipt-preview .button {
  width: 100%;
  margin-top: 10px;
}

.receipt-review-form,
.receipt-line-items,
.receipt-line-items table {
  min-width: 0;
  max-width: 100%;
}

.receipt-line-items input {
  width: 100%;
  min-width: 0;
}

.receipt-confirm-button {
  justify-self: start;
}

.muted-copy {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.timeline-item.is-overdue {
  border-color: rgba(198, 93, 34, 0.38);
  background: rgba(255, 247, 237, 0.88);
}

.schedule-mobile-agenda {
  display: none;
}

.timeline-item time small {
  display: block;
  margin-top: 3px;
  color: #b45309;
  font-size: 0.72rem;
  font-weight: 900;
}

tr.is-overdue td {
  background: rgba(255, 247, 237, 0.66);
}

.overdue-copy {
  color: #b45309 !important;
  font-weight: 900 !important;
}

.attention-copy {
  color: var(--red-dark) !important;
  font-weight: 900 !important;
}

@media (max-width: 980px) {
  .onboarding-checklist-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .quickbooks-migration-guide {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .onboarding-checklist-head {
    align-items: flex-start;
  }

  .onboarding-checklist-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-action-section {
    padding: 12px;
  }

  .dashboard-action-grid {
    grid-template-columns: 1fr;
  }
}

/* AI-guided, read-only product walkthroughs */
.bizos-tour-shell {
  inset: 0;
  pointer-events: none;
  position: fixed;
  z-index: 500;
}

.bizos-tour-shield {
  background: transparent;
  inset: 0;
  pointer-events: auto;
  position: absolute;
}

.bizos-tour-highlight {
  border: 3px solid #12b8aa;
  border-radius: 14px;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.96),
    0 0 0 9999px rgba(12, 24, 39, 0.62),
    0 12px 34px rgba(8, 76, 92, 0.34);
  pointer-events: none;
  position: fixed;
  transition: left 180ms ease, top 180ms ease, width 180ms ease, height 180ms ease;
  z-index: 1;
}

.bizos-tour-highlight[hidden],
.bizos-tour-tooltip[hidden] {
  display: none !important;
}

.bizos-tour-tooltip {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(13, 110, 198, 0.2);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(8, 28, 48, 0.3);
  color: #17283d;
  max-height: min(560px, calc(100vh - 32px));
  max-width: calc(100vw - 32px);
  overflow: auto;
  padding: 20px;
  pointer-events: auto;
  position: fixed;
  width: 360px;
  z-index: 2;
}

.bizos-tour-tooltip.is-centered {
  left: 50% !important;
  right: auto !important;
  top: 50% !important;
  transform: translate(-50%, -50%);
}

.bizos-tour-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.bizos-tour-progress {
  color: #526579;
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  margin: 0;
  text-transform: uppercase;
}

.bizos-tour-exit {
  background: transparent;
  border: 0;
  color: #526579;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 900;
  min-height: 36px;
  padding: 6px 8px;
}

.bizos-tour-exit:hover,
.bizos-tour-exit:focus-visible {
  color: #0d6ec6;
}

.bizos-tour-tooltip h2 {
  color: #17283d;
  font-size: 1.22rem;
  line-height: 1.25;
  margin: 0 0 10px;
}

.bizos-tour-tooltip > p:not(.bizos-tour-progress) {
  color: #526579;
  line-height: 1.55;
  margin: 0;
}

.bizos-tour-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.bizos-tour-actions .button {
  min-height: 44px;
  min-width: 88px;
}

.bizos-tour-actions .button[disabled] {
  cursor: not-allowed;
  opacity: 0.42;
}

.dark-mode .bizos-tour-highlight {
  border-color: #38e8ff;
  box-shadow:
    0 0 0 2px rgba(7, 19, 31, 0.96),
    0 0 0 9999px rgba(0, 5, 12, 0.74),
    0 0 34px rgba(56, 232, 255, 0.36);
}

.dark-mode .bizos-tour-tooltip {
  background: rgba(12, 23, 37, 0.98);
  border-color: rgba(56, 232, 255, 0.26);
  box-shadow: 0 24px 74px rgba(0, 0, 0, 0.58);
  color: #eefbff;
}

.dark-mode .bizos-tour-tooltip h2 {
  color: #eefbff;
}

.dark-mode .bizos-tour-progress,
.dark-mode .bizos-tour-exit,
.dark-mode .bizos-tour-tooltip > p:not(.bizos-tour-progress) {
  color: #b7d1dc;
}

.dark-mode .bizos-tour-exit:hover,
.dark-mode .bizos-tour-exit:focus-visible {
  color: #38e8ff;
}

@media (max-width: 760px) {
  .bizos-tour-tooltip,
  .bizos-tour-tooltip.is-mobile {
    border-radius: 18px;
    max-height: min(390px, calc(100vh - 184px));
    max-width: none;
    padding: 17px;
    transform: none;
    width: auto;
  }

  .bizos-tour-tooltip.is-centered {
    bottom: calc(86px + env(safe-area-inset-bottom, 0px)) !important;
    left: 12px !important;
    right: 12px !important;
    top: auto !important;
    transform: none;
  }

  .bizos-tour-highlight {
    border-radius: 11px;
    transition-duration: 120ms;
  }

  .bizos-tour-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .bizos-tour-exit {
    min-height: 44px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bizos-tour-highlight {
    transition: none !important;
  }
}

.hub-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  padding: 22px;
  box-shadow: var(--shadow-soft);
}

.hub-hero h2 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.hub-hero p {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.hub-actions,
.next-action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hub-tabs {
  margin-bottom: 16px;
}

.next-action {
  display: grid;
  gap: 4px;
  min-width: min(100%, 210px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
  text-decoration: none;
  box-shadow: var(--shadow-hairline);
}

.next-action span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.next-action strong {
  color: var(--ink);
  font-size: 0.94rem;
}

.hub-timeline {
  display: grid;
  gap: 10px;
}

.hub-timeline-item {
  display: grid;
  gap: 3px;
  border-left: 3px solid var(--gold);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.68);
  padding: 12px 14px;
}

.hub-timeline-item span,
.hub-timeline-item small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.hub-timeline-item strong {
  color: var(--ink);
  font-size: 0.94rem;
}

.hr-section:not(.is-active),
.material-section:not(.is-active) {
  display: none;
}

.metric-card,
.panel {
  border: 1px solid rgba(220, 228, 238, 0.88);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.metric-card:hover,
.panel:hover {
  border-color: rgba(13, 110, 198, 0.18);
  box-shadow: var(--shadow-hairline), 0 16px 38px rgba(18, 32, 51, 0.11);
}

.metric-card {
  display: grid;
  align-content: space-between;
  min-height: 136px;
  padding: 18px;
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--teal) 55%, var(--gold) 100%);
  content: "";
}

.metric-card span,
.metric-card small {
  color: var(--muted);
  font-weight: 800;
}

.metric-card strong {
  margin-top: 10px;
  font-size: 2rem;
  line-height: 1.1;
}

.panel {
  margin-bottom: 20px;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(220, 228, 238, 0.72);
}

.panel h2 {
  font-size: 1.18rem;
  letter-spacing: 0;
}

.dashboard-visual-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.chart-panel {
  display: grid;
  align-content: start;
  gap: 2px;
}

.chart-panel .panel-head {
  margin-bottom: 8px;
}

.chart-panel .panel-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 720;
}

.chart-list,
.insight-list {
  display: grid;
  gap: 12px;
}

.chart-row {
  display: grid;
  gap: 7px;
}

.chart-row-head,
.insight-list div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.chart-row-head span,
.insight-list span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 760;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chart-row-head strong,
.insight-list strong {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 840;
  white-space: nowrap;
}

.chart-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7edf5;
}

.chart-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--teal));
  transform-origin: left;
  animation: chart-fill 480ms ease both;
}

.add-panel .panel-head {
  flex-wrap: wrap;
  margin-bottom: 0;
  border-bottom: 0;
  padding-bottom: 0;
}

.add-panel:not(.is-open) {
  cursor: pointer;
}

.add-panel.is-open .panel-head {
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(220, 228, 238, 0.72);
  padding-bottom: 12px;
}

.add-panel-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.add-panel-toggle {
  white-space: nowrap;
}

.add-panel-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition: max-height 220ms ease, opacity 180ms ease, transform 180ms ease;
}

.add-panel.is-open .add-panel-body {
  opacity: 1;
  transform: translateY(0);
}

.add-panel-subsection {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.add-panel-subsection h3 {
  margin-bottom: 12px;
  font-size: 1rem;
}

.estimate-line-items {
  display: grid;
  grid-column: 1 / -1;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 14px;
}

.estimate-builder-form {
  grid-template-columns: repeat(4, minmax(180px, 1fr));
}

.estimate-builder-form > .span-2,
.estimate-builder-form > .form-actions {
  grid-column: 1 / -1;
}

.estimate-line-items-head,
.estimate-line-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.estimate-line-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.estimate-margin-strip {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 10px;
  padding: 10px 14px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--muted);
}

.estimate-margin-head {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.estimate-margin-head svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.estimate-margin-figures {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin: 0;
}

.estimate-margin-figures > div {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.estimate-margin-figures dt {
  font-size: 0.78rem;
}

.estimate-margin-figures dd {
  margin: 0;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.estimate-margin-note {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.78rem;
}

.estimate-margin-solve {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.estimate-margin-solve label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
}

.estimate-margin-solve input {
  width: 5.5rem;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  text-align: right;
}

.estimate-margin-solve-message {
  flex-basis: 100%;
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Status drives only the margin figures, so the cost number stays neutral. */
.estimate-margin-strip[data-estimate-margin-status="ok"] {
  border-color: var(--green);
  border-style: solid;
}

.estimate-margin-strip[data-estimate-margin-status="ok"] [data-estimate-margin-amount],
.estimate-margin-strip[data-estimate-margin-status="ok"] [data-estimate-margin-pct] {
  color: var(--green);
}

.estimate-margin-strip[data-estimate-margin-status="warn"] {
  border-color: var(--gold);
  border-style: solid;
}

.estimate-margin-strip[data-estimate-margin-status="warn"] [data-estimate-margin-amount],
.estimate-margin-strip[data-estimate-margin-status="warn"] [data-estimate-margin-pct],
.estimate-margin-strip[data-estimate-margin-status="warn"] .estimate-margin-note {
  color: var(--gold);
}

.estimate-margin-strip[data-estimate-margin-status="bad"] {
  border-color: var(--danger);
  border-style: solid;
  background: var(--danger-soft);
}

.estimate-margin-strip[data-estimate-margin-status="bad"] [data-estimate-margin-amount],
.estimate-margin-strip[data-estimate-margin-status="bad"] [data-estimate-margin-pct],
.estimate-margin-strip[data-estimate-margin-status="bad"] .estimate-margin-note {
  color: var(--danger);
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8fb;
  padding: 2px;
}

.segmented-control .button {
  border-color: transparent;
  box-shadow: none;
}

.segmented-control .button[aria-pressed="true"] {
  background: #fff;
  color: var(--blue);
  border-color: var(--line);
}

.estimate-line-items-head h3 {
  margin: 0;
  font-size: 1rem;
}

.estimate-line-table-head {
  display: none;
}

.estimate-line-table-preview {
  display: none;
}

.estimate-line-item {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.estimate-line-item.is-dragging {
  opacity: 0.54;
}

.estimate-line-item > label {
  grid-column: span 3;
  min-width: 0;
}

.estimate-line-item > label:focus-within {
  border-color: #21a43a;
  box-shadow: 0 0 0 2px rgba(33, 164, 58, 0.2);
}

.estimate-line-item input,
.estimate-line-item select,
.estimate-line-item textarea {
  min-width: 0;
}

.estimate-product-control {
  display: block;
  min-width: 0;
}

.estimate-product-control[hidden] {
  display: none;
}

[data-estimate-section-title]:disabled {
  display: none;
}

.estimate-line-item .line-field-description textarea {
  min-height: 38px;
  overflow: hidden;
  line-height: 1.35;
  white-space: pre-wrap;
  resize: none;
}

.line-field-drag {
  grid-column: span 1;
  align-self: end;
  display: flex;
  align-items: center;
  min-height: 44px;
}

.estimate-line-drag,
.estimate-line-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 7px;
  padding: 0;
}

.estimate-line-drag {
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: grab;
}

.estimate-line-drag:active {
  cursor: grabbing;
}

.estimate-line-drag:hover,
.estimate-line-drag:focus-visible {
  border-color: var(--line);
  background: #f6f8fb;
  color: var(--ink);
}

.estimate-line-drag svg,
.estimate-line-remove svg {
  width: 17px;
  height: 17px;
}

.estimate-line-item .line-field-code,
.estimate-line-item .line-field-qty,
.estimate-line-item .line-field-unit,
.estimate-line-item .line-field-labor,
.estimate-line-item .line-field-material,
.estimate-line-item .line-field-subcontract,
.estimate-line-item .line-field-price {
  grid-column: span 2;
}

.estimate-line-item .line-field-section,
.estimate-line-item .line-field-provider,
.estimate-line-item .line-field-material-handling,
.estimate-line-item .line-field-accounting,
.estimate-line-item .line-field-photo,
.estimate-line-item .line-field-caption {
  grid-column: span 3;
}

.estimate-line-item .line-field-description {
  grid-column: span 7;
}

.estimate-line-item .line-field-notes {
  grid-column: span 6;
}

.estimate-line-item .line-field-row-total {
  grid-column: span 2;
  align-self: end;
  display: grid;
  gap: 6px;
  min-height: 44px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.estimate-line-item .line-field-row-total strong {
  color: var(--ink);
  font-size: 0.9rem;
  text-transform: none;
}

.estimate-line-item .line-field-split {
  grid-column: span 4;
  align-self: center;
}

.estimate-line-item .line-field-allowance {
  grid-column: span 2;
  align-self: center;
}

.line-field-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-start;
}

.estimate-line-remove {
  align-self: end;
}

.estimate-line-item.is-section-row {
  align-items: end;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.estimate-line-item.is-section-row .line-field-section {
  grid-column: span 8;
}

.estimate-line-item.is-section-row .line-field-notes {
  grid-column: span 3;
}

.estimate-line-item.is-section-row .line-field-code,
.estimate-line-item.is-section-row .line-field-description,
.estimate-line-item.is-section-row .line-field-qty,
.estimate-line-item.is-section-row .line-field-unit,
.estimate-line-item.is-section-row .line-field-labor,
.estimate-line-item.is-section-row .line-field-material,
.estimate-line-item.is-section-row .line-field-subcontract,
.estimate-line-item.is-section-row .line-field-price,
.estimate-line-item.is-section-row .line-field-provider,
.estimate-line-item.is-section-row .line-field-material-handling,
.estimate-line-item.is-section-row .line-field-accounting,
.estimate-line-item.is-section-row .line-field-split,
.estimate-line-item.is-section-row .line-field-allowance,
.estimate-line-item.is-section-row .line-field-photo,
.estimate-line-item.is-section-row .line-field-caption,
.estimate-line-item.is-section-row .line-field-row-total {
  display: none;
}

.estimate-line-items.is-table-view {
  --estimate-col-product: 210px;
  --estimate-col-description: 300px;
  --estimate-col-quantity: 78px;
  --estimate-col-unit: 105px;
  --estimate-col-labor: 118px;
  --estimate-col-materials: 128px;
  --estimate-col-subcontract: 132px;
  --estimate-col-customer: 145px;
  --estimate-col-total: 118px;
  --estimate-col-details: 164px;
  --estimate-table-width: 1498px;
  overflow-x: auto;
}

.estimate-line-items.is-table-view .estimate-line-table-head,
.estimate-line-items.is-table-view .estimate-line-preview-row {
  display: grid;
  grid-template-columns: var(--estimate-table-columns, var(--estimate-col-product) var(--estimate-col-description) var(--estimate-col-quantity) var(--estimate-col-unit) var(--estimate-col-labor) var(--estimate-col-materials) var(--estimate-col-subcontract) var(--estimate-col-customer) var(--estimate-col-total) var(--estimate-col-details));
  min-width: max(100%, var(--estimate-table-width));
  gap: 0;
}

.estimate-line-items.is-table-view .estimate-line-table-preview {
  display: block;
}

.estimate-line-items.is-table-view > .estimate-line-item {
  display: none;
}

.estimate-line-items.is-table-view .estimate-line-table-head {
  position: sticky;
  top: 0;
  z-index: 1;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #f6f8fb;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.estimate-line-items.is-table-view .estimate-line-table-head span {
  position: relative;
  padding: 8px;
  border-right: 1px solid var(--line);
}

.estimate-column-resizer {
  position: absolute;
  top: 0;
  right: -5px;
  z-index: 3;
  width: 10px;
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  cursor: col-resize;
  touch-action: none;
}

.estimate-column-resizer::after {
  content: '';
  position: absolute;
  top: 20%;
  bottom: 20%;
  left: 4px;
  width: 2px;
  border-radius: 2px;
  background: transparent;
}

.estimate-line-table-head span:hover .estimate-column-resizer::after,
.estimate-column-resizer:focus-visible::after,
.is-resizing-estimate-column .estimate-column-resizer::after {
  background: var(--blue);
}

.is-resizing-estimate-column,
.is-resizing-estimate-column * {
  cursor: col-resize !important;
  user-select: none !important;
}

.estimate-line-items.is-table-view .estimate-line-preview-row > .estimate-preview-cell {
  min-width: 0;
  padding: 4px 6px;
  border-right: 1px solid var(--line);
}

.estimate-line-items.is-table-view .estimate-line-preview-row {
  border-bottom: 1px solid var(--line);
  align-items: center;
  background: rgba(255, 255, 255, 0.72);
}

.estimate-line-preview-group {
  min-width: max(100%, var(--estimate-table-width));
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.estimate-line-preview-group.is-dragging,
.estimate-line-preview-row.is-section-row.is-dragging {
  opacity: 0.48;
}

[data-estimate-preview-container].is-drop-before {
  box-shadow: 0 -3px 0 var(--blue);
}

[data-estimate-preview-container].is-drop-after {
  box-shadow: 0 3px 0 var(--blue);
}

.estimate-line-preview-group .estimate-line-preview-row:last-child {
  border-bottom: 0;
}

.estimate-line-preview-row.is-group-summary {
  background: #f8fafc;
}

.estimate-line-preview-group.has-components .estimate-line-preview-row.is-group-summary {
  border-bottom: 1px solid #cbd7e6;
}

.estimate-line-preview-row.is-component-row {
  background: rgba(246, 248, 251, 0.62);
}

.estimate-line-preview-row.is-component-row > .estimate-preview-cell {
  min-height: 42px;
}

.client-inline-dialog {
  height: auto;
  max-height: min(760px, 94vh);
}

.estimate-preview-input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  padding: 7px 8px;
  color: var(--ink);
  font: inherit;
}

.estimate-preview-input:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.78);
}

.estimate-preview-input:focus {
  position: relative;
  z-index: 2;
  border-color: #21a43a;
  outline: 0;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(33, 164, 58, 0.2);
}

.estimate-preview-input[readonly] {
  cursor: default;
  color: var(--muted);
}

.estimate-preview-input.is-money,
.estimate-preview-total {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.estimate-preview-product-editor,
.estimate-preview-description-editor {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.estimate-preview-product-editor > small,
.estimate-preview-description-editor > small {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #e8eef8;
  padding: 3px 7px;
  color: #3f5570;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.estimate-preview-product-editor .estimate-preview-input,
.estimate-preview-description-editor .estimate-preview-input {
  flex: 1 1 auto;
  font-weight: 800;
}

.estimate-preview-component-label {
  display: grid;
  align-content: center;
  gap: 2px;
  padding-left: 24px !important;
  color: var(--ink);
}

.estimate-preview-component-label strong::before {
  content: '↳ ';
  color: var(--muted);
}

.estimate-preview-component-label small {
  color: var(--muted);
  font-size: 0.72rem;
}

.estimate-line-preview-row.is-adjustment-row .estimate-preview-component-label {
  color: var(--muted);
  font-style: italic;
}

.estimate-preview-total {
  font-weight: 800;
}

.estimate-line-items.is-table-view .estimate-line-preview-row.is-section-row {
  background: #eef5ff;
}

.estimate-line-items.is-table-view .estimate-line-preview-row.is-section-row > .estimate-preview-section-title {
  grid-column: 1 / 10;
}

.estimate-line-preview-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 4px !important;
}

.estimate-preview-drag,
.estimate-preview-delete {
  width: 30px;
  min-width: 30px;
  height: 32px;
  padding: 0 !important;
}

.estimate-preview-drag {
  cursor: grab;
  font-size: 0;
}

.estimate-preview-drag:active {
  cursor: grabbing;
}

.estimate-preview-drag::before {
  content: '\283F';
  font-size: 1rem;
  line-height: 1;
}

.estimate-preview-delete {
  font-size: 0;
}

.estimate-preview-delete::before {
  content: '\00D7';
  font-size: 1.2rem;
  line-height: 1;
}

.estimate-deposit-request {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(180px, 1fr) minmax(160px, 0.8fr) minmax(150px, 0.7fr);
  align-items: end;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 14px;
}

.estimate-deposit-enabled {
  align-self: center;
}

.estimate-deposit-calculated {
  display: grid;
  gap: 6px;
  min-height: 44px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.estimate-deposit-calculated strong {
  color: var(--ink);
  font-size: 0.95rem;
  text-transform: none;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  color: var(--ink);
}

.checkbox-field input {
  width: auto;
  min-height: auto;
  box-shadow: none;
}

.inline-edit-form {
  display: none;
  margin-top: 12px;
}

.inline-edit-form.is-open {
  display: grid;
}

.detail-modal .inline-edit-form {
  display: grid;
}

.detail-modal .detail-record-edit-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 0;
}

.detail-modal .detail-record-edit-form .detail-record-primary,
.detail-modal .detail-record-edit-form .detail-record-wide {
  grid-column: 1 / -1;
}

.detail-modal .detail-record-footer {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: flex-end;
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.detail-modal .detail-record-footer > .button {
  min-width: 142px;
}

.detail-modal .detail-record-footer .archive-form {
  margin-left: auto;
}

.detail-modal .detail-record-footer .archive-form .button {
  background: transparent;
  box-shadow: none;
  opacity: 0.82;
}

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

.payment-workflow {
  display: grid;
  gap: 10px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 14px;
  box-shadow: var(--shadow-hairline);
}

.payment-workflow strong {
  font-size: 1rem;
}

.payment-workflow p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.payment-setup-panel {
  overflow: hidden;
}

.payment-setup-head {
  align-items: start;
}

.payment-setup-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr);
  gap: 16px;
  align-items: stretch;
}

.payment-setup-copy {
  display: grid;
  gap: 16px;
}

.payment-lead {
  max-width: 760px;
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 750;
}

.payment-step-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: payment-step;
}

.payment-step-list li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  min-height: 52px;
  border: 1px solid rgba(220, 228, 238, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  box-shadow: var(--shadow-hairline);
  counter-increment: payment-step;
}

.payment-step-list li::before {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: #e8f3fb;
  color: var(--red-dark);
  font-size: 0.84rem;
  font-weight: 950;
  content: counter(payment-step);
}

.payment-step-list strong,
.payment-step-list span {
  grid-column: 2;
}

.payment-step-list strong {
  color: var(--ink);
}

.payment-step-list span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.payment-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.payment-connection-card {
  display: grid;
  align-content: start;
  gap: 12px;
  border: 1px solid rgba(185, 198, 214, 0.92);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88) 0%, rgba(238, 246, 251, 0.84) 100%);
  padding: 16px;
  box-shadow: var(--shadow-hairline);
}

.payment-connection-card > span,
.payment-connection-card dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.payment-connection-card > strong {
  font-size: 1.35rem;
  line-height: 1.1;
}

.payment-connection-card dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.payment-connection-card div {
  display: grid;
  grid-template-columns: minmax(76px, auto) minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}

.payment-connection-card dd {
  min-width: 0;
  margin: 0;
  color: var(--ink);
  font-weight: 850;
  overflow-wrap: anywhere;
  text-align: right;
}

.billing-detail-card {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 16px;
}

.billing-detail-card div {
  grid-template-columns: 1fr;
  align-items: start;
}

.billing-detail-card dd {
  text-align: left;
}

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

.payment-support-list div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
  padding: 12px;
  box-shadow: var(--shadow-hairline);
}

.payment-support-list strong {
  color: var(--ink);
}

.payment-support-list span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.advanced-settings {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(185, 198, 214, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  padding: 12px;
}

.advanced-settings summary {
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.advanced-settings p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.advanced-settings[open] summary {
  margin-bottom: 10px;
}

.advanced-settings code,
.notice code,
.empty-state code {
  overflow-wrap: anywhere;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  .add-panel-body {
    transition: none;
  }

  .page-content,
  .page-content.is-entering {
    animation: none;
  }
}

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

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(220, 228, 238, 0.82);
  background: rgba(255, 255, 255, 0.72);
}

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

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

th {
  background: rgba(246, 248, 251, 0.92);
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

tbody tr {
  transition: background-color 0.14s ease;
}

tbody tr:hover td {
  background: rgba(238, 246, 251, 0.74);
}

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

.table-select-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 10px;
}

.table-select-count {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
}

.bulk-action-form {
  margin: 12px 0;
}

.estimate-pipeline-controls {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 12px 0;
}

.estimate-pipeline-controls .inline-form {
  margin: 0;
}

.estimate-filter-form {
  flex: 1 1 auto;
}

.estimate-bulk-action {
  margin-left: auto !important;
}

.estimate-bulk-action[hidden] {
  display: none !important;
}

.row-selection-table .selectable-row {
  cursor: default;
  user-select: none;
}

[data-hub-row-href] {
  cursor: pointer;
}

[data-hub-row-href]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -3px;
}

.row-selection-table .selectable-row.is-selected td {
  background: #e8f3fb;
}

.row-selection-table .selectable-row.is-selected:hover td {
  background: #dcecf7;
}

.row-selection-table .selectable-row:focus-visible {
  outline: 3px solid rgba(36, 94, 131, 0.24);
  outline-offset: -3px;
}

.row-select-cell {
  width: 44px;
  min-width: 44px;
  text-align: center;
  vertical-align: middle;
}

.row-select-box {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin: 0;
  cursor: pointer;
}

.row-select-box input {
  width: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--blue);
}

.row-selecting {
  cursor: crosshair;
  user-select: none;
}

.row-selecting * {
  user-select: none;
}

td strong,
td small {
  display: block;
}

td small {
  color: var(--muted);
  margin-top: 2px;
}

.detail-row {
  cursor: pointer;
}

.detail-row:hover td,
.detail-row:focus-visible td {
  background: #eef6fb;
}

.detail-row:focus-visible {
  outline: 3px solid rgba(181, 138, 58, 0.28);
  outline-offset: -3px;
}

.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-form select {
  min-width: 132px;
}

.panel-subhead h3 {
  color: var(--muted);
  font-size: 0.86rem;
  letter-spacing: 0;
  margin: 8px 0 4px;
  text-transform: uppercase;
}

.archive-form {
  display: inline-flex;
}

.row-action-cell {
  width: 1%;
  white-space: nowrap;
}

.row-edit-button,
.row-level-action {
  min-width: 72px;
}

.row-action-cell .button + .button {
  margin-left: 6px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  background: #e8eef6;
  color: var(--ink);
  padding: 5px 10px;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(20, 32, 51, 0.04);
}

.status-pill.success {
  background: #edf8f0;
  color: var(--green);
}

.status-pill.warning {
  background: #fff8e9;
  color: #5f4820;
}

.priority-high,
.priority-critical {
  background: var(--danger-soft);
  color: var(--danger);
}

.priority-low {
  background: #e6f1f5;
  color: var(--blue);
}

.timeline-list,
.job-list {
  display: grid;
  gap: 10px;
}

.timeline-item,
.job-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(220, 228, 238, 0.88);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 12px;
  box-shadow: var(--shadow-hairline), 0 6px 18px rgba(18, 32, 51, 0.05);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.timeline-item:hover,
.job-row:hover {
  border-color: rgba(13, 110, 198, 0.24);
  box-shadow: var(--shadow-hairline), 0 12px 26px rgba(18, 32, 51, 0.08);
  transform: translateY(-1px);
}

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

.timeline-item time,
.job-row small,
.timeline-item span:not(.status-pill),
.job-row span:not(.status-pill) {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.timeline-item strong,
.job-row strong {
  display: block;
}

.timeline-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.schedule-checklist-summary {
  color: var(--green) !important;
}

.schedule-checklist-form,
.schedule-checklist-items {
  display: grid;
  gap: 8px;
}

.schedule-checklist-form {
  margin-top: 6px;
}

.schedule-checklist-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--ink);
}

.schedule-checklist-item input[type="checkbox"] {
  width: auto;
  min-height: 0;
  margin: 0;
}

.schedule-checklist-item input[type="text"] {
  min-height: 36px;
  padding: 7px 9px;
}

.schedule-checklist-new {
  margin-top: 2px;
}

.schedule-checklist-new textarea {
  min-height: 72px;
}

.schedule-checklist-actions {
  justify-content: start;
}

.schedule-checklist-readonly {
  display: grid;
  gap: 4px;
  margin: 6px 0 0;
  padding-left: 18px;
}

.schedule-checklist-readonly li {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.schedule-checklist-readonly li.is-done {
  text-decoration: line-through;
  opacity: 0.68;
}

.kanban-board-tabs {
  margin-bottom: 18px;
}

.kanban-admin-grid {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(220px, 0.8fr) minmax(360px, 1.4fr);
  gap: 16px;
  align-items: start;
}

.kanban-admin-grid h3,
.kanban-card-form h3 {
  margin: 0;
  font-size: 1rem;
}

.kanban-board-description {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.kanban-board {
  display: flex;
  align-items: stretch;
  gap: 16px;
  min-height: min(68vh, 760px);
  overflow-x: auto;
  overscroll-behavior-x: contain;
  padding: 16px;
  scroll-snap-type: x proximity;
  border-radius: var(--radius-lg);
  background: rgba(232, 238, 246, 0.48);
}

.kanban-column {
  display: grid;
  flex: 0 0 320px;
  grid-template-rows: auto 1fr;
  min-width: 320px;
  max-width: 320px;
  min-height: 100%;
  border: 1px solid rgba(220, 228, 238, 0.9);
  border-top: 5px solid var(--column-color, var(--gold));
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.92);
  overflow: hidden;
  scroll-snap-align: start;
  box-shadow: var(--shadow-soft);
}

.kanban-column-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  grid-template-columns: 48px minmax(64px, 1fr) minmax(74px, auto) 34px;
  gap: 7px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
}

.kanban-column-head > input[name="name"] {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.kanban-column-head > input[type="color"] {
  grid-column: 1;
  width: 100%;
}

.kanban-column-head > input[name="sort_order"] {
  grid-column: 2;
  width: 100%;
  min-width: 0;
}

.kanban-column-head input,
.kanban-column-head button,
.kanban-card-update input,
.kanban-card-update select,
.kanban-card-update button {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 0.82rem;
}

.kanban-column-head > input[type="color"] {
  padding: 3px;
}

.kanban-column-head > button {
  grid-column: 3;
  width: 100%;
  min-width: 74px;
  white-space: nowrap;
}

.kanban-column-head > span {
  grid-column: 4;
  display: inline-grid;
  justify-self: center;
  place-items: center;
  min-width: 30px;
  min-height: 30px;
  border-radius: 999px;
  background: var(--column-color, var(--gold));
  color: #fff;
  font-size: 0.78rem;
  font-weight: 900;
}

.kanban-card-list {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 100%;
  padding: 12px;
  background: transparent;
}

.kanban-card {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(220, 228, 238, 0.9);
  border-left: 5px solid #d8c9b1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-soft);
  padding: 12px;
  overflow-wrap: anywhere;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.kanban-card:hover {
  border-color: rgba(13, 110, 198, 0.24);
  box-shadow: 0 16px 32px rgba(18, 32, 51, 0.11);
  transform: translateY(-1px);
}

.kanban-card.priority-high {
  border-left-color: var(--gold);
}

.kanban-card.priority-critical {
  border-left-color: var(--danger);
}

.kanban-card.priority-low {
  border-left-color: var(--blue);
}

.kanban-card header,
.kanban-card-meta div,
.kanban-labels,
.kanban-card-update {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.kanban-card header {
  justify-content: space-between;
}

.kanban-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.kanban-card-meta {
  display: grid;
  gap: 5px;
  margin: 0;
}

.kanban-card-meta dt,
.kanban-card-meta dd {
  margin: 0;
}

.kanban-card-meta dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.kanban-card-meta dd {
  font-size: 0.84rem;
  font-weight: 800;
}

.kanban-labels span {
  border-radius: 999px;
  background: #e8eef6;
  color: var(--muted);
  padding: 4px 8px;
  font-size: 0.74rem;
  font-weight: 900;
}

.kanban-card-update select,
.kanban-card-update input {
  flex: initial;
  min-width: 0;
}

.kanban-card-update {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.kanban-card-update button {
  grid-column: 1 / -1;
  width: 100%;
}

.empty-state {
  margin: 0;
  border: 1px dashed #b9c6d6;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
  color: var(--muted);
  padding: 20px;
  text-align: center;
  font-weight: 800;
}

.empty-state.compact {
  padding: 12px;
  text-align: left;
}

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

.schedule-calendar-toolbar,
.schedule-calendar-title,
.schedule-calendar-actions,
.schedule-view-tabs {
  display: flex;
  align-items: center;
  gap: 10px;
}

.schedule-calendar-toolbar {
  justify-content: space-between;
  flex-wrap: wrap;
}

.schedule-calendar-title {
  align-items: baseline;
  flex-wrap: wrap;
}

.schedule-calendar-title h3 {
  margin: 0;
  font-size: 1.04rem;
  line-height: 1.2;
}

.schedule-calendar-title span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.schedule-view-tabs {
  margin-bottom: 0;
}

.schedule-calendar-scroll {
  overflow-x: auto;
}

.schedule-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  min-width: 760px;
  overflow: hidden;
  border: 1px solid rgba(220, 228, 238, 0.9);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-soft);
}

.schedule-calendar-weekday {
  border-right: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.96);
  color: var(--muted);
  padding: 9px 10px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.schedule-calendar-weekday:nth-child(7) {
  border-right: 0;
}

.schedule-calendar-day {
  display: grid;
  align-content: start;
  gap: 8px;
  min-height: 142px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  padding: 10px;
}

.schedule-calendar-day:nth-child(7n) {
  border-right: 0;
}

.schedule-calendar-grid-week .schedule-calendar-day {
  min-height: 260px;
}

.schedule-calendar-day.is-muted {
  background: rgba(238, 243, 247, 0.72);
}

.schedule-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
}

.schedule-day-head time {
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 900;
}

.schedule-day-head span {
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  padding: 3px 7px;
  font-size: 0.68rem;
  font-weight: 900;
}

.schedule-calendar-events,
.schedule-day-list {
  display: grid;
  gap: 8px;
}

.schedule-calendar-event {
  display: grid;
  gap: 3px;
  min-width: 0;
  border: 1px solid rgba(220, 228, 238, 0.9);
  border-left: 3px solid var(--red);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.96);
  padding: 8px;
  box-shadow: var(--shadow-hairline), 0 6px 16px rgba(18, 32, 51, 0.06);
}

.schedule-calendar-event strong {
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  line-height: 1.25;
}

.schedule-calendar-event span,
.schedule-calendar-event small,
.schedule-calendar-event p {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.schedule-calendar-event p {
  margin: 4px 0 0;
  font-weight: 700;
}

.schedule-calendar-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}

.schedule-calendar-meta .status-pill {
  min-height: 24px;
  padding: 4px 8px;
  font-size: 0.72rem;
}

.schedule-day-list .schedule-calendar-event {
  border-left-color: var(--gold);
  padding: 12px;
}

.photo-row td {
  background: #eef6fb;
  padding-top: 10px;
}

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

.upload-form input[type="file"] {
  max-width: 230px;
}

.upload-form input[type="text"] {
  max-width: 180px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}

.lead-visualizer-stack {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.lead-visualizer-card {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid rgba(13, 110, 198, 0.18);
  border-radius: 8px;
  background: rgba(13, 110, 198, 0.06);
  padding: 10px;
}

.lead-visualizer-thumb {
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  overflow: hidden;
}

.lead-visualizer-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.lead-visualizer-copy strong,
.lead-visualizer-copy span,
.lead-visualizer-copy small {
  overflow-wrap: anywhere;
}

.lead-visualizer-copy span {
  color: var(--ink);
  font-weight: 900;
}

.lead-visualizer-copy .button {
  justify-self: start;
  margin-top: 4px;
}

.photo-card {
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  box-shadow: var(--shadow-hairline), 0 8px 18px rgba(18, 32, 51, 0.07);
}

.photo-card a {
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--surface);
}

.media-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 0;
  background: var(--surface);
  padding: 0;
  cursor: zoom-in;
}

.photo-card img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.document-card a {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.document-icon {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 2px solid var(--red);
  border-radius: 6px;
  color: var(--red);
  font-weight: 900;
}

.media-modal[hidden] {
  display: none;
}

.detail-modal[hidden] {
  display: none;
}

.invoice-modal[hidden] {
  display: none;
}

.modal-open {
  overflow: hidden;
}

.media-modal,
.detail-modal,
.invoice-modal {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(10px, 2vw, 24px);
}

.media-modal {
  z-index: 90;
}

.detail-modal,
.invoice-modal {
  z-index: 82;
}

.media-modal-backdrop,
.detail-modal-backdrop,
.invoice-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 9, 8, 0.82);
}

.media-modal-dialog,
.detail-modal-dialog,
.invoice-modal-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1180px, 96vw);
  height: min(880px, 94vh);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: #111;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.38);
  overflow: hidden;
}

.detail-modal-dialog {
  width: min(920px, 96vw);
  background: var(--paper);
}

.invoice-modal-dialog {
  width: min(1180px, 98vw);
  background: var(--paper);
}

.media-modal-head,
.detail-modal-head,
.invoice-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  background: var(--paper);
  padding: 10px 12px 10px 16px;
}

.detail-modal-head,
.invoice-modal-head {
  border-bottom: 1px solid var(--line);
}

.media-modal-head strong,
.detail-modal-head strong,
.detail-modal-head span,
.invoice-modal-head strong,
.invoice-modal-head span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-modal-head span,
.invoice-modal-head span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
  margin-top: 2px;
}

.media-modal-body {
  display: grid;
  place-items: center;
  min-height: 0;
  background: #111;
  padding: 10px;
}

.media-modal-body img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.detail-modal-body {
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 16px;
}

.detail-item {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.detail-item h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0;
  text-transform: uppercase;
}

.detail-value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.detail-value strong,
.detail-value small {
  display: block;
}

.detail-value small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.detail-actions .detail-value {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 8px;
}

.detail-actions .inline-edit-form {
  width: 100%;
}

.detail-actions .inline-form,
.detail-actions .archive-form,
.detail-actions form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.detail-actions form:has(select[data-searchable-select]) {
  display: grid;
  grid-template-columns: minmax(0, 220px) minmax(0, 220px) auto;
  align-items: end;
  width: 100%;
}

.detail-actions form:has(select[data-searchable-select]) .searchable-select {
  width: 100%;
}

.detail-actions .searchable-select-list {
  top: auto;
  bottom: calc(100% + 6px);
}

.detail-actions select,
.detail-actions input:not([type="hidden"]),
.detail-actions textarea {
  min-width: min(220px, 100%);
}

.detail-actions .button {
  flex: 0 0 auto;
}

.detail-status-editor .detail-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.detail-status-editor .status-pill {
  display: none;
}

.detail-status-editor .status-edit-form {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.detail-status-editor select {
  min-width: min(260px, 100%);
}

.detail-value .photo-grid {
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
}

/*
 * The body scrolls, so its sections must keep their natural height. A fixed
 * minmax(0, 1fr) middle row capped the wizard track below the height its own
 * panels needed, and the overflow painted the overview panel straight over the
 * action buttons. Let the sections size themselves and stick the actions to the
 * bottom edge instead.
 */
.invoice-modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 0;
  overflow: auto;
  padding: 16px;
}

.invoice-modal-body > .invoice-form-grid,
.invoice-modal-body > .invoice-wizard-grid {
  flex: 0 0 auto;
}

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

.invoice-wizard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.38fr);
  gap: 14px;
  min-height: 0;
}

.invoice-item-panel,
.invoice-overview-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  padding: 12px;
  box-shadow: var(--shadow-hairline);
}

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

.invoice-item-row {
  display: grid;
  grid-template-columns: 30px minmax(220px, 1.2fr) minmax(74px, 0.34fr) minmax(88px, 0.38fr) minmax(96px, 0.42fr) minmax(92px, 0.36fr) auto;
  align-items: end;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef6fb;
  padding: 10px;
}

.invoice-item-check {
  display: grid;
  place-items: center;
  min-height: 42px;
}

.invoice-item-check input {
  width: 18px;
  min-height: 18px;
}

.invoice-item-description textarea {
  min-height: 42px;
}

.invoice-line-total {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  color: var(--ink);
  font-weight: 900;
}

.invoice-overview-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.invoice-overview-panel h2 {
  margin: 0;
  font-size: 1.05rem;
}

.invoice-overview-list,
.receipt-summary dl,
.document-totals dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.invoice-overview-list div,
.receipt-summary dl div,
.document-totals dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.invoice-overview-list dt,
.receipt-summary dt,
.document-totals dt {
  color: var(--muted);
  font-weight: 900;
}

.invoice-overview-list dd,
.receipt-summary dd,
.document-totals dd {
  margin: 0;
  color: var(--ink);
  font-weight: 900;
  text-align: right;
}

.invoice-overview-list input {
  max-width: 130px;
  text-align: right;
}

.invoice-total-row dd,
.document-balance dd {
  color: var(--red);
  font-size: 1.15rem;
}

.invoice-modal-actions {
  position: sticky;
  z-index: 1;
  bottom: -16px;
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 8px;
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: 12px 0 16px;
}

.document-body {
  background: #d9d5ce;
}

.document-shell {
  width: min(940px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 14px;
}

.document-paper {
  min-height: 1050px;
  border: 1px solid #cfc7bd;
  background: #fff;
  box-shadow: var(--shadow);
  padding: clamp(24px, 5vw, 54px);
}

.receipt-paper {
  min-height: 680px;
}

.document-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 3px solid var(--ink);
  padding-bottom: 22px;
}

.document-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.document-brand img {
  width: 82px;
  height: 82px;
  object-fit: contain;
  flex: 0 0 auto;
}

.document-logo-mark {
  display: inline-grid;
  place-items: center;
  width: 82px;
  height: 82px;
  flex: 0 0 auto;
  border: 2px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-warm);
  color: var(--red-dark);
  font-size: 1.35rem;
  font-weight: 900;
}

.document-brand > div {
  min-width: 0;
}

.document-header h1 {
  margin: 0;
  font-size: 2.5rem;
  line-height: 1;
}

.document-header p {
  margin: 8px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.document-back-button {
  margin-right: auto;
}

.document-embedded-body .page-content {
  min-height: calc(100vh - 86px);
  background: #d9d5ce;
  padding: 0 18px 24px;
}

.embedded-document-view {
  min-width: 0;
}

.invoice-balance-warning {
  margin-bottom: 12px;
  border: 1px solid rgba(180, 83, 9, 0.32);
  border-radius: var(--radius-md);
  background: rgba(255, 247, 237, 0.96);
  color: #92400e;
  padding: 10px 12px;
  font-size: 0.86rem;
  font-weight: 900;
}

.invoice-remaining-row {
  border-color: rgba(13, 110, 198, 0.28) !important;
  background: rgba(13, 110, 198, 0.07);
}

.document-business-details {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.document-business-details p {
  margin: 0;
}

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

.signature-certificate-document {
  min-height: 920px;
}

.signature-audit-section dl,
.portal-signature-details dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.signature-audit-section dl div,
.portal-signature-details dl div {
  display: grid;
  gap: 3px;
}

.signature-audit-section dt,
.portal-signature-details dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.signature-audit-section dd,
.portal-signature-details dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.document-number {
  display: grid;
  align-content: start;
  justify-items: end;
  gap: 6px;
  text-align: right;
}

.document-number strong {
  font-size: 1.25rem;
}

.document-number span {
  border-radius: 999px;
  background: #e8eef6;
  padding: 5px 10px;
  font-weight: 900;
}

.document-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.document-meta-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.document-meta-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.document-meta-grid strong,
.document-meta-grid p {
  overflow-wrap: anywhere;
}

.document-meta-grid strong {
  display: block;
  margin-top: 4px;
}

.document-meta-grid p {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.document-table {
  min-width: 0;
  margin-top: 16px;
}

.document-table th,
.document-table td {
  padding: 10px 8px;
}

.document-table .document-section-row td {
  background: #eef5ff;
  color: var(--ink);
  font-size: 0.86rem;
  text-transform: uppercase;
}

.document-table th:last-child,
.document-table td:last-child,
.document-table th:nth-last-child(2),
.document-table td:nth-last-child(2) {
  text-align: right;
}

.compact-document-table {
  font-size: 0.92rem;
}

.document-totals {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.document-totals dl {
  width: min(340px, 100%);
}

.document-section {
  margin-top: 24px;
}

.compact-document-section {
  margin-top: -6px;
  margin-bottom: 18px;
}

.document-section h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.document-section p {
  margin: 0 0 12px;
  color: var(--muted);
  font-weight: 700;
}

.document-section h3 {
  margin: 16px 0 10px;
  font-size: 0.95rem;
}

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

.document-photo-grid figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.document-photo-grid img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.document-photo-grid figcaption {
  padding: 8px 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

@media (max-width: 900px) {
  .document-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .estimate-line-item > label,
  .estimate-line-item .line-field-code,
  .estimate-line-item .line-field-section,
  .estimate-line-item .line-field-description,
  .estimate-line-item .line-field-qty,
  .estimate-line-item .line-field-unit,
  .estimate-line-item .line-field-labor,
  .estimate-line-item .line-field-material,
  .estimate-line-item .line-field-subcontract,
  .estimate-line-item .line-field-price,
  .estimate-line-item .line-field-provider,
  .estimate-line-item .line-field-material-handling,
  .estimate-line-item .line-field-accounting,
  .estimate-line-item .line-field-split,
  .estimate-line-item .line-field-allowance,
  .estimate-line-item .line-field-notes,
  .estimate-line-item .line-field-photo,
  .estimate-line-item .line-field-caption,
  .estimate-line-item .line-field-row-total {
    grid-column: span 1;
  }

  .line-field-drag {
    grid-column: span 2;
  }

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

  .estimate-line-items.is-table-view .estimate-line-table-head,
  .estimate-line-items.is-table-view .estimate-line-preview-row {
    min-width: var(--estimate-table-width);
  }
}

@media (max-width: 640px) {
  .estimate-line-items-head,
  .estimate-line-total {
    align-items: stretch;
    flex-direction: column;
  }

  .estimate-line-item,
  .estimate-builder-form,
  .document-photo-grid {
    grid-template-columns: 1fr;
  }

  .estimate-line-item > label,
  .estimate-line-item .line-field-code,
  .estimate-line-item .line-field-section,
  .estimate-line-item .line-field-description,
  .estimate-line-item .line-field-qty,
  .estimate-line-item .line-field-unit,
  .estimate-line-item .line-field-labor,
  .estimate-line-item .line-field-material,
  .estimate-line-item .line-field-subcontract,
  .estimate-line-item .line-field-price,
  .estimate-line-item .line-field-provider,
  .estimate-line-item .line-field-material-handling,
  .estimate-line-item .line-field-accounting,
  .estimate-line-item .line-field-split,
  .estimate-line-item .line-field-allowance,
  .estimate-line-item .line-field-notes,
  .estimate-line-item .line-field-photo,
  .estimate-line-item .line-field-caption,
  .estimate-line-item .line-field-row-total {
    grid-column: 1 / -1;
  }

  .line-field-drag {
    grid-column: 1 / -1;
  }

  .estimate-deposit-request {
    grid-template-columns: 1fr;
  }
}

.receipt-summary {
  margin-top: 24px;
}

.photo-card figcaption {
  display: grid;
  gap: 2px;
  padding: 9px;
}

.photo-card strong,
.photo-card span {
  overflow-wrap: anywhere;
}

.photo-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.blog-editor-panel {
  padding-bottom: 20px;
}

.blog-editor-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.blog-editor-sidebar,
.blog-editor-main,
.preview-panel,
.seo-fields {
  display: grid;
  gap: 14px;
}

.blog-editor-sidebar {
  align-content: start;
}

.blog-editor-main {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr);
  align-items: start;
}

.blog-editor-main textarea[name="content"] {
  min-height: 620px;
  font-family: Consolas, Monaco, monospace;
  font-size: 0.92rem;
  line-height: 1.55;
}

.preview-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 12px;
  box-shadow: var(--shadow-hairline);
}

.preview-panel iframe {
  width: 100%;
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.compact-head {
  margin-bottom: 0;
}

.seo-fields {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 12px;
  box-shadow: var(--shadow-hairline);
}

.seo-fields summary {
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
}

.blog-featured-check {
  font-size: 0.82rem;
}

.blog-featured-check strong {
  margin-bottom: 2px;
}

.blog-editor-actions,
.blog-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.blog-editor-actions .button {
  flex: 1 1 130px;
}

.blog-filter-bar {
  margin-bottom: 14px;
}

.blog-filter-bar input[type="search"] {
  width: min(320px, 100%);
}

.blog-status-published {
  background: #edf8f0;
  color: var(--green);
}

.blog-status-archived {
  background: #e8eef6;
  color: var(--muted);
}

.blog-category-form {
  margin-bottom: 14px;
}

.category-edit-form {
  align-items: center;
  margin-bottom: 8px;
}

.category-edit-form input[name="description"] {
  min-width: min(340px, 100%);
}

.category-edit-form input[name="sort_order"] {
  max-width: 92px;
}

.category-delete-form {
  margin-top: 0;
}

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

.email-sidebar,
.email-main {
  min-width: 0;
}

.email-account-help {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 14px;
  box-shadow: var(--shadow-hairline);
}

.email-account-help strong {
  display: block;
  margin-bottom: 6px;
}

.email-account-help p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.email-folder-list {
  display: grid;
  gap: 4px;
  margin-top: 16px;
}

.email-folder-link {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border-radius: 8px;
  color: var(--ink);
  padding: 9px 10px;
  text-decoration: none;
}

.email-folder-link span {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 950;
}

.email-folder-link strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-folder-link:hover,
.email-folder-link.is-active {
  background: #eef6fb;
}

.email-folder-link.is-drop-target {
  outline: 2px dashed rgba(13, 110, 198, 0.55);
  outline-offset: 2px;
  background: #f0f8ff;
}

.email-folder-link.is-active {
  color: var(--red-dark);
}

.email-folder-link.is-active span {
  border-color: rgba(13, 110, 198, 0.28);
  background: #e8f3fb;
  color: var(--red-dark);
}

.email-setup-guide,
.email-saved-accounts {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  padding: 14px;
  box-shadow: var(--shadow-hairline);
}

.email-setup-guide p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.email-saved-accounts {
  display: grid;
  gap: 10px;
}

.email-saved-account {
  justify-content: space-between;
}

.email-toolbar,
.email-reader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.email-toolbar {
  margin-bottom: 14px;
}

.email-toolbar-actions,
.email-reader-actions,
.email-compose-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.email-compose-details {
  margin-bottom: 16px;
}

.email-sidebar-details {
  margin-top: 14px;
}

.email-compose-details summary {
  width: fit-content;
  list-style: none;
}

.email-compose-details summary::-webkit-details-marker {
  display: none;
}

.email-compose {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  padding: 16px;
  box-shadow: var(--shadow-hairline);
}

.email-signature-form {
  padding: 12px;
}

.email-checkline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
}

.email-checkline input {
  width: auto;
}

.email-attachment-grid {
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) repeat(2, minmax(220px, 1fr));
  gap: 12px;
}

.email-attachment-grid select {
  min-height: 132px;
}

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

.email-layout {
  display: grid;
  grid-template-columns: minmax(260px, 38%) minmax(0, 1fr);
  min-height: 620px;
  border: 1px solid rgba(220, 228, 238, 0.9);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-soft);
}

.email-layout.is-listing,
.email-layout.is-reading {
  grid-template-columns: minmax(0, 1fr);
}

.email-layout.is-listing .email-reader,
.email-layout.is-reading .email-list {
  display: none;
}

.email-layout.is-listing .email-list {
  border-right: 0;
}

.email-reader-back {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 8px 12px;
  text-decoration: none;
}

.email-list {
  min-width: 0;
  border-right: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.92);
  overflow: auto;
}

.email-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 248, 251, 0.86);
  color: var(--ink);
  padding: 11px 16px;
  text-decoration: none;
}

.email-row:hover,
.email-row.is-active {
  background: #fff;
}

.email-row.is-dragging {
  opacity: 0.55;
}

.email-row.is-active {
  box-shadow: inset 4px 0 0 var(--red);
}

.email-row.is-unread {
  background: #fff;
  color: var(--ink);
}

.email-row.is-unread .email-from,
.email-row.is-unread strong,
.email-row.is-unread time {
  font-weight: 950;
}

.email-unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: transparent;
}

.email-row.is-unread .email-unread-dot {
  background: var(--red);
}

.email-row-content {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.email-from {
  overflow: hidden;
  color: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-from em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.email-row strong {
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-row small,
.email-row time,
.email-reader-head p {
  color: var(--muted);
}

.email-row time {
  align-self: start;
  font-size: 0.78rem;
  white-space: nowrap;
}

.email-reader {
  min-width: 0;
  overflow: auto;
  padding: clamp(18px, 3vw, 28px);
}

.email-reader-head {
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  padding-bottom: 16px;
}

.email-reader-head h2 {
  font-size: 1.6rem;
}

.email-reader-head p {
  margin: 8px 0 0;
}

.email-reader-head span {
  display: inline-block;
  margin-left: 8px;
}

.email-body {
  margin: 0;
  color: var(--ink);
  font: inherit;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.email-thread-strip {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.email-thread-strip h3 {
  margin: 0;
  font-size: 0.9rem;
}

.email-thread-strip a {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  padding: 9px 11px;
  text-decoration: none;
}

.email-thread-strip a.is-active {
  border-color: rgba(13, 110, 198, 0.32);
  background: #eef6fb;
}

.email-thread-strip span,
.email-thread-strip small {
  color: var(--muted);
  font-size: 0.82rem;
}

.email-html-frame {
  display: block;
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.email-attachments-panel {
  margin-top: 22px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.email-attachments-panel h3 {
  margin: 0 0 12px;
  font-size: 1rem;
}

.email-attachment-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}

.email-attachment-card {
  display: grid;
  gap: 8px;
  align-content: start;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  padding: 10px;
  text-decoration: none;
  box-shadow: var(--shadow-hairline);
}

.email-attachment-card:hover {
  border-color: rgba(13, 110, 198, 0.32);
  box-shadow: 0 14px 30px rgba(18, 32, 51, 0.1);
}

.email-attachment-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 6px;
  background: #f2eee8;
}

.email-attachment-card strong,
.email-attachment-card small,
.email-attachment-card em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.email-attachment-card small {
  color: var(--muted);
}

.email-attachment-card em {
  color: var(--red-dark);
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 900;
}

.button.danger {
  border-color: #efb3a9;
  color: var(--danger);
}

.button.danger:hover {
  background: #ffe2dc;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.bizos-ai-message-actions {
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  padding-top: 2px;
}

.bizos-ai-message-actions .bizos-ai-save-mind,
.bizos-ai-message-actions .button {
  flex: 0 1 auto;
  font-size: 0.74rem;
  min-height: 28px;
  padding: 5px 9px;
}

.bizos-ai-message-action-status {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

.bizos-ai-correction-card {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
}

.bizos-ai-correction-text {
  margin: 0;
  color: var(--ink);
  font-size: 0.8rem;
  line-height: 1.4;
}

.bizos-ai-correction-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.bizos-ai-correction-actions .button {
  flex: 0 1 auto;
  font-size: 0.74rem;
  min-height: 28px;
  padding: 5px 9px;
}

.bizos-ai-correction-status,
.bizos-ai-correction-card.is-confirmed {
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
}

/* Capture is the reason the page exists, so its controls lead the panel and are
   sized for a thumb in a work glove rather than a mouse pointer. */
.photo-capture-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
}

.photo-capture-action {
  position: relative;
  overflow: hidden;
  justify-content: center;
  min-width: 0;
  min-height: 52px;
  font-size: 1rem;
  cursor: pointer;
}

/* The native control is the accessible target; it is stretched across the label
   so the whole button is tappable, and made invisible rather than display:none
   so it still receives focus and clicks. */
.photo-capture-action input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.photo-capture-action:focus-within {
  outline: 2px solid var(--accent, currentColor);
  outline-offset: 2px;
}

.photo-capture-hint {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  margin: 0;
}

/* This is an immediate receipt for a camera handoff: compact enough to stay
   above the fold, but each shot remains visible and removable before upload. */
.photo-capture-confirmation {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-hairline);
}

.photo-capture-confirmation[hidden] {
  display: none;
}

.photo-capture-confirmation-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 3px 10px;
  color: var(--ink);
  font-size: 0.84rem;
}

.photo-capture-confirmation-heading strong {
  font-weight: 800;
}

.photo-capture-confirmation-heading span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.photo-capture-thumbnail-strip {
  display: flex;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 1px 1px 4px;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
}

.photo-capture-thumbnail {
  position: relative;
  flex: 0 0 76px;
  width: 76px;
  height: 76px;
  overflow: hidden;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  scroll-snap-align: start;
}

.photo-capture-thumbnail > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-capture-thumbnail[data-photo-upload-state="uploading"],
.photo-capture-thumbnail[data-photo-upload-state="resizing"],
.photo-capture-thumbnail[data-photo-upload-state="claimed"] {
  border-color: var(--accent);
}

.photo-capture-thumbnail[data-photo-upload-state="done"],
.photo-capture-thumbnail[data-photo-upload-state="duplicate"] {
  border-color: rgba(32, 114, 92, 0.78);
}

.photo-capture-thumbnail[data-photo-upload-state="failed"] {
  border-color: var(--danger);
}

.photo-capture-thumbnail-state {
  position: absolute;
  right: 3px;
  bottom: 3px;
  left: 3px;
  overflow: hidden;
  padding: 3px 4px;
  border-radius: 4px;
  background: rgba(20, 25, 35, 0.82);
  color: #fff;
  font-size: 0.64rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.photo-capture-thumbnail[data-photo-upload-state="failed"] .photo-capture-thumbnail-state {
  background: var(--danger);
}

.photo-capture-thumbnail-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(20, 25, 35, 0.82);
  color: #fff;
  cursor: pointer;
  font-size: 0;
}

.photo-capture-thumbnail-remove::before,
.photo-capture-thumbnail-remove::after {
  position: absolute;
  top: 21px;
  left: 15px;
  width: 14px;
  height: 2px;
  background: currentColor;
  content: '';
}

.photo-capture-thumbnail-remove::before {
  transform: rotate(45deg);
}

.photo-capture-thumbnail-remove::after {
  transform: rotate(-45deg);
}

.photo-capture-thumbnail-remove:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.photo-capture-thumbnail-remove[hidden] {
  display: none;
}

.photo-report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.photo-upload-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.photo-upload-list[hidden],
.photo-upload-status[hidden] {
  display: none;
}

.photo-upload-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
  padding: 8px;
  box-shadow: var(--shadow-hairline);
}

.photo-upload-row[data-photo-upload-state="done"],
.photo-upload-row[data-photo-upload-state="duplicate"] {
  border-color: rgba(32, 114, 92, 0.34);
}

.photo-upload-row[data-photo-upload-state="failed"] {
  border-color: rgba(180, 35, 24, 0.4);
  background: var(--danger-soft);
}

.photo-upload-row .button[hidden] {
  display: none;
}

.photo-upload-preview {
  width: 52px;
  height: 52px;
  display: block;
  border-radius: var(--radius-sm);
  background: var(--surface);
  object-fit: cover;
}

.photo-upload-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.photo-upload-copy strong {
  color: var(--ink);
  font-size: 0.84rem;
  overflow-wrap: anywhere;
}

.photo-upload-copy span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.photo-upload-row[data-photo-upload-state="failed"] .photo-upload-copy span {
  color: var(--danger);
}

.photo-upload-bar {
  width: 100%;
  height: 5px;
  border: 0;
  border-radius: 999px;
  background: var(--surface);
}

.photo-upload-bar[hidden] {
  display: none;
}

.photo-upload-status {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.photo-phase-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.photo-phase-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 6px 12px;
  font-size: 0.84rem;
  font-weight: 900;
  text-decoration: none;
  box-shadow: var(--shadow-hairline);
}

.photo-phase-chip span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  border-radius: 999px;
  background: #e8eef6;
  color: var(--muted);
  padding: 1px 6px;
  font-size: 0.72rem;
}

.photo-phase-chip:hover,
.photo-phase-chip:focus-visible,
.photo-phase-chip.is-active {
  border-color: var(--red-dark);
  background: var(--red);
  color: #fff;
}

.photo-phase-chip.is-active span,
.photo-phase-chip:hover span,
.photo-phase-chip:focus-visible span {
  background: rgba(255, 255, 255, 0.24);
  color: #fff;
}

.photo-timeline {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.photo-day {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.photo-day-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid rgba(220, 228, 238, 0.72);
  padding-bottom: 7px;
}

.photo-day-head h3 {
  margin: 0;
  font-size: 0.98rem;
}

.photo-day-count {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.photo-day-select {
  margin-left: auto;
}

.photo-day-select[hidden] {
  display: none;
}

.photo-timeline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  min-width: 0;
}

.photo-tile {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.9);
  overflow: hidden;
  box-shadow: var(--shadow-hairline), 0 8px 18px rgba(18, 32, 51, 0.07);
}

.photo-tile.is-selected {
  border-color: var(--red-dark);
  box-shadow: var(--shadow-hairline), 0 0 0 2px var(--red);
}

.photo-tile-select {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  display: grid;
  place-items: center;
  gap: 0;
  min-width: 34px;
  min-height: 34px;
}

.photo-tile-select input {
  position: absolute;
  width: 100%;
  min-height: 100%;
  margin: 0;
  border: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.photo-tile-select-mark {
  width: 22px;
  height: 22px;
  border: 2px solid var(--paper);
  border-radius: var(--radius-sm);
  background: rgba(20, 32, 51, 0.42);
  box-shadow: 0 2px 6px rgba(18, 32, 51, 0.32);
  pointer-events: none;
}

.photo-tile-select input:checked + .photo-tile-select-mark {
  border-color: var(--paper);
  background: var(--red);
}

.photo-tile-select input:focus-visible + .photo-tile-select-mark {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.photo-tile-thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
}

.photo-tile-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.photo-tile-meta {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  padding: 8px 9px 9px;
}

.photo-tile-meta strong {
  color: var(--ink);
  font-size: 0.82rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.photo-tile-meta > span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.photo-phase-badge {
  justify-self: start;
  border-radius: 999px;
  background: #e8eef6;
  color: var(--ink);
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.photo-phase-badge.is-before {
  background: #e8eef6;
  color: var(--blue);
}

.photo-phase-badge.is-progress {
  background: rgba(13, 110, 198, 0.12);
  color: var(--red-dark);
}

.photo-phase-badge.is-after,
.photo-phase-badge.is-completion {
  background: #edf8f0;
  color: var(--green);
}

.photo-phase-badge.is-issue {
  background: var(--danger-soft);
  color: var(--danger);
}

.photo-phase-badge.is-materials {
  background: rgba(184, 138, 53, 0.14);
  color: var(--gold);
}

.photo-phase-badge.is-safety {
  background: rgba(22, 131, 122, 0.12);
  color: var(--teal);
}

.photo-phase-badge.is-unsorted {
  background: #eef1f5;
  color: var(--muted);
}

.photo-tile-flags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.photo-tile-pin,
.photo-tile-flag {
  border-radius: 999px;
  background: #eef1f5;
  color: var(--muted);
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 900;
}

.photo-tile-pin {
  color: var(--red-dark);
  text-decoration: none;
}

.photo-tile-pin:hover,
.photo-tile-pin:focus-visible {
  text-decoration: underline;
}

.photo-bulk-bar {
  position: sticky;
  bottom: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  padding: 10px;
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-soft);
}

.photo-bulk-bar[hidden] {
  display: none;
}

.photo-bulk-count {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
}

.photo-bulk-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.photo-bulk-group select,
.photo-bulk-group input[type="text"] {
  width: auto;
  min-width: 0;
  max-width: 200px;
}

.photo-empty-state {
  display: grid;
  gap: 6px;
  text-align: left;
}

.photo-empty-state strong {
  color: var(--ink);
}

.photo-empty-state p {
  margin: 0;
  font-weight: 700;
}

/* Receipt review queue
   ------------------------------------------------------------------------ */

/* Sits on the dark sidebar, so it borrows the nav's light-on-dark treatment
   rather than the light-surface pill used inside the workspace. */
.nav-count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  min-height: 18px;
  padding: 2px 6px;
  border: 1px solid rgba(120, 180, 255, 0.38);
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.24);
  color: #dbeafe;
  font-size: 0.62rem;
  font-weight: 900;
  line-height: 1;
}

/* A translucent tint over whatever the tab is sitting on, so the badge reads
   the same on a light tab, an active tab, and the dark theme. */
.section-tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  margin-left: 7px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(184, 138, 53, 0.2);
  color: inherit;
  font-size: 0.72rem;
  font-weight: 900;
  line-height: 1.2;
}

.section-tab.is-active .section-tab-count {
  background: rgba(255, 255, 255, 0.24);
}

.status-pill.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.receipt-queue-filter {
  align-items: end;
  margin-top: 12px;
}

/* Explicit minmax(0, 1fr) tracks throughout: the line-item table carries the
   global 780px table min-width, and an auto-sized grid track would grow to it
   and push the whole queue sideways instead of letting the table scroll. */
.receipt-rows {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.receipt-row {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--paper);
  padding: 12px;
  box-shadow: var(--shadow-hairline);
}

.receipt-row.is-working {
  opacity: 0.6;
}

.receipt-row-head {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

/* A receipt is a full-resolution phone photo. The row always loads the thumb
   derivative and only the modal reaches for a larger rendition. */
.receipt-row-thumb {
  width: 92px;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.receipt-row-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.receipt-row-summary {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.receipt-row-summary p {
  margin: 0;
  min-width: 0;
}

.receipt-row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.receipt-row-title strong {
  color: var(--ink);
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.receipt-row-figures {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.receipt-row-amount {
  color: var(--ink);
  font-size: 1.06rem;
  font-weight: 900;
}

.receipt-row-job {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.receipt-row-job-name {
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

/* Carries .status-pill.warning in the markup so the unanswered job inherits the
   theme handling that variant already has; this only sizes it for a text line. */
.receipt-row-job-empty {
  min-height: 24px;
  padding: 3px 9px;
  font-size: 0.74rem;
}

.receipt-row-meta {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.receipt-row-detail {
  margin-top: 10px;
}

.receipt-row-detail > summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  border-radius: var(--radius-md);
  padding: 10px 4px;
  color: var(--red);
  font-size: 0.88rem;
  font-weight: 900;
  cursor: pointer;
}

.receipt-row-detail > summary:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.receipt-row-detail-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.receipt-row-detail-body > * {
  min-width: 0;
}

.receipt-row-detail-body .notice,
.receipt-row-detail-body .form-help {
  margin: 0;
}

.receipt-row-detail-body .stacked-form {
  margin-top: 0;
}

.receipt-warnings ul {
  margin: 6px 0 0;
  padding-left: 20px;
}

.receipt-warnings li {
  font-weight: 700;
}

.receipt-suggestions {
  display: grid;
  gap: 8px;
  /* min() keeps the track from forcing a horizontal scroll on a narrow phone. */
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
}

/* Ranked jobs are the fast path, so each one is a single tap that says which
   job and why it was suggested. */
.receipt-suggestion {
  display: grid;
  gap: 2px;
  min-width: 0;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
  box-shadow: var(--shadow-hairline);
}

.receipt-suggestion:hover,
.receipt-suggestion:focus-visible {
  border-color: var(--red-dark);
  background: var(--paper);
}

.receipt-suggestion strong {
  font-size: 0.92rem;
  font-weight: 900;
  overflow-wrap: anywhere;
}

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

.receipt-assign-form {
  margin: 0;
}

.receipt-assign-fallback {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 8px;
}

.receipt-job-picker {
  flex: 1 1 220px;
  min-width: 0;
}

.receipt-job-settled {
  margin: 0;
  border-left: 4px solid var(--green);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: 9px 12px;
  font-size: 0.86rem;
  font-weight: 700;
}

.receipt-change-job > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.receipt-change-job > label {
  margin-top: 6px;
}

.receipt-confirm-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.receipt-line-item-disclosure > summary {
  min-height: 44px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  cursor: pointer;
}

.receipt-line-item-disclosure .table-wrap {
  margin-top: 8px;
}

.receipt-row-secondary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.receipt-row-secondary form {
  margin: 0;
}

.line-field-material-source { align-self: end; min-width: 0; }
.material-source-popover { position: relative; }
.material-source-popover summary { cursor: pointer; color: var(--accent, #1478c9); font-weight: 800; list-style: none; }
.material-source-popover summary::-webkit-details-marker { display: none; }
.material-source-card { position: absolute; z-index: 30; inset: calc(100% + 7px) auto auto 0; display: grid; gap: 5px; width: min(330px, 80vw); padding: 12px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); color: var(--text); box-shadow: 0 14px 35px rgba(0,0,0,.25); font-size: 13px; }
.material-source-card span { color: var(--muted); }
.material-source-card a { color: var(--accent, #1478c9); font-weight: 800; }
@media (hover: hover) { .material-source-popover:not([open]):hover .material-source-card { display: grid; } .material-source-popover:not([open]) .material-source-card { display: none; } }
@media (max-width: 760px) { .material-source-card { position: static; width: 100%; margin-top: 8px; } }

body.bizos-global-draft-review-open { overflow: hidden; }
.bizos-global-draft-review { position: fixed; inset: 0; z-index: 2350; background: var(--surface); }
.bizos-global-draft-review-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--surface); }
@media (max-width: 1180px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-visual-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .subcontractor-compliance-gate:nth-child(3) {
    border-inline-start: 0;
  }

  .subcontractor-compliance-gate:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

  .blog-editor-grid,
  .blog-editor-main,
  .email-shell {
    grid-template-columns: 1fr;
  }

  .email-layout {
    grid-template-columns: 1fr;
  }

  .email-list {
    max-height: 360px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .email-attachment-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  html,
  body {
    max-width: 100%;
    overflow-x: clip;
  }

  body {
    padding-bottom: env(safe-area-inset-bottom);
  }

  .finance-section-content {
    scroll-margin-top: 116px;
  }

  button,
  .button,
  .button.small,
  .nav-group summary,
  .searchable-select-option {
    min-height: 44px;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  body.view-agent {
    height: 100dvh;
    overflow: hidden;
    padding-bottom: 0;
  }

  body.view-agent .content-shell {
    display: flex;
    height: 100dvh;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
  }

  body.view-agent .topbar {
    flex: 0 0 auto;
  }

  body.view-agent .page-content {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    overflow: hidden;
  }

  body.view-agent .mobile-quick-nav {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    z-index: 20;
    inset: 0 auto 0 0;
    width: min(320px, 84vw);
    height: 100dvh;
    max-height: 100dvh;
    box-sizing: border-box;
    display: block;
    padding-bottom: calc(22px + env(safe-area-inset-bottom));
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.26) transparent;
    clip-path: inset(0 100% 0 0);
    visibility: hidden;
    pointer-events: none;
    transition: clip-path 0.2s ease, visibility 0s linear 0.2s;
  }

  .sidebar.open {
    clip-path: inset(0);
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .sidebar-open {
    overflow: hidden;
  }

  .sidebar-open .sidebar-backdrop {
    display: block;
  }

  .content-shell {
    padding: 14px 14px calc(22px + env(safe-area-inset-bottom));
  }

  .nav-list {
    grid-auto-rows: max-content;
    align-content: start;
    min-height: auto;
    overflow: visible;
    padding-right: 2px;
  }

  .nav-group {
    min-height: max-content;
  }

  .sidebar::-webkit-scrollbar {
    display: block;
    width: 4px;
  }

  .sidebar::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.26);
  }

  .sidebar-account {
    display: grid;
    gap: 8px;
    margin-top: 18px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 14px 4px 0;
  }

  .sidebar-account span {
    overflow: hidden;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.82rem;
    font-weight: 900;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .sidebar-account a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: 900;
    text-decoration: none;
  }

  .email-reader-head,
  .email-toolbar {
    display: grid;
  }

  .form-grid.two {
    grid-template-columns: 1fr;
  }

  .mobile-quick-nav {
    display: none;
  }

  .icon-button {
    display: inline-grid;
  }

  .topbar {
    display: grid;
    grid-template-columns: 44px max-content minmax(0, 1fr) 44px;
    align-items: center;
    position: sticky;
    z-index: 12;
    top: 0;
    gap: 8px;
    margin: -14px -14px 14px;
    border-bottom: 1px solid rgba(220, 228, 238, 0.86);
    background: rgba(246, 248, 251, 0.94);
    padding: 9px 10px 10px;
    backdrop-filter: blur(10px);
  }

  .topbar-title {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .topbar > [data-menu-toggle] {
    grid-column: 1;
    grid-row: 1;
  }

  .dark-mode-toggle-btn {
    grid-column: 4;
    grid-row: 1;
  }

  .topbar .eyebrow {
    display: none;
  }

  .topbar h1 {
    overflow: hidden;
    font-size: 1.2rem;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .icon-button,
  .dark-mode-toggle-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    padding: 9px;
  }

  .release-notes-button {
    display: none;
  }

  .global-search {
    grid-column: 3;
    grid-row: 1;
    order: 0;
    max-width: none;
    margin-left: 0;
  }

  .global-search input[type="search"] {
    min-height: 44px;
    padding: 9px 11px;
    text-overflow: ellipsis;
  }

  .global-search-results {
    left: 50%;
    right: auto;
    width: min(360px, calc(100vw - 20px));
    max-height: min(360px, calc(100svh - 128px));
    transform: translateX(-50%);
  }

  .user-chip {
    display: none;
  }

  .two-column,
  .content-grid.two,
  .metric-grid,
  .payment-setup-layout,
  .checkbox-grid,
  .payment-workflow-grid,
  .kanban-admin-grid {
    grid-template-columns: 1fr;
  }

  .timeline-item,
  .job-row,
  .schedule-calendar-toolbar {
    grid-template-columns: 1fr;
  }

  .timeline-item,
  .job-row {
    align-items: start;
  }

  .timeline-item .button,
  .job-row .button {
    width: 100%;
  }

  .payment-action-row .button,
  .payment-action-row .is-disabled {
    width: 100%;
  }

  .job-photo-panel .panel-head,
  .job-photo-timeline-panel .panel-head {
    align-items: stretch;
    flex-direction: column;
  }

  .job-photo-panel .panel-head .form-actions {
    min-height: 0;
  }

  .photo-bulk-group {
    flex: 1 1 100%;
  }

  .photo-bulk-group select,
  .photo-bulk-group input[type="text"] {
    flex: 1 1 160px;
    max-width: none;
  }
}

@media (pointer: coarse) {
  button,
  .button,
  .button.small,
  .section-tab,
  .nav-group summary,
  .searchable-select-option,
  input:not([type="hidden"]):not([type="checkbox"]):not([type="radio"]),
  select,
  textarea,
  .schedule-checklist-item {
    min-height: 44px;
  }

  .release-notes-button {
    min-height: 44px;
  }

  button,
  .button {
    min-width: 44px;
  }
}

@media (max-width: 620px) {
  input,
  select,
  textarea {
    min-height: 48px;
    font-size: 16px;
  }

  .button,
  button {
    min-height: 46px;
  }

  .button.small {
    min-height: 44px;
  }

  .content-shell {
    padding: 10px 10px calc(82px + env(safe-area-inset-bottom));
  }

  .job-hub-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: flex-start;
    margin-bottom: 10px;
    padding: 14px;
  }

  .job-hub-hero h2 {
    overflow-wrap: anywhere;
    font-size: 1.12rem;
    line-height: 1.25;
  }

  .job-hub-hero p {
    margin-top: 4px;
    font-size: 0.84rem;
    line-height: 1.35;
  }

  .job-hub-hero .eyebrow {
    margin-bottom: 5px;
    font-size: 0.66rem;
  }

  .job-hub-hero .hub-actions,
  .job-field-actions-desktop {
    display: none;
  }

  .job-mobile-actions {
    display: block;
    position: relative;
    z-index: 5;
    margin: 0;
  }

  .job-mobile-actions > summary {
    display: grid;
    grid-template-columns: max-content 18px;
    align-items: center;
    gap: 5px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--surface-raised);
    padding: 7px 9px;
    color: var(--ink);
    cursor: pointer;
    font-size: 0.78rem;
    font-weight: 900;
    list-style: none;
    box-shadow: var(--shadow-hairline);
  }

  .job-mobile-actions > summary::-webkit-details-marker {
    display: none;
  }

  .job-mobile-actions > summary:focus-visible {
    border-radius: inherit;
    outline: 3px solid var(--red);
    outline-offset: 2px;
  }

  .job-mobile-actions-chevron {
    display: inline-grid;
    place-items: center;
    transform: rotate(-90deg);
    transition: transform 0.16s ease;
  }

  .job-mobile-actions[open] .job-mobile-actions-chevron {
    transform: rotate(0deg);
  }

  .job-mobile-actions .job-field-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    width: min(300px, calc(100vw - 32px));
    margin: 0;
    border-radius: var(--radius-md);
    background: var(--paper);
    padding: 9px;
    box-shadow: var(--shadow);
  }

  .job-mobile-actions .button {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .hub-tabs {
    scroll-padding-inline: 10px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .hub-tabs .section-tab {
    scroll-snap-align: start;
  }

  .booking-public-grid > aside.booking-public-card {
    order: -1;
  }

  .schedule-calendar .schedule-mobile-agenda {
    display: block;
  }

  .schedule-calendar .schedule-mobile-agenda + .schedule-calendar-scroll {
    display: none;
  }

  .section-tab-clusters,
  .section-tab-group {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .finance-section-picker {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
  }

  .finance-section-picker > span {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  .finance-section-picker select {
    width: 100%;
  }

  .section-tab-clusters {
    display: none;
  }

  .finance-section-heading {
    margin-bottom: 12px;
  }

  .finance-section-heading h2 {
    font-size: 1.35rem;
  }

  .finance-section-heading p:not(.eyebrow) {
    font-size: 0.9rem;
  }

  .section-tabs {
    flex-wrap: nowrap;
    margin-right: -10px;
    margin-left: -10px;
    overflow-x: auto;
    padding: 0 10px 2px;
  }

  .section-tab {
    min-height: 44px;
    white-space: nowrap;
  }

  .section-tab-group .section-tabs {
    width: 100%;
    max-width: 100%;
    margin-right: 0;
    margin-left: 0;
    padding-right: 0;
    padding-left: 0;
  }

  .release-demo-shell {
    align-items: end;
    padding: 10px;
  }

  .release-demo-dialog {
    max-height: calc(100vh - 20px);
    padding: 18px;
  }

  .release-demo-step ul {
    grid-template-columns: 1fr;
  }

  .release-demo-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .release-demo-actions > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .kanban-board {
    margin-right: -14px;
    margin-left: -14px;
    min-height: min(72vh, 720px);
    padding: 0 14px 12px;
    scroll-padding-inline: 14px;
  }

  .kanban-column {
    flex-basis: min(360px, calc(100vw - 28px));
    min-width: min(360px, calc(100vw - 28px));
    max-width: min(360px, calc(100vw - 28px));
  }

  .kanban-column-head {
    grid-template-columns: 46px minmax(58px, 1fr) minmax(70px, auto) 32px;
  }

  .kanban-column-head > input[name="name"] {
    grid-column: 1 / -1;
  }

  .schedule-calendar-grid {
    min-width: 720px;
  }

  .schedule-calendar-actions,
  .schedule-calendar-actions .button {
    width: 100%;
  }

  .schedule-calendar-actions .button {
    flex: 1 1 0;
  }

  .schedule-day-list .schedule-calendar-event {
    padding: 10px;
  }

  .panel,
  .metric-card {
    padding: 12px;
  }

  .metric-card {
    min-height: 112px;
  }

  .metric-card strong {
    font-size: 1.65rem;
  }

  .panel-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .panel-head .inline-form,
  .panel-head .button,
  .panel-head form,
  .panel-head select {
    width: 100%;
  }

  .inline-form,
  .form-actions,
  .blog-editor-actions,
  .blog-filter-bar {
    align-items: stretch;
    width: 100%;
  }

  .inline-form > *,
  .form-actions > *,
  .blog-editor-actions > *,
  .blog-filter-bar > * {
    flex: 1 1 150px;
  }

  .inline-form .button,
  .form-actions .button,
  .form-actions button,
  .decision-card-actions .button,
  .blog-editor-actions .button {
    width: 100%;
  }

  .decision-card-head,
  .decision-card-actions {
    align-items: stretch;
    flex-direction: column;
    text-align: left;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .subcontractor-compliance-gates {
    grid-template-columns: 1fr;
  }

  .subcontractor-compliance-gate + .subcontractor-compliance-gate {
    border-top: 1px solid var(--line);
    border-inline-start: 0;
  }

  .subcontractor-compliance-gate {
    padding: 14px 12px;
  }

  .subcontractor-compliance-form .form-actions .button {
    width: 100%;
  }

  .payment-public-summary {
    grid-template-columns: 1fr;
  }

  .add-panel-toggle {
    width: 100%;
  }

  .span-2 {
    grid-column: span 1;
  }

  .topbar {
    grid-template-columns: 44px max-content minmax(0, 1fr) 44px;
    margin: -10px -10px 12px;
    padding: 8px 8px 9px;
  }

  .auth-panel h1 {
    font-size: 2.2rem;
  }

  .topbar h1 {
    font-size: 1.08rem;
  }

  .topbar-title {
    max-width: 7.5rem;
  }

  .icon-button,
  .dark-mode-toggle-btn {
    width: 44px;
    height: 44px;
    min-height: 44px;
    border-radius: 8px;
  }

  .global-search input[type="search"] {
    min-height: 44px;
    font-size: 16px;
  }

  .global-search-result {
    grid-template-columns: 72px minmax(0, 1fr);
  }

  .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: visible;
  }

  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
  }

  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) thead {
    display: none;
  }

  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody {
    display: grid;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    gap: 10px;
  }

  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr {
    display: grid;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #fff;
    padding: 10px;
    box-shadow: var(--shadow-soft);
  }

  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr td {
    display: grid;
    grid-template-columns: minmax(76px, 0.32fr) minmax(0, 1fr);
    align-items: start;
    gap: 10px;
    min-width: 0;
    max-width: 100%;
    border-bottom: 0;
    padding: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr td::before {
    color: var(--muted);
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
  }

  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr td:not([data-label])::before {
    display: none;
  }

  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr td:not([data-label]) {
    display: block;
  }

  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr td.row-select-cell,
  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr td.row-select-cell:not([data-label]) {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    width: 100%;
    min-width: 0;
  }

  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr td:first-child {
    color: var(--ink);
    font-weight: 900;
  }

  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr td strong,
  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr td small,
  :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr td a:not(.button) {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  tbody tr td a:not(.button) {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  input[type="checkbox"] {
    width: 24px;
    height: 24px;
    min-height: 24px;
  }

  .row-select-cell,
  .check-row,
  .schedule-checklist-item {
    min-height: 44px;
  }

  tbody tr td .inline-form,
  tbody tr td .archive-form {
    min-width: 0;
  }

  tbody tr td .inline-form select,
  tbody tr td .inline-form .button,
  tbody tr td .archive-form .button {
    flex: 1 1 140px;
  }

  tbody tr td.row-action-cell {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
    white-space: normal;
  }

  tbody tr td.row-action-cell::before {
    flex: 0 0 100%;
  }

  tbody tr td.row-action-cell .button + .button {
    margin-left: 0;
  }

  tbody tr td.row-action-cell .row-edit-button,
  tbody tr td.row-action-cell .row-level-action {
    flex: 1 1 calc(50% - 4px);
    min-width: 132px;
    white-space: normal;
  }

  tr.photo-row {
    display: none;
  }

  .detail-modal-dialog,
  .media-modal-dialog,
  .invoice-modal-dialog {
    width: calc(100vw - 12px);
    height: calc(100svh - 12px);
  }

  .detail-modal-body,
  .invoice-modal-body {
    padding: 12px;
  }

  .invoice-form-grid,
  .invoice-wizard-grid,
  .document-meta-grid {
    grid-template-columns: 1fr;
  }

  .invoice-item-row {
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: start;
  }

  .invoice-modal-actions {
    position: sticky;
    right: 0;
    bottom: -12px;
    display: grid;
    grid-template-columns: 1fr;
    border-top: 1px solid var(--line);
    background: var(--paper);
    padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  }

  .invoice-modal-actions .button,
  .invoice-modal-actions button {
    width: 100%;
  }

  .invoice-item-description,
  .invoice-item-row label:not(.invoice-item-check),
  .invoice-line-total,
  .invoice-item-row button {
    grid-column: 2;
  }

  .document-header {
    display: grid;
  }

  .document-brand {
    align-items: flex-start;
  }

  .document-brand img {
    width: 64px;
    height: 64px;
  }

  .document-number {
    justify-items: start;
    text-align: left;
  }

  .receipt-task-status-copy,
  .receipt-review-heading {
    display: grid;
    gap: 10px;
  }

  .receipt-review-heading .status-pill,
  .receipt-task-status-copy .status-pill {
    justify-self: start;
  }

  .receipt-review-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
  }

  .receipt-preview {
    padding: 10px;
  }

  .receipt-preview img {
    max-height: 55vh;
  }

  .receipt-line-items[data-mobile-layout="cards"].is-responsive-table-ready tbody tr td {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }

  .receipt-line-items[data-mobile-layout="cards"].is-responsive-table-ready tbody tr td::before {
    margin-bottom: 2px;
  }

  .receipt-line-items input,
  .receipt-confirm-button {
    width: 100%;
  }

  .receipt-confirm-button {
    min-height: 48px;
  }

  .detail-item {
    padding: 10px;
  }

  .detail-value td,
  .detail-value tr,
  .detail-value tbody,
  .detail-value table {
    display: block;
    min-width: 0;
  }

  .upload-form input[type="file"],
  .upload-form input[type="text"] {
    max-width: none;
  }

  .detail-actions select,
  .detail-actions input:not([type="hidden"]),
  .detail-actions textarea,
  .detail-actions .button {
    width: 100%;
    min-width: 0;
  }

  .detail-actions form:has(select[data-searchable-select]) {
    grid-template-columns: 1fr;
  }

  .job-photo-panel .panel-head .form-actions .button {
    flex: 1 1 100%;
  }

  .photo-phase-chip {
    font-size: 0.8rem;
  }

  .photo-capture-actions {
    gap: 8px;
  }

  .photo-capture-action {
    padding-inline: 8px;
    font-size: 0.88rem;
  }

  /* Two columns still read as a contact sheet at 360px without overflowing. */
  .photo-timeline-grid {
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
  }

  .photo-tile-meta {
    padding: 7px 8px 8px;
  }

  .photo-upload-row {
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-areas:
      "preview copy"
      "retry retry";
  }

  .photo-upload-preview {
    grid-area: preview;
    width: 44px;
    height: 44px;
  }

  .photo-upload-copy {
    grid-area: copy;
  }

  .photo-upload-row .button {
    grid-area: retry;
    width: 100%;
  }

  .photo-bulk-bar {
    bottom: max(8px, env(safe-area-inset-bottom));
  }

  .photo-bulk-group .button {
    flex: 1 1 auto;
  }

  .receipt-queue-filter > label {
    flex: 1 1 100%;
  }

  .receipt-queue-filter .button {
    width: 100%;
  }

  .receipt-row {
    padding: 10px;
  }

  /* 76px still reads as a receipt while leaving the vendor and amount a full
     line of their own at 360px. */
  .receipt-row-head {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px;
  }

  .receipt-row-thumb {
    width: 76px;
  }

  .receipt-row-title strong {
    font-size: 0.94rem;
  }

  .receipt-row-amount {
    font-size: 1rem;
  }

  .receipt-suggestion {
    min-height: 56px;
  }

  .receipt-assign-fallback > .receipt-job-picker {
    flex: 1 1 100%;
  }

  .receipt-assign-fallback .button,
  .receipt-row-secondary .button,
  .receipt-confirm-actions .button {
    width: 100%;
  }

  .receipt-row-secondary form {
    flex: 1 1 100%;
  }

  .receipt-confirm-actions {
    display: grid;
    gap: 8px;
  }
}

@media print {
  @page {
    margin: 0.5in;
  }

  body,
  .document-body {
    background: #fff;
  }

  .no-print,
  .document-actions {
    display: none !important;
  }

  .document-embedded-body .sidebar,
  .document-embedded-body .topbar,
  .document-embedded-body .mobile-quick-nav,
  .document-embedded-body .release-demo,
  .document-embedded-body .bizos-ai-sidecar,
  .document-embedded-body .bizos-ai-bubble,
  .document-embedded-body .bizos-voice-bubble {
    display: none !important;
  }

  .document-embedded-body .app-shell,
  .document-embedded-body .content-shell,
  .document-embedded-body .page-content {
    display: block;
    width: 100%;
    min-height: 0;
    margin: 0;
    background: #fff;
    padding: 0;
  }

  .document-shell {
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .document-paper {
    min-height: 0;
    border: 0;
    box-shadow: none;
    padding: 0;
  }

  .document-table {
    page-break-inside: auto;
  }

  .document-table tr,
  .document-meta-grid div,
  .document-section,
  .document-totals {
    page-break-inside: avoid;
  }
}

/* ==========================================================================
   Dark Mode & Glassmorphism Theme Additions
   ========================================================================== */

/* Toggle Button Styling */
.dark-mode-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(185, 198, 214, 0.9);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
  box-shadow: var(--shadow-hairline), 0 1px 2px rgba(18, 32, 51, 0.04);
}
.dark-mode-toggle-btn:hover {
  border-color: rgba(13, 110, 198, 0.38);
  background: #fff;
  transform: translateY(-1px);
  box-shadow: var(--shadow-hairline), 0 8px 18px rgba(18, 32, 51, 0.08);
}
.dark-mode-toggle-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}
.dark-mode-toggle-btn .sun-icon {
  display: none;
}
.dark-mode-toggle-btn .moon-icon {
  display: block;
}
@media (min-width: 861px) {
  .dark-mode-toggle-btn {
    margin-left: auto;
  }
  .global-search {
    margin-left: 0 !important;
  }
}

/* Job Estimate workspace: validated Takeoff and pre-order Material List. */
.estimate-workspace-tabs {
  margin-bottom: 16px;
}

.estimate-workspace-tabs .section-tab {
  display: grid;
  gap: 2px;
  min-width: 190px;
}

.estimate-workspace-tabs .section-tab strong {
  color: inherit;
}

.estimate-workspace-tabs .section-tab small {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.2;
  text-transform: none;
}

.takeoff-workspace,
.material-list-workspace {
  display: grid;
  gap: 16px;
}

.takeoff-workspace .panel,
.material-list-workspace .panel {
  margin-bottom: 0;
}

.takeoff-summary-grid,
.material-list-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.material-list-summary-grid {
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
}

.takeoff-summary-grid article,
.material-list-summary-grid article {
  display: grid;
  min-width: 0;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
}

.takeoff-summary-grid article.is-warning,
.material-list-summary-grid article.is-warning {
  border-color: var(--gold);
  background: color-mix(in srgb, var(--gold) 8%, var(--surface));
}

.takeoff-summary-grid article.is-success,
.material-list-summary-grid article.is-success {
  border-color: var(--green);
}

.takeoff-summary-grid span,
.material-list-summary-grid span {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.takeoff-summary-grid strong,
.material-list-summary-grid strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 1.08rem;
  font-variant-numeric: tabular-nums;
}

.takeoff-summary-grid small,
.material-list-summary-grid small {
  color: var(--muted);
  line-height: 1.3;
}

.takeoff-status-banner {
  margin-top: 14px;
}

.takeoff-source-list,
.material-list-primary-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.takeoff-alternatives-panel {
  display: grid;
  gap: 14px;
}

.takeoff-version-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.takeoff-alternative-card {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.takeoff-alternative-card:hover {
  border-color: color-mix(in srgb, var(--blue) 58%, var(--line));
  transform: translateY(-1px);
}

.takeoff-alternative-card.is-current {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 14%, transparent);
}

.takeoff-alternative-card > span:first-child,
.takeoff-alternative-counts {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.takeoff-alternative-card strong {
  overflow-wrap: anywhere;
}

.takeoff-alternative-card small {
  color: var(--muted);
  line-height: 1.3;
}

.takeoff-alternative-counts {
  flex: 0 0 auto;
  text-align: right;
}

.material-list-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) repeat(2, minmax(170px, 1fr)) auto;
  align-items: end;
  gap: 10px;
  margin-bottom: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
}

.material-list-filters .form-actions {
  flex-wrap: nowrap;
  margin: 0;
}

.material-list-filter-count {
  margin: 0 0 10px;
}

.takeoff-source-chip {
  display: grid;
  min-width: min(100%, 210px);
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 9px 11px;
  color: var(--ink);
  text-decoration: none;
}

.takeoff-source-chip:hover,
.takeoff-source-chip:focus-visible {
  border-color: var(--blue);
}

.takeoff-source-chip small {
  color: var(--muted);
}

.takeoff-header-disclosure,
.takeoff-add-item,
.material-list-add-item,
.takeoff-item-editor,
.material-list-item-editor {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 12px;
}

.takeoff-header-disclosure > summary,
.takeoff-add-item > summary,
.material-list-add-item > summary {
  width: fit-content;
  cursor: pointer;
  list-style: none;
}

.takeoff-header-disclosure > summary::-webkit-details-marker,
.takeoff-add-item > summary::-webkit-details-marker,
.material-list-add-item > summary::-webkit-details-marker {
  display: none;
}

.takeoff-header-form,
.takeoff-item-form,
.material-list-item-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-top: 12px;
}

.takeoff-header-form > .span-2,
.takeoff-item-form > .span-2,
.material-list-item-form > .span-2,
.takeoff-header-form > .form-actions,
.takeoff-item-form > .form-actions,
.material-list-item-form > .form-actions {
  grid-column: span 2;
}

.calculated-output {
  display: flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(15, 23, 42, 0.04);
  padding: 8px 10px;
  color: var(--ink);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.takeoff-analysis-panel {
  overflow: hidden;
  border-color: color-mix(in srgb, var(--blue) 36%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 6%, transparent), transparent 42%),
    var(--paper);
}

.takeoff-analysis-heading {
  align-items: flex-start;
}

.takeoff-analysis-heading .eyebrow {
  margin-bottom: 3px;
}

.takeoff-analysis-safety-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
  padding: 10px 12px;
  line-height: 1.4;
}

.takeoff-analysis-safety-note strong {
  flex: 0 0 auto;
}

.takeoff-analysis-safety-note span,
.takeoff-analysis-roles small,
.takeoff-analysis-run small,
.takeoff-analysis-start small {
  color: var(--muted);
}

.takeoff-analysis-roles {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.takeoff-analysis-roles > summary {
  cursor: pointer;
  padding: 11px 12px;
  color: var(--ink);
  font-weight: 800;
}

.takeoff-analysis-role-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  border-top: 1px solid var(--line);
  padding: 12px;
}

.takeoff-analysis-role-grid article {
  display: flex;
  min-width: 0;
  gap: 9px;
}

.takeoff-analysis-role-grid article > span,
.takeoff-analysis-question-number {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--blue) 14%, var(--surface));
  color: var(--blue);
  font-size: 0.75rem;
  font-weight: 900;
}

.takeoff-analysis-role-grid article div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.takeoff-analysis-role-grid small {
  line-height: 1.35;
}

.takeoff-analysis-start {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.takeoff-analysis-start fieldset {
  min-width: 0;
  margin: 0;
  border: 0;
  padding: 0;
}

.takeoff-analysis-start legend {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.takeoff-analysis-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.takeoff-analysis-mode-card {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  min-width: 0;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
  cursor: pointer;
}

.takeoff-analysis-mode-card:has(input:checked) {
  border-color: var(--blue);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--blue) 14%, transparent);
}

.takeoff-analysis-mode-card input[type="radio"] {
  appearance: auto;
  inline-size: 18px;
  block-size: 18px;
  width: 18px;
  min-width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  padding: 0;
  box-shadow: none;
  accent-color: var(--blue);
}

.takeoff-analysis-mode-card > span {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.takeoff-analysis-mode-card small {
  line-height: 1.35;
}

.takeoff-analysis-start-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.takeoff-analysis-start-actions small {
  flex-basis: 100%;
}

.takeoff-analysis-message {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  padding: 9px 11px;
  color: var(--muted);
}

.takeoff-analysis-message[hidden] {
  display: none;
}

.takeoff-analysis-message.is-success {
  border-color: color-mix(in srgb, var(--green) 62%, var(--line));
  color: var(--green);
}

.takeoff-analysis-message.is-warning {
  border-color: var(--gold);
  color: color-mix(in srgb, var(--gold) 72%, var(--ink));
}

.takeoff-analysis-message.is-danger {
  border-color: var(--red);
  color: var(--red);
}

.takeoff-analysis-run {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.takeoff-analysis-run[hidden],
.takeoff-analysis-run [hidden] {
  display: none !important;
}

.takeoff-analysis-progress-head,
.takeoff-analysis-subhead,
.takeoff-analysis-finding-head,
.takeoff-analysis-question-heading {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.takeoff-analysis-progress-head > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.takeoff-analysis-progress-head > strong {
  font-variant-numeric: tabular-nums;
}

.takeoff-analysis-run progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 18%, var(--surface));
  accent-color: var(--blue);
}

.takeoff-analysis-stage-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.takeoff-analysis-stage {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 10px;
}

.takeoff-analysis-stage > div {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.takeoff-analysis-stage-marker {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  background: color-mix(in srgb, var(--muted) 14%, var(--surface));
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 900;
}

.takeoff-analysis-task-status {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  white-space: nowrap;
}

.takeoff-analysis-stage.is-running,
.takeoff-analysis-stage.is-processing {
  border-color: var(--blue);
}

.takeoff-analysis-stage.is-running .takeoff-analysis-stage-marker,
.takeoff-analysis-stage.is-processing .takeoff-analysis-stage-marker {
  background: var(--blue);
  color: #fff;
}

.takeoff-analysis-stage.is-complete,
.takeoff-analysis-stage.is-completed,
.takeoff-analysis-stage.is-applied {
  border-color: color-mix(in srgb, var(--green) 52%, var(--line));
}

.takeoff-analysis-stage.is-complete .takeoff-analysis-stage-marker,
.takeoff-analysis-stage.is-completed .takeoff-analysis-stage-marker,
.takeoff-analysis-stage.is-applied .takeoff-analysis-stage-marker {
  background: var(--green);
  color: #fff;
}

.takeoff-analysis-stage.is-failed,
.takeoff-analysis-stage.is-blocked {
  border-color: var(--gold);
}

.takeoff-analysis-questions,
.takeoff-analysis-findings {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.takeoff-analysis-subhead h3,
.takeoff-analysis-subhead p,
.takeoff-analysis-question p,
.takeoff-analysis-finding p,
.takeoff-analysis-reconcile-card p,
.takeoff-analysis-apply p {
  margin: 0;
}

.takeoff-analysis-subhead p,
.takeoff-analysis-question p,
.takeoff-analysis-finding p,
.takeoff-analysis-reconcile-card p,
.takeoff-analysis-apply p {
  color: var(--muted);
  line-height: 1.4;
}

.takeoff-analysis-question-list,
.takeoff-analysis-finding-list {
  display: grid;
  gap: 9px;
}

.takeoff-analysis-applied-findings {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 96%, var(--blue) 4%);
}

.takeoff-analysis-applied-findings-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  cursor: pointer;
}

.takeoff-analysis-applied-findings-note {
  margin: 0;
  padding: 0 12px 12px;
  color: var(--muted);
}

.takeoff-analysis-applied-finding-list {
  display: grid;
  gap: 9px;
  padding: 0 12px 12px;
}

.takeoff-analysis-code-basis-answer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid color-mix(in srgb, var(--blue) 52%, var(--line));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--blue) 7%, var(--surface));
  padding: 12px;
}

.takeoff-analysis-code-basis-answer > div {
  display: grid;
  gap: 4px;
}

.takeoff-analysis-code-basis-answer small {
  color: var(--muted);
  line-height: 1.4;
}

.takeoff-analysis-question,
.takeoff-analysis-finding,
.takeoff-analysis-reconcile-card {
  display: grid;
  min-width: 0;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
}

.takeoff-analysis-question,
.takeoff-analysis-finding.is-conflict,
.takeoff-analysis-reconcile-card.has-conflicts {
  border-color: color-mix(in srgb, var(--gold) 72%, var(--line));
  background: color-mix(in srgb, var(--gold) 7%, var(--surface));
}

.takeoff-analysis-reconcile-card.is-clear {
  border-color: color-mix(in srgb, var(--green) 54%, var(--line));
}

.takeoff-analysis-question-heading {
  justify-content: flex-start;
}

.takeoff-analysis-question-heading strong {
  padding-top: 4px;
  line-height: 1.4;
}

.takeoff-analysis-professional-verification {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 6px 10px;
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--blue) 42%, var(--line));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--blue) 6%, var(--surface));
}

.takeoff-analysis-professional-verification small {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.4;
}

.takeoff-analysis-blocked {
  color: color-mix(in srgb, var(--gold) 72%, var(--ink)) !important;
  font-weight: 800;
}

.takeoff-analysis-requested-source {
  color: var(--ink) !important;
  font-weight: 800;
}

.takeoff-analysis-question-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.takeoff-analysis-answer-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.takeoff-analysis-answer-form label {
  min-width: 0;
}

.takeoff-analysis-finding-head .status-pill {
  flex: 0 0 auto;
}

.takeoff-analysis-finding-quantity {
  color: var(--ink) !important;
  font-size: 1rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.takeoff-analysis-code-upgrade {
  display: grid;
  justify-items: start;
  gap: 6px;
  border-left: 3px solid var(--gold);
  padding-left: 10px;
}

.takeoff-analysis-code-upgrade small {
  color: var(--ink);
  line-height: 1.45;
}

.takeoff-analysis-reconcile-card > small,
.takeoff-analysis-conflict-affected,
.takeoff-analysis-conflict-note {
  color: var(--muted);
  line-height: 1.4;
}

.takeoff-analysis-conflict-note {
  border-left: 3px solid color-mix(in srgb, var(--green) 62%, var(--line));
  padding-left: 9px;
}

.takeoff-analysis-conflict-resolution {
  border-top: 1px solid var(--line);
  padding-top: 9px;
}

.takeoff-analysis-conflict-resolution > summary {
  cursor: pointer;
  color: var(--ink);
  font-weight: 800;
}

.takeoff-analysis-conflict-form {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(280px, 1.2fr) auto;
  align-items: end;
  gap: 10px;
  padding-top: 10px;
}

.takeoff-analysis-conflict-form label {
  min-width: 0;
}

.takeoff-analysis-apply {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--green) 62%, var(--line));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--green) 7%, var(--surface));
  padding: 13px;
}

.takeoff-analysis-apply > div {
  display: grid;
  gap: 3px;
}

.takeoff-analysis-apply .button {
  flex: 0 0 auto;
}

.takeoff-action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.takeoff-action-grid > * {
  align-content: start;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 12px;
}

.takeoff-action-grid p {
  margin: 0;
  color: var(--muted);
}

.takeoff-items-panel td small,
.material-list-items-panel td small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.3;
}

.takeoff-items-panel td:last-child,
.material-list-items-panel td:last-child {
  min-width: 150px;
}

.takeoff-items-panel td:last-child > *,
.material-list-items-panel td:last-child > * {
  margin: 0 5px 5px 0;
}

.takeoff-items-panel td:last-child {
  min-width: 132px;
}

.takeoff-row-actions {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 6px;
  margin: 0 !important;
}

.takeoff-row-actions form {
  display: flex;
  margin: 0 !important;
}

.takeoff-edit-button {
  flex: 0 1 78px;
  min-width: 62px;
  justify-content: center;
  padding-inline: 11px;
}

.takeoff-items-panel td:last-child .takeoff-row-actions .takeoff-archive-button {
  display: inline-grid;
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  place-items: center;
  padding: 0;
}

.takeoff-items-panel td:last-child .takeoff-row-actions .takeoff-archive-button svg {
  width: 18px;
  height: 18px;
}

.takeoff-review-help {
  margin: 0 0 14px;
  border-left: 4px solid var(--blue);
  border-radius: var(--radius-sm);
  background: rgba(37, 99, 235, 0.08);
  padding: 10px 12px;
  color: var(--ink);
  line-height: 1.45;
}

.takeoff-procurement-callout,
.takeoff-procurement-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0 0 14px;
  border: 1px solid color-mix(in srgb, var(--blue) 38%, var(--line));
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--blue) 6%, var(--surface));
  padding: 12px;
}

.takeoff-procurement-callout p,
.takeoff-procurement-summary {
  color: var(--muted);
  line-height: 1.4;
}

.takeoff-procurement-callout p {
  margin: 3px 0 0;
}

.takeoff-procurement-details {
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--blue) 4%, var(--surface));
  padding: 7px 8px;
}

.takeoff-procurement-details summary {
  cursor: pointer;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 800;
}

.takeoff-procurement-details ul {
  display: grid;
  gap: 7px;
  margin: 8px 0;
  padding: 0;
  list-style: none;
}

.takeoff-procurement-details li {
  display: grid;
  gap: 2px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}

.takeoff-procurement-details li > span > strong {
  display: block;
  font-size: 0.78rem;
}

.material-calculation-basis {
  max-width: 48rem;
}

.takeoff-items-panel tr[data-takeoff-edit-href],
.material-list-items-panel tr[data-material-edit-href] {
  cursor: pointer;
}

.takeoff-items-panel tr[data-takeoff-edit-href]:hover > td,
.material-list-items-panel tr[data-material-edit-href]:hover > td {
  background: rgba(37, 99, 235, 0.04);
}

.takeoff-items-panel tr.is-editing > td,
.material-list-items-panel tr.is-editing > td {
  background: rgba(37, 99, 235, 0.06);
}

.takeoff-items-panel .takeoff-item-editor-row > td,
.material-list-items-panel .material-list-item-editor-row > td {
  background: transparent;
  padding: 0 10px 16px;
}

.takeoff-items-panel .takeoff-item-editor-row[hidden],
.material-list-items-panel .material-list-item-editor-row[hidden] {
  display: none !important;
}

.takeoff-items-panel .takeoff-item-editor-row .takeoff-item-editor,
.material-list-items-panel .material-list-item-editor-row .material-list-item-editor {
  margin-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.08);
  scroll-margin-top: 110px;
}

.material-list-delta {
  color: var(--gold) !important;
  font-weight: 800;
}

.material-shopping-basket-head,
.material-shopping-basket-row,
.material-shopping-add-row {
  display: grid;
  align-items: end;
  gap: 10px;
}

.material-shopping-basket-head {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.material-shopping-basket-head small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.material-shopping-basket {
  display: grid;
  gap: 8px;
  max-height: min(55vh, 680px);
  overflow: auto;
  padding-right: 4px;
}

.material-shopping-basket-row {
  grid-template-columns: minmax(240px, 1fr) minmax(105px, 0.2fr) minmax(105px, 0.2fr) auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 10px;
}

.material-shopping-basket-row label,
.material-shopping-add-row label {
  margin: 0;
}

.material-shopping-basket-row label > span,
.material-shopping-add-row label > span {
  font-size: 0.72rem;
}

.material-shopping-row-meta {
  display: flex;
  min-width: 150px;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding-bottom: 2px;
}

.material-shopping-row-meta small {
  color: var(--muted);
  text-align: right;
}

.material-shopping-add-row {
  grid-template-columns: minmax(240px, 1fr) minmax(105px, 0.2fr) minmax(105px, 0.2fr) auto;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.material-list-promote-form {
  align-items: center;
}

.status-pill.muted {
  background: rgba(100, 116, 139, 0.12);
  color: var(--muted);
}

@media (max-width: 900px) {
  .takeoff-summary-grid,
  .material-list-summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .takeoff-header-form,
  .takeoff-item-form,
  .material-list-item-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .takeoff-action-grid {
    grid-template-columns: 1fr;
  }

  .takeoff-analysis-role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .material-list-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .estimate-workspace-tabs,
  .estimate-workspace-tabs[data-tab-scrollable],
  .estimate-workspace-tabs[data-tab-more-left],
  .estimate-workspace-tabs[data-tab-more-right] {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    padding-inline-end: 0;
    -webkit-mask-image: none;
    mask-image: none;
  }

  .estimate-workspace-tabs .section-tab {
    min-width: 0;
    min-height: 48px;
    padding: 9px 6px;
    text-align: center;
    white-space: normal;
  }

  .estimate-workspace-tabs .section-tab strong {
    font-size: 0.78rem;
    line-height: 1.15;
  }

  .estimate-workspace-tabs .section-tab small {
    display: none;
  }

  .takeoff-summary-grid,
  .material-list-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .takeoff-analysis-safety-note,
  .takeoff-analysis-apply,
  .takeoff-analysis-code-basis-answer {
    display: grid;
  }

  .takeoff-analysis-mode-grid,
  .takeoff-analysis-role-grid,
  .takeoff-analysis-stage-list,
  .takeoff-analysis-answer-form,
  .takeoff-analysis-conflict-form {
    grid-template-columns: 1fr;
  }

  .takeoff-analysis-professional-verification {
    grid-template-columns: 1fr;
  }

  .takeoff-analysis-professional-verification small {
    grid-column: auto;
  }

  .takeoff-analysis-apply .button,
  .takeoff-analysis-start-actions .button,
  .takeoff-analysis-answer-form .button,
  .takeoff-analysis-conflict-form .button,
  .takeoff-analysis-code-basis-answer .button {
    width: 100%;
  }

  .takeoff-analysis-progress-head,
  .takeoff-analysis-finding-head {
    align-items: flex-start;
  }

  .takeoff-analysis-stage {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .takeoff-analysis-task-status {
    grid-column: 2;
  }

  .takeoff-header-form,
  .takeoff-item-form,
  .material-list-item-form {
    grid-template-columns: 1fr;
  }

  .takeoff-header-form > .span-2,
  .takeoff-item-form > .span-2,
  .material-list-item-form > .span-2,
  .takeoff-header-form > .form-actions,
  .takeoff-item-form > .form-actions,
  .material-list-item-form > .form-actions {
    grid-column: 1 / -1;
  }

  .takeoff-items-panel .takeoff-item-editor-row,
  .material-list-items-panel .material-list-item-editor-row {
    border: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    box-shadow: none !important;
  }

  .takeoff-items-panel .takeoff-item-editor-row > td,
  .material-list-items-panel .material-list-item-editor-row > td {
    display: block !important;
    padding: 0;
  }

  .takeoff-items-panel .takeoff-item-editor-row > td::before,
  .material-list-items-panel .material-list-item-editor-row > td::before {
    display: none !important;
  }

  .takeoff-items-panel .takeoff-item-editor-row .takeoff-item-editor,
  .material-list-items-panel .material-list-item-editor-row .material-list-item-editor {
    border-radius: var(--radius-lg);
  }

  .takeoff-version-list {
    grid-template-columns: 1fr;
  }

  .takeoff-alternative-card,
  .material-list-primary-actions .button,
  .material-list-primary-actions form {
    width: 100%;
  }

  .takeoff-items-panel td:last-child {
    min-width: 0;
  }

  .material-shopping-basket-head,
  .material-shopping-basket-row,
  .material-shopping-add-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .material-shopping-basket-head .button,
  .material-shopping-add-row .button {
    width: 100%;
  }

  .material-shopping-row-meta {
    min-width: 0;
    justify-content: space-between;
  }

  .material-shopping-row-meta small {
    text-align: left;
  }

  .takeoff-row-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .takeoff-edit-button {
    flex: 0 1 72px;
    width: auto;
    min-width: 60px;
  }

  .takeoff-items-panel td:last-child .takeoff-row-actions .takeoff-archive-button {
    flex: 0 0 44px;
    width: 44px;
    min-width: 44px;
  }

  .material-list-filters {
    grid-template-columns: 1fr;
  }

  .takeoff-procurement-callout,
  .takeoff-procurement-summary {
    align-items: stretch;
    flex-direction: column;
  }

  .takeoff-procurement-callout .button {
    width: 100%;
  }

  .material-list-filters .form-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .material-list-primary-actions form .button {
    width: 100%;
  }
}

/* Dark Mode Variables and System Overrides */
.dark-mode {
  --ink: #f1f5f9; /* Slate 100 */
  --muted: #94a3b8; /* Slate 400 */
  --line: rgba(255, 255, 255, 0.08);
  --paper: rgba(23, 28, 41, 0.65); /* Translucent dark slate */
  --surface: #0b0f19; /* Very dark slate/blue-black */
  --surface-warm: #07090f;
  --surface-raised: rgba(30, 41, 59, 0.45); /* Translucent slate-800 */
  --charcoal: #090d16;
  --charcoal-2: #1e293b;
  --red: #3b82f6; /* Modern Blue */
  --red-dark: #1d4ed8;
  --focus: rgba(59, 130, 246, 0.3);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  --shadow-soft: 0 16px 36px rgba(0, 0, 0, 0.4);
  --shadow-hairline: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* Soft Glow Mesh Background for Dark Mode */
.dark-mode body {
  background:
    radial-gradient(circle at 10% 20%, rgba(13, 110, 198, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(22, 131, 122, 0.08) 0%, transparent 40%),
    linear-gradient(180deg, #090c14 0%, #0d111d 60%, #06080d 100%) !important;
  color: var(--ink);
}

/* Toggle Button Styling in Dark Mode */
.dark-mode .dark-mode-toggle-btn {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 2px 4px rgba(0, 0, 0, 0.2);
}
.dark-mode .dark-mode-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.3);
}
.dark-mode .dark-mode-toggle-btn .sun-icon {
  display: block;
  color: #ffb800;
  filter: drop-shadow(0 0 4px rgba(255, 184, 0, 0.4));
}
.dark-mode .dark-mode-toggle-btn .moon-icon {
  display: none;
}

/* Glassmorphic Side Navigation (Sidebar) */
.dark-mode .sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.06) !important;
  background: rgba(13, 17, 29, 0.8) !important;
  backdrop-filter: blur(20px);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5) !important;
}

.dark-mode .brand-block {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.dark-mode .brand-logo {
  background: rgba(255, 255, 255, 0.95);
}

.dark-mode .nav-icon {
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.6);
}
.dark-mode .nav-group {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.025);
}
.dark-mode .nav-group summary:hover,
.dark-mode .nav-group summary.active {
  background: rgba(59, 130, 246, 0.1);
}
.dark-mode .nav-list a:hover {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}
.dark-mode .nav-list a.active {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.15);
  color: #fff;
}
.dark-mode .nav-list a.active .nav-icon {
  background: #3b82f6;
  color: #fff;
  box-shadow: 0 8px 18px rgba(59, 130, 246, 0.3);
}

/* Glassmorphic Header / Topbar */
.dark-mode .topbar {
  background: rgba(13, 17, 29, 0.7) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06) !important;
  backdrop-filter: blur(20px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

/* Interactive Elements (Global Search & User Chip) */
.dark-mode .global-search input[type="search"] {
  background: rgba(0, 0, 0, 0.25) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
}
.dark-mode .global-search input[type="search"]:focus {
  border-color: #3b82f6 !important;
  background: rgba(0, 0, 0, 0.4) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}

.dark-mode .user-chip {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.dark-mode .user-chip a {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
}
.dark-mode .user-chip a:hover {
  background: rgba(255, 255, 255, 0.22) !important;
}
.dark-mode .release-notes-button {
  border-color: rgba(59, 130, 246, 0.3);
  background: rgba(59, 130, 246, 0.12);
  color: #dbeafe;
}
.dark-mode .release-notes-button:hover {
  background: rgba(59, 130, 246, 0.2);
}
.dark-mode .release-demo-dialog {
  border-color: rgba(59, 130, 246, 0.28);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(9, 13, 22, 0.96));
  color: #e5e7eb;
}
.dark-mode .release-demo-step p,
.dark-mode .release-demo-notes p {
  color: #aeb7c7;
}
.dark-mode .release-demo-step li {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.05);
}
.dark-mode .release-demo-notes {
  border-color: rgba(59, 130, 246, 0.22);
  background: rgba(59, 130, 246, 0.1);
}

/* Glassmorphic Containers: Panels and Metric Cards */
.dark-mode .metric-card,
.dark-mode .panel {
  background: rgba(23, 28, 41, 0.65) !important;
  border: 1px solid rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
  backdrop-filter: blur(16px);
}
.dark-mode .metric-card:hover,
.dark-mode .panel:hover {
  border-color: rgba(59, 130, 246, 0.3) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.08) !important;
}

.dark-mode .receipt-preview {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(15, 23, 42, 0.58);
}

/* Business setup readiness cards are standalone surfaces, not panels. */
.dark-mode .setup-readiness-card {
  background: rgba(23, 28, 41, 0.82);
  border-color: rgba(255, 255, 255, 0.09);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.dark-mode .setup-readiness-card.is-ready {
  border-color: rgba(74, 222, 128, 0.28);
}

.dark-mode .setup-readiness-card.needs-attention {
  border-color: rgba(251, 191, 36, 0.3);
}

.dark-mode .panel-head {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.dark-mode .estimate-line-items {
  border-color: rgba(255, 255, 255, 0.08) !important;
  background: rgba(15, 23, 42, 0.72) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 24px rgba(0, 0, 0, 0.24) !important;
}

.view-agent .bizos-ai-bubble {
  display: none !important;
}

.view-agent .bizos-voice-bubble {
  display: none !important;
}

.dark-mode .estimate-deposit-request {
  border-color: rgba(255, 255, 255, 0.08) !important;
  background: rgba(15, 23, 42, 0.72) !important;
}

.dark-mode .estimate-line-drag {
  color: #cbd5e1 !important;
}

.dark-mode .estimate-line-drag:hover,
.dark-mode .estimate-line-drag:focus-visible {
  background: rgba(30, 41, 59, 0.82) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  color: #f8fafc !important;
}

.dark-mode .estimate-line-items-head,
.dark-mode .estimate-line-total {
  color: #f1f5f9 !important;
}

.dark-mode .estimate-line-items-head h3,
.dark-mode .estimate-line-total strong {
  color: #fff !important;
}

.dark-mode .estimate-workspace-tabs .section-tab small,
.dark-mode .takeoff-summary-grid span,
.dark-mode .takeoff-summary-grid small,
.dark-mode .material-list-summary-grid span,
.dark-mode .material-list-summary-grid small,
.dark-mode .takeoff-source-chip small,
.dark-mode .takeoff-items-panel td small,
.dark-mode .material-list-items-panel td small {
  color: #aebed2 !important;
}

.dark-mode .takeoff-summary-grid article,
.dark-mode .material-list-summary-grid article,
.dark-mode .takeoff-alternative-card,
.dark-mode .takeoff-source-chip,
.dark-mode .takeoff-header-disclosure,
.dark-mode .takeoff-add-item,
.dark-mode .takeoff-analysis-roles,
.dark-mode .takeoff-analysis-mode-card,
.dark-mode .takeoff-analysis-message,
.dark-mode .takeoff-analysis-stage,
.dark-mode .takeoff-analysis-question,
.dark-mode .takeoff-analysis-finding,
.dark-mode .takeoff-analysis-reconcile-card,
.dark-mode .material-list-add-item,
.dark-mode .material-list-filters,
.dark-mode .takeoff-item-editor,
.dark-mode .material-list-item-editor,
.dark-mode .takeoff-action-grid > * {
  border-color: rgba(148, 163, 184, 0.24) !important;
  background: rgba(15, 23, 42, 0.78) !important;
  color: #e2e8f0 !important;
}

.dark-mode .takeoff-analysis-code-basis-answer {
  border-color: rgba(96, 165, 250, 0.56);
  background: rgba(30, 64, 175, 0.2);
}

.dark-mode .takeoff-analysis-panel {
  border-color: rgba(96, 165, 250, 0.42) !important;
  background:
    linear-gradient(135deg, rgba(37, 99, 235, 0.12), transparent 42%),
    rgba(15, 23, 42, 0.72) !important;
}

.dark-mode .takeoff-analysis-safety-note {
  background: rgba(30, 64, 175, 0.2);
  color: #e2e8f0;
}

.dark-mode .takeoff-analysis-role-grid,
.dark-mode .takeoff-analysis-run,
.dark-mode .takeoff-analysis-questions,
.dark-mode .takeoff-analysis-findings {
  border-color: rgba(148, 163, 184, 0.22);
}

.dark-mode .takeoff-analysis-mode-card:has(input:checked),
.dark-mode .takeoff-alternative-card.is-current,
.dark-mode .takeoff-analysis-stage.is-running,
.dark-mode .takeoff-analysis-stage.is-processing {
  border-color: #60a5fa !important;
}

.dark-mode .takeoff-analysis-question,
.dark-mode .takeoff-analysis-finding.is-conflict,
.dark-mode .takeoff-analysis-reconcile-card.has-conflicts {
  border-color: rgba(251, 191, 36, 0.68) !important;
  background: rgba(120, 53, 15, 0.22) !important;
}

.dark-mode .takeoff-analysis-apply {
  border-color: rgba(74, 222, 128, 0.56);
  background: rgba(20, 83, 45, 0.22);
}

.dark-mode .takeoff-analysis-code-upgrade small {
  color: #e2e8f0;
}

.dark-mode .takeoff-analysis-finding-quantity,
.dark-mode .takeoff-analysis-heading h2,
.dark-mode .takeoff-analysis-role-grid strong,
.dark-mode .takeoff-analysis-progress-head strong,
.dark-mode .takeoff-analysis-stage strong,
.dark-mode .takeoff-analysis-question strong,
.dark-mode .takeoff-analysis-finding strong,
.dark-mode .takeoff-analysis-apply strong {
  color: #f8fafc !important;
}

.dark-mode .takeoff-review-help {
  border-color: #60a5fa;
  background: rgba(30, 64, 175, 0.22);
  color: #e2e8f0;
}

.dark-mode .takeoff-procurement-callout,
.dark-mode .takeoff-procurement-summary,
.dark-mode .takeoff-procurement-details {
  border-color: rgba(96, 165, 250, 0.32);
  background: rgba(30, 64, 175, 0.14);
}

.dark-mode .takeoff-summary-grid article.is-warning,
.dark-mode .material-list-summary-grid article.is-warning {
  border-color: rgba(251, 191, 36, 0.72) !important;
  background: rgba(120, 53, 15, 0.24) !important;
}

.dark-mode .takeoff-summary-grid article.is-success,
.dark-mode .material-list-summary-grid article.is-success {
  border-color: rgba(74, 222, 128, 0.68) !important;
}

.dark-mode .takeoff-summary-grid strong,
.dark-mode .material-list-summary-grid strong,
.dark-mode .takeoff-source-chip,
.dark-mode .calculated-output,
.dark-mode .takeoff-action-grid strong {
  color: #f8fafc !important;
}

.dark-mode .calculated-output {
  border-color: rgba(148, 163, 184, 0.24) !important;
  background: rgba(2, 6, 23, 0.5) !important;
}

.dark-mode .status-pill.muted {
  background: rgba(148, 163, 184, 0.14) !important;
  color: #cbd5e1 !important;
}

.dark-mode .estimate-margin-strip {
  background: rgba(15, 23, 42, 0.88) !important;
  border-color: rgba(255, 255, 255, 0.16) !important;
  color: #cbd5e1 !important;
}

.dark-mode .estimate-margin-figures dd {
  color: #fff !important;
}

.dark-mode .estimate-margin-solve input {
  background: rgba(15, 23, 42, 0.92) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: #f1f5f9 !important;
}

.dark-mode .estimate-margin-solve-message {
  color: #cbd5e1 !important;
}

.dark-mode .estimate-margin-strip[data-estimate-margin-status="ok"] {
  border-color: #4ade80 !important;
}

.dark-mode .estimate-margin-strip[data-estimate-margin-status="ok"] [data-estimate-margin-amount],
.dark-mode .estimate-margin-strip[data-estimate-margin-status="ok"] [data-estimate-margin-pct] {
  color: #4ade80 !important;
}

.dark-mode .estimate-margin-strip[data-estimate-margin-status="warn"] {
  border-color: #fbbf24 !important;
}

.dark-mode .estimate-margin-strip[data-estimate-margin-status="warn"] [data-estimate-margin-amount],
.dark-mode .estimate-margin-strip[data-estimate-margin-status="warn"] [data-estimate-margin-pct],
.dark-mode .estimate-margin-strip[data-estimate-margin-status="warn"] .estimate-margin-note {
  color: #fbbf24 !important;
}

.dark-mode .estimate-margin-strip[data-estimate-margin-status="bad"] {
  background: rgba(127, 29, 29, 0.35) !important;
  border-color: #f87171 !important;
}

.dark-mode .estimate-margin-strip[data-estimate-margin-status="bad"] [data-estimate-margin-amount],
.dark-mode .estimate-margin-strip[data-estimate-margin-status="bad"] [data-estimate-margin-pct],
.dark-mode .estimate-margin-strip[data-estimate-margin-status="bad"] .estimate-margin-note {
  color: #f87171 !important;
}

.dark-mode .segmented-control,
.dark-mode .estimate-line-items.is-table-view .estimate-line-table-head {
  background: rgba(15, 23, 42, 0.88) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #cbd5e1 !important;
}

.dark-mode .segmented-control .button[aria-pressed="true"] {
  background: rgba(30, 64, 175, 0.42) !important;
  color: #f8fafc !important;
  border-color: rgba(96, 165, 250, 0.42) !important;
}

.dark-mode .estimate-line-item {
  border-top-color: rgba(255, 255, 255, 0.08) !important;
}

.dark-mode .estimate-line-item.is-section-row,
.dark-mode .estimate-line-items.is-table-view .estimate-line-preview-row.is-section-row {
  background: rgba(30, 41, 59, 0.78) !important;
  border-color: rgba(96, 165, 250, 0.2) !important;
}

.dark-mode .estimate-line-items.is-table-view .estimate-line-preview-row {
  background: rgba(15, 23, 42, 0.72) !important;
  color: #e2e8f0 !important;
  border-bottom-color: rgba(255, 255, 255, 0.08) !important;
}

.dark-mode .estimate-line-preview-group {
  border-color: rgba(148, 163, 184, 0.22) !important;
  background: rgba(2, 6, 23, 0.3) !important;
}

.dark-mode .estimate-line-items.is-table-view .estimate-line-preview-row.is-group-summary {
  background: rgba(30, 41, 59, 0.82) !important;
}

.dark-mode .estimate-line-items.is-table-view .estimate-line-preview-row.is-component-row {
  background: rgba(15, 23, 42, 0.58) !important;
}

.dark-mode .estimate-preview-product-editor > small,
.dark-mode .estimate-preview-description-editor > small {
  background: rgba(59, 130, 246, 0.18) !important;
  color: #bfdbfe !important;
}

.dark-mode .estimate-line-item label > span,
.dark-mode .estimate-line-items label > span,
.dark-mode .checkbox-field,
.dark-mode .estimate-line-item .line-field-row-total {
  color: #cbd5e1 !important;
}

.dark-mode .estimate-line-item .line-field-row-total strong {
  color: #f8fafc !important;
}

.dark-mode .estimate-line-item input,
.dark-mode .estimate-line-item select,
.dark-mode .estimate-line-item textarea,
.dark-mode .estimate-line-items input,
.dark-mode .estimate-line-items select,
.dark-mode .estimate-line-items textarea {
  background: rgba(2, 6, 23, 0.58) !important;
  border-color: rgba(148, 163, 184, 0.26) !important;
  color: #f8fafc !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.28) !important;
}

.dark-mode .estimate-line-item input:focus,
.dark-mode .estimate-line-item select:focus,
.dark-mode .estimate-line-item textarea:focus,
.dark-mode .estimate-line-items input:focus,
.dark-mode .estimate-line-items select:focus,
.dark-mode .estimate-line-items textarea:focus {
  border-color: #60a5fa !important;
  background: rgba(2, 6, 23, 0.78) !important;
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.22), inset 0 1px 2px rgba(0, 0, 0, 0.28) !important;
}

.dark-mode .estimate-line-item input[type="file"],
.dark-mode .estimate-line-items input[type="file"] {
  background: rgba(255, 255, 255, 0.04) !important;
  color: #e2e8f0 !important;
}

.dark-mode .estimate-line-item input[type="checkbox"],
.dark-mode .estimate-line-items input[type="checkbox"] {
  accent-color: #3b82f6;
  box-shadow: none !important;
}

.dark-mode .estimate-line-items.is-table-view .estimate-line-table-head span,
.dark-mode .estimate-line-items.is-table-view .estimate-line-preview-row > * {
  border-right-color: rgba(255, 255, 255, 0.08) !important;
}

/* List Items and Grid Rows (Jobs, Schedule) */
.dark-mode .timeline-item,
.dark-mode .job-row {
  background: rgba(23, 28, 41, 0.5) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}
.dark-mode .timeline-item:hover,
.dark-mode .job-row:hover {
  background: rgba(23, 28, 41, 0.7) !important;
  border-color: rgba(59, 130, 246, 0.2) !important;
}

/* Table Style Overrides */
.dark-mode .table-wrap {
  background: rgba(23, 28, 41, 0.65) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
  backdrop-filter: blur(16px);
}
.dark-mode th {
  background: rgba(255, 255, 255, 0.03) !important;
  color: var(--muted) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.dark-mode td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05) !important;
}
.dark-mode tbody tr:hover td,
.dark-mode .detail-row:hover td,
.dark-mode .detail-row:focus-visible td {
  background: rgba(255, 255, 255, 0.05) !important;
}
.dark-mode .row-selection-table .selectable-row.is-selected td {
  background: rgba(59, 130, 246, 0.18) !important;
}
.dark-mode .row-selection-table .selectable-row.is-selected:hover td {
  background: rgba(59, 130, 246, 0.28) !important;
}
@media (max-width: 620px) {
  .dark-mode :is(
    .table-wrap[data-mobile-layout="cards"].is-responsive-table-ready table,
    table.document-table[data-mobile-layout="cards"].is-responsive-table-ready
  ) tbody tr {
    background: rgba(23, 28, 41, 0.65) !important;
    border: 1px solid rgba(255, 255, 255, 0.06) !important;
  }
}

/* Complete Button Restyling */
.dark-mode .button {
  background: rgba(255, 255, 255, 0.06) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #f1f5f9 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 2px 4px rgba(0, 0, 0, 0.2) !important;
  transition:
    background-color 0.16s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.16s cubic-bezier(0.4, 0, 0.2, 1),
    color 0.16s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.16s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.16s cubic-bezier(0.4, 0, 0.2, 1) !important;
}
.dark-mode .button:hover {
  background: rgba(255, 255, 255, 0.12) !important;
  border-color: rgba(255, 255, 255, 0.18) !important;
  color: #fff !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 20px rgba(0, 0, 0, 0.3) !important;
  transform: translateY(-1.5px) !important;
}
.dark-mode .button:active {
  transform: translateY(0) !important;
}

.dark-mode .button.primary {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.2) !important;
}
.dark-mode .button.primary:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%) !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.3) !important;
}

.dark-mode .button.danger {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #ef4444 !important;
  box-shadow: none !important;
}
.dark-mode .button.danger:hover {
  background: rgba(239, 68, 68, 0.25) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  color: #f87171 !important;
  box-shadow: 0 8px 20px rgba(239, 68, 68, 0.2) !important;
}

.dark-mode .button.ghost {
  background: transparent !important;
  border-color: transparent !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
}
.dark-mode .button.ghost:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  color: #f1f5f9 !important;
  border-color: rgba(255, 255, 255, 0.04) !important;
}

/* Form inputs & Selects */
.dark-mode input,
.dark-mode select,
.dark-mode textarea {
  background: rgba(0, 0, 0, 0.25) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}
.dark-mode input:focus,
.dark-mode select:focus,
.dark-mode textarea:focus {
  border-color: #3b82f6 !important;
  background: rgba(0, 0, 0, 0.4) !important;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25) !important;
}

/* Modals */
.dark-mode .detail-modal-dialog,
.dark-mode .invoice-modal-dialog {
  background: #0f172a !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.6) !important;
}
.dark-mode .detail-modal-head,
.dark-mode .invoice-modal-head,
.dark-mode .media-modal-head {
  background: #1e293b !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
  color: #fff !important;
}
.dark-mode .detail-modal-body,
.dark-mode .invoice-modal-body {
  background: #0f172a !important;
}
.dark-mode .detail-modal .detail-edit-top-actions {
  background: rgba(15, 23, 42, 0.96) !important;
}
.dark-mode .media-modal-dialog {
  border-color: rgba(255, 255, 255, 0.1) !important;
}

/* Notices and Notifications */
.dark-mode .notice {
  background: rgba(245, 158, 11, 0.1) !important;
  border-color: rgba(245, 158, 11, 0.3) !important;
  color: #fbbf24 !important;
}
.dark-mode .notice.success {
  background: rgba(16, 185, 129, 0.1) !important;
  border-color: rgba(16, 185, 129, 0.3) !important;
  color: #34d399 !important;
}
.dark-mode .notice.danger {
  background: rgba(239, 68, 68, 0.1) !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
  color: #f87171 !important;
}

/* Pills and Badges */
.dark-mode .status-pill {
  background: rgba(255, 255, 255, 0.06) !important;
  color: #f1f5f9 !important;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08) !important;
}
.dark-mode .status-pill.success {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #34d399 !important;
}
.dark-mode .status-pill.warning {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #fbbf24 !important;
}
.dark-mode .priority-high,
.dark-mode .priority-critical {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #f87171 !important;
}
.dark-mode .priority-low {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #60a5fa !important;
}

/* Kanban Theme overrides */
.dark-mode .kanban-board {
  background: rgba(0, 0, 0, 0.3) !important;
}
.dark-mode .kanban-column {
  background: rgba(13, 17, 29, 0.7) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3) !important;
}
.dark-mode .kanban-column-head {
  background: rgba(23, 28, 41, 0.8) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}
.dark-mode .kanban-card {
  background: rgba(23, 28, 41, 0.8) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}
.dark-mode .kanban-card:hover {
  border-color: rgba(59, 130, 246, 0.3) !important;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.4) !important;
}

/* Calendar Grid overrides */
.dark-mode .schedule-calendar-grid {
  background: rgba(23, 28, 41, 0.5) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}
.dark-mode .schedule-calendar-weekday {
  background: rgba(13, 17, 29, 0.8) !important;
  border-right-color: rgba(255, 255, 255, 0.06) !important;
  color: var(--muted) !important;
}
.dark-mode .schedule-calendar-day {
  background: rgba(23, 28, 41, 0.7) !important;
  border-top-color: rgba(255, 255, 255, 0.06) !important;
  border-right-color: rgba(255, 255, 255, 0.06) !important;
}
.dark-mode .schedule-calendar-day.is-muted {
  background: rgba(0, 0, 0, 0.25) !important;
}
.dark-mode .schedule-calendar-event {
  background: rgba(13, 17, 29, 0.85) !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2) !important;
}
.dark-mode .schedule-day-head time {
  color: #fff !important;
}

/* Checkbox alignment */
.dark-mode .check-row {
  background: rgba(0, 0, 0, 0.2) !important;
  border-color: rgba(255, 255, 255, 0.06) !important;
}
.dark-mode .check-row strong {
  color: #fff !important;
}

/* Dark mode contrast repairs for nested surfaces */
.dark-mode .photo-row td {
  background: rgba(13, 17, 29, 0.78) !important;
  border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
}

.dark-mode .photo-card {
  background: rgba(23, 28, 41, 0.92) !important;
  border-color: rgba(255, 255, 255, 0.1) !important;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

.dark-mode .photo-card a,
.dark-mode .media-thumb {
  background: rgba(5, 8, 15, 0.78) !important;
}

.dark-mode .document-card a {
  background: rgba(13, 17, 29, 0.9) !important;
}

.dark-mode .photo-card strong,
.dark-mode .photo-card figcaption,
.dark-mode .photo-card small,
.dark-mode .document-card strong,
.dark-mode .document-card small {
  color: #e2e8f0 !important;
}

.dark-mode .detail-item,
.dark-mode .invoice-item-panel,
.dark-mode .invoice-overview-panel,
.dark-mode .invoice-item-row,
.dark-mode .preview-panel,
.dark-mode .seo-fields,
.dark-mode .payment-workflow,
.dark-mode .email-account-help,
.dark-mode .email-setup-guide,
.dark-mode .email-saved-accounts,
.dark-mode .email-compose,
.dark-mode .email-thread-strip a,
.dark-mode .email-attachment-card {
  background: rgba(23, 28, 41, 0.88) !important;
  border-color: rgba(255, 255, 255, 0.09) !important;
  color: #e2e8f0 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 8px 20px rgba(0, 0, 0, 0.22) !important;
}

.dark-mode .detail-item h3,
.dark-mode .field-label,
.dark-mode label,
.dark-mode th,
.dark-mode .table-select-count,
.dark-mode .empty-state {
  color: #a8b3c7 !important;
}

.dark-mode .detail-value,
.dark-mode .detail-value strong,
.dark-mode .detail-value td,
.dark-mode .detail-value tr,
.dark-mode .detail-value tbody,
.dark-mode .detail-value table {
  color: #f1f5f9 !important;
  background: transparent !important;
}

.dark-mode .detail-value small,
.dark-mode td small,
.dark-mode .search-result-body small {
  color: #9fb0c8 !important;
}

.dark-mode .email-layout {
  background: rgba(8, 12, 22, 0.9) !important;
  border-color: rgba(148, 163, 184, 0.2) !important;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.28) !important;
}

.dark-mode .email-list {
  background: rgba(10, 15, 27, 0.96) !important;
  border-right-color: rgba(148, 163, 184, 0.18) !important;
}

.dark-mode .email-row {
  background: rgba(15, 23, 42, 0.7) !important;
  border-bottom-color: rgba(148, 163, 184, 0.14) !important;
  color: #dbe7f6 !important;
}

.dark-mode .email-row:hover,
.dark-mode .email-row.is-active {
  background: rgba(30, 41, 59, 0.92) !important;
  color: #f8fafc !important;
}

.dark-mode .email-row.is-unread {
  background: rgba(17, 24, 39, 0.98) !important;
  color: #f8fafc !important;
}

.dark-mode .email-from,
.dark-mode .email-row strong,
.dark-mode .email-reader-head h2,
.dark-mode .email-thread-strip h3,
.dark-mode .email-attachments-panel h3 {
  color: #f8fafc !important;
}

.dark-mode .email-row small,
.dark-mode .email-row time,
.dark-mode .email-reader-head p,
.dark-mode .email-reader-head span,
.dark-mode .email-from em {
  color: #9fb0c8 !important;
}

.dark-mode .email-reader {
  background: rgba(15, 23, 42, 0.72) !important;
  color: #e2e8f0 !important;
}

.dark-mode .email-reader-head,
.dark-mode .email-attachments-panel {
  border-color: rgba(148, 163, 184, 0.18) !important;
}

.dark-mode .email-body {
  background: rgba(8, 12, 22, 0.72) !important;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  color: #e2e8f0 !important;
  padding: 14px;
}

.dark-mode .email-folder-link {
  color: #dbe7f6 !important;
}

.dark-mode .email-folder-link span {
  background: rgba(15, 23, 42, 0.9) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
  color: #cbd5e1 !important;
}

.dark-mode .email-folder-link:hover,
.dark-mode .email-folder-link.is-active {
  background: rgba(37, 99, 235, 0.18) !important;
  color: #f8fafc !important;
}

.dark-mode .email-folder-link.is-active span {
  background: rgba(96, 165, 250, 0.18) !important;
  border-color: rgba(147, 197, 253, 0.34) !important;
  color: #bfdbfe !important;
}

.dark-mode .email-thread-strip a.is-active {
  background: rgba(37, 99, 235, 0.22) !important;
  border-color: rgba(96, 165, 250, 0.42) !important;
}

.dark-mode .email-html-frame {
  border-color: rgba(148, 163, 184, 0.22) !important;
  background: #fff !important;
}

.dark-mode .detail-actions select,
.dark-mode .detail-actions input:not([type="hidden"]),
.dark-mode .detail-actions textarea,
.dark-mode .detail-status-editor select,
.dark-mode .searchable-select-input {
  background: rgba(8, 12, 22, 0.82) !important;
  border-color: rgba(255, 255, 255, 0.13) !important;
  color: #f8fafc !important;
}

.dark-mode .detail-actions select option,
.dark-mode select option {
  background: #111827 !important;
  color: #f8fafc !important;
}

.dark-mode .section-tab {
  background: rgba(255, 255, 255, 0.08) !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  color: #e2e8f0 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05) !important;
}

.dark-mode .section-tab:hover,
.dark-mode .section-tab:focus-visible {
  background: rgba(59, 130, 246, 0.2) !important;
  border-color: rgba(96, 165, 250, 0.46) !important;
  color: #fff !important;
}

.dark-mode .section-tab.is-active {
  background: #2563eb !important;
  border-color: #60a5fa !important;
  color: #fff !important;
  box-shadow: 0 10px 24px rgba(37, 99, 235, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
}

.dark-mode .section-tab-group > span {
  color: #94a3b8 !important;
}

.dark-mode .onboarding-checklist {
  background: linear-gradient(135deg, rgba(32, 114, 92, 0.18), rgba(181, 138, 58, 0.14)) !important;
  border-color: rgba(148, 163, 184, 0.18) !important;
}

.dark-mode .onboarding-checklist-grid a {
  background: rgba(15, 23, 42, 0.76) !important;
  border-color: rgba(148, 163, 184, 0.2) !important;
  color: #f8fafc !important;
}

.dark-mode .onboarding-checklist-grid a small {
  color: #94a3b8 !important;
}

.dark-mode .empty-state,
.dark-mode .searchable-select-empty {
  background: rgba(15, 23, 42, 0.74) !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  color: #b6c2d5 !important;
}

.dark-mode .payment-lead {
  color: #eef4ff !important;
}

.dark-mode .payment-step-list li,
.dark-mode .payment-connection-card,
.dark-mode .payment-support-list div {
  background: rgba(15, 23, 42, 0.82) !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #e2e8f0 !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045), 0 8px 20px rgba(0, 0, 0, 0.2) !important;
}

.dark-mode .payment-step-list li::before {
  background: rgba(96, 165, 250, 0.18) !important;
  color: #bfdbfe !important;
  border: 1px solid rgba(147, 197, 253, 0.28);
}

.dark-mode .payment-step-list strong,
.dark-mode .payment-support-list strong,
.dark-mode .payment-connection-card > strong,
.dark-mode .check-row strong {
  color: #f8fafc !important;
}

.dark-mode .payment-step-list span,
.dark-mode .payment-support-list span,
.dark-mode .payment-connection-card > span,
.dark-mode .payment-connection-card dt {
  color: #9fb0c8 !important;
}

.dark-mode .payment-connection-card dd {
  color: #f1f5f9 !important;
}

.dark-mode .payment-step-list code,
.dark-mode .payment-support-list code,
.dark-mode .empty-state code {
  background: rgba(96, 165, 250, 0.12) !important;
  color: #bfdbfe !important;
  border-color: rgba(147, 197, 253, 0.24) !important;
}

.dark-mode .button,
.dark-mode button.button {
  color: #f8fafc !important;
  text-shadow: none !important;
}

.dark-mode .button.primary,
.dark-mode .button.primary:visited,
.dark-mode .button.primary:hover,
.dark-mode .row-edit-button {
  color: #fff !important;
}

.dark-mode .button.ghost {
  color: #cbd5e1 !important;
}

.dark-mode .button.danger {
  color: #fecaca !important;
}

.dark-mode .button:disabled,
.dark-mode .button[disabled],
.dark-mode button:disabled {
  background: rgba(148, 163, 184, 0.12) !important;
  border-color: rgba(148, 163, 184, 0.16) !important;
  color: rgba(226, 232, 240, 0.52) !important;
  opacity: 1 !important;
  box-shadow: none !important;
}

.dark-mode .searchable-select-list,
.dark-mode .global-search-results {
  background: rgba(10, 15, 27, 0.98) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.44), inset 0 1px 0 rgba(255, 255, 255, 0.04) !important;
}

.dark-mode .searchable-select-option,
.dark-mode .global-search-result {
  color: #e2e8f0 !important;
}

.dark-mode .searchable-select-option[aria-selected="true"] {
  color: #bfdbfe !important;
}

.dark-mode .search-result-label {
  background: rgba(219, 234, 254, 0.12) !important;
  border: 1px solid rgba(147, 197, 253, 0.18) !important;
  color: #dbeafe !important;
}

.dark-mode .search-result-body strong {
  color: #f8fafc !important;
}

.dark-mode .search-result-body small,
.dark-mode .global-search-empty {
  color: #93c5fd !important;
}

.dark-mode .searchable-select-option:hover,
.dark-mode .searchable-select-option:focus-visible,
.dark-mode .searchable-select-option.is-active,
.dark-mode .global-search-result:hover,
.dark-mode .global-search-result:focus-visible {
  background: rgba(59, 130, 246, 0.18) !important;
}

.portal-admin-row > td,
.job-operations-row > td {
  background: rgba(31, 41, 55, 0.025);
  padding: 14px;
}

.portal-admin-grid,
.job-operations-panel {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.job-operation-card,
.portal-admin-panel,
.portal-thread-panel,
.portal-file-panel {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 8px;
  padding: 14px;
}

.job-operation-card .panel,
.portal-admin-grid .panel {
  box-shadow: none;
  margin: 0;
}

.portal-admin-form,
.portal-message-form {
  margin-top: 12px;
}

.portal-admin-lists {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin-top: 14px;
}

.portal-admin-lists h3 {
  font-size: 0.92rem;
  margin: 0 0 8px;
}

.portal-mini-list,
.portal-message-list,
.mini-list,
.decision-list,
.decision-file-list {
  display: grid;
  gap: 8px;
}

.portal-mini-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.portal-mini-list li,
.mini-list a,
.decision-file-list a {
  background: rgba(31, 41, 55, 0.04);
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 8px;
  color: inherit;
  display: grid;
  gap: 4px;
  padding: 9px 10px;
  text-decoration: none;
}

.portal-mini-list span,
.mini-list span,
.decision-file-list span {
  color: #64748b;
  font-size: 0.82rem;
}

.portal-invite-link {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 8px;
}

.portal-invite-link .token-box {
  margin-top: 0;
  min-width: 0;
  white-space: nowrap;
}

.portal-message {
  border-radius: 8px;
  display: grid;
  gap: 8px;
  padding: 12px 14px;
}

.portal-message.customer {
  background: rgba(37, 107, 74, 0.1);
  border: 1px solid rgba(37, 107, 74, 0.18);
}

.portal-message.team {
  background: rgba(36, 94, 131, 0.1);
  border: 1px solid rgba(36, 94, 131, 0.18);
}

.portal-message header {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.portal-message header span,
.portal-message p {
  color: #526173;
  margin: 0;
}

.decision-card {
  background: rgba(31, 41, 55, 0.035);
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 8px;
  padding: 12px;
}

.decision-card-head,
.decision-card-actions {
  align-items: start;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.decision-card-actions {
  align-items: end;
  flex-direction: column;
  gap: 6px;
  text-align: right;
}

.decision-card-actions .inline-form {
  justify-content: flex-end;
}

.decision-delete-form {
  justify-content: flex-end;
  margin-top: 8px;
}

.dark-mode .portal-admin-row > td,
.dark-mode .job-operations-row > td {
  background: rgba(2, 6, 23, 0.24) !important;
}

.dark-mode .job-operation-card,
.dark-mode .portal-admin-panel,
.dark-mode .portal-thread-panel,
.dark-mode .portal-file-panel,
.dark-mode .decision-card,
.dark-mode .portal-mini-list li,
.dark-mode .mini-list a,
.dark-mode .decision-file-list a,
.dark-mode .hub-hero,
.dark-mode .next-action,
.dark-mode .hub-timeline-item {
  background: rgba(15, 23, 42, 0.82) !important;
  border-color: rgba(148, 163, 184, 0.16) !important;
}

.dark-mode .portal-mini-list span,
.dark-mode .mini-list span,
.dark-mode .decision-file-list span,
.dark-mode .portal-message header span,
.dark-mode .portal-message p,
.dark-mode .hub-hero p,
.dark-mode .next-action span,
.dark-mode .hub-timeline-item span,
.dark-mode .hub-timeline-item small {
  color: #9fb0c8 !important;
}

.dark-mode .portal-invite-link .token-box {
  background: rgba(2, 6, 23, 0.86) !important;
  border: 1px solid rgba(52, 211, 153, 0.28) !important;
  color: #e2e8f0 !important;
  text-shadow: none;
}

.dark-mode .hub-hero h2,
.dark-mode .next-action strong,
.dark-mode .hub-timeline-item strong {
  color: #f8fafc !important;
}

.dark-mode .bizos-ai-sidecar {
  background: rgba(15, 23, 42, 0.98);
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
}

.dark-mode .bizos-ai-sidecar-resize::after {
  background: rgba(96, 165, 250, 0.36);
}

.dark-mode .bizos-ai-sidecar.is-resizing .bizos-ai-sidecar-resize::after {
  background: rgba(96, 165, 250, 0.88);
}

.dark-mode .bizos-ai-sidecar-head,
.dark-mode .bizos-ai-sidecar-actions,
.dark-mode .bizos-ai-prompt {
  border-color: rgba(148, 163, 184, 0.16);
}

.dark-mode .bizos-ai-sidecar-head strong,
.dark-mode .bizos-ai-sidecar-body p,
.dark-mode .bizos-ai-sidecar-body li,
.dark-mode .bizos-ai-sidecar-body h3,
.dark-mode .bizos-ai-sidecar-body h4 {
  color: #e5edf8;
}

.dark-mode .bizos-ai-message-body {
  background: rgba(2, 6, 23, 0.38);
  border-color: rgba(148, 163, 184, 0.15);
  color: #e5edf8;
}

.dark-mode .bizos-ai-message.from-user .bizos-ai-message-body {
  background: rgba(37, 99, 235, 0.18);
  border-color: rgba(96, 165, 250, 0.28);
}

.dark-mode .bizos-ai-message-label,
.dark-mode .bizos-ai-muted,
.dark-mode .bizos-ai-loading,
.dark-mode .bizos-ai-context-toggle {
  color: #9fb0c8 !important;
}

.dark-mode .bizos-ai-sidecar-body code {
  background: rgba(148, 163, 184, 0.14);
}

.dark-mode .bizos-ai-prompt {
  background: rgba(2, 6, 23, 0.34);
}

.dark-mode .booking-hero,
.dark-mode .booking-card,
.dark-mode .booking-service-card,
.dark-mode .booking-public-card,
.dark-mode .booking-toggle-list,
.dark-mode .booking-card-grid div,
.dark-mode .lead-visualizer-card,
.dark-mode .visualizer-upload {
  background: rgba(15, 23, 42, 0.82);
  border-color: rgba(148, 163, 184, 0.16);
}

.dark-mode .booking-hero h2,
.dark-mode .booking-hero-metrics strong,
.dark-mode .booking-card-head h3,
.dark-mode .booking-card-grid strong,
.dark-mode .booking-service-card h3,
.dark-mode .booking-service-card dd,
.dark-mode .booking-public-card h2,
.dark-mode .booking-public-card h3,
.dark-mode .booking-public-details dd {
  color: #f8fafc;
}

.dark-mode .public-stepper span {
  background: rgba(15, 23, 42, 0.76);
  border-color: rgba(148, 163, 184, 0.2);
  color: #94a3b8;
}

.dark-mode .public-stepper span.is-active {
  background: #2563eb;
  border-color: #60a5fa;
  color: #fff;
}

.dark-mode .booking-hero p,
.dark-mode .booking-hero-metrics span,
.dark-mode .booking-card-head p,
.dark-mode .booking-card-note,
.dark-mode .booking-card-grid span,
.dark-mode .booking-service-card p,
.dark-mode .booking-service-card dt,
.dark-mode .booking-public-card p,
.dark-mode .booking-public-details dt,
.dark-mode .visualizer-assumptions,
.dark-mode .lead-visualizer-copy small,
.dark-mode .visualizer-chat-message p {
  color: #9fb0c8;
}

.dark-mode .visualizer-chat {
  border-color: rgba(148, 163, 184, 0.16);
}

.dark-mode .visualizer-chat-message,
.dark-mode .visualizer-revision-form {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.16);
}

.dark-mode .visualizer-chat-message.is-ai {
  background: rgba(47, 107, 87, 0.2);
}

.dark-mode .virtual-design-log,
.dark-mode .virtual-design-message,
.dark-mode .virtual-design-text textarea,
.dark-mode .visualizer-upload-preview-item {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(148, 163, 184, 0.16);
}

.dark-mode .visualizer-upload-preview-item.is-primary {
  background: rgba(47, 107, 87, 0.22);
  border-color: rgba(47, 107, 87, 0.34);
}

.dark-mode .visualizer-upload-preview-item strong {
  color: #f8fafc;
}

.dark-mode .visualizer-upload-preview-item small {
  color: #9fb0c8;
}

.dark-mode .virtual-design-message.is-ai {
  background: rgba(47, 107, 87, 0.22);
}

.dark-mode .virtual-design-message strong {
  color: #f8fafc;
}

.dark-mode .virtual-design-message p,
.dark-mode .virtual-design-note {
  color: #9fb0c8;
}

.dark-mode .virtual-design-note {
  background: rgba(15, 23, 42, 0.72);
  border-color: rgba(47, 107, 87, 0.28);
  border-left-color: #2f6b57;
}

.dark-mode .booking-service-edit {
  border-color: rgba(148, 163, 184, 0.16);
}

@media (max-width: 760px) {
  .bizos-ai-bubble {
    right: 14px;
    bottom: calc(14px + env(safe-area-inset-bottom));
    width: 52px;
    height: 52px;
  }

  .view-leads tbody tr td[data-label="Project details"] {
    grid-template-columns: 1fr;
  }

  .view-leads tbody tr td[data-label="Project details"]::before {
    margin-bottom: 2px;
  }

  .view-leads tbody tr td[data-label="Files"] {
    display: none;
  }

  .view-leads .lead-request-details,
  .view-leads .lead-request-details > summary {
    width: 100%;
  }

  .bizos-ai-sidecar {
    top: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: calc(100vw - 20px);
    min-width: 0;
    max-width: calc(100vw - 20px);
  }

  .bizos-ai-sidecar-resize {
    display: none;
  }

  .bizos-ai-prompt-row {
    grid-template-columns: minmax(0, 1fr) 46px;
  }

  .bizos-ai-prompt-utilities .bizos-ai-open-chat {
    min-height: 34px;
    padding: 5px 9px;
    font-size: 0.72rem;
  }

  .billing-detail-card {
    grid-template-columns: 1fr;
  }

  .bizos-ai-composer-actions {
    height: 96px;
  }

  .booking-hero,
  .booking-layout,
  .booking-public-grid,
  .public-flow-summary,
  .public-funnel-grid,
  .virtual-design-grid,
  .public-preview-review-grid,
  .visualizer-result-grid {
    grid-template-columns: 1fr;
  }

  .virtual-design-head {
    align-items: stretch;
    flex-direction: column;
  }

  .virtual-design-camera,
  .virtual-design-camera video,
  .virtual-design-camera-empty {
    min-height: 320px;
  }

  .virtual-design-panel {
    grid-template-rows: auto auto auto;
  }

  .virtual-design-log {
    max-height: 360px;
  }

  .virtual-design-message {
    max-width: 94%;
  }

  .virtual-design-actions .button {
    flex: 1 1 160px;
  }

  .public-preview-review-head {
    align-items: stretch;
    flex-direction: column;
  }

  .visualizer-upload-grid {
    grid-template-columns: 1fr;
  }

  .visualizer-before-after.has-generated {
    grid-template-columns: 1fr;
  }

  .booking-hero-metrics,
  .booking-card-grid,
  .booking-form-row,
  .booking-service-card dl,
  .booking-public-details {
    grid-template-columns: 1fr;
  }

  .lead-visualizer-card {
    grid-template-columns: 1fr;
  }

  .booking-card-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .hub-hero,
  .hub-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .hub-actions .button,
  .next-action {
    width: 100%;
  }

  .portal-admin-row > td,
  .job-operations-row > td {
    padding: 10px;
  }

  .portal-admin-grid,
  .job-operations-panel,
  .portal-invite-link {
    grid-template-columns: 1fr;
  }

  .portal-message header {
    align-items: flex-start;
    flex-direction: column;
  }
}

.portal-auth-body {
  min-height: 100vh;
}

.portal-auth-body .auth-panel {
  max-width: 460px;
}

.portal-topbar {
  align-items: center;
  background: #ffffff;
  border-bottom: 1px solid rgba(31, 41, 55, 0.1);
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(190px, auto) minmax(0, 1fr) auto;
  padding: 14px clamp(16px, 2.4vw, 32px);
  position: sticky;
  top: 0;
  z-index: 20;
}

.portal-brand {
  align-items: center;
  color: #172033;
  display: inline-flex;
  gap: 10px;
  text-decoration: none;
}

.portal-brand span {
  align-items: center;
  background: #245e83;
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 900;
  height: 34px;
  justify-content: center;
  min-width: 34px;
  padding: 0 9px;
}

.portal-brand strong {
  font-size: 0.98rem;
}

.portal-nav {
  align-items: center;
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow-x: auto;
}

.portal-nav a {
  border-radius: 8px;
  color: #475569;
  font-size: 0.88rem;
  font-weight: 800;
  padding: 8px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.portal-nav a:hover,
.portal-nav a.is-active {
  background: rgba(36, 94, 131, 0.12);
  color: #174765;
}

.portal-logout {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.portal-logout span {
  color: #64748b;
  font-size: 0.86rem;
  font-weight: 800;
}

.portal-shell {
  display: grid;
  gap: 18px;
  margin: 0 auto;
  max-width: none;
  padding: 24px clamp(16px, 2.4vw, 32px) 44px;
  width: min(100%, 1480px);
}

.portal-hero,
.portal-page-head,
.portal-panel,
.portal-metric {
  background: #fff;
  border: 1px solid rgba(31, 41, 55, 0.1);
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(31, 41, 55, 0.06);
}

.portal-dashboard-head {
  display: flex;
  justify-content: flex-end;
}

.portal-hero {
  align-items: center;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding: clamp(20px, 4vw, 34px);
}

.portal-hero.compact {
  padding: 22px 24px;
}

.portal-hero h1,
.portal-page-head h1 {
  font-size: clamp(1.55rem, 3vw, 2.45rem);
  letter-spacing: 0;
  line-height: 1.08;
  margin: 0 0 8px;
}

.portal-hero p,
.portal-page-head p,
.portal-muted {
  color: #64748b;
  margin: 0;
}

.portal-total {
  color: #256b4a;
  font-size: clamp(1.35rem, 3vw, 2.1rem);
}

.portal-page-head {
  padding: 22px 24px;
}

.portal-metrics {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.portal-metric {
  display: grid;
  gap: 5px;
  min-height: 118px;
  padding: 18px;
}

.portal-metric span,
.portal-document-meta span {
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.portal-metric strong {
  color: #172033;
  font-size: 1.55rem;
  line-height: 1;
}

.portal-metric small {
  color: #64748b;
}

.portal-grid {
  display: grid;
  gap: 16px;
}

.portal-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.portal-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.portal-panel .table-wrap {
  overflow-x: visible;
}

.portal-panel table {
  min-width: 0;
}

.portal-panel th,
.portal-panel td {
  overflow-wrap: anywhere;
  padding: 11px 12px;
}

.portal-estimate-table {
  table-layout: auto;
}

.portal-estimate-table :is(th, td):nth-child(2) {
  min-width: 5.5rem;
}

.portal-estimate-table :is(th, td):nth-child(3) {
  min-width: 6.5rem;
}

.portal-estimate-table :is(th, td):nth-child(4),
.portal-estimate-table :is(th, td):nth-child(5) {
  min-width: 8.5rem;
}

.portal-estimate-table :is(th, td):nth-child(n + 2) {
  font-variant-numeric: tabular-nums;
  overflow-wrap: normal;
  white-space: nowrap;
  word-break: normal;
}

.portal-panel td small {
  display: block;
  margin-top: 3px;
}

.portal-panel-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.portal-panel-head h2 {
  font-size: 1.08rem;
  margin: 0;
}

.portal-panel-head a {
  color: #245e83;
  font-weight: 800;
  text-decoration: none;
}

.portal-list,
.portal-file-grid {
  display: grid;
  gap: 10px;
}

.portal-list-row {
  align-items: center;
  background: rgba(31, 41, 55, 0.035);
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 8px;
  color: #172033;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  min-height: 58px;
  padding: 12px 14px;
  text-decoration: none;
}

.portal-list-row strong,
.portal-file-card strong {
  display: block;
}

.portal-list-row small,
.portal-file-card small {
  color: #5c6b7d;
  display: block;
  margin-top: 3px;
}

.portal-decision-list {
  display: grid;
  gap: 14px;
}

.portal-decision-card {
  align-content: start;
}

.portal-decision-files {
  border-top: 1px solid rgba(31, 41, 55, 0.1);
  padding-top: 12px;
}

.portal-document-meta {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-document-meta div {
  background: rgba(31, 41, 55, 0.04);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  padding: 12px;
}

.portal-totals {
  display: grid;
  gap: 8px;
  justify-self: end;
  margin: 0;
  min-width: min(100%, 320px);
}

.portal-totals div {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
}

.portal-totals dt {
  color: #64748b;
  font-weight: 800;
}

.portal-totals dd {
  font-weight: 900;
  margin: 0;
}

.portal-scope h2 {
  font-size: 1rem;
  margin: 0 0 8px;
}

.portal-scope p {
  color: #475569;
  margin: 0;
}

.portal-signature-form {
  border-top: 1px solid rgba(31, 41, 55, 0.1);
  padding-top: 16px;
}

.portal-signature-consent {
  display: grid;
  gap: 10px;
}

.portal-signature-consent label {
  align-items: flex-start;
  background: rgba(36, 94, 131, 0.06);
  border: 1px solid rgba(36, 94, 131, 0.14);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  padding: 12px;
}

.portal-signature-consent input {
  flex: 0 0 auto;
  margin-top: 2px;
  min-height: 18px;
  width: 18px;
}

.portal-signature-receipt {
  display: grid;
  gap: 12px;
}

.portal-signature-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-signature-grid div {
  background: rgba(37, 107, 74, 0.07);
  border: 1px solid rgba(37, 107, 74, 0.16);
  border-radius: 8px;
  display: grid;
  gap: 5px;
  padding: 12px;
}

.portal-signature-grid span {
  color: #476158;
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.portal-signature-details {
  border: 1px solid rgba(31, 41, 55, 0.1);
  border-radius: 8px;
  padding: 12px;
}

.portal-signature-details summary {
  color: #172033;
  cursor: pointer;
  font-weight: 900;
}

.portal-file-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.portal-file-controls {
  margin-bottom: 14px;
}

.portal-file-card {
  background: rgba(31, 41, 55, 0.04);
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 8px;
  color: #172033;
  display: grid;
  gap: 10px;
  grid-template-rows: 150px minmax(0, auto);
  min-height: 232px;
  overflow: hidden;
  padding: 10px;
  text-decoration: none;
}

.portal-file-thumb {
  align-items: center;
  background: linear-gradient(135deg, #b58a3a, #7a5b22);
  border-radius: 8px;
  color: #fff;
  display: flex;
  font-size: 0.9rem;
  font-weight: 900;
  height: 100%;
  justify-content: center;
  min-height: 0;
  overflow: hidden;
  width: 100%;
}

.portal-file-thumb img {
  display: block;
  height: 100%;
  object-fit: cover;
  width: 100%;
}

.portal-file-thumb span {
  align-items: center;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  display: inline-flex;
  justify-content: center;
  min-height: 48px;
  min-width: 68px;
  padding: 0 12px;
}

.portal-file-info {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.portal-file-info strong,
.portal-file-info em,
.portal-file-info small {
  overflow-wrap: anywhere;
}

.portal-file-info em {
  color: #7a5b22;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 900;
}

.dark-mode .portal-topbar,
.dark-mode .portal-hero,
.dark-mode .portal-page-head,
.dark-mode .portal-panel,
.dark-mode .portal-metric {
  background: rgba(15, 23, 42, 0.82) !important;
  border-color: rgba(148, 163, 184, 0.16) !important;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.3) !important;
}

.dark-mode .portal-brand,
.dark-mode .portal-brand strong,
.dark-mode .portal-hero h1,
.dark-mode .portal-page-head h1,
.dark-mode .portal-panel-head h2,
.dark-mode .portal-admin-lists h3,
.dark-mode .portal-list-row strong,
.dark-mode .portal-file-card strong,
.dark-mode .portal-metric strong,
.dark-mode .portal-signature-grid strong,
.dark-mode .portal-signature-details summary {
  color: #f8fafc !important;
}

.dark-mode .portal-nav a,
.dark-mode .portal-logout span,
.dark-mode .portal-hero p,
.dark-mode .portal-page-head p,
.dark-mode .portal-muted,
.dark-mode .portal-note-list small,
.dark-mode .portal-list-row small,
.dark-mode .portal-file-card small,
.dark-mode .portal-file-card em,
.dark-mode .portal-metric span,
.dark-mode .portal-metric small,
.dark-mode .portal-document-meta span,
.dark-mode .portal-signature-grid span,
.dark-mode .portal-scope p,
.dark-mode .portal-totals dt {
  color: #94a3b8 !important;
}

.dark-mode .portal-nav a:hover,
.dark-mode .portal-nav a.is-active {
  background: rgba(59, 130, 246, 0.16);
  color: #bfdbfe;
}

.dark-mode .portal-note-list article,
.dark-mode .portal-list-row,
.dark-mode .portal-file-card,
.dark-mode .portal-document-meta div,
.dark-mode .portal-signature-grid div,
.dark-mode .portal-signature-details,
.dark-mode .portal-signature-consent label {
  background: rgba(2, 6, 23, 0.42) !important;
  border-color: rgba(148, 163, 184, 0.14) !important;
  color: #e5edf8 !important;
}

.dark-mode .portal-message.customer {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.24);
}

.dark-mode .portal-message.team {
  background: rgba(59, 130, 246, 0.13);
  border-color: rgba(59, 130, 246, 0.24);
}

@media (max-width: 980px) {
  .portal-topbar {
    grid-template-columns: 1fr;
    position: static;
  }

  .portal-nav,
  .portal-logout {
    justify-content: flex-start;
  }

  .portal-metrics,
  .portal-grid.two,
  .portal-document-meta,
  .portal-signature-grid {
    grid-template-columns: 1fr;
  }

  .portal-hero {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .portal-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .portal-dashboard-head .button {
    width: 100%;
  }

  .portal-list-row {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Persistent hands-free controls for the BizOS AI Agent. */
.bizos-voice-launch {
  align-items: center;
  background: linear-gradient(135deg, #075ca8, #0d82d9);
  border-color: #075ca8;
  color: #fff;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  margin-top: 8px;
  min-height: 44px;
}

.bizos-voice-launch:hover {
  background: linear-gradient(135deg, #064f91, #0b70bc);
  border-color: #064f91;
  color: #fff;
}

.bizos-voice-panel {
  background: #fff;
  border: 2px solid #9eb5cc;
  border-radius: 20px;
  bottom: max(18px, env(safe-area-inset-bottom, 0px));
  box-shadow: 0 24px 70px rgba(8, 28, 48, 0.34);
  color: #17283d;
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 36px - env(safe-area-inset-bottom, 0px));
  overflow: auto;
  padding: 18px;
  position: fixed;
  right: 18px;
  width: min(440px, calc(100vw - 36px));
  z-index: 620;
}

.bizos-voice-panel-head {
  cursor: grab;
  touch-action: none;
}

.bizos-voice-panel.is-dragging .bizos-voice-panel-head {
  cursor: grabbing;
}

.bizos-voice-window-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.bizos-voice-compact-toggle,
.bizos-voice-end-icon {
  display: none;
}

.bizos-voice-panel.is-minimized {
  display: grid;
  grid-template-areas: "state actions";
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: min(420px, calc(100vw - 36px));
  max-height: none;
  overflow: visible;
  padding: 10px;
  cursor: pointer;
}

.bizos-voice-panel.is-minimized .bizos-voice-panel-head {
  display: contents;
}

.bizos-voice-panel.is-minimized .bizos-voice-panel-head > div:first-child,
.bizos-voice-panel.is-minimized .bizos-voice-meter,
.bizos-voice-panel.is-minimized .bizos-voice-caption,
.bizos-voice-panel.is-minimized .bizos-voice-activity,
.bizos-voice-panel.is-minimized .bizos-voice-controls,
.bizos-voice-panel.is-minimized .bizos-voice-confirm-actions,
.bizos-voice-panel.is-minimized .bizos-voice-links,
.bizos-voice-panel.is-minimized .bizos-voice-help {
  display: none !important;
}

.bizos-voice-panel.is-minimized .bizos-voice-state {
  grid-area: state;
  min-width: 0;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
}

.bizos-voice-panel.is-minimized .bizos-voice-state > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.bizos-voice-panel.is-minimized .bizos-voice-window-actions {
  grid-area: actions;
}

.bizos-voice-panel.is-minimized .bizos-voice-dock {
  display: none !important;
}

.bizos-voice-panel.is-minimized .bizos-voice-compact-toggle,
.bizos-voice-panel.is-minimized .bizos-voice-end-icon {
  display: inline-grid;
}

.bizos-voice-panel.is-minimized .bizos-voice-end-label {
  display: none;
}

.bizos-voice-panel.is-minimized .bizos-voice-window-actions .button {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 6px;
}

.bizos-voice-panel.is-compact-attention {
  gap: 9px;
  width: min(390px, calc(100vw - 36px));
  max-height: min(430px, calc(100dvh - 36px));
  padding: 14px;
}

.bizos-voice-panel.is-compact-attention .bizos-voice-meter,
.bizos-voice-panel.is-compact-attention .bizos-voice-activity,
.bizos-voice-panel.is-compact-attention .bizos-voice-help,
.bizos-voice-panel.is-compact-attention .bizos-voice-links,
.bizos-voice-panel.is-compact-attention [data-bizos-voice-stop-speech],
.bizos-voice-panel.is-compact-attention [data-bizos-voice-mute] {
  display: none !important;
}

.bizos-voice-panel.is-compact-attention .bizos-voice-caption {
  min-height: 0;
  max-height: 132px;
  overflow: auto;
}

@media (min-width: 1200px) {
  body.bizos-voice-docked .app-shell {
    grid-template-columns: 268px minmax(0, 1fr) 440px;
  }

  body.sidebar-collapsed.bizos-voice-docked .app-shell {
    grid-template-columns: 0 minmax(0, 1fr) 440px;
  }

  .bizos-voice-panel.is-docked {
    top: 0;
    right: 0;
    bottom: 0;
    left: auto;
    width: 440px;
    height: 100dvh;
    max-height: none;
    border-radius: 0;
    border-width: 0 0 0 2px;
    box-shadow: -16px 0 42px rgba(8, 28, 48, 0.22);
  }
}

@media (min-width: 861px) {
  .bizos-voice-panel[data-voice-side="left"]:not(.is-docked) {
    left: 18px;
    right: auto;
  }
}

.bizos-voice-panel[hidden] {
  display: none !important;
}

.bizos-voice-panel [hidden] {
  display: none !important;
}

.bizos-voice-panel-head,
.bizos-voice-controls,
.bizos-voice-confirm-actions,
.bizos-voice-state {
  align-items: center;
  display: flex;
}

.bizos-voice-panel-head {
  gap: 14px;
  justify-content: space-between;
}

.bizos-voice-panel-head .eyebrow {
  color: #075ca8;
  margin: 0 0 3px;
}

.bizos-voice-panel-head h2 {
  color: #142338;
  display: block;
  font-size: 20px;
  line-height: 1.2;
  margin: 0;
}

.bizos-voice-panel .button {
  min-height: 44px;
  min-width: 44px;
}

.bizos-voice-state {
  background: #eaf4ff;
  border: 1px solid #b8d6f2;
  border-radius: 999px;
  color: #153a5d;
  font-size: 14px;
  font-weight: 800;
  gap: 9px;
  min-height: 38px;
  padding: 7px 12px;
  width: fit-content;
}

.bizos-voice-state-dot {
  background: #64748b;
  border-radius: 999px;
  box-shadow: 0 0 0 4px rgba(100, 116, 139, 0.14);
  flex: 0 0 auto;
  height: 10px;
  width: 10px;
}

.bizos-voice-meter {
  background: #dce6ef;
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  width: 100%;
}

.bizos-voice-meter > span {
  background: linear-gradient(90deg, #0d82d9, #0f9f70);
  display: block;
  height: 100%;
  transform: scaleX(var(--bizos-voice-level, 0));
  transform-origin: left center;
  transition: transform 90ms linear;
  width: 100%;
}

.bizos-voice-caption {
  background: #f7fafc;
  border: 1px solid #cbd7e3;
  border-radius: 14px;
  min-height: 84px;
  padding: 13px 14px;
}

.bizos-voice-caption p {
  color: #17283d;
  font-size: 16px;
  line-height: 1.45;
  margin: 0;
  overflow-wrap: anywhere;
}

.bizos-voice-caption .bizos-voice-interim {
  color: #53677d;
  font-style: italic;
  margin-top: 7px;
}

.bizos-voice-activity {
  background: #eef7ff;
  border: 1px solid #b9d8ee;
  border-radius: 14px;
  padding: 11px 13px;
}

.bizos-voice-activity-head {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.bizos-voice-activity-head strong {
  color: #103d62;
  font-size: 14px;
}

.bizos-voice-activity-head span {
  color: #52718a;
  font-size: 12px;
}

.bizos-voice-activity ol {
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 10px 0 0;
  max-height: 190px;
  overflow: auto;
  padding: 0;
}

.bizos-voice-activity li {
  border-left: 2px solid #9ec8e5;
  display: grid;
  gap: 2px;
  padding-left: 9px;
}

.bizos-voice-activity li.is-current {
  border-left-color: #0d82d9;
}

.bizos-voice-activity li strong {
  color: #173a57;
  font-size: 13px;
}

.bizos-voice-activity li span {
  color: #3d5f78;
  font-size: 12px;
  line-height: 1.35;
}

.bizos-background-toast-region {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(430px, calc(100vw - 32px));
  pointer-events: none;
  position: fixed;
  right: 18px;
  top: 82px;
  z-index: 100001;
}

.bizos-background-toast {
  background: #17243a;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-left: 4px solid #0f9f70;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(2, 6, 23, 0.34);
  color: #f8fafc;
  display: grid;
  gap: 5px;
  opacity: 0;
  padding: 14px 15px;
  pointer-events: auto;
  transform: translateY(-8px);
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.bizos-background-toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.bizos-background-toast.is-warning {
  border-left-color: #e7ad3f;
}

.bizos-background-toast.is-danger {
  border-left-color: #ef6a6a;
}

.bizos-background-toast strong {
  color: #fff;
  font-size: 14px;
}

.bizos-background-toast > span {
  color: #d6e1ef;
  font-size: 13px;
  line-height: 1.4;
}

.bizos-background-toast-actions {
  align-items: center;
  display: flex;
  gap: 14px;
  margin-top: 5px;
}

.bizos-background-toast-action,
.bizos-background-toast-actions button {
  font: inherit;
  font-size: 13px;
  font-weight: 700;
}

.bizos-background-toast-action {
  background: #0d82d9;
  border-radius: 7px;
  color: #fff;
  padding: 7px 10px;
  text-decoration: none;
}

.bizos-background-toast-action:hover {
  background: #0b70bc;
  color: #fff;
}

.bizos-background-toast-actions button {
  background: transparent;
  border: 0;
  color: #c7d5e5;
  cursor: pointer;
  padding: 7px 0;
  text-decoration: underline;
}

.bizos-background-toast-action:focus-visible,
.bizos-background-toast-actions button:focus-visible {
  outline: 3px solid #7dd3fc;
  outline-offset: 2px;
}

.bizos-voice-controls,
.bizos-voice-confirm-actions {
  flex-wrap: wrap;
  gap: 8px;
}

.bizos-voice-links {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bizos-voice-toggle {
  flex: 1 1 150px;
}

.bizos-voice-confirm-actions:not(:has([data-bizos-voice-approve]:not([hidden]), [data-bizos-voice-cancel]:not([hidden]))) {
  display: none;
}

.bizos-voice-help {
  color: #53677d;
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}

.bizos-voice-panel[data-state="listening"] {
  border-color: #0f8a62;
}

.bizos-voice-panel[data-state="listening"] .bizos-voice-state {
  background: #e8f8f1;
  border-color: #8dd4ba;
  color: #075f45;
}

.bizos-voice-panel[data-state="listening"] .bizos-voice-state-dot {
  animation: bizos-voice-pulse 1.4s ease-out infinite;
  background: #0f9f70;
  box-shadow: 0 0 0 4px rgba(15, 159, 112, 0.16);
}

.bizos-voice-panel[data-state="thinking"] .bizos-voice-state-dot {
  animation: bizos-voice-pulse 1.2s ease-out infinite;
  background: #0d6ec6;
  box-shadow: 0 0 0 4px rgba(13, 110, 198, 0.16);
}

.bizos-voice-panel[data-state="speaking"] {
  border-color: #6750a4;
}

.bizos-voice-panel[data-state="speaking"] .bizos-voice-state {
  background: #f1ecff;
  border-color: #c7b8f0;
  color: #4e398b;
}

.bizos-voice-panel[data-state="speaking"] .bizos-voice-state-dot {
  background: #7457bd;
  box-shadow: 0 0 0 4px rgba(116, 87, 189, 0.16);
}

.bizos-voice-panel[data-state="approval"],
.bizos-voice-panel[data-state="awaiting-confirmation"],
.bizos-voice-panel[data-state="awaiting_confirmation"] {
  border-color: #b7791f;
}

.bizos-voice-panel[data-state="approval"] .bizos-voice-state,
.bizos-voice-panel[data-state="awaiting-confirmation"] .bizos-voice-state,
.bizos-voice-panel[data-state="awaiting_confirmation"] .bizos-voice-state {
  background: #fff6dc;
  border-color: #e7c769;
  color: #6d4708;
}

.bizos-voice-panel[data-state="approval"] .bizos-voice-state-dot,
.bizos-voice-panel[data-state="awaiting-confirmation"] .bizos-voice-state-dot,
.bizos-voice-panel[data-state="awaiting_confirmation"] .bizos-voice-state-dot {
  background: #c68516;
  box-shadow: 0 0 0 4px rgba(198, 133, 22, 0.17);
}

.bizos-voice-panel[data-state="error"],
.bizos-voice-panel[data-state="unsupported"] {
  border-color: #c24141;
}

.bizos-voice-panel[data-state="error"] .bizos-voice-state,
.bizos-voice-panel[data-state="unsupported"] .bizos-voice-state {
  background: #fff0f0;
  border-color: #efb3b3;
  color: #8b2020;
}

.bizos-voice-panel[data-state="error"] .bizos-voice-state-dot,
.bizos-voice-panel[data-state="unsupported"] .bizos-voice-state-dot {
  background: #c24141;
  box-shadow: 0 0 0 4px rgba(194, 65, 65, 0.16);
}

.bizos-voice-launch:focus-visible,
.bizos-voice-bubble:focus-visible,
.bizos-voice-panel button:focus-visible,
.bizos-voice-panel a:focus-visible {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px #075ca8;
  outline: none;
}

.dark-mode .bizos-voice-panel {
  background: #0f172a;
  border-color: #64748b;
  box-shadow: 0 24px 72px rgba(0, 0, 0, 0.62);
  color: #f8fafc;
}

.dark-mode .bizos-voice-panel-head .eyebrow {
  color: #7dd3fc;
}

.dark-mode .bizos-voice-panel-head h2,
.dark-mode .bizos-voice-caption p {
  color: #f8fafc;
}

.dark-mode .bizos-voice-state {
  background: #17243a;
  border-color: #53677d;
  color: #e2e8f0;
}

.dark-mode .bizos-voice-caption {
  background: #111c30;
  border-color: #475569;
}

.dark-mode .bizos-voice-activity {
  background: #102236;
  border-color: #285876;
}

.dark-mode .bizos-voice-activity-head strong,
.dark-mode .bizos-voice-activity li strong {
  color: #d9efff;
}

.dark-mode .bizos-voice-activity-head span,
.dark-mode .bizos-voice-activity li span {
  color: #a9c8dc;
}

.dark-mode .bizos-voice-activity li {
  border-left-color: #376a89;
}

.dark-mode .bizos-voice-activity li.is-current {
  border-left-color: #38bdf8;
}

.dark-mode .bizos-voice-meter {
  background: #334155;
}

.dark-mode .bizos-voice-caption .bizos-voice-interim,
.dark-mode .bizos-voice-help {
  color: #b7c4d4;
}

.dark-mode .bizos-voice-panel[data-state="listening"] .bizos-voice-state {
  background: #0d372d;
  border-color: #2c8c6e;
  color: #b7f7de;
}

.dark-mode .bizos-voice-panel[data-state="speaking"] .bizos-voice-state {
  background: #2d2349;
  border-color: #8069bd;
  color: #e2d8ff;
}

.dark-mode .bizos-voice-panel[data-state="approval"] .bizos-voice-state,
.dark-mode .bizos-voice-panel[data-state="awaiting-confirmation"] .bizos-voice-state,
.dark-mode .bizos-voice-panel[data-state="awaiting_confirmation"] .bizos-voice-state {
  background: #3b2b0a;
  border-color: #9f7725;
  color: #ffe7a0;
}

.dark-mode .bizos-voice-panel[data-state="error"] .bizos-voice-state,
.dark-mode .bizos-voice-panel[data-state="unsupported"] .bizos-voice-state {
  background: #421d25;
  border-color: #a94454;
  color: #ffc8d0;
}

@keyframes bizos-voice-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(15, 159, 112, 0.42);
  }
  70%, 100% {
    box-shadow: 0 0 0 9px rgba(15, 159, 112, 0);
  }
}

@media (max-width: 760px) {
  .bizos-voice-bubble {
    bottom: 78px;
    height: 52px;
    min-width: 82px;
    padding: 0 14px;
    right: 74px;
  }

  .bizos-voice-launch {
    min-height: 56px;
    width: 100%;
  }

  .bizos-voice-panel {
    border-radius: 20px 20px 0 0;
    bottom: 0;
    left: 0;
    max-height: calc(100dvh - 12px);
    padding: 16px 14px calc(14px + env(safe-area-inset-bottom, 0px));
    right: 0;
    width: 100%;
  }

  .bizos-voice-links .button {
    flex: 1 1 calc(50% - 4px);
  }

  .bizos-voice-panel .button {
    min-height: 56px;
    min-width: 56px;
  }

  /* Live voice is meant to accompany the current screen, not cover it. Keep
     the active conversation in a small dock; approval, error, and setup
     states retain the full panel because they need their complete context. */
  .bizos-voice-panel.is-minimized {
    border-radius: 16px;
    bottom: max(8px, env(safe-area-inset-bottom, 0px));
    gap: 8px;
    grid-template-areas:
      "state actions";
    grid-template-columns: minmax(0, 1fr) auto;
    left: 8px;
    max-height: none;
    overflow: visible;
    padding: 10px;
    right: 8px;
    width: auto;
  }

  .bizos-voice-panel.is-minimized .bizos-voice-panel-head {
    display: contents;
  }

  .bizos-voice-panel.is-minimized .bizos-voice-panel-head > div:first-child,
  .bizos-voice-panel.is-minimized .bizos-voice-help {
    clip: rect(0, 0, 0, 0);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
  }

  .bizos-voice-panel.is-minimized .bizos-voice-panel-head .button {
    grid-area: end;
  }

  .bizos-voice-panel.is-minimized .bizos-voice-state {
    grid-area: state;
    margin: 0;
    min-width: 0;
    padding: 9px 11px;
  }

  .bizos-voice-panel.is-minimized .bizos-voice-meter,
  .bizos-voice-panel.is-minimized .bizos-voice-caption,
  .bizos-voice-panel.is-minimized .bizos-voice-activity,
  .bizos-voice-panel.is-minimized .bizos-voice-confirm-actions,
  .bizos-voice-panel.is-minimized .bizos-voice-links,
  .bizos-voice-panel.is-minimized [data-bizos-voice-stop-speech],
  .bizos-voice-panel.is-minimized [data-bizos-voice-mute] {
    display: none !important;
  }

  .bizos-voice-panel.is-minimized .bizos-voice-controls {
    display: block;
    grid-area: controls;
  }

  .bizos-voice-panel.is-minimized .bizos-voice-controls .bizos-voice-toggle,
  .bizos-voice-panel.is-minimized .bizos-voice-panel-head .button {
    min-height: 42px;
    min-width: 0;
    padding: 8px 12px;
  }

  .bizos-voice-panel.is-minimized .bizos-voice-controls .bizos-voice-toggle {
    width: 100%;
  }

  body.bizos-tour-active .bizos-voice-panel:not([data-state="approval"]) {
    gap: 6px;
    max-height: min(204px, 36dvh);
    padding-top: 8px;
  }

  body.bizos-tour-active .bizos-voice-panel:not([data-state="approval"]) .bizos-voice-panel-head {
    justify-content: flex-end;
    margin-bottom: 4px;
  }

  body.bizos-tour-active .bizos-voice-panel:not([data-state="approval"]) .bizos-voice-panel-head > div,
  body.bizos-tour-active .bizos-voice-panel:not([data-state="approval"]) .bizos-voice-caption,
  body.bizos-tour-active .bizos-voice-panel:not([data-state="approval"]) .bizos-voice-help,
  body.bizos-tour-active .bizos-voice-panel:not([data-state="approval"]) [data-bizos-voice-test-speaker],
  body.bizos-tour-active .bizos-voice-panel:not([data-state="approval"]) [data-bizos-voice-mute] {
    display: none !important;
  }

  body.bizos-tour-active .bizos-voice-panel:not([data-state="approval"]) .bizos-voice-state {
    margin-bottom: 6px;
  }

  body.bizos-tour-active .bizos-voice-panel:not([data-state="approval"]) .bizos-voice-panel-head .button {
    min-height: 44px;
  }

  .bizos-voice-caption {
    min-height: 96px;
  }

  .bizos-voice-caption p {
    font-size: 17px;
  }

  .bizos-voice-controls .button,
  .bizos-voice-confirm-actions .button {
    flex: 1 1 calc(50% - 4px);
  }

  .bizos-voice-controls .bizos-voice-toggle {
    flex-basis: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bizos-voice-panel .bizos-voice-state-dot {
    animation: none !important;
  }

  .bizos-voice-meter > span {
    transition: none;
  }
}

@media (forced-colors: active) {
  .bizos-voice-launch,
  .bizos-voice-panel,
  .bizos-voice-state,
  .bizos-voice-caption {
    border: 2px solid CanvasText;
  }

  .bizos-voice-state-dot {
    background: CanvasText;
    box-shadow: none;
  }
}

/* Dark-mode contrast repairs: keep generated documents as readable paper and
   ensure dashboard callouts do not retain their light-theme surfaces. */
.dark-mode .document-embedded-body .page-content {
  background: #282c33;
}

.dark-mode .document-paper {
  --ink: #1f2937;
  --muted: #526277;
  --line: #d7dee8;
  --red: #b42318;
  --red-dark: #8f1d15;
  background: #fff !important;
  border-color: #cbd5e1 !important;
  color: #1f2937 !important;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42) !important;
}

.dark-mode .document-paper .document-number span {
  background: #e8eef6;
  color: #334155;
}

.dark-mode .document-actions .button,
.dark-mode .document-actions .button:disabled,
.dark-mode .document-actions .button[disabled] {
  background: #fff !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
  opacity: 1 !important;
}

.dark-mode .document-actions .button.primary {
  background: #2563eb !important;
  border-color: #1d4ed8 !important;
  color: #fff !important;
}

.dark-mode .dashboard-action-section {
  background: rgba(15, 23, 42, 0.94) !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #f8fafc;
}

.dark-mode .dashboard-action-heading h2,
.dark-mode .dashboard-action-card strong {
  color: #f8fafc !important;
}

.dark-mode .dashboard-action-heading p:not(.eyebrow),
.dark-mode .dashboard-action-card small {
  color: #cbd5e1 !important;
}

.dark-mode .dashboard-action-card {
  background: rgba(30, 41, 59, 0.92) !important;
  border-color: rgba(148, 163, 184, 0.24) !important;
  color: #f8fafc !important;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28) !important;
}

.dark-mode .dashboard-action-card:hover,
.dark-mode .dashboard-action-card:focus-visible {
  background: rgba(37, 99, 235, 0.18) !important;
  border-color: rgba(96, 165, 250, 0.58) !important;
}

.dark-mode .dashboard-action-count {
  background: rgba(96, 165, 250, 0.2) !important;
  color: #bfdbfe !important;
}

.dark-mode .dashboard-action-card em {
  color: #93c5fd !important;
}

.dark-mode .job-field-actions {
  background: rgba(15, 23, 42, 0.94) !important;
  border-color: rgba(148, 163, 184, 0.22) !important;
}

.dark-mode .job-field-actions .button {
  background: rgba(30, 41, 59, 0.92) !important;
  border-color: rgba(148, 163, 184, 0.26) !important;
  color: #e2e8f0 !important;
}

.dark-mode .job-field-actions .button:hover,
.dark-mode .job-field-actions .button:focus-visible {
  background: rgba(37, 99, 235, 0.24) !important;
  border-color: rgba(96, 165, 250, 0.56) !important;
  color: #fff !important;
}

/* Jobsite photo controls and cards need their own opaque dark surfaces. Their
   light defaults otherwise become pale tiles with nearly white copy. */
.dark-mode .photo-phase-chip {
  border-color: rgba(148, 163, 184, 0.28);
  background: rgba(30, 41, 59, 0.92);
  color: #e2e8f0;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.dark-mode .photo-phase-chip span {
  background: rgba(148, 163, 184, 0.18);
  color: #cbd5e1;
}

.dark-mode .photo-phase-chip:hover,
.dark-mode .photo-phase-chip:focus-visible,
.dark-mode .photo-phase-chip.is-active {
  border-color: #60a5fa;
  background: #2563eb;
  color: #fff;
}

.dark-mode .photo-tile {
  border-color: rgba(148, 163, 184, 0.24);
  background: rgba(15, 23, 42, 0.96);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 8px 18px rgba(0, 0, 0, 0.28);
}

.dark-mode .photo-tile-meta {
  background: rgba(15, 23, 42, 0.98);
}

.dark-mode .photo-tile-meta strong {
  color: #f1f5f9;
}

.dark-mode .photo-tile-meta > span,
.dark-mode .photo-day-count {
  color: #aebed2;
}

.dark-mode .photo-phase-badge,
.dark-mode .photo-tile-pin,
.dark-mode .photo-tile-flag {
  background: rgba(148, 163, 184, 0.18);
  color: #dbe7f5;
}

.dark-mode .photo-phase-badge.is-before {
  background: rgba(96, 165, 250, 0.18);
  color: #bfdbfe;
}

.dark-mode .photo-phase-badge.is-progress {
  background: rgba(59, 130, 246, 0.22);
  color: #dbeafe;
}

.dark-mode .photo-phase-badge.is-after,
.dark-mode .photo-phase-badge.is-completion {
  background: rgba(52, 211, 153, 0.18);
  color: #a7f3d0;
}

.dark-mode .photo-phase-badge.is-issue {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
}

.dark-mode .photo-phase-badge.is-materials {
  background: rgba(251, 191, 36, 0.18);
  color: #fde68a;
}

.dark-mode .photo-phase-badge.is-safety {
  background: rgba(45, 212, 191, 0.18);
  color: #99f6e4;
}

.dark-mode .photo-day-head {
  border-color: rgba(148, 163, 184, 0.2);
}

@media (pointer: coarse) {
  .portal-nav a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
  }
}

/* Address-first building-code research keeps the structured research payload
   behind the service boundary and gives contractors a readable review. */
.project-code-basis {
  display: block;
}

.project-code-basis-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  cursor: pointer;
  list-style: none;
}

.project-code-basis-summary::-webkit-details-marker {
  display: none;
}

.project-code-basis-summary::after {
  content: "▾";
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 1rem;
  transition: transform .18s ease;
}

.project-code-basis:not([open]) .project-code-basis-summary::after {
  transform: rotate(-90deg);
}

.project-code-basis-heading {
  display: grid;
  min-width: 0;
  gap: .2rem;
}

.project-code-basis-title {
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 800;
}

.project-code-basis-message {
  color: var(--muted);
  line-height: 1.45;
}

.project-code-basis-content {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.project-code-basis-content > .callout,
.project-code-basis .code-research-results {
  margin: 0;
}

.project-code-basis .callout {
  padding: .85rem 1rem;
  border: 1px solid color-mix(in srgb, var(--blue) 34%, var(--line));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--blue) 7%, var(--surface));
}

.project-code-basis .callout.warning {
  border-color: color-mix(in srgb, var(--gold) 48%, var(--line));
  background: color-mix(in srgb, var(--gold) 10%, var(--surface));
}

.project-code-research-form {
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 94%, var(--red) 6%);
}

.project-code-research-form .form-actions {
  align-items: center;
}

.code-research-task-status {
  margin: 0;
  padding: .7rem .8rem;
  border: 1px solid color-mix(in srgb, var(--blue) 35%, var(--line));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--blue) 8%, var(--surface));
  color: var(--ink);
}

.code-research-task-status[data-variant="success"] {
  border-color: color-mix(in srgb, var(--green) 45%, var(--line));
  background: color-mix(in srgb, var(--green) 9%, var(--surface));
}

.code-research-task-status[data-variant="warning"] {
  border-color: color-mix(in srgb, var(--gold) 48%, var(--line));
  background: color-mix(in srgb, var(--gold) 10%, var(--surface));
}

.code-research-task-status[data-variant="danger"] {
  border-color: color-mix(in srgb, var(--danger) 48%, var(--line));
  background: color-mix(in srgb, var(--danger) 9%, var(--surface));
}

.code-research-results {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  border: 1px solid color-mix(in srgb, var(--red) 36%, var(--line));
  border-radius: var(--radius-md);
  background: var(--surface);
}

.code-research-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.code-research-columns > div,
.code-research-sources {
  min-width: 0;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 96%, var(--muted) 4%);
}

.site-screening-results {
  display: grid;
  gap: .75rem;
}

.site-screening-heading h5,
.site-screening-heading p {
  margin: 0;
}

.site-screening-heading p {
  margin-top: .25rem;
}

.site-screening-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.site-screening-card {
  display: grid;
  min-width: 0;
  gap: .55rem;
  padding: .9rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--surface) 96%, var(--muted) 4%);
}

.site-screening-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .65rem;
}

.site-screening-result,
.site-screening-card small {
  margin: 0;
}

.site-screening-card small {
  display: block;
  line-height: 1.45;
}

.code-research-columns h5,
.code-research-sources h5 {
  margin: 0 0 .65rem;
}

.code-basis-list {
  display: grid;
  gap: .65rem;
  margin: 0;
}

.code-basis-list > div {
  display: grid;
  grid-template-columns: minmax(8rem, .45fr) minmax(0, 1fr);
  gap: .75rem;
  padding-bottom: .65rem;
  border-bottom: 1px solid var(--line);
}

.code-basis-list > div:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.code-basis-list dt {
  color: var(--muted);
  font-weight: 700;
}

.code-basis-list dd {
  margin: 0;
}

.code-research-sources ul,
.project-code-basis .callout ul {
  display: grid;
  gap: .55rem;
  margin: .5rem 0 0;
  padding-left: 1.25rem;
}

.code-research-sources li small {
  display: block;
  margin-top: .2rem;
}

.conceptual-code-basis {
  padding: .85rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.conceptual-code-basis > summary {
  cursor: pointer;
  font-weight: 700;
}

.dark-mode .project-code-research-form,
.dark-mode .code-research-results,
.dark-mode .code-research-columns > div,
.dark-mode .site-screening-card,
.dark-mode .code-research-sources,
.dark-mode .conceptual-code-basis {
  background: rgba(15, 23, 42, .84);
  border-color: rgba(148, 163, 184, .24);
}

@media (max-width: 760px) {
  .project-code-basis-summary {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .project-code-basis-heading {
    flex: 1 1 calc(100% - 2rem);
  }

  .project-code-basis-summary .status-pill {
    order: 3;
  }

  .code-research-columns {
    grid-template-columns: 1fr;
  }

  .site-screening-grid {
    grid-template-columns: 1fr;
  }

  .site-screening-card-head {
    align-items: stretch;
    flex-direction: column;
  }

  .code-basis-list > div {
    grid-template-columns: 1fr;
    gap: .2rem;
  }

  .project-code-research-form .form-actions,
  .project-code-research-form .button,
  .code-research-results > .form-actions,
  .code-research-results > .form-actions .button {
    width: 100%;
  }
}
.procurement-plan-panel {
  display: grid;
  gap: 16px;
}

.procurement-plan-actions {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.procurement-plan-actions > .muted,
.procurement-plan-actions > .notice {
  flex: 1 1 280px;
  margin: 0;
}

.procurement-estimate-picker {
  min-width: 210px;
}

.procurement-group-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
  gap: 12px;
}

.procurement-group-card {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  background: var(--panel-muted-bg, rgba(255, 255, 255, .02));
}

.procurement-group-card h3,
.procurement-group-card p {
  margin: 6px 0 0;
}

.procurement-group-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.procurement-group-card dl > div {
  padding: 8px;
  border-radius: 8px;
  background: rgba(127, 127, 127, .08);
}

.procurement-group-card dt {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.procurement-group-card dd {
  margin: 3px 0 0;
  font-weight: 700;
}

.procurement-group-card details ul {
  max-height: 220px;
  overflow: auto;
  margin-bottom: 0;
}

.material-shopping-source-groups {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
}

.material-shopping-source-groups > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.material-shopping-source-groups .button small {
  display: block;
  margin-top: 2px;
  opacity: .72;
}

@media (max-width: 700px) {
  .procurement-plan-actions,
  .procurement-plan-actions > *,
  .procurement-estimate-picker {
    width: 100%;
  }

  .procurement-group-card {
    padding: 13px;
  }
}

/* ------------------------------------------------------------------ */
/* Capacity view                                                       */
/* The second-crew cockpit: backlog, cash forward, margin by crew, and */
/* the five gates that decide whether a hire survives its first year.  */
/* ------------------------------------------------------------------ */

.status-pill[data-tone="danger"] {
  border-color: rgba(180, 35, 24, 0.28);
  background: var(--danger-soft);
  color: var(--danger);
}

.capacity-verdict {
  border-left: 4px solid var(--muted);
}

.capacity-verdict.is-go { border-left-color: var(--green); }
.capacity-verdict.is-close { border-left-color: var(--gold); }
.capacity-verdict.is-stop { border-left-color: var(--danger); }

.capacity-gates {
  display: grid;
  gap: 10px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.capacity-gate {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  border-radius: var(--radius-md);
  background: var(--surface);
  padding: 11px 13px;
}

.capacity-gate-mark {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
}

.capacity-gate.is-pass .capacity-gate-mark { background: var(--green); }
.capacity-gate.is-warn .capacity-gate-mark { background: var(--gold); }
.capacity-gate.is-fail .capacity-gate-mark { background: var(--danger); }

.capacity-gate strong {
  display: block;
  color: var(--ink);
  font-size: 0.94rem;
}

.capacity-gate p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.5;
}

.capacity-breaks {
  margin: 14px 0 0;
  border-left: 3px solid var(--blue);
  padding: 2px 0 2px 14px;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.55;
}

.capacity-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.55;
}

.capacity-row-negative td {
  background: var(--danger-soft);
}

.capacity-row-negative td strong {
  color: var(--danger);
}

/* ------------------------------------------------------------------ */
/* Handoff packet                                                      */
/* Read on a phone in a driveway more often than at a desk: one tap    */
/* per item, targets big enough for a work glove.                      */
/* ------------------------------------------------------------------ */

.packet-section {
  margin-top: 18px;
}

.packet-section h3 {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.packet-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.packet-item {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--paper);
  padding: 11px 13px;
}

.packet-item.is-done {
  border-left-color: var(--green);
  background: var(--surface);
}

.packet-item.is-na {
  border-left-color: var(--muted);
  opacity: 0.62;
}

.packet-item.is-open {
  border-left-color: var(--gold);
}

.packet-item-body {
  flex: 1 1 260px;
  min-width: 0;
}

.packet-item-body strong {
  display: block;
  color: var(--ink);
  font-size: 0.96rem;
}

.packet-item.is-done .packet-item-body strong,
.packet-item.is-na .packet-item-body strong {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.packet-item-body p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.5;
}

.packet-item-body small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.76rem;
}

.packet-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.packet-item-actions .button {
  min-height: 38px;
}

.packet-add {
  margin-top: 18px;
}

.packet-add summary {
  color: var(--blue);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 700;
}

@media (max-width: 620px) {
  .packet-item-actions {
    width: 100%;
  }

  .packet-item-actions .button {
    flex: 1 1 auto;
  }
}
