:root {
  --ink: #182634;
  --muted: #5b6b7a;
  --line: #d7dfe6;
  --surface: #ffffff;
  --surface-2: #eef3f6;
  --teal: #0b5563;
  --teal-2: #0f7a80;
  --blue: #21507a;
  --green: #1e7a52;
  --amber: #92620a;
  --red: #a93434;
  --red-bg: #fff1f2;
  --amber-bg: #fff8e8;
  --shadow: 0 16px 40px rgba(11, 30, 40, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--surface-2);
  scroll-padding-top: calc(64px + env(safe-area-inset-top));
  scroll-padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

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

a {
  color: inherit;
  text-decoration: none;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.entry-screen,
.client-app {
  min-height: 100vh;
  background: var(--surface-2);
}

@supports (min-height: 100dvh) {
  .entry-screen,
  .client-app,
  .auth-screen { min-height: 100dvh; }
}

.client-app { scroll-padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

@supports (min-height: 100dvh) {
  .entry-screen,
  .client-app,
  .auth-screen { min-height: 100dvh; }
}

.entry-band {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  display: grid;
  align-items: center;
  padding: 32px;
  background: transparent;
}

.insurer-backdrop {
  position: absolute;
  z-index: -2;
  inset: 0;
  overflow: hidden;
  background: #0b0e13;
}

.insurance-photo-image {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: auto;
}

.insurance-photo-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background-color: #0b0e13;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  image-rendering: auto;
}

.insurance-photo-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg, rgba(5, 8, 12, 0.48), rgba(5, 8, 12, 0.12) 52%, rgba(5, 8, 12, 0.24)),
    linear-gradient(180deg, rgba(5, 8, 12, 0.04), rgba(5, 8, 12, 0.2));
}

.insurance-photo-caption {
  position: absolute;
  top: 50%;
  left: clamp(22px, 8vw, 128px);
  display: flex;
  width: min(360px, 68vw);
  flex-direction: column;
  gap: 8px;
  color: #fff;
  z-index: 2;
  transform: translateY(-50%);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.5);
}

.entry-band .insurance-photo-caption {
  display: none;
}

.insurance-photo-caption span {
  color: #fff;
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.insurance-photo-caption strong {
  font-size: clamp(1.3rem, 2.8vw, 2.7rem);
  line-height: 1.05;
}

.insurance-photo-caption small {
  color: rgba(255, 255, 255, 0.82);
  font-size: clamp(0.82rem, 1.2vw, 1rem);
}

@media (prefers-reduced-motion: reduce) {
  .insurance-photo-stage { animation-duration: 0.01ms; }
}

@media (max-width: 650px) {
  .insurance-photo-caption { left: 22px; width: 52vw; }
}

.entry-content {
  width: min(860px, 100%);
  color: #fff;
}

.entry-content h1 {
  margin: 0;
  font-size: clamp(2.1rem, 5vw, 4.8rem);
  line-height: 1.02;
}

.entry-copy {
  max-width: 760px;
  margin: 28px 0;
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.12rem;
  line-height: 1.7;
}

.entry-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.entry-toolbar {
  min-height: 48px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  margin: 12px 0 0;
}

.client-install-row {
  min-height: 44px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.connection-status {
  display: flex;
  flex-wrap: wrap;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin: 10px 0 14px;
  padding: 9px 12px;
  border: 1px solid rgba(55, 126, 87, 0.24);
  border-radius: 8px;
  background: rgba(241, 251, 245, 0.92);
  color: #28643e;
  font-size: 0.82rem;
  line-height: 1.35;
}

.connection-status.offline {
  border-color: rgba(167, 71, 71, 0.3);
  background: rgba(255, 245, 244, 0.95);
  color: #8d3030;
}

.connection-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #3d9a5f;
}

.connection-status.offline .connection-dot {
  background: #c74b4b;
}

.connection-retry {
  min-height: 38px;
  margin-left: auto;
  padding: 7px 11px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  font-size: 0.82rem;
  font-weight: 750;
}

.connection-retry:disabled { opacity: 0.65; }

.connection-retry {
  min-height: 38px;
  margin-left: auto;
  padding: 7px 11px;
  border: 1px solid currentColor;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
  font-size: 0.82rem;
  font-weight: 750;
}

.connection-retry:disabled { opacity: 0.65; }

.saved-draft {
  margin-top: 18px;
  padding: 12px 14px;
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #edf7f1;
  color: #215b3d;
}

.saved-draft[hidden] { display: none; }

.access-band {
  align-items: end;
  background: transparent;
}

.access-band .entry-content { color: #fff; }
.access-band .entry-content .eyebrow { color: rgba(255, 255, 255, 0.88); }
.access-band .entry-copy { color: rgba(255, 255, 255, 0.9); }
.access-band .access-content { margin-bottom: clamp(20px, 5vh, 48px); }

@media (max-width: 650px) {
  .access-band .access-content { margin-bottom: 16px; }
}

.access-content {
  width: min(920px, 100%);
}

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

.access-card {
  min-height: 160px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  color: var(--ink);
  padding: 18px;
  box-shadow: 0 18px 42px rgba(11, 30, 40, 0.16);
}

.access-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.08rem;
}

.access-card small {
  color: var(--muted);
  line-height: 1.45;
}

.broker-access-card {
  background: rgba(238, 243, 246, 0.96);
}

.client-chat-band {
  position: relative;
  isolation: isolate;
  overflow: clip;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background: transparent;
}

.client-chat-band > .insurer-backdrop { z-index: -2; }
.client-shell { position: relative; z-index: 1; }
.client-shell .assistant-panel,
.client-shell .workflow-panel {
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
}

.client-shell {
  display: grid;
  grid-template-columns: minmax(280px, 0.84fr) minmax(320px, 1.16fr);
  gap: 18px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.assistant-panel,
.workflow-panel,
.auth-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.assistant-panel {
  min-height: calc(100vh - 36px);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background:
    linear-gradient(180deg, rgba(11, 85, 99, 0.07), rgba(255, 255, 255, 0)),
    #fff;
}

.workflow-panel {
  min-height: calc(100vh - 36px);
  padding: 22px;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
}

.icon {
  width: 1.3em;
  height: 1.3em;
  flex: 0 0 auto;
}

.brand-mark .icon { width: 24px; height: 24px; }
.tile-icon .icon { width: 22px; height: 22px; }

.eyebrow,
.panel-kicker {
  margin: 0 0 4px;
  color: var(--teal-2);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.entry-content .eyebrow {
  color: rgba(255, 255, 255, 0.86);
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 1.34rem;
}

h2 {
  margin: 0;
  font-size: 1.36rem;
}

h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  max-width: 100%;
  padding: 13px 14px;
  border-radius: 8px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.message.ai {
  background: #e6f1f3;
  color: #0e3a42;
}

.message.client {
  align-self: flex-end;
  background: #eaf2f8;
  color: #1f3d58;
}

.message.system {
  background: #f2f2f2;
  color: var(--muted);
}

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

.action-tile,
.choice-button {
  min-height: 104px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 16px;
  text-align: left;
  transition:
    border-color 160ms ease,
    transform 160ms ease,
    box-shadow 160ms ease;
}

.action-tile:hover,
.choice-button:hover {
  border-color: var(--teal-2);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(11, 85, 99, 0.14);
}

.action-tile strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1rem;
}

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

.tile-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  background: #e6f1f3;
  color: var(--teal);
}

.panel-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.back-button,
.text-button,
.ghost-button {
  border: 0;
  background: transparent;
  color: var(--teal-2);
  font-weight: 800;
}

.back-button {
  padding: 8px 0;
}

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

.choice-button {
  min-height: 64px;
  align-items: center;
  font-weight: 800;
}

.choice-button.selected {
  border-color: var(--teal);
  background: #e6f1f3;
}

.progress-track {
  height: 9px;
  width: 100%;
  margin-bottom: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress-track span {
  display: block;
  height: 100%;
  background: var(--green);
  transition: width 180ms ease;
}

.question-count,
.help-text,
.panel-copy,
.empty-state,
.source-text {
  color: var(--muted);
  line-height: 1.55;
}

.question-label {
  display: block;
  margin: 20px 0 8px;
  font-size: 1.1rem;
  font-weight: 850;
}

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

.question-field {
  min-width: 0;
}

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

.question-grid .question-label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 7px;
  font-size: 1rem;
}

.field-meta {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
}

.other-company-field {
  margin-top: 10px;
}

.question-field .help-text {
  margin: 0 0 7px;
}

.text-field {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  outline: none;
  scroll-margin-top: calc(70px + env(safe-area-inset-top));
  scroll-margin-bottom: 38vh;
}

.client-app .workflow-panel .button-row {
  position: sticky;
  bottom: max(6px, env(safe-area-inset-bottom));
  z-index: 5;
  padding: 9px 0 max(9px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
}

textarea.text-field {
  resize: vertical;
}

@media (max-width: 650px) {
  .question-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

.text-field:focus {
  border-color: var(--teal-2);
  box-shadow: 0 0 0 3px rgba(116, 88, 184, 0.18);
}

.phone-field-group {
  display: grid;
  grid-template-columns: minmax(120px, 42%) 1fr;
  gap: 8px;
}

.country-code-select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--teal-2) 50%),
    linear-gradient(135deg, var(--teal-2) 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
  text-overflow: ellipsis;
}

@media (max-width: 420px) {
  .phone-field-group {
    grid-template-columns: 1fr;
  }
}

/* --- Skip link (WCAG 2.4.1 Bypass Blocks) --- */
.skip-link {
  position: absolute;
  top: -100px;
  left: 12px;
  z-index: 1000;
  padding: 12px 18px;
  border-radius: 0 0 8px 8px;
  background: var(--teal-2);
  color: #fff;
  font-weight: 800;
  text-decoration: none;
  transition: top 0.15s ease-in-out;
}

.skip-link:focus {
  top: 0;
}

/* --- Visible focus for every interactive element --- */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--teal-2);
  outline-offset: 2px;
  border-radius: 4px;
}

/* iOS zooms the page when a focused control is under 16px. Keeping controls at
   16px lets us drop maximum-scale=1 from the viewport without that side effect. */
.text-field,
.country-code-select,
.dashboard-filters input,
.dashboard-filters select {
  font-size: 16px;
}

/* --- Touch targets (WCAG 2.5.8) --- */
.dashboard-action-link,
.task-toggle,
.upload-button,
.password-toggle {
  min-height: 44px;
  min-width: 44px;
}

.dashboard-action-danger {
  color: var(--red);
}

.dashboard-btn-danger {
  border-color: var(--red);
  background: var(--red);
  color: #fff;
}

.dashboard-btn-danger:hover,
.dashboard-btn-danger:focus-visible {
  filter: brightness(0.92);
}

/* --- htmx loading indicators --- */
.htmx-indicator {
  display: none;
  width: 14px;
  height: 14px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}

.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Service worker update prompt --- */
.sw-update-banner {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 900;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
}

.sw-update-banner[hidden] {
  display: none;
}

/* --- Form feedback --- */
.form-error-summary {
  margin: 16px 0;
  padding: 12px 14px;
  border-left: 4px solid var(--red);
  border-radius: 6px;
  background: var(--red-bg);
}

.help-text-warn {
  color: #8a5300;
}

.auth-forgot-link {
  margin-top: 14px;
  text-align: center;
  font-size: 0.95rem;
}

/* --- Broker case detail --- */
.breadcrumb {
  margin: 0 0 12px;
  font-size: 0.95rem;
}

.case-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 20px;
  align-items: start;
}

.case-main,
.case-sidebar {
  display: grid;
  gap: 20px;
  min-width: 0;
}

.case-status-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.case-action-stack {
  display: grid;
  gap: 10px;
}

.case-link {
  font-weight: 800;
}

.attachment-table,
.task-list,
.audit-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.attachment-row,
.task-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.task-row {
  grid-template-columns: auto 1fr;
}

.task-row-done strong {
  text-decoration: line-through;
  opacity: 0.65;
}

.attachment-meta small,
.task-row small {
  display: block;
  color: #5a6b73;
}

.attachment-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--teal-2);
}

.audit-action {
  font-weight: 700;
}

/* Segmented control panels span the full width of the two-column grid. */
.segmented-panel {
  grid-column: 1 / -1;
}

.task-toggle {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--teal-2);
  cursor: pointer;
}

.task-checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid var(--teal-2);
  border-radius: 4px;
}

.audit-list li {
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr auto;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.audit-time,
.audit-actor {
  color: #5a6b73;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pagination-status,
.dashboard-result-count {
  color: #5a6b73;
  font-size: 0.95rem;
}

@media (max-width: 860px) {
  .case-layout {
    grid-template-columns: 1fr;
  }

  .audit-list li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* Honour an OS-level request to reduce motion across the whole UI. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Saved views, bulk actions, assignment --- */
.saved-views {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.saved-view {
  padding: 7px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.saved-view.active {
  border-color: var(--teal-2);
  background: var(--teal-2);
  color: #fff;
}

.bulk-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--teal-2);
  border-radius: 10px;
  background: var(--surface-2);
}

.select-col {
  width: 40px;
  text-align: center;
}

.row-selected {
  background: var(--surface-2);
}

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

/* --- Progress timeline --- */
.progress-timeline {
  display: grid;
  gap: 0;
  margin: 16px 0;
  padding: 0;
  list-style: none;
}

.progress-step {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  padding-bottom: 18px;
  position: relative;
}

.progress-step:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 26px;
  bottom: 0;
  width: 2px;
  background: var(--line);
}

.progress-step-done:not(:last-child)::before {
  background: var(--teal-2);
}

.progress-marker {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--teal-2);
}

.progress-step-done .progress-marker {
  border-color: var(--teal-2);
  background: var(--teal-2);
  color: #fff;
}

.progress-step-current .progress-marker {
  border-color: var(--teal-2);
  box-shadow: 0 0 0 4px var(--surface-2);
}

.progress-step small {
  display: block;
  color: var(--muted);
}

.client-case-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.client-case-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.client-case-row small {
  display: block;
  color: var(--muted);
}

.session-list {
  display: grid;
  gap: 10px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.session-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.session-row small {
  display: block;
  color: var(--muted);
}

.date-fallback {
  margin-top: 10px;
}

.date-fallback summary {
  cursor: pointer;
  color: var(--teal-2);
  font-size: 0.95rem;
}

.date-parts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.mfa-qr {
  display: grid;
  place-items: center;
  margin: 18px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.mfa-qr svg {
  width: 200px;
  height: 200px;
}

.mfa-manual summary {
  cursor: pointer;
  color: var(--teal-2);
  font-size: 0.95rem;
}

.mfa-secret {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  font-family: ui-monospace, monospace;
  letter-spacing: 0.08em;
  word-break: break-all;
}

.recovery-codes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  list-style: none;
}

.recovery-codes code {
  font-family: ui-monospace, monospace;
  font-size: 1.02rem;
  letter-spacing: 0.06em;
}

.password-field-wrap {
  position: relative;
}

.password-field {
  padding-right: 54px;
}

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--teal-2);
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  background: #e6f1f3;
  outline: none;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 4px;
}

.segmented > button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-weight: 850;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.segmented > button:hover {
  border-color: var(--teal-2);
}

.segmented > .active {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  box-shadow: 0 10px 22px rgba(11, 85, 99, 0.24);
}

.primary-button,
.secondary-button,
.danger-button,
.upload-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 850;
  transition: transform 150ms ease, box-shadow 150ms ease, opacity 150ms ease;
}

.primary-button {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 10px 24px rgba(11, 85, 99, 0.28);
}

.primary-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(11, 85, 99, 0.34);
}

.primary-button:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 6px 14px rgba(11, 85, 99, 0.22);
}

.primary-button:disabled {
  box-shadow: none;
  cursor: not-allowed;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}

.secondary-local-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 18px;
  background: #fff;
  color: var(--teal);
  font-weight: 850;
}

.danger-button {
  background: var(--red);
  color: #fff;
}

.full-width {
  width: 100%;
}

.upload-box {
  margin: 16px 0;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: var(--surface-2);
}

.upload-button {
  width: 100%;
  background: #e6f1f3;
  color: var(--teal);
}

.upload-progress {
  margin-top: 14px;
}

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

.attachment-list,
.mini-form,
.summary-block {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.quote-selection {
  display: grid;
  gap: 4px;
}

.attachment-row,
.summary-row,
.answer-box,
.warning-box,
.emergency-box {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.attachment-row {
  align-items: center;
}

.attachment-row span {
  flex: 1;
  overflow-wrap: anywhere;
}

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

.summary-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-row {
  justify-content: space-between;
  padding: 0;
  border: 0;
}

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

.summary-row strong {
  max-width: 58%;
  text-align: right;
}

.warning-box {
  margin: 14px 0;
  border-color: #f1d19a;
  background: var(--amber-bg);
  color: #4b3108;
}

.emergency-box {
  border-color: #f2b8b5;
  background: var(--red-bg);
}

.emergency-contact-link {
  color: var(--teal-2);
  font-weight: 850;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.emergency-selected-contact {
  display: grid;
  gap: 4px;
  margin: 4px 0 14px;
  padding: 12px;
  border: 1px solid #f0b7b7;
  border-radius: 8px;
  background: #fff7f7;
}

.emergency-selected-contact p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.location-picker {
  display: grid;
  gap: 10px;
  margin: 18px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--surface-2);
}

.location-picker-heading {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  color: var(--teal);
}

.location-picker-heading strong {
  display: block;
  color: var(--ink);
}

.location-picker-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.location-picker .secondary-button {
  width: 100%;
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.location-link {
  color: var(--teal-2);
  font-size: 0.9rem;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
  overflow-wrap: anywhere;
}

.answer-box {
  margin-top: 16px;
  background: var(--surface-2);
}

.error-text {
  color: var(--red);
  font-weight: 750;
}

.plain-list {
  margin: 16px 0;
  padding-left: 22px;
  line-height: 1.65;
}

.secondary-actions {
  width: min(1180px, 100%);
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin: 0 auto 28px;
  padding: 0 18px;
}

.confirmation-panel {
  display: grid;
  gap: 10px;
  place-items: start;
}

.dashboard-shell,
.auth-screen {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.auth-screen {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 100vh;
  display: grid;
  place-items: end center;
  padding: max(32px, env(safe-area-inset-top)) max(32px, env(safe-area-inset-right)) max(32px, env(safe-area-inset-bottom)) max(32px, env(safe-area-inset-left));
  background: transparent;
}

.auth-screen .auth-box {
  position: relative;
  z-index: 1;
  margin-bottom: clamp(20px, 5vh, 48px);
}

.auth-box {
  width: min(440px, 100%);
  max-height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom) - 20px);
  overflow-y: auto;
  padding: 26px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 24px 60px rgba(31, 20, 52, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

.auth-box .brand-row {
  margin-bottom: 6px;
}

.auth-box .button-row {
  margin-top: 24px;
}

.auth-box form .button-row {
  position: sticky;
  bottom: max(4px, env(safe-area-inset-bottom));
  z-index: 2;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
}

.auth-box .segmented {
  margin-top: 18px;
}

.auth-return-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--teal-2);
  font-weight: 850;
}

.auth-signup-link {
  margin: 20px 0 0;
  color: var(--muted);
  text-align: center;
}

.auth-signup-link a {
  color: var(--teal-2);
  font-weight: 850;
}

.google-login-button {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
  border: 1px solid #c9c2d9;
  border-radius: 10px;
  padding: 12px 18px;
  background: #fff;
  color: #2d243c;
  font-weight: 850;
  transition: border-color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.google-login-button:disabled {
  cursor: not-allowed;
  opacity: 0.7;
}

.google-login-button:hover:not(:disabled),
.google-login-button:focus-visible:not(:disabled) {
  border-color: var(--teal-2);
  outline: none;
  box-shadow: 0 8px 20px rgba(116, 88, 184, 0.18);
  transform: translateY(-1px);
}

.google-login-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
  text-align: center;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 22px 0 16px;
  color: var(--muted);
  font-size: 0.82rem;
}

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

@media (max-width: 980px) {
  .client-shell {
    grid-template-columns: 1fr;
  }

  .assistant-panel,
  .workflow-panel {
    min-height: auto;
  }
}

@media (max-width: 640px) {
  .entry-band,
  .dashboard-shell,
  .auth-screen {
    padding: max(14px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  }

  .client-chat-band {
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }

  .assistant-panel,
  .workflow-panel,
  .auth-box {
    padding: 16px;
    box-shadow: none;
  }

  .auth-screen .auth-box { margin-bottom: 16px; }

  .action-grid,
  .access-grid,
  .choice-list {
    grid-template-columns: 1fr;
  }

  .action-tile {
    min-height: 88px;
  }

  .summary-row {
    display: grid;
  }

  .summary-row strong {
    max-width: none;
    text-align: left;
  }
}

/* --- Translucent Django message toasts --- */
.toast-stack {
  position: fixed;
  z-index: 100;
  top: 66px;
  right: 18px;
  display: grid;
  width: min(420px, calc(100vw - 36px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  gap: 12px;
  align-items: start;
  padding: 12px 12px 12px 15px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  border-left: 4px solid var(--teal-2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 12px 32px rgba(11, 30, 40, 0.17);
  color: var(--ink);
  font-size: 0.9rem;
  line-height: 1.45;
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  pointer-events: auto;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast-message { min-width: 0; overflow-wrap: anywhere; }

.toast-dismiss {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
}

.toast-dismiss:hover,
.toast-dismiss:focus-visible {
  background: rgba(24, 38, 52, 0.08);
  color: var(--ink);
}

.toast-dismiss .icon { width: 16px; height: 16px; }
.toast-dismissed { opacity: 0; transform: translateY(-6px); }
.flash-success { border-left-color: var(--green); }
.flash-error { border-left-color: var(--red); }
.flash-warning { border-left-color: #c18a16; }
.flash-info { border-left-color: var(--blue); }

@media (max-width: 520px) {
  .toast-stack { top: 60px; right: 10px; width: calc(100vw - 20px); }
}

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}

[x-cloak] {
  display: none !important;
}

.client-consent {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 22px;
  padding: 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.consent-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.92rem;
  line-height: 1.5;
}

.consent-box input[type="checkbox"] {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--teal);
}

.client-consent small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.disabled-overlay {
  opacity: 0.5;
  pointer-events: none;
  filter: grayscale(0.3);
}

.landing-section {
  padding: clamp(48px, 8vh, 96px) 32px;
  background: var(--surface);
}

.landing-section-alt {
  background: var(--surface-2);
}

.landing-container {
  width: min(1080px, 100%);
  margin: 0 auto;
}

.section-eyebrow {
  margin: 0 0 6px;
  color: var(--teal-2);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.section-title {
  margin: 0 0 12px;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  line-height: 1.15;
}

.section-lede {
  max-width: 640px;
  margin: 0 0 32px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.how-it-works-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}

.how-column-label {
  margin: 0 0 16px;
  color: var(--teal);
  font-weight: 850;
  font-size: 1.05rem;
}

.how-steps {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.how-steps li {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.how-steps strong {
  display: block;
  margin-bottom: 4px;
}

.how-steps small {
  color: var(--muted);
  line-height: 1.5;
}

.how-step-num {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-weight: 850;
  font-size: 0.9rem;
}

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

.feature-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.feature-card strong {
  font-size: 1.05rem;
}

.feature-card small {
  color: var(--muted);
  line-height: 1.5;
}

.cta-band {
  background: linear-gradient(135deg, var(--teal), var(--teal-2));
  color: #fff;
  text-align: center;
}

.cta-band-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cta-title {
  color: #fff;
}

.cta-lede {
  color: rgba(255, 255, 255, 0.88);
  margin-left: auto;
  margin-right: auto;
}

.cta-actions {
  justify-content: center;
}

.cta-band .secondary-local-button {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}

.cta-band .secondary-local-button:hover {
  background: rgba(255, 255, 255, 0.22);
}

@media (max-width: 800px) {
  .how-it-works-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

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

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 14px;
  padding: 18px 16px;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.site-footer a {
  color: var(--muted);
  text-decoration: underline;
}

.cookie-consent-banner {
  position: fixed;
  left: max(16px, env(safe-area-inset-left));
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 60;
  max-width: 640px;
  margin: 0 auto;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.cookie-consent-banner .button-row {
  margin-top: 10px;
  justify-content: flex-end;
}

/* Site header + mobile nav */
.site-header {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: calc(12px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.site-header-home {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  background: transparent;
  border-bottom-color: transparent;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.site-header-home .site-header-logo,
.site-header-home .site-header-nav a,
.site-header-home .site-header-menu-toggle {
  color: #fff;
  transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.site-header-home .site-header-logo .icon {
  color: #fff;
}

.site-header-home .site-header-menu-toggle {
  border-color: rgba(255, 255, 255, 0.6);
  background: transparent;
}

.site-header-home.site-header-scrolled {
  background: var(--surface);
  border-bottom-color: var(--line);
  box-shadow: 0 8px 22px rgba(11, 30, 40, 0.12);
}

.site-header-home.site-header-scrolled .site-header-logo,
.site-header-home.site-header-scrolled .site-header-nav a,
.site-header-home.site-header-scrolled .site-header-menu-toggle {
  color: var(--ink);
}

.site-header-home.site-header-scrolled .site-header-logo .icon {
  color: var(--teal);
}

.site-header-home.site-header-scrolled .site-header-menu-toggle {
  border-color: var(--line);
  background: var(--surface);
}

.site-header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-weight: 850;
  font-size: 1.05rem;
}

.site-header-logo .icon {
  width: 26px;
  height: 26px;
  color: var(--teal);
}

.site-header-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.site-header-nav a {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.92rem;
}

.site-header-nav .site-header-app-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.site-header-app-link .icon {
  width: 18px;
  height: 18px;
}

.site-header-nav a:hover,
.site-header-nav a:focus-visible {
  color: var(--teal);
}

.site-header-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.site-header-mobile-panel {
  position: fixed;
  top: calc(64px + env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  left: auto;
  display: flex;
  width: min(340px, calc(100vw - 40px));
  max-height: calc(100dvh - 82px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 38px rgba(11, 30, 40, 0.2);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
}

.site-header-mobile-panel a {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 6px;
  color: var(--ink);
  font-weight: 700;
}

.site-header-mobile-panel a:hover,
.site-header-mobile-panel a:focus-visible {
  background: #e8f2f3;
  color: var(--teal);
  outline: none;
}

@media (max-width: 780px) {
  .site-header-nav {
    display: none;
  }

  .site-header-menu-toggle {
    display: inline-flex;
  }
}

/* Legal pages (privacy, terms, cookies) */
.legal-shell {
  display: flex;
  justify-content: center;
  width: 100%;
  padding: clamp(24px, 5vw, 56px) 20px 64px;
  background: var(--surface-2);
  min-height: calc(100vh - 64px);
}

.legal-panel {
  width: min(760px, 100%);
  padding: clamp(24px, 4vw, 40px);
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.legal-panel h1 {
  margin: 4px 0 14px;
  font-size: clamp(1.5rem, 3vw, 2rem);
}

.legal-panel h2 {
  margin: 28px 0 8px;
  font-size: 1.15rem;
}

.legal-panel p {
  color: var(--ink);
  line-height: 1.6;
}

.legal-panel .source-text {
  margin-top: 10px;
}

.cookie-table {
  width: 100%;
  margin: 12px 0 8px;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.cookie-table th,
.cookie-table td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.cookie-table th {
  background: var(--surface-2);
  font-weight: 800;
}

.error-panel {
  text-align: center;
}

.error-panel-mark {
  margin: 0 auto 18px;
}

.error-panel-actions {
  justify-content: center;
}


/* --- Broker dashboard --- */
.dashboard-shell {
  width: min(1180px, 100%);
  margin-inline: auto;
  padding: clamp(20px, 4vw, 40px) 20px 64px;
  display: grid;
  gap: 22px;
}

.dashboard-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-heading h1 {
  margin: 0 0 4px;
  font-size: clamp(1.4rem, 3vw, 1.9rem);
}

.dashboard-subtitle {
  margin: 0;
  color: var(--muted);
}

.dashboard-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
  font-size: 0.92rem;
  border: 1px solid var(--line);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.dashboard-btn .icon {
  width: 1.1em;
  height: 1.1em;
}

.dashboard-btn-primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.dashboard-btn-secondary {
  background: var(--surface);
  color: var(--ink);
}

.dashboard-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}

.dashboard-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.dashboard-card .icon {
  width: 1.6em;
  height: 1.6em;
  color: var(--teal-2);
  flex-shrink: 0;
}

.dashboard-card-urgent {
  border-color: var(--red);
  background: var(--red-bg);
}

.dashboard-card-urgent .icon {
  color: var(--red);
}

.dashboard-card-value {
  display: block;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.1;
}

.dashboard-card-label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
}

.dashboard-panel {
  padding: clamp(16px, 3vw, 24px);
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.dashboard-panel h2 {
  margin: 0 0 14px;
  font-size: 1.1rem;
}

.dashboard-chart {
  display: grid;
  gap: 10px;
}

.dashboard-chart-row {
  display: grid;
  grid-template-columns: 90px 1fr 32px;
  align-items: center;
  gap: 10px;
}

.dashboard-chart-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.dashboard-chart-track {
  height: 12px;
  border-radius: 6px;
  background: var(--surface-2);
  overflow: hidden;
}

.dashboard-chart-bar {
  height: 100%;
  border-radius: 6px;
  background: var(--teal-2);
  transition: width 0.3s ease;
}

.dashboard-chart-bar-urgent {
  background: var(--red);
}

.dashboard-chart-bar-high {
  background: var(--amber);
}

.dashboard-chart-bar-low {
  background: var(--green);
}

.dashboard-chart-value {
  font-weight: 700;
  text-align: right;
}

.dashboard-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.dashboard-filters input[type="search"] {
  flex: 1 1 220px;
}

.dashboard-filters input,
.dashboard-filters select {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 0.92rem;
  background: var(--surface);
  color: var(--ink);
}

.dashboard-table-wrap {
  overflow-x: auto;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.dashboard-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  white-space: nowrap;
}

.dashboard-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.dashboard-actions {
  display: flex;
  gap: 4px;
}

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

.dashboard-action-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--teal-2);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  text-decoration: underline;
}

.dashboard-action-link:hover {
  color: var(--teal);
}

.dashboard-empty {
  color: var(--muted);
  padding: 20px 0;
  text-align: center;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--ink);
  white-space: nowrap;
}

.status-pill-urgent {
  background: var(--red-bg);
  color: var(--red);
}

.status-pill-high {
  background: var(--amber-bg);
  color: var(--amber);
}

.status-pill-low,
.status-pill-completed,
.status-pill-closed {
  background: #eaf6f0;
  color: var(--green);
}

.status-pill-new,
.status-pill-normal {
  background: #e6f1f3;
  color: var(--teal-2);
}

@media (max-width: 700px) {
  .dashboard-chart-row {
    grid-template-columns: 70px 1fr 28px;
  }

  .dashboard-table th:nth-child(3),
  .dashboard-table td:nth-child(3) {
    display: none;
  }
}

/* --- Landing page reviews --- */
.reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.review-card {
  padding: 20px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
}

.review-stars {
  display: flex;
  gap: 2px;
  color: var(--amber);
}

.review-star {
  width: 1.05em;
  height: 1.05em;
  fill: currentColor;
}

.review-quote {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

.review-attribution {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

/* --- Custom system administration --- */
.admin-shell { display: grid; grid-template-columns: 238px minmax(0, 1fr); min-height: calc(100vh - 64px); background: #f4f7f8; }
.admin-sidebar { position: sticky; top: 0; display: flex; height: 100vh; flex-direction: column; padding: 22px 14px 16px; border-right: 1px solid var(--line); background: #fff; }
.admin-sidebar-home { display: flex; align-items: center; gap: 10px; padding: 2px 8px 22px; color: var(--ink); }
.admin-sidebar-home strong, .admin-sidebar-home small { display: block; }
.admin-sidebar-home small { margin-top: 3px; color: var(--muted); font-size: 0.78rem; }
.admin-sidebar-mark { display: grid; width: 36px; height: 36px; flex: 0 0 auto; place-items: center; border-radius: 8px; background: var(--teal); color: #fff; font-size: 1.05rem; font-weight: 850; }
.admin-sidebar-nav { display: grid; gap: 4px; }
.admin-sidebar-nav a { padding: 10px 12px; border-radius: 6px; color: #53636d; font-size: 0.92rem; font-weight: 650; }
.admin-sidebar-nav a:hover, .admin-sidebar-nav a.active { background: #e8f2f3; color: var(--teal); }
.admin-sidebar-footer { display: grid; gap: 8px; margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.84rem; overflow-wrap: anywhere; }
.admin-sidebar-footer a, .admin-inline-link { color: var(--teal-2); font-weight: 750; }
.admin-main { min-width: 0; padding: 30px clamp(18px, 3vw, 42px) 38px; }
.admin-page-heading, .admin-panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.admin-page-heading { margin-bottom: 24px; }
.admin-page-heading h1 { margin: 2px 0 0; font-size: clamp(1.7rem, 3vw, 2.15rem); }
.admin-eyebrow { margin: 0; color: var(--teal-2); font-size: 0.76rem; font-weight: 800; text-transform: uppercase; }
.admin-subtitle, .admin-panel-heading p { margin: 6px 0 0; color: var(--muted); font-size: 0.9rem; }
.admin-heading-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.admin-metric { position: relative; display: grid; min-height: 112px; align-content: space-between; gap: 12px; overflow: hidden; padding: 16px 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); transition: border-color 160ms ease, transform 160ms ease; }
a.admin-metric:hover { transform: translateY(-2px); border-color: #93bfc2; }
.admin-metric-label { color: var(--muted); font-size: 0.85rem; font-weight: 650; }
.admin-metric strong { font-size: 1.8rem; line-height: 1; }
.admin-metric-urgent strong { color: #a93434; }
.admin-metric-warning strong { color: #92620a; }
.admin-metric-mark { position: absolute; right: 18px; bottom: 16px; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.admin-metric-urgent .admin-metric-mark { background: #a93434; }
.admin-metric-warning .admin-metric-mark { background: #d39b27; }
.admin-chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.admin-panel { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.admin-directory-panel { padding-top: 14px; }
.admin-panel h2 { margin: 0; font-size: 1.02rem; }
.admin-bars { display: grid; gap: 13px; margin-top: 22px; }
.admin-bar-row { display: grid; grid-template-columns: minmax(110px, 0.8fr) minmax(70px, 1.8fr) 32px; gap: 10px; align-items: center; color: #53636d; font-size: 0.82rem; }
.admin-bar-track, .admin-volume-track { overflow: hidden; border-radius: 999px; background: #eaf0f2; }
.admin-bar-track { height: 9px; }
.admin-bar-track i { display: block; height: 100%; border-radius: inherit; background: var(--teal-2); }
.admin-bar-row strong { color: var(--ink); text-align: right; }
.admin-volume-chart { display: grid; height: 172px; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; align-items: end; margin-top: 15px; }
.admin-volume-column { display: grid; height: 100%; grid-template-rows: 20px 1fr 18px; gap: 6px; justify-items: center; color: var(--muted); font-size: 0.74rem; }
.admin-volume-column strong { color: var(--ink); font-size: 0.78rem; }
.admin-volume-track { display: flex; width: min(28px, 100%); height: 100%; align-items: flex-end; }
.admin-volume-track i { display: block; width: 100%; min-height: 4px; border-radius: 999px; background: var(--green); }
.admin-recent-panel { margin-top: 14px; }
.admin-table-wrap { width: 100%; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.admin-table th { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 0.77rem; text-align: left; text-transform: uppercase; white-space: nowrap; }
.admin-table td { padding: 12px; border-bottom: 1px solid #edf1f2; color: #34434c; white-space: nowrap; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table td a, .admin-row-actions a, .admin-row-actions button { color: var(--teal-2); font-weight: 750; }
.admin-status, .admin-priority { display: inline-block; padding: 4px 7px; border-radius: 4px; background: #edf2f4; font-size: 0.76rem; }
.admin-priority-urgent, .admin-priority-high { background: #fff0ed; color: #a93434; }
.admin-row-actions { display: flex; gap: 12px; }
.admin-row-actions form { display: inline; }
.admin-row-actions button { padding: 0; border: 0; background: transparent; font: inherit; cursor: pointer; }
.admin-result-count { margin: 14px 0 10px; color: var(--muted); font-size: 0.86rem; }
.admin-filter-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.admin-filter-form input, .admin-filter-form select, .admin-form-field input:not([type="checkbox"]), .admin-form-field select, .admin-form-field textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.admin-filter-form select, .admin-filter-form input { width: auto; min-width: 150px; }
.admin-filter-form .admin-search-field { flex: 1 1 220px; }
.admin-filter-form .admin-search-field input { width: 100%; }
.admin-inline-link { font-size: 0.85rem; }
.admin-pagination { display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.84rem; }
.admin-pagination a { color: var(--teal-2); font-weight: 750; }
.admin-empty { display: grid; gap: 5px; padding: 28px 12px; color: var(--muted); text-align: center; }
.admin-empty strong { color: var(--ink); }
.admin-main-footer { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px; color: var(--muted); font-size: 0.8rem; }
.admin-form-panel, .admin-delete-panel { max-width: 900px; }
.admin-link-issued { max-width: 720px; }
.admin-link-issued > p:not(.admin-eyebrow) { color: var(--muted); line-height: 1.5; }
.admin-link-issued > label { display: block; margin: 18px 0 6px; font-size: 0.86rem; font-weight: 700; }
.admin-form-panel form:first-child { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-form-field { display: grid; min-width: 0; align-content: start; gap: 6px; }
.admin-form-field label { color: #34434c; font-size: 0.87rem; font-weight: 700; }
.admin-form-field small { color: var(--muted); font-size: 0.77rem; }
.admin-form-field textarea { min-height: 96px; resize: vertical; }
.admin-form-checkbox { grid-template-columns: auto 1fr; align-items: center; }
.admin-form-checkbox input { width: 18px; height: 18px; }
.admin-field-error, .admin-form-errors { color: #a93434; font-size: 0.82rem; }
.admin-form-actions { display: flex; flex-wrap: wrap; grid-column: 1 / -1; gap: 9px; padding-top: 8px; border-top: 1px solid var(--line); }
.admin-delete-record { display: flex; justify-content: flex-end; margin-top: 14px; }
.admin-delete-panel h1 { margin-top: 8px; }
.admin-delete-panel form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
@media (max-width: 1000px) { .admin-shell { grid-template-columns: 190px minmax(0, 1fr); } .admin-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .admin-shell { display: block; }
  .admin-sidebar { position: static; width: 100%; height: auto; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-sidebar-home { padding-bottom: 10px; }
  .admin-sidebar-nav { display: flex; gap: 4px; overflow-x: auto; padding-bottom: 2px; }
  .admin-sidebar-nav a { flex: 0 0 auto; padding: 8px 10px; font-size: 0.82rem; }
  .admin-sidebar-footer { display: flex; justify-content: space-between; gap: 10px; padding-top: 8px; margin-top: 8px; }
  .admin-main { padding: 22px 14px 30px; }
  .admin-chart-grid { grid-template-columns: 1fr; }
  .admin-page-heading { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 520px) {
  .admin-metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .admin-metric { min-height: 96px; padding: 12px; }
  .admin-metric strong { font-size: 1.5rem; }
  .admin-panel { padding: 14px 12px; }
  .admin-form-panel form:first-child { grid-template-columns: 1fr; }
  .admin-form-actions { grid-column: 1; }
  .admin-filter-form label, .admin-filter-form select, .admin-filter-form .dashboard-btn { width: 100%; }
}
