:root {
  color-scheme: light;
  --ink: #292d32;
  --muted: #626970;
  --background: #f8f6f5;
  --surface: #fff;
  --surface-muted: #f5f1f0;
  --line: #dcd9d8;
  --brand: #b51f2d;
  --brand-dark: #8d1722;
  --brand-soft: #f8e9eb;
  --radius-sm: .35rem;
  --radius-md: .55rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  background: var(--background);
  color: var(--ink);
}

body { min-width: 320px; }
button, a { font: inherit; }
a { color: var(--brand-dark); }

a:focus-visible, button:focus-visible, [tabindex="-1"]:focus-visible {
  outline: 3px solid #df737d;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: .75rem;
  left: .75rem;
  padding: .65rem .85rem;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  transform: translateY(-160%);
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 1.5rem 1.25rem;
  overflow-y: auto;
  background: #33373b;
  color: #fff;
}

.brand {
  display: flex;
  align-items: center;
  margin-bottom: 2rem;
  padding: .25rem .75rem;
}

.brand img {
  display: block;
  width: min(100%, 12rem);
  height: auto;
}

.navigation-link {
  display: block;
  padding: .7rem .75rem;
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  color: #f3f4f5;
  font-size: .9rem;
  font-weight: 650;
  text-decoration: none;
}

.navigation-link:hover { background: #41464b; }
.navigation-link.active {
  border-left-color: #df737d;
  background: #4a3e41;
}

.navigation-group {
  margin-top: .85rem;
}

nav > .navigation-group:first-child {
  margin-top: 0;
}

.navigation-group + .navigation-link,
.navigation-link + .navigation-group {
  margin-top: .85rem;
}

.navigation-group-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  gap: .45rem;
  padding: .35rem .75rem;
  border: 0;
  background: transparent;
  color: #b7bcc1;
  cursor: pointer;
  font: inherit;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-align: left;
  text-transform: uppercase;
}

.navigation-group-toggle::before {
  content: "▸";
  width: .7rem;
  font-size: .65rem;
  letter-spacing: 0;
}

.navigation-group-toggle[aria-expanded]::before {
  content: "▾";
}

.navigation-group .navigation-link {
  padding-top: .5rem;
  padding-bottom: .5rem;
  padding-left: 1.35rem;
  font-weight: 600;
}

.navigation-link--with-count {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.navigation-count {
  min-width: 1.4rem;
  padding: .1rem .35rem;
  border-radius: 999px;
  background: #f3f4f5;
  color: #292d32;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  text-align: center;
}

.workspace {
  display: flex;
  min-width: 0;
  min-height: 100vh;
  flex-direction: column;
}

.topbar {
  display: flex;
  min-height: 4.25rem;
  align-items: center;
  gap: 1rem;
  padding: .75rem clamp(1.25rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.topbar-logo {
  display: block;
  width: 7.5rem;
  height: auto;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  color: var(--muted);
  font-size: .82rem;
}

.topbar-actions form { margin: 0; }
.environment-label { color: var(--muted); }
.identity-name { color: var(--ink); }

.text-action {
  border: 0;
  padding: 0;
  background: none;
  color: var(--brand-dark);
  font-weight: 650;
  text-decoration: underline;
  cursor: pointer;
}

.navigation-toggle {
  display: none;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.navigation-close {
  display: none;
}

.content {
  width: 100%;
  max-width: 78rem;
  flex: 1;
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem);
}

.page-header {
  margin-bottom: 2.5rem;
}

h1, h2, p { margin-top: 0; }
h1 {
  margin-bottom: .75rem;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  letter-spacing: -.035em;
}

h2 {
  margin-bottom: .6rem;
  font-size: 1.15rem;
}

p {
  max-width: 44rem;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.4;
}

.primary-link, .secondary-link {
  display: inline-block;
  margin-top: .4rem;
  padding: .65rem .9rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
}

.primary-link {
  background: var(--brand);
  color: #fff;
  text-decoration: none;
}

.primary-link:hover { background: var(--brand-dark); }
.secondary-link { padding-left: 0; }

.empty-state, .error-panel {
  max-width: 38rem;
  margin-top: 5vh;
}

.back-link {
  display: inline-block;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: .85rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(16rem, .85fr);
  gap: 2rem;
  align-items: start;
}

.contact-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
}

.contact-header > div { min-width: 0; }
.contact-header h1 { overflow-wrap: anywhere; }
.contact-header p { margin-bottom: 0; }

.contact-header .text-action {
  flex: none;
  margin-bottom: .15rem;
}

.contact-header__actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: none;
}

.contact-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  gap: 2rem 3rem;
  align-items: start;
  margin-bottom: 2rem;
}

.contact-facts > .detail-section {
  min-width: 0;
  margin-bottom: 0;
}

.contact-person + .contact-person,
.contact-property + .contact-property,
.contact-site + .contact-site {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.contact-person h3,
.contact-property h3,
.contact-site h3 {
  margin: 0 0 .2rem;
  font-size: 1rem;
}

.contact-person > p,
.contact-property > p,
.contact-site > p { margin-bottom: .85rem; }

.contact-person > p:last-child,
.contact-property > p:last-child,
.contact-site > p:last-child { margin-bottom: 0; }

a.work-row.contact-journey {
  flex-wrap: wrap;
  align-items: baseline;
  color: inherit;
  text-decoration: none;
}

a.work-row.contact-journey strong {
  color: var(--ink);
  overflow-wrap: anywhere;
}

a.work-row.contact-journey:hover strong,
a.work-row.contact-journey:focus-visible strong { color: var(--brand-dark); }

a.work-row.contact-journey span {
  color: var(--muted);
  font-size: .88rem;
}

a.work-row.contact-journey small { margin-left: auto; }

.document-navigator {
  display: grid;
  grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.document-tree {
  display: flex;
  flex-direction: column;
  padding: .35rem 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.4;
}

.document-tree-row {
  display: block;
  width: 100%;
  margin: 0;
  padding: .4rem 1rem .4rem calc(1rem + var(--depth, 0) * 1.35rem);
  border: 0;
  background: #fff;
  color: inherit;
  font: inherit;
  text-align: left;
}

button.document-tree-row { cursor: pointer; }

.document-tree-row[aria-current="true"] {
  font-weight: 650;
  background: #f1f3f4;
}

.document-files .table-scroll,
.document-files table,
.document-files th {
  background: #fff;
}

.document-files td {
  background: #fff;
}

.document-files tbody tr[role="button"]:hover td {
  background: #f1f3f4;
}

.document-files tbody tr.selected-row td {
  background: #dfe5ea !important;
}

.document-breadcrumb {
  margin: 0 0 1rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .8rem;
  line-height: 1.45;
}

.document-breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.document-breadcrumb li:not(:last-child) { color: var(--muted); }
.document-breadcrumb li:last-child { font-weight: 650; }

.document-breadcrumb li:not(:last-child)::after {
  content: "/";
  margin-left: .35rem;
}

.document-files {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: .75rem;
}

.document-files > .document-breadcrumb { grid-column: 1; grid-row: 1; margin: 0; }
.document-files .document-file-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
}
.document-files .document-file-message { grid-column: 1 / -1; grid-row: 2; margin: .75rem 0 0; }
.document-files .table-scroll { grid-column: 1 / -1; grid-row: 3; margin-top: 1rem; }
.document-files > .text-action { grid-column: 1 / -1; grid-row: 4; justify-self: start; margin-top: .75rem; }

.icon-action {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
}

a.icon-action { text-decoration: none; }
.icon-action:disabled { cursor: not-allowed; opacity: .5; }
.icon-action--danger { color: #9f1724; }

.icon-action svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.document-popover {
  position: fixed;
  width: min(18rem, calc(100vw - 2rem));
  margin: .35rem 0 0;
  padding: 1rem;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  inset: auto;
  position-area: block-end span-inline-start;
  position-try-fallbacks: flip-block, flip-inline;
}

.document-popover form { display: grid; gap: .75rem; }
.document-popover .secondary-action { justify-self: start; }

.document-matches { margin-top: 1rem; }
.document-matches .document-tree-button {
  display: block;
  width: 100%;
  margin: 0;
  padding: .3rem 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.document-matches .document-tree-button[aria-current="true"] { font-weight: 650; }

@media (max-width: 800px) {
  .document-navigator { grid-template-columns: 1fr; }
}

.detail-section {
  margin-bottom: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}

.detail-section--first {
  padding-top: 0;
  border-top: 0;
}

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

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

.details-edit-form {
  display: grid;
  gap: 1rem;
}

.details-edit-form h3 {
  margin: .5rem 0 0;
  font-size: .95rem;
}

.contact-edit-section {
  max-width: 62rem;
}

.lead-header-meta {
  display: grid;
  justify-items: end;
  gap: .35rem;
  text-align: right;
}

.lead-header-meta small {
  color: var(--muted);
}

.lead-workspace-header {
  width: 100%;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.lead-workspace-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 2rem;
}

.lead-stage {
  display: block;
  margin-top: 1.5rem;
  padding: 1.25rem 0;
  border-top: 1px solid var(--line);
}

.lead-stage-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.lead-stage-heading h2 {
  margin: 0;
}

.lead-stage-heading > span {
  color: var(--muted);
  font-size: .85rem;
}

.lead-status-path {
  display: flex;
  width: 100%;
  min-width: 0;
  margin-top: 1rem;
  overflow-x: auto;
  padding: .2rem 0 .45rem;
}

.lead-status-path__step {
  position: relative;
  display: flex;
  min-width: 7.5rem;
  flex: 1 0 7.5rem;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
  font-size: .72rem;
  text-align: center;
}

.lead-status-path__step::after {
  position: absolute;
  top: .8rem;
  left: calc(50% + 1rem);
  z-index: 0;
  width: calc(100% - 2rem);
  height: 2px;
  background: var(--line);
  content: "";
}

.lead-status-path__step:last-child::after {
  display: none;
}

.lead-status-path__marker {
  z-index: 1;
  display: grid;
  width: 1.65rem;
  height: 1.65rem;
  place-items: center;
  border: 2px solid #b9bec3;
  border-radius: 50%;
  background: var(--background);
  color: #7a8188;
  font-size: .75rem;
}

.lead-status-path__label {
  max-width: 7.5rem;
}

.lead-status-path__step--complete {
  color: #237a4b;
}

.lead-status-path__step--complete::after {
  background: #399565;
}

.lead-status-path__step--complete .lead-status-path__marker {
  border-color: #399565;
  background: #e8f5ed;
  color: #237a4b;
}

.lead-status-path__step--current {
  color: var(--ink);
}

.lead-status-path__step--current > .lead-status-path__marker,
.lead-status-path__step--current > .lead-status-path__main > .lead-status-path__marker {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
  box-shadow: 0 0 0 4px #f7dadd;
}

.lead-status-path--detailed .lead-status-path__step {
  min-width: 0;
  flex: 1 1 0;
}

.lead-status-path--detailed .lead-status-path__step::after {
  left: 50%;
  width: 100%;
}

.lead-status-path--detailed .lead-status-path__label {
  max-width: 100%;
  padding-inline: .15rem;
  line-height: 1.15;
}

.lead-status-path--detailed .lead-status-path__step--sub {
  flex: 0.78 1 0;
  color: var(--ink);
  font-size: .66rem;
}

.lead-status-path--detailed .lead-status-path__step--sub .lead-status-path__marker {
  width: .7rem;
  height: .7rem;
  margin-top: .48rem;
  margin-bottom: .47rem;
  border-color: var(--brand);
  background: var(--background);
  box-shadow: none;
}

.lead-status-path--detailed .lead-status-path__step--sub.is-current .lead-status-path__marker {
  background: var(--brand);
}

.lead-stage-meta {
  margin: .65rem 0 0;
}

.lead-stage-summary dl {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  margin: 0;
}

.lead-stage-summary dt,
.lead-loss-action label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.lead-stage-summary dd {
  margin: .2rem 0 0;
  font-size: .88rem;
}

.dashboard-metrics dl {
  display: flex;
  flex-wrap: wrap;
  gap: .9rem 2rem;
  margin: 0;
}

.dashboard-metrics dt {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.dashboard-metrics dd {
  margin: .2rem 0 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.lead-read-only {
  margin: .75rem 0 0;
  color: #7a2028;
  font-weight: 700;
}

.lead-stage-actions {
  display: flex;
  justify-content: flex-end;
}

.lead-status-action {
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) minmax(11rem, auto) auto;
  align-items: end;
  gap: .35rem .5rem;
}

.lead-status-action__field {
  display: grid;
  gap: .35rem;
}

.lead-status-action__field label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.lead-status-action__field input,
.lead-status-action__field select,
.lead-workspace-main textarea {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid #adb3b8;
  border-radius: var(--radius-sm);
  padding: .6rem .7rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.lead-workspace-main textarea {
  min-height: 6rem;
  resize: vertical;
}

.lead-status-action__field input:focus,
.lead-status-action__field select:focus,
.lead-workspace-main textarea:focus {
  border-color: var(--brand);
  outline: 2px solid #f2c7cb;
}

.lead-workspace-main {
  width: 100%;
}

.lead-action-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 2rem;
    align-items: center;
    margin: 1rem 0;
    padding: 1rem 1.25rem;
    border: 1px solid var(--border, #d9e0e7);
    border-radius: var(--radius-md);
    background: var(--surface, #fff);
}

.lead-action-toolbar__title {
    display: grid;
    min-width: 50%;
    gap: .2rem;
}

.lead-action-toolbar__title span {
    color: var(--muted, #64748b);
    font-size: .875rem;
}

.lead-action-toolbar__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: .5rem;
}

@media (max-width: 800px) {
    .lead-action-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .lead-status-action {
        grid-template-columns: 1fr;
        width: 100%;
    }
}

.workspace-tabs {
  display: flex;
  gap: .25rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.workspace-tab {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 2.65rem;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: .6rem .85rem;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.workspace-tab-count {
  min-width: 1.25rem;
  padding: .05rem .4rem;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: .72rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  text-align: center;
}

.workspace-tab--active {
  border-bottom-color: var(--brand);
  color: var(--ink);
}

.workspace-tab:disabled {
  color: #9a9da1;
  cursor: not-allowed;
}

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

.detail-grid--single {
  grid-template-columns: 1fr;
}

.detail-grid div {
  min-width: 0;
}

.detail-grid dt {
  text-transform: uppercase;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.detail-grid dd {
  margin: .2rem 0 0;
  overflow-wrap: anywhere;
}

.decision-actions {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.modal-backdrop {
  position: fixed;
  z-index: 20;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgb(41 45 50 / 55%);
}

.attachment-list {
  display: grid;
  gap: .35rem;
  margin: 0 0 1rem;
  border: 0;
  padding: 0;
}

.attachment-list legend {
  margin-bottom: .15rem;
  padding: 0;
  color: var(--ink);
  font-size: .82rem;
  font-weight: 700;
}

.message-body {
  white-space: pre-wrap;
}

.mail-client {
  min-width: 0;
}

.mail-folders {
  display: grid;
  gap: .15rem;
}

.mail-folders button {
  border: 0;
  background: transparent;
  padding: .35rem .4rem;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.mail-folders button[aria-current="page"] {
  font-weight: 700;
}

.mail-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
}

.compose-form {
  max-width: 58rem;
  gap: 1.5rem;
}

.compose-section {
  display: grid;
  gap: .85rem;
}

.compose-section + .compose-section,
.compose-attachments,
.compose-actions,
.email-thread {
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
}

.compose-section__header h2 {
  margin: 0 0 .2rem;
  font-size: 1rem;
}

.compose-section__header p,
.compose-attachments__content > .form-field p {
  margin: 0;
  color: var(--muted);
  font-size: .85rem;
}

.compose-form textarea {
  min-height: 18rem;
  resize: vertical;
}

.compose-attachments {
  color: var(--ink);
}

.compose-attachments summary {
  cursor: pointer;
  font-size: .9rem;
  font-weight: 700;
}

.compose-attachments__content {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.compose-actions {
  justify-content: flex-end;
}

@media (max-width: 800px) {
  .mail-folders {
    grid-auto-flow: column;
    justify-content: start;
  }
}

.decision-dialog {
  width: min(32rem, 100%);
  padding: 1.5rem;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 1rem 3rem rgb(0 0 0 / 20%);
}

.decision-dialog.email-dialog {
  width: min(52rem, 100%);
}

.email-composer-dialog {
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.document-picker-dialog {
  width: min(72rem, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
}

.document-picker-dialog .document-navigator {
  margin: 1rem 0 1.25rem;
}

.document-files table tbody tr[role="button"] {
  cursor: pointer;
}

.document-preview {
  display: block;
  width: 100%;
  min-height: 42rem;
  border: 1px solid var(--line);
  background: #fff;
}

.document-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.rich-text {
  display: grid;
  gap: .35rem;
}

.rich-text__toolbar {
  display: flex;
  gap: .35rem;
}

.rich-text__toolbar button {
  border: 1px solid var(--line);
  padding: .25rem .5rem;
  background: var(--surface);
  color: var(--ink);
  font-size: .75rem;
  cursor: pointer;
}

.rich-text__body {
  min-height: 12rem;
  border: 1px solid #adb3b8;
  padding: .6rem .7rem;
  background: var(--surface);
  color: var(--ink);
}

.rich-text__body:focus {
  outline: 3px solid #df737d;
  outline-offset: 2px;
}

.decision-dialog h2 {
  margin-top: 0;
}

.decision-dialog p {
  color: var(--muted);
}

.decision-dialog textarea {
  width: 100%;
  min-height: 7rem;
  border: 1px solid #adb3b8;
  border-radius: 0;
  padding: .6rem .7rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.quote-preview {
  margin: 1.25rem 0;
  border: 1px solid var(--line);
  background: #e9eaeb;
}

.quote-preview iframe {
  display: block;
  width: 100%;
  min-height: 55rem;
  border: 0;
  background: #fff;
}

.contract-record {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.contract-record:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.contract-record__heading,
.contract-document-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.contract-record__heading h3,
.contract-document-heading h4 {
  margin: 0;
  font-size: 1rem;
}

.contract-record__heading p,
.contract-document-heading p {
  margin: .25rem 0 0;
  color: var(--muted);
  font-size: .85rem;
}

.contract-record__heading > p {
  margin: 0;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
}

.contract-document-tabs {
  margin: 0;
}

.contract-document-preview {
  margin: 0;
}

.activity-list {
  display: grid;
  gap: .55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-filter { margin: 0 0 .75rem; }

.activity-list li {
  padding-left: .75rem;
  border-left: 2px solid var(--line);
}

.activity-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem .6rem;
  align-items: baseline;
  font-size: .78rem;
}

.activity-meta time, .activity-meta span, .activity-list small {
  color: var(--muted);
  font-size: .78rem;
}

.activity-text {
  margin: .05rem 0 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.activity-meta .activity-actor,
.activity-actor {
  color: var(--ink);
  font-weight: 600;
}

.activity-text p {
  margin: 0 0 .5rem;
}

.activity-text p:last-child {
  margin-bottom: 0;
}

.activity-text br {
  content: "";
  display: block;
  margin-top: .2rem;
}

.auth-page { max-width: 30rem; }

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 2rem 1.25rem;
  background: var(--background);
}

.auth-panel {
  width: min(100%, 28rem);
  padding: clamp(2rem, 5vw, 3.5rem);
  background: var(--surface);
  border-top: 4px solid var(--brand);
  border-radius: var(--radius-md);
}

.auth-logo {
  display: block;
  width: min(100%, 225px);
  height: auto;
  margin: 0 auto 2.5rem;
}

.auth-panel .auth-page {
  max-width: none;
}

.stacked-form {
  display: grid;
  gap: .55rem;
  margin-top: 1.5rem;
}

.auth-alternative {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1.25rem 0 .25rem;
  color: var(--muted);
  font-size: .85rem;
}

.auth-alternative::before,
.auth-alternative::after {
  content: "";
  flex: 1;
  border-top: 1px solid var(--line);
}

.field-hint { color: var(--muted); font-weight: 400; }
.account-security { max-width: 44rem; }
.passkey-register { max-width: 28rem; margin-top: 2rem; }
.data-list { border-top: 1px solid var(--line); }
.data-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.data-list-row span { display: block; margin-top: .2rem; color: var(--muted); }

.wizard-steps {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 1.5rem;
}

.wizard-step {
  border: 2px solid var(--surface);
  border-radius: var(--radius-sm);
  padding: .55rem .75rem;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.wizard-step span {
  font-weight: 700;
}

.wizard-step.active {
  color: var(--ink);
  border-bottom-color: var(--brand);
}

.wizard-step.completed {
  color: var(--ink);
  cursor: pointer;
}

.wizard-step--future {
  background: var(--surface-muted);
  border-color: var(--surface-muted);
  color: var(--muted);
  cursor: pointer;
}

.wizard-form {
  max-width: 42rem;
}

.wizard-form fieldset {
  border: 0;
  margin: 0;
  padding: 0;
  min-inline-size: 0;
}

.wizard-panel {
  display: grid;
  gap: .75rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 1rem;
  align-items: start;
}

.address-fields {
  display: contents;
}

.product-tariff-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.product-tariff-column {
  display: grid;
  gap: .75rem;
  align-content: start;
  border-left: 1px solid var(--line);
  padding-left: 1rem;
}

.product-tariff-column:first-child {
  border-left: 0;
  padding-left: 0;
}

.product-tariff-column h3 {
  margin: 0;
  font-size: .95rem;
}

.form-grid > .form-field {
  color: var(--ink);
  font-size: .82rem;
  font-weight: 700;
}

.form-grid__full {
  grid-column: 1 / -1;
  margin: 0;
}

.form-field--full {
  grid-column: 1 / -1;
}

.postcode-lookup__control {
  display: flex;
  gap: .5rem;
}

.postcode-lookup__control input {
  min-width: 0;
  flex: 1;
}

.postcode-lookup__button {
  display: grid;
  width: 2.65rem;
  padding: 0 !important;
  place-items: center;
}

.postcode-lookup__button svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.form-grid > .form-field input:not(.checkbox__input),
.form-grid > .form-field select {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid #adb3b8;
  border-radius: var(--radius-sm);
  padding: .6rem .7rem;
  background: var(--surface);
  color: var(--ink);
}

.form-grid > button {
  align-self: end;
  min-height: 2.65rem;
}

@media (max-width: 720px) {
  .form-grid,
  .product-tariff-columns {
    grid-template-columns: 1fr;
  }

  .product-tariff-column,
  .product-tariff-column:first-child {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 1rem 0 0;
  }

  .product-tariff-column:first-child {
    border-top: 0;
    padding-top: 0;
  }
}

.quote-result {
    margin-top: 2rem;
    border-top: 1px solid var(--line);
    padding-top: 1.25rem;
}

.quote-result-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin: 0;
}

.quote-result-summary div {
    min-width: 0;
}

.quote-result-summary dt {
    color: var(--muted);
    font-size: 0.8rem;
}

.quote-result-summary dd {
    margin: 0.2rem 0 0;
    font-weight: 600;
}

.quote-document-actions {
    margin: 1.25rem 0;
}

.quote-document-preview {
    display: block;
    width: 100%;
    min-height: 42rem;
    border: 1px solid var(--line);
    background: #fff;
}

@media (max-width: 720px) {
    .quote-result-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.wizard-panel h3 {
  margin: 1rem 0 0;
  color: var(--ink);
  font-size: .95rem;
}

.form-field--postcode {
  gap: .2rem;
}

.form-field--postcode label {
  font-size: .72rem;
}

.postcode-input-row {
  display: flex;
  align-items: stretch;
  gap: .5rem;
}

.postcode-input-row input {
  min-width: 0;
  flex: 1;
}

.postcode-search-action {
  white-space: nowrap;
}

.postcode-lookup-results {
  display: grid;
  gap: .35rem;
  margin-top: .25rem;
}

.postcode-lookup-results label {
  font-size: .72rem;
}

.postcode-lookup-results select {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid #adb3b8;
  border-radius: var(--radius-sm);
  padding: .6rem .7rem;
  background: var(--surface);
  color: var(--ink);
}

.wizard-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1.5rem;
}

.secondary-action {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .65rem .9rem;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}

.secondary-action:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.destructive-action {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.destructive-action h3 {
  margin-bottom: .35rem;
  color: #9f1724;
}

.danger-action {
  border: 1px solid #9f1724;
  border-radius: var(--radius-sm);
  padding: .65rem .9rem;
  background: #9f1724;
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.danger-action:disabled {
  cursor: not-allowed;
  opacity: .5;
}

.record-actions {
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.bulk-actions {
  display: flex;
  align-items: end;
  gap: .75rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
}

.bulk-actions .form-field {
  min-width: 16rem;
}

.selection-column {
  width: 2.5rem;
  text-align: center;
}

.stacked-form label, .form-field label {
  color: var(--ink);
  font-size: .82rem;
  font-weight: 700;
}

.form-field:has(input:required, select:required, textarea:required) > .form-field__label::after {
  content: " *";
  color: var(--brand);
}

.form-field__control {
  min-width: 0;
}

.digit-code {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.form-field .digit-code__box {
  width: 2.8rem;
  flex: 0 0 2.8rem;
  padding-left: .35rem;
  padding-right: .35rem;
  text-align: center;
}

.stacked-form input:not(.checkbox__input), .form-field input:not(.checkbox__input), .form-field select, .form-field textarea {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid #adb3b8;
  border-radius: var(--radius-sm);
  padding: .6rem .7rem;
  background: var(--surface);
  color: var(--ink);
}

.detail-layout input:not(.checkbox__input),
.detail-layout select,
.detail-layout textarea {
  width: 100%;
  min-height: 2.65rem;
  border: 1px solid #adb3b8;
  border-radius: var(--radius-sm);
  padding: .6rem .7rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}

.detail-layout textarea {
  min-height: 6rem;
  resize: vertical;
}

.detail-layout input:not(.checkbox__input):focus,
.detail-layout select:focus,
.detail-layout textarea:focus {
  border-color: var(--brand);
  outline: 2px solid #f2c7cb;
}

.stacked-form input:not(.checkbox__input):focus, .form-field input:not(.checkbox__input):focus, .form-field select:focus, .form-field textarea:focus {
  border-color: var(--brand);
  outline: 2px solid #f2c7cb;
}

.form-help, .validation-message, .field-error, .inline-error, .inline-success {
  margin: 0;
  font-size: .72rem;
  line-height: 1.3;
}

.validation-message, .field-error, .inline-error { color: #9f1724; }
.inline-success { color: #28623b; }
.inline-error p { color: inherit; margin-bottom: .25rem; }

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  min-height: 2.65rem;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  padding: .6rem .9rem;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.primary-action svg {
  width: 1rem;
  height: 1rem;
}

.primary-action:disabled { opacity: .6; cursor: wait; }

.inline-form {
  display: flex;
  align-items: end;
  gap: 1rem;
  margin: 1rem 0 2rem;
}

.form-field { display: grid; min-width: 10rem; gap: .2rem; }
.form-field--wide { flex: 1; }

.field-error {
  display: block;
  min-height: 1.3em;
}

.view-switcher {
  display: flex;
  gap: .35rem;
  margin: 1rem 0;
}

.view-switcher button {
  border: 1px solid #adb3b8;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  padding: .45rem .7rem;
  cursor: pointer;
}

.view-switcher button.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

label.checkbox {
  position: relative;
  display: flex;
  align-items: center;
  gap: .45rem;
  width: fit-content;
  max-width: 100%;
  margin: 0;
  color: var(--ink);
  font-size: inherit;
  font-weight: 400;
  line-height: 1.35;
  cursor: pointer;
  user-select: none;
}

label.checkbox > .checkbox__input {
  position: absolute;
  top: 0;
  left: 0;
  width: 1.05rem;
  height: 1.05rem;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  opacity: 0;
  cursor: pointer;
}

.checkbox__box {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  border: 1px solid #adb3b8;
  border-radius: .2rem;
  background: var(--surface);
}

label.checkbox > .checkbox__input:checked + .checkbox__box {
  border-color: var(--brand);
  background: var(--brand);
}

label.checkbox > .checkbox__input:checked + .checkbox__box::after {
  content: "";
  width: .28rem;
  height: .5rem;
  margin-top: -.12rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

label.checkbox > .checkbox__input:focus-visible + .checkbox__box {
  outline: 2px solid #f2c7cb;
  outline-offset: 2px;
}

label.checkbox > .checkbox__input:disabled + .checkbox__box {
  background: #f3f4f5;
  border-color: #c5c9cd;
}

label.checkbox > .checkbox__input:checked:disabled + .checkbox__box {
  border-color: #c9a8ac;
  background: #c9a8ac;
}

label.checkbox:has(> .checkbox__input:disabled) {
  color: var(--muted);
  cursor: not-allowed;
}

.checkbox__text {
  min-width: 0;
}

.form-field__control > .checkbox,
.inline-form > .checkbox {
  align-items: center;
  min-height: 2.65rem;
}

@media (forced-colors: active) {
  .checkbox__box {
    border-color: ButtonText;
    background: ButtonFace;
  }

  label.checkbox > .checkbox__input:checked + .checkbox__box {
    border-color: Highlight;
    background: Highlight;
  }

  label.checkbox > .checkbox__input:checked + .checkbox__box::after {
    border-color: HighlightText;
  }

  label.checkbox > .checkbox__input:focus-visible + .checkbox__box {
    outline-color: Highlight;
  }
}

.kanban-board {
  display: flex;
  gap: .75rem;
  overflow-x: auto;
  padding-bottom: .5rem;
}

.kanban-column {
  --kanban-stage: var(--ink);
  --kanban-tint: #f5f7f8;
  min-width: 12rem;
  min-height: 24rem;
  border-top: 2px solid var(--kanban-stage);
  border-radius: var(--radius-md);
  background: var(--kanban-tint);
  padding: .55rem .5rem .1rem;
}

.pipeline-board .kanban-column[data-kanban-column="NeedsAssessment"],
.pipeline-board .kanban-column[data-kanban-column="Design"] { --kanban-stage: #35718b; --kanban-tint: #eaf5f8; }
.pipeline-board .kanban-column[data-kanban-column="Quote"] { --kanban-stage: #7158a6; --kanban-tint: #f1edfa; }
.pipeline-board .kanban-column[data-kanban-column="Finance"] { --kanban-stage: #9a6712; --kanban-tint: #fff5df; }
.pipeline-board .kanban-column[data-kanban-column="Contract"] { --kanban-stage: #8b4f75; --kanban-tint: #faedf5; }
.pipeline-board .kanban-column[data-kanban-column="ReadyForOrder"] { --kanban-stage: #2f7556; --kanban-tint: #e9f5ee; }
.pipeline-board .kanban-column[data-kanban-column="ClosedWon"] { --kanban-stage: #24726f; --kanban-tint: #e6f5f3; }
.pipeline-board .kanban-column[data-kanban-column="Lost"] { --kanban-stage: #a24d4d; --kanban-tint: #fbeeee; }

.kanban-column h3 {
  font-size: .85rem;
  margin: 0 0 .65rem;
}

.kanban-column.is-drop-target {
  border-top-color: var(--brand);
  box-shadow: inset 0 0 0 2px var(--brand-soft);
}

.kanban-item {
  display: grid;
  gap: .1rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: .5rem;
  margin-bottom: .4rem;
  color: var(--ink);
  text-decoration: none;
  background: #fff;
}

.kanban-item__reference {
  color: var(--muted);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .05em;
  line-height: 1.2;
  text-transform: uppercase;
}

.kanban-item__name {
  font-size: .82rem;
  line-height: 1.25;
}

.kanban-item:hover {
  box-shadow: 0 0 0 2px var(--brand-soft);
}

article.kanban-item { cursor: pointer; }
.kanban-item[data-draggable="true"] { cursor: grab; touch-action: none; }
.kanban-board.is-dragging { cursor: grabbing; user-select: none; }
.kanban-item.is-dragging { opacity: .35; }
.kanban-item.is-selected { border-color: var(--brand); }
.kanban-card--ghost {
  position: fixed;
  z-index: 30;
  margin: 0;
  pointer-events: none;
  box-shadow: 0 10px 28px rgba(28, 32, 36, .18);
  cursor: grabbing;
}

.kanban-item small,
.work-row small,
.muted-text {
  color: var(--muted);
  font-size: .72rem;
}

.workspace-sections {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.work-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  border-top: 1px solid #e1e4e6;
  padding: .65rem 0;
}

.work-row .completed {
  color: var(--muted);
  text-decoration: line-through;
}

.notification-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-left: auto;
}

.notification-tab-header {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.5rem;
}

.notification-tab-header .workspace-tabs {
  flex: 1;
  margin-bottom: 0;
}

.notification-tab-header + .work-row { border-top: 0; }

.notification-row-content {
  display: grid;
  flex: 1;
  gap: .2rem;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

button.notification-row-content { cursor: pointer; }
button.notification-row-content:hover strong,
button.notification-row-content:focus-visible strong { color: var(--brand-dark); }

.notification-row--read { color: var(--muted); }
.notification-row--read strong { font-weight: 500; }
.notification-unread {
  display: inline-block;
  width: .5rem;
  height: .5rem;
  margin-right: .35rem;
  border-radius: 50%;
  background: var(--brand);
  vertical-align: middle;
}

.ticket-row { align-items: flex-start; }

a.ticket-row {
  color: inherit;
  text-decoration: none;
}

a.ticket-row:hover strong,
a.ticket-row:focus-visible strong { color: var(--brand-dark); }

.ticket-row .notification-actions {
  flex-shrink: 0;
  padding-top: .15rem;
}

.ticket-board .kanban-column[data-kanban-column="Open"] { --kanban-stage: #35718b; --kanban-tint: #eaf5f8; }
.ticket-board .kanban-column[data-kanban-column="InProgress"] { --kanban-stage: #7158a6; --kanban-tint: #f1edfa; }
.ticket-board .kanban-column[data-kanban-column="Waiting"] { --kanban-stage: #9a6712; --kanban-tint: #fff5df; }
.ticket-board .kanban-column[data-kanban-column="Resolved"] { --kanban-stage: #2f7556; --kanban-tint: #e9f5ee; }
.ticket-board .kanban-column[data-kanban-column="Closed"] { --kanban-stage: #6d7378; --kanban-tint: #f3f4f5; }

.ticket-detail {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.ticket-detail h3 { margin: 0 0 .25rem; font-size: 1rem; }

.ticket-detail__heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.ticket-card__title {
  font-size: .9rem;
  line-height: 1.3;
}

.ticket-priority {
  display: inline-block;
  width: .55rem;
  height: .55rem;
  margin-right: .35rem;
  border-radius: 50%;
  background: #8b9096;
  vertical-align: middle;
}

.ticket-priority[data-priority="Low"] { background: #8b9096; }
.ticket-priority[data-priority="Normal"] { background: #35718b; }
.ticket-priority[data-priority="High"] { background: #9a6712; }
.ticket-priority[data-priority="Urgent"] { background: var(--brand); }

.ticket-comments { margin-top: .35rem; }

.ticket-comment {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
  margin: .35rem 0 0;
}

.ticket-comment p {
  display: grid;
  gap: .1rem;
  margin: 0;
}

.ticket-comment-form {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-top: .45rem;
}

.ticket-comment-form input { flex: 1; min-width: 0; }

.user-editor {
  display: grid;
  gap: 1rem;
  max-width: 62rem;
}

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

.preset-list,
.permission-list {
  display: grid;
  gap: .55rem;
}

.payment-field--changed input {
  border-color: var(--color-warning, #a15c00);
  background: #fff9ed;
}

.payment-value--changed {
  font-weight: 700;
  background: #fff9ed;
}

.payment-override-request {
  margin-top: 1rem;
  max-width: 42rem;
}

.error-details {
  max-height: 28rem;
  overflow: auto;
  margin-top: .75rem;
  padding: .75rem;
  background: #f5f6f7;
  border: 1px solid #d5d9dc;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: .8rem/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.preset-option,
.permission-option {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  padding: .7rem;
  border: 1px solid #d5d9dc;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.preset-option:has(input:checked) {
  border-color: var(--brand);
}

.preset-option span,
.permission-option span {
  display: grid;
  gap: .15rem;
}

.preset-option small {
  color: var(--muted);
  font-size: .75rem;
}

.permission-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.permission-list fieldset {
  display: grid;
  gap: .4rem;
  border: 0;
  border-top: 1px solid var(--line);
  padding: .75rem 0 0;
}

.permission-list legend {
  padding: 0;
  font-size: .8rem;
  font-weight: 700;
}

.permission-option {
  border: 0;
  padding: .25rem 0;
}

.permission-option input,
.preset-option input {
  width: auto;
  min-height: auto;
  margin-top: .2rem;
}

.user-list {
  margin-top: 2rem;
}

.task-list {
  display: grid;
  max-width: 42rem;
  border-top: 1px solid var(--line);
}

.task-list a {
  display: grid;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.task-list a:hover { color: var(--brand-dark); }
.task-list span { color: var(--muted); font-size: .85rem; }

.results { margin-top: 2rem; }
.results-heading, .pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.results-heading span, .pagination span { color: var(--muted); font-size: .82rem; }
.table-scroll { overflow-x: auto; border-top: 1px solid var(--line); }
.eligibility-question-reorder { width: 3.25rem; text-align: center; }
.eligibility-question-drag-handle {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: grab;
  touch-action: none;
}
.eligibility-question-drag-handle:active { cursor: grabbing; }
.eligibility-question-drag-handle { font-size: 1.1rem; }
.eligibility-question-drag-handle svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}
.eligibility-question-editor.is-reordering { user-select: none; }
.eligibility-question-editor tr.is-drop-before > td { border-top: 3px solid var(--brand); }
.eligibility-question-editor tr.is-drop-after > td { border-bottom: 3px solid var(--brand); }
.catalog-editor .table-scroll,
.catalog-versions .table-scroll { margin-bottom: 1rem; }
.catalog-editor {
  display: grid;
  gap: 2rem;
  margin-top: 1.5rem;
}
.catalog-editor > div {
  min-width: 0;
}
.catalog-model-form {
  margin-top: 1.25rem;
}
.catalog-form-actions,
.catalog-publish-actions,
.catalog-version-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .9rem;
}
.catalog-publish-actions {
  margin-top: 1.5rem;
}
.lead-reference-setting {
  display: flex;
  align-items: end;
  gap: .75rem;
}
.catalog-version-actions {
  gap: .75rem;
}
.table-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  min-height: 2rem;
}
.table-action--danger { color: #9f1724; }
.catalog-versions .table-scroll {
  margin-top: 1rem;
}
.table-action-help {
  display: block;
  margin-top: .35rem;
  color: var(--muted);
  font-size: .72rem;
}
.text-action:disabled {
  color: #999;
  cursor: not-allowed;
  text-decoration: none;
}
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .84rem; }
th, td { padding: .75rem .65rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { color: var(--muted); font-size: .72rem; }
.permission-table .permission-group th { color: var(--ink); font-size: .84rem; }
tbody tr[onclick] { cursor: pointer; }
tbody tr[onclick]:hover,
tbody tr.selected-row { background: #f1f3f4 !important; }
.pagination { margin-top: 1rem; }
.pagination button, .row-actions button {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: .45rem .65rem;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.pagination button:disabled { color: #999; cursor: not-allowed; }

.temporary-password {
  margin: 1rem 0;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.temporary-password code { display: block; margin: .5rem 0; font-size: 1.05rem; }
.temporary-password p { margin-bottom: 0; }
.user-list { margin-top: 2.5rem; }
.user-row {
  display: grid;
  grid-template-columns: minmax(14rem, 1fr) 8rem 6rem minmax(18rem, auto);
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
  font-size: .85rem;
}
.user-row > div:first-child { display: grid; gap: .2rem; }
.user-row > div:first-child span { color: var(--muted); }
.row-actions { display: flex; justify-content: flex-end; gap: .4rem; flex-wrap: wrap; }
.row-actions--start { justify-content: flex-start; }
.compact-action { padding: .45rem .65rem; font-size: inherit; text-decoration: none; }
.account-actions { max-width: 62rem; margin-top: 2rem; }

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

  .sidebar {
    position: fixed;
    z-index: 20;
    width: min(17rem, 86vw);
    transform: translateX(-105%);
    transition: transform 160ms ease;
  }

  .navigation-open .sidebar { transform: translateX(0); }
  .navigation-toggle { display: grid; place-items: center; }
  .navigation-close {
    display: grid;
    position: absolute;
    top: .75rem;
    right: .75rem;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .35);
    background: transparent;
    color: #fff;
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
  }
  .inline-form { align-items: stretch; flex-direction: column; }
  .user-row { grid-template-columns: 1fr; }
  .row-actions { justify-content: flex-start; }
  .lead-stage { grid-template-columns: 1fr; }
  .lead-stage-actions { justify-content: flex-start; }
  .contact-header { align-items: flex-start; flex-direction: column; gap: .75rem; }
}

@media (max-width: 600px) {
  .environment-label, .identity-name { display: none; }
  .content { padding: 2rem 1.25rem; }
  .inline-form > .checkbox { width: 100%; }
  .editor-grid,
  .permission-list,
  .contact-record .detail-grid { grid-template-columns: 1fr; }
  a.work-row.contact-journey small { flex-basis: 100%; margin-left: 0; }
  .lead-workspace-heading { align-items: start; flex-direction: column; gap: 1rem; }
  .lead-header-meta { justify-items: start; text-align: left; }
  .lead-loss-action { width: 100%; grid-template-columns: 1fr; }
  .lead-loss-action label { grid-column: auto; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}

.notification-toast-stack {
  position: fixed;
  z-index: 30;
  right: 1.25rem;
  bottom: 1.25rem;
  width: min(22rem, calc(100vw - 2.5rem));
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.notification-toast {
  position: relative;
  display: grid;
  gap: .55rem;
  padding: .9rem 2.5rem .9rem 1rem;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--ink);
  animation: notification-toast-in .18s ease-out both;
}

.notification-toast--leaving { animation: notification-toast-out .18s ease-in both; }

.notification-toast-dismiss {
  position: absolute;
  top: .35rem;
  right: .45rem;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.notification-toast-dismiss:hover,
.notification-toast-dismiss:focus-visible { color: var(--ink); }

.notification-toast a {
  color: inherit;
  text-decoration: none;
}

.notification-toast strong {
  display: block;
  font-size: .9rem;
}

.notification-toast p {
  margin: .2rem 0 0;
  color: var(--muted);
  font-size: .8rem;
}

/* Softer controls and grouped table data without adding visual clutter. */
.primary-action,
.secondary-action,
.danger-action,
.icon-action,
.view-switcher button,
.pagination button,
.row-actions button {
  border-color: transparent;
}

.secondary-action,
.icon-action,
.view-switcher button,
.pagination button,
.row-actions button {
  background: var(--surface-muted);
}

input:not([type="checkbox"]):not([type="hidden"]):not([type="file"]),
select,
textarea {
  border-color: var(--line) !important;
  background: var(--surface) !important;
}

input:not([type="checkbox"]):not([type="hidden"]):not([type="file"]):focus,
select:focus,
textarea:focus {
  background: var(--surface) !important;
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.table-scroll {
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface);
}

table {
  border-collapse: separate;
  border-spacing: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: transparent;
}

th,
td {
  border: 0;
}

th {
  background: #f1edec;
}

tbody tr:nth-child(even) {
  background: #faf7f7;
}

.document-files .table-scroll,
.document-files table,
.document-files th,
.document-files td {
  background: transparent;
}

@keyframes notification-toast-in {
  from { opacity: 0; transform: translateY(.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes notification-toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(.5rem); }
}
