:root {
  color-scheme: dark;
  --bg: #050505;
  --surface: #0d0d0d;
  --surface-2: #141414;
  --border: #272727;
  --text: #f7f7f7;
  --muted: #b4b4b4;
  --red: #ff2028;
  --red-dark: #9e1016;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% 0%, rgba(255, 32, 40, .16), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: Rubik, Arial, sans-serif;
  overflow-x: hidden;
}

main {
  min-width: 0;
}

a {
  color: inherit;
  overflow-wrap: anywhere;
}

button,
input,
select,
textarea {
  font: inherit;
  max-width: 100%;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--border);
  background: rgba(5, 5, 5, .82);
  backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.brand {
  flex: 0 1 auto;
  font-weight: 900;
  min-width: 0;
  text-decoration: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.topbar__links {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: clamp(.45rem, 1vw, .75rem);
  justify-content: flex-end;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.topbar__links::-webkit-scrollbar {
  display: none;
}

.topbar__identity {
  align-self: center;
  display: inline-grid;
  flex: 0 1 clamp(8.75rem, 18vw, 13rem);
  gap: .1rem;
  justify-content: start;
  max-width: clamp(8.75rem, 18vw, 13rem);
  min-height: 2.65rem;
  min-width: 0;
  padding: .45rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  color: var(--muted);
  line-height: 1.15;
  overflow: hidden;
}

.topbar__identity span,
.topbar__identity em {
  font-size: .72rem;
  font-style: normal;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar__identity strong {
  color: var(--text);
  font-size: .92rem;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-entry__details {
  display: grid;
  gap: .25rem;
  margin: .75rem 0 0;
  padding: .75rem 0 0;
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: var(--muted);
  list-style: none;
}

.stack-list .log-entry__details li {
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.topbar__links a,
.topbar__links button {
  align-items: center;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  display: inline-flex;
  justify-content: center;
  min-height: 2.4rem;
  padding: .35rem .45rem;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 0 auto;
}

.topbar__links form {
  align-items: center;
  display: flex;
  margin: 0;
}

.topbar__menu {
  display: none;
  margin-left: auto;
  position: relative;
}

.topbar__menu summary {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .045);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
  list-style: none;
  min-height: 2.4rem;
  padding: .45rem .8rem;
  user-select: none;
}

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

.topbar__menu summary::after {
  content: "⌄";
  color: var(--muted);
  font-size: .8rem;
  margin-left: .45rem;
  transform: translateY(-1px);
}

.topbar__menu[open] summary {
  border-color: rgba(255, 32, 40, .75);
}

.topbar__menu[open] summary::after {
  content: "×";
}

.topbar__menu-panel {
  background: rgba(10, 10, 10, .98);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, .44);
  display: grid;
  gap: .35rem;
  min-width: min(22rem, calc(100vw - 1.5rem));
  padding: .7rem;
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  z-index: 20;
}

.topbar__menu-panel a,
.topbar__menu-panel button {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-weight: 850;
  justify-content: flex-start;
  min-height: 2.5rem;
  padding: .65rem .75rem;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.topbar__menu-panel a:hover,
.topbar__menu-panel button:hover {
  background: rgba(255, 255, 255, .06);
}

.topbar__menu-panel form {
  margin: 0;
}

.topbar__menu-panel .topbar__identity {
  max-width: none;
  width: 100%;
}

.table-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  justify-content: flex-start;
  min-width: max-content;
}

.table-actions form {
  flex: 0 0 auto;
  margin: 0;
}

.topbar__links a:hover,
.topbar__links button:hover {
  background: rgba(255, 255, 255, .06);
}

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

.auth-home-link {
  align-items: center;
  background: rgba(255, 255, 255, .045);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  display: inline-flex;
  font-weight: 900;
  left: clamp(.9rem, 2vw, 1.5rem);
  min-height: 2.5rem;
  padding: .55rem .8rem;
  position: fixed;
  text-decoration: none;
  top: clamp(.9rem, 2vw, 1.5rem);
  z-index: 12;
}

.auth-home-link:hover {
  border-color: rgba(255, 32, 40, .55);
  background: rgba(255, 32, 40, .08);
}

.auth-card,
.panel-card {
  border: 1px solid var(--border);
  background: linear-gradient(145deg, rgba(20, 20, 20, .95), rgba(8, 8, 8, .96));
  border-radius: 8px;
  box-shadow: 0 22px 80px rgba(0, 0, 0, .28);
}

.auth-card {
  width: min(100%, 520px);
  padding: clamp(1.4rem, 4vw, 2.5rem);
}

.auth-card h1 {
  font-size: 3.35rem;
  line-height: .98;
  overflow-wrap: anywhere;
  text-wrap: balance;
}

.auth-card .muted {
  max-width: 36rem;
}

.page {
  width: min(1240px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) 0;
}

.page-heading {
  margin-bottom: 2rem;
}

.page-heading--split {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.eyebrow {
  color: var(--red);
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .12em;
  margin: 0 0 .7rem;
}

h1,
h2 {
  letter-spacing: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

h1 {
  font-size: 4rem;
  line-height: .94;
}

h2 {
  font-size: 1.55rem;
  margin-bottom: 1rem;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.form {
  display: grid;
  gap: 1rem;
}

.form label {
  display: grid;
  gap: .45rem;
  color: var(--muted);
  font-size: .95rem;
}

.form input,
.form select,
.form textarea,
.filter-form input {
  width: 100%;
  border: 1px solid var(--border);
  background: #050505;
  color: var(--text);
  border-radius: 6px;
  padding: .9rem 1rem;
  outline: none;
}

.form input:focus,
.form select:focus,
.form textarea:focus,
.filter-form input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(255, 32, 40, .18);
}

.form input[type="checkbox"],
.form input[type="radio"],
.filter-form input[type="checkbox"],
.filter-form input[type="radio"] {
  accent-color: var(--red);
  background: transparent;
  border: 0;
  box-shadow: none;
  height: 1rem;
  min-height: 0;
  padding: 0;
  width: 1rem;
}

.form input[type="checkbox"]:focus,
.form input[type="radio"]:focus,
.filter-form input[type="checkbox"]:focus,
.filter-form input[type="radio"]:focus {
  border-color: transparent;
  box-shadow: 0 0 0 3px rgba(255, 32, 40, .18);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--red);
  background: var(--red);
  color: white;
  border-radius: 6px;
  padding: .95rem 1.2rem;
  font-weight: 900;
  line-height: 1.15;
  min-height: 3.2rem;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  max-width: 100%;
  overflow-wrap: normal;
  white-space: nowrap;
}

.button--ghost {
  background: transparent;
}

.button--small {
  min-height: 0;
  min-width: 5.35rem;
  padding: .55rem .75rem;
  font-size: .85rem;
}

.form-note {
  color: var(--muted);
  line-height: 1.6;
  margin: 1rem 0 0;
}

.form-note a,
.inline-link {
  color: var(--text);
  font-weight: 900;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.alert {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
  line-height: 1.6;
}

.alert--error {
  border-color: var(--red-dark);
  background: rgba(255, 32, 40, .08);
}

.alert--success {
  border-color: rgba(65, 220, 128, .35);
  background: rgba(65, 220, 128, .08);
}

.danger-zone {
  border-color: rgba(255, 32, 40, .55);
  background: linear-gradient(145deg, rgba(35, 8, 9, .62), rgba(8, 8, 8, .96));
}

code {
  background: #050505;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .15rem .35rem;
}

.stat-grid,
.three-column {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.three-column {
  align-items: stretch;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 310px), 1fr));
}

.stat-grid article,
.panel-card {
  min-width: 0;
  padding: 1.2rem;
  overflow: hidden;
}

.stat-grid article {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  min-height: 9rem;
}

.stat-grid span,
.stack-list span,
table span {
  display: block;
  color: var(--muted);
  font-size: .9rem;
  margin-top: .25rem;
}

.stat-grid strong {
  display: block;
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.08;
  margin-top: .5rem;
  overflow-wrap: anywhere;
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  margin: 0 0 1rem;
}

.filter-chip {
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  padding: .65rem 1rem;
  text-decoration: none;
}

.filter-chip.is-active {
  border-color: var(--red);
  color: var(--text);
  background: rgba(255, 32, 40, .12);
}

.search-card {
  background:
    radial-gradient(circle at top right, rgba(255, 32, 40, .13), transparent 28rem),
    linear-gradient(145deg, rgba(20, 20, 20, .97), rgba(8, 8, 8, .98));
  margin-bottom: 1rem;
  padding: 1.25rem;
}

.search-card__head {
  align-items: end;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.search-card__head h2 {
  margin-bottom: 0;
}

.search-card__head .muted {
  margin: 0;
  max-width: 430px;
}

.filter-form {
  display: grid;
  gap: .9rem;
}

.search-field {
  display: grid;
  gap: .55rem;
  color: var(--muted);
  position: relative;
}

.search-field label,
.filter-group p {
  color: var(--text);
  font-size: .86rem;
  font-weight: 900;
  margin: 0;
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap::before {
  border: 2px solid var(--muted);
  border-radius: 999px;
  content: "";
  height: .72rem;
  left: 1rem;
  opacity: .7;
  position: absolute;
  top: 50%;
  transform: translateY(-58%);
  width: .72rem;
}

.search-input-wrap::after {
  background: var(--muted);
  content: "";
  height: 2px;
  left: 1.72rem;
  opacity: .7;
  position: absolute;
  top: calc(50% + .34rem);
  transform: rotate(45deg);
  width: .5rem;
}

.search-input-wrap input {
  border-color: rgba(255, 255, 255, .12);
  border-radius: 8px;
  font-size: 1rem;
  padding-left: 2.75rem;
}

.search-input-wrap input:focus {
  border-color: var(--red);
}

.live-search-results {
  background: #070707;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, .45);
  display: grid;
  left: 0;
  max-height: 360px;
  overflow: auto;
  padding: .45rem;
  position: absolute;
  right: 0;
  top: calc(100% + .35rem);
  z-index: 20;
}

.live-search-results[hidden] {
  display: none !important;
}

.live-search-item {
  border-radius: 6px;
  color: var(--text);
  display: grid;
  gap: .35rem;
  padding: .75rem;
  text-decoration: none;
}

.live-search-item:hover,
.live-search-item:focus {
  background: rgba(255, 32, 40, .12);
  outline: none;
}

.live-search-top {
  align-items: center;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
}

.live-search-badge {
  border: 1px solid rgba(255, 32, 40, .45);
  border-radius: 999px;
  color: var(--text);
  font-size: .78rem;
  padding: .25rem .5rem;
}

.live-search-meta,
.live-search-empty {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}

.live-search-empty {
  padding: .75rem;
}

.filter-groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  gap: .75rem;
}

.filter-group {
  background: rgba(255, 255, 255, .025);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  display: grid;
  gap: .7rem;
  min-width: 0;
  padding: .85rem;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  min-width: 0;
}

.check-pill,
.checkbox-row {
  align-items: center;
  display: inline-flex;
  gap: .55rem;
}

.form label.checkbox-row {
  align-items: flex-start;
  color: var(--text);
  display: flex;
  flex-direction: row;
  gap: .65rem;
  line-height: 1.45;
}

.form label.checkbox-row span {
  min-width: 0;
}

.check-pill {
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer;
  font-size: .9rem;
  max-width: 100%;
  overflow: hidden;
  padding: 0;
  position: relative;
}

.check-pill span {
  align-items: center;
  display: inline-flex;
  gap: .45rem;
  min-width: 0;
  padding: .55rem .75rem;
  white-space: nowrap;
}

.check-pill span::before {
  border: 1px solid rgba(255, 255, 255, .35);
  border-radius: 4px;
  content: "";
  height: .72rem;
  width: .72rem;
}

.check-pill input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.check-pill:has(input:checked),
.check-pill input:checked + span {
  border-color: var(--red);
  color: var(--text);
  background: rgba(255, 32, 40, .12);
}

.check-pill input:checked + span::before {
  background: var(--red);
  border-color: var(--red);
  box-shadow: inset 0 0 0 2px #050505;
}

.checkbox-row input {
  accent-color: var(--red);
  background: transparent;
  border: 0;
  flex: 0 0 auto;
  height: 1rem;
  justify-self: start;
  min-height: 0;
  box-shadow: none;
  padding: 0;
  width: 1rem;
}

.checkbox-row span {
  min-width: 0;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
}

.quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .7rem;
  margin: -1rem 0 1rem;
}

.client-dashboard {
  display: grid;
  gap: 1.1rem;
}

.client-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 1rem;
  align-items: end;
}

.client-hero__copy h1 {
  max-width: 920px;
}

.client-hero__copy .muted {
  max-width: 720px;
}

.client-hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 1.3rem;
}

.client-status-card,
.client-summary-grid article,
.client-section,
.client-tabs {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(20, 20, 20, .92), rgba(8, 8, 8, .95));
}

.client-status-card {
  min-width: 0;
  padding: 1.25rem;
}

.client-status-card span,
.client-summary-grid span,
.section-head span {
  color: var(--red);
  display: block;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .12em;
  margin-bottom: .5rem;
  text-transform: uppercase;
}

.client-status-card strong {
  display: block;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: .95;
  overflow-wrap: anywhere;
}

.client-status-card p,
.section-head p,
.client-summary-grid p {
  color: var(--muted);
  line-height: 1.55;
  margin: .75rem 0 0;
}

.client-tabs {
  display: flex;
  gap: .45rem;
  overflow-x: auto;
  padding: .45rem;
  position: sticky;
  top: 73px;
  z-index: 4;
  backdrop-filter: blur(16px);
}

.client-tab-link {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  display: inline-flex;
  flex: 0 0 auto;
  gap: .45rem;
  min-height: 2.75rem;
  padding: .7rem .95rem;
  text-decoration: none;
  white-space: nowrap;
}

.client-tab-link:hover,
.client-tab-link.is-active {
  background: rgba(255, 32, 40, .12);
  border-color: rgba(255, 32, 40, .5);
  color: var(--text);
}

.client-tab-count {
  align-items: center;
  background: var(--red);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: .72rem;
  font-weight: 900;
  justify-content: center;
  line-height: 1;
  min-width: 1.35rem;
  padding: .28rem .42rem;
}

.client-tab-panels {
  min-width: 0;
}

.client-tab-panel {
  display: none;
}

.client-tab-panel.is-active {
  display: block;
}

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

.client-summary-grid article {
  min-width: 0;
  padding: 1rem;
}

.client-summary-grid strong {
  display: block;
  font-size: 2.35rem;
  line-height: 1;
}

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

.client-section {
  min-width: 0;
  padding: 1.15rem;
}

.client-section--wide {
  grid-column: 1 / -1;
}

.section-head {
  margin-bottom: 1rem;
}

.section-head h2,
.section-head h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.section-head h3 {
  font-size: 1.2rem;
  line-height: 1.15;
}

.section-head--compact {
  margin-bottom: .85rem;
}

.client-next-list {
  display: grid;
  gap: .75rem;
}

.client-next-item {
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 8px;
  display: grid;
  gap: .35rem;
  padding: .9rem;
  text-decoration: none;
}

.client-next-item:hover {
  border-color: rgba(255, 32, 40, .5);
  background: rgba(255, 32, 40, .08);
}

.client-next-item span {
  color: var(--muted);
  line-height: 1.45;
}

.client-dashboard .quick-actions {
  margin: 0;
}

.client-dashboard .quick-actions .button {
  flex: 1 1 190px;
}

.item-head {
  display: flex;
  gap: .8rem;
  justify-content: space-between;
  align-items: flex-start;
  min-width: 0;
}

.item-head > div {
  min-width: 0;
}

.item-head form,
.item-head .button {
  flex: 0 0 auto;
}

.status-badge {
  align-items: center;
  border: 1px solid rgba(255, 32, 40, .42);
  border-radius: 999px;
  color: var(--text);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: .75rem;
  font-weight: 900;
  margin-top: 0;
  padding: .3rem .55rem;
}

.resource-item {
  display: grid;
  gap: .75rem;
}

.survey-admin-item details {
  margin-top: .8rem;
}

.survey-admin-item summary {
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
}

.survey-preview {
  display: grid;
  gap: .65rem;
  margin: .85rem 0 0;
}

.survey-preview div {
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 6px;
  padding: .75rem;
}

.survey-preview dt {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 900;
  margin-bottom: .35rem;
  text-transform: uppercase;
}

.survey-preview dd {
  line-height: 1.5;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.compact-form {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  align-items: end;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 1rem;
  align-items: start;
}

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

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

th,
td {
  border-bottom: 1px solid var(--border);
  padding: .9rem .7rem;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  color: var(--muted);
  font-size: .85rem;
}

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

.stack-list li {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .9rem;
  background: rgba(255, 255, 255, .02);
  min-width: 0;
  overflow: hidden;
}

.stack-list strong {
  display: block;
  overflow-wrap: anywhere;
}

.stack-list p {
  color: var(--muted);
  line-height: 1.6;
  margin: .65rem 0;
}

.stack-list .stack-list__more {
  background: transparent;
  border: 0;
  padding: 0;
}

.stack-list__more details {
  display: grid;
  gap: .8rem;
}

.stack-list__more summary {
  align-items: center;
  border: 1px solid rgba(255, 32, 47, .62);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  font-weight: 900;
  justify-content: center;
  list-style: none;
  min-height: 2.7rem;
  padding: .7rem 1rem;
  width: 100%;
}

.stack-list__more summary::-webkit-details-marker {
  display: none;
}

.stack-list__more summary:hover {
  background: rgba(255, 32, 47, .12);
}

.stack-list--nested {
  margin-top: .8rem;
}

.stack-list .activity-item {
  padding: .75rem .85rem;
}

.activity-brief summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: .75rem;
  justify-content: space-between;
  list-style: none;
  min-width: 0;
}

.activity-brief summary::-webkit-details-marker {
  display: none;
}

.activity-brief summary::after {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  color: var(--muted);
  content: "+";
  display: inline-flex;
  flex: 0 0 auto;
  font-size: .82rem;
  font-weight: 900;
  height: 1.45rem;
  justify-content: center;
  width: 1.45rem;
}

.activity-brief[open] summary::after {
  content: "-";
}

.activity-brief summary > span {
  display: grid;
  gap: .12rem;
  min-width: 0;
}

.activity-brief strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-brief__details,
.activity-brief__details-empty {
  border-top: 1px solid rgba(255, 255, 255, .08);
  color: var(--muted);
  margin: .65rem 0 0;
  padding: .65rem 0 0;
}

.activity-brief__details {
  display: grid;
  gap: .3rem;
  list-style: none;
}

.stack-list .activity-brief__details li {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.4;
  overflow-wrap: anywhere;
  padding: 0;
}

.activity-brief__details-empty {
  font-size: .86rem;
  line-height: 1.4;
}

.checklist-row {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.checklist-row form {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
}

.message-list,
.chat-thread {
  max-height: 460px;
  overflow: auto;
}

.chat-layout,
.chat-admin-shell {
  display: grid;
  gap: 1rem;
  min-width: 0;
}

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

.chat-admin-shell {
  align-items: start;
  grid-template-columns: minmax(250px, 340px) minmax(0, 1fr);
}

.chat-sidebar,
.chat-card {
  min-width: 0;
}

.chat-card {
  display: grid;
  gap: 1rem;
}

.chat-card__head {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: .8rem;
  justify-content: space-between;
  min-width: 0;
}

.chat-card__head span,
.chat-card__head p {
  color: var(--muted);
  display: block;
  margin: .25rem 0 0;
}

.chat-search {
  display: grid;
  gap: .75rem;
  margin-bottom: 1rem;
}

.chat-search label {
  color: var(--muted);
  display: grid;
  gap: .45rem;
}

.chat-search input {
  width: 100%;
  border: 1px solid var(--border);
  background: #050505;
  color: var(--text);
  border-radius: 6px;
  padding: .8rem .9rem;
}

.chat-contact-list {
  display: grid;
  gap: .55rem;
  max-height: 620px;
  overflow: auto;
}

.chat-contact {
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  font: inherit;
  gap: .15rem .65rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: .75rem;
  position: relative;
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.chat-contact:hover,
.chat-contact.is-active {
  border-color: var(--red);
  background: rgba(255, 32, 40, .08);
}

.chat-contact span {
  color: var(--muted);
  font-size: .85rem;
  grid-column: 1;
}

.chat-contact small {
  color: var(--muted);
  display: block;
  font-size: .82rem;
  grid-column: 1;
  line-height: 1.35;
  max-width: calc(100% - 2rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-contact em {
  align-items: center;
  background: var(--red);
  border-radius: 999px;
  display: inline-flex;
  font-style: normal;
  font-size: .78rem;
  font-weight: 900;
  justify-content: center;
  min-width: 1.55rem;
  min-height: 1.55rem;
  padding: .15rem .45rem;
  grid-column: 2;
  grid-row: 1 / span 2;
  margin-left: .5rem;
}

.chat-contact em[hidden] {
  display: none;
}

.admin-chat-card {
  align-items: center;
  display: flex;
  gap: 1rem;
  justify-content: space-between;
}

.admin-chat-card h2 {
  margin-bottom: .25rem;
}

.admin-chat-card .button {
  white-space: nowrap;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  list-style: none;
  margin: 0;
  padding: .25rem .2rem .25rem 0;
}

.chat-thread .empty {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
}

.chat-message {
  display: flex;
  flex-direction: column;
  gap: .34rem;
}

.chat-message--own {
  align-items: flex-end;
}

.chat-message--other {
  align-items: flex-start;
}

.chat-bubble {
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 8px;
  max-width: min(78%, 680px);
  min-width: 0;
  padding: .85rem 1rem;
  transition:
    border-color .18s ease,
    transform .18s ease;
}

.chat-message--own .chat-bubble {
  background: rgba(255, 32, 40, .14);
  border-color: rgba(255, 32, 40, .35);
}

.chat-bubble p {
  line-height: 1.55;
  margin: 0;
  overflow-wrap: anywhere;
}

.chat-message__meta {
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 999px;
  color: var(--muted);
  display: none;
  font-size: .74rem;
  line-height: 1.25;
  margin-top: .08rem;
  max-width: min(78%, 680px);
  padding: .34rem .58rem;
}

.chat-message--receipt .chat-message__meta,
.chat-message:hover .chat-message__meta,
.chat-message:focus-within .chat-message__meta {
  display: block;
}

.chat-compose {
  align-items: end;
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: grid;
  gap: .7rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding-top: 1rem;
}

.chat-compose label {
  color: var(--muted);
  display: grid;
  gap: .4rem;
  grid-column: 1 / -1;
}

.chat-compose textarea,
.chat-compose select {
  width: 100%;
  border: 1px solid var(--border);
  background: #050505;
  color: var(--text);
  border-radius: 6px;
  padding: .85rem 1rem;
  outline: none;
}

.chat-compose textarea {
  min-height: 3.2rem;
  resize: vertical;
}

.chat-launch-card {
  display: grid;
  gap: 1rem;
  max-width: 560px;
}

.chat-audit-summary {
  display: grid;
  gap: .8rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.chat-audit-summary article {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .03);
  padding: 1rem;
}

.chat-audit-summary span {
  color: var(--muted);
  display: block;
  font-size: .82rem;
  font-weight: 800;
  margin-bottom: .35rem;
}

.chat-audit-summary strong {
  color: var(--text);
  font-size: 1.8rem;
  line-height: 1;
}

.chat-audit-filters {
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr);
}

.chat-audit-filters .form-actions {
  grid-column: 1 / -1;
}

.chat-audit-list {
  display: grid;
  gap: .85rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.chat-audit-item {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, .025);
  display: grid;
  gap: .8rem;
  padding: 1rem;
}

.chat-audit-item--staff {
  border-color: rgba(255, 32, 40, .34);
  background: linear-gradient(145deg, rgba(255, 32, 40, .12), rgba(255, 255, 255, .025));
}

.chat-audit-item__head {
  align-items: flex-start;
  display: flex;
  gap: .9rem;
  justify-content: space-between;
}

.chat-audit-item__head > div {
  display: grid;
  gap: .2rem;
  min-width: 0;
}

.chat-audit-item__head strong {
  color: var(--text);
  overflow-wrap: anywhere;
}

.chat-audit-item__head span {
  color: var(--muted);
  font-size: .84rem;
}

.chat-audit-item p {
  color: var(--text);
  line-height: 1.5;
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-audit-item dl {
  border-top: 1px solid rgba(255, 255, 255, .08);
  display: grid;
  gap: .45rem;
  margin: 0;
  padding-top: .75rem;
}

.chat-audit-item dl div {
  align-items: baseline;
  display: grid;
  gap: .65rem;
  grid-template-columns: 7.5rem minmax(0, 1fr);
}

.chat-audit-item dt {
  color: var(--muted);
  font-weight: 800;
}

.chat-audit-item dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.floating-chat {
  bottom: 1.25rem;
  max-width: calc(100vw - 1rem);
  position: fixed;
  right: 1.25rem;
  z-index: 20;
}

.floating-chat__button {
  align-items: center;
  background: var(--red);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 999px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .42);
  color: white;
  cursor: pointer;
  display: inline-flex;
  font-weight: 900;
  gap: .45rem;
  justify-content: center;
  min-height: 3.6rem;
  min-width: 3.6rem;
  padding: 0 1.1rem;
  position: relative;
  transition:
    opacity .18s ease,
    transform .18s ease;
}

.floating-chat__button em {
  align-items: center;
  background: #fff;
  border: 2px solid var(--red);
  border-radius: 999px;
  color: var(--red);
  display: inline-flex;
  font-size: .74rem;
  font-style: normal;
  font-weight: 950;
  justify-content: center;
  line-height: 1;
  min-width: 1.35rem;
  padding: .22rem .38rem;
}

.floating-chat__button em[hidden] {
  display: none;
}

.floating-chat__panel {
  background: linear-gradient(145deg, rgba(20, 20, 20, .98), rgba(7, 7, 7, .99));
  border: 1px solid var(--border);
  border-radius: 8px;
  bottom: 4.6rem;
  box-shadow: 0 22px 80px rgba(0, 0, 0, .48);
  display: none;
  flex-direction: column;
  height: min(720px, calc(100vh - 6.5rem));
  height: min(720px, calc(100svh - 6.5rem));
  height: min(720px, calc(100dvh - 6.5rem));
  max-height: min(720px, calc(100vh - 6.5rem));
  max-height: min(720px, calc(100svh - 6.5rem));
  max-height: min(720px, calc(100dvh - 6.5rem));
  min-height: min(26rem, calc(100vh - 6.5rem));
  min-height: min(26rem, calc(100svh - 6.5rem));
  min-height: min(26rem, calc(100dvh - 6.5rem));
  overflow: hidden;
  position: absolute;
  right: 0;
  width: min(40rem, calc(100vw - 2rem));
}

.floating-chat.is-open .floating-chat__panel {
  display: flex;
}

.floating-chat.is-open .floating-chat__button {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(.92);
}

.floating-chat__head {
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: flex;
  gap: .8rem;
  justify-content: space-between;
  min-width: 0;
  padding: 1rem 1.1rem;
}

.floating-chat__head > div {
  display: grid;
  gap: .12rem;
  min-width: 0;
}

.floating-chat__title {
  color: var(--text);
  cursor: default;
  display: inline-flex;
  min-width: 0;
  font-weight: 900;
  line-height: 1.2;
  overflow: hidden;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-chat__head small {
  color: var(--muted);
  display: block;
  font-size: .78rem;
  line-height: 1.2;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-chat__head small[hidden] {
  display: none;
}

.floating-chat__title.is-link {
  cursor: pointer;
}

.floating-chat__title.is-link:hover {
  color: var(--red);
}

.floating-chat__profile-link {
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  flex: 0 0 auto;
  font-size: .82rem;
  font-weight: 900;
  margin-left: auto;
  min-height: 2rem;
  padding: .45rem .65rem;
  text-decoration: none;
}

.floating-chat__profile-link:hover {
  border-color: var(--red);
  background: rgba(255, 32, 40, .08);
}

.floating-chat__head button {
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  font-weight: 900;
  min-height: 2rem;
  min-width: 2rem;
}

.floating-chat__search {
  display: grid;
  gap: .55rem;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: .85rem 1rem;
}

.floating-chat__search .button {
  width: auto;
}

.floating-chat__search input {
  width: 100%;
  border: 1px solid var(--border);
  background: #050505;
  color: var(--text);
  border-radius: 6px;
  padding: .7rem .8rem;
}

.floating-chat__contacts {
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  display: grid;
  gap: .5rem;
  max-height: min(11rem, 28dvh);
  overflow: auto;
  padding: 0 1rem .85rem;
}

.floating-chat__picker {
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  min-width: 0;
  padding: .85rem 1rem;
}

.floating-chat__picker summary {
  align-items: center;
  background: #050505;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font-weight: 900;
  gap: .75rem;
  justify-content: space-between;
  list-style: none;
  padding: .85rem 1rem;
}

.floating-chat__picker summary span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-chat__picker summary::-webkit-details-marker {
  display: none;
}

.floating-chat__picker summary::after {
  color: var(--muted);
  content: "v";
  font-size: .85rem;
}

.floating-chat__picker[open] summary::after {
  content: "^";
}

.floating-chat__picker .floating-chat__contacts {
  border-bottom: 0;
  max-height: min(14rem, 32dvh);
  overflow: auto;
  padding: .65rem 0 0;
}

.floating-chat__picker--search {
  padding: .75rem 1rem;
}

.floating-chat__picker--search .floating-chat__search {
  padding: .65rem 0 .2rem;
}

.floating-chat__picker--search .floating-chat__contacts {
  max-height: min(15rem, 34dvh);
  padding: .65rem 0 .15rem;
}

.floating-chat__picker--search:not([open]) {
  padding-bottom: .75rem;
}

.floating-chat__head + .floating-chat__contacts {
  padding-top: .85rem;
}

.floating-chat__thread {
  flex: 1 1 auto;
  max-height: none;
  min-height: 0;
  overflow: auto;
  padding: 1rem 1rem 1.1rem;
  scrollbar-gutter: stable;
}

.floating-chat__compose {
  background: rgba(255, 255, 255, .025);
  flex: 0 0 auto;
  padding: .9rem 1rem 1rem;
}

.floating-chat__compose .button {
  width: auto;
}

.floating-chat__compose textarea {
  min-height: 4.6rem;
}

.chat-compose__status {
  color: var(--muted);
  font-size: .82rem;
  grid-column: 1 / -1;
  margin: -.25rem 0 0;
  min-height: 1rem;
}

.chat-compose__status.is-error {
  color: #ff6b6f;
}

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

@media (max-width: 900px) {
  h1 {
    font-size: 3.1rem;
  }

  .auth-card h1 {
    font-size: 3rem;
  }

  .stat-grid,
  .chat-audit-summary,
  .two-column,
  .three-column {
    grid-template-columns: 1fr;
  }

  .chat-audit-filters {
    grid-template-columns: 1fr;
  }

  .client-hero,
  .client-overview-grid,
  .plan-groups,
  .chat-admin-shell {
    grid-template-columns: 1fr;
  }

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

  .page-heading--split {
    flex-direction: column;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: .7rem;
  }

  .topbar__links {
    justify-content: flex-start;
    width: 100%;
  }

  .topbar__identity {
    flex: 0 1 11rem;
    max-width: min(100%, 11rem);
  }
}

@media (max-width: 640px) {
  .auth-shell {
    align-items: start;
    padding: 1rem;
  }

  .auth-shell--with-home {
    padding-top: 4.6rem;
  }

  .auth-home-link {
    left: .75rem;
    right: auto;
    top: .75rem;
  }

  .auth-card {
    padding: 1.15rem;
  }

  .auth-card h1,
  h1 {
    font-size: 2.45rem;
    line-height: 1;
  }

  .page {
    width: min(100% - 1rem, 1240px);
    padding: 1.25rem 0;
  }

  .search-card__head,
  .checklist-row,
  .item-head {
    align-items: stretch;
    flex-direction: column;
  }

  .client-tabs {
    position: static;
  }

  .client-summary-grid {
    grid-template-columns: 1fr;
  }

  .client-hero__actions {
    width: 100%;
  }

  .form-actions,
  .quick-actions,
  .topbar__links {
    width: 100%;
    justify-content: flex-start;
  }

  .button,
  .form-actions .button,
  .quick-actions .button,
  .item-head .button,
  .chat-compose .button {
    width: 100%;
  }

  .chat-compose {
    grid-template-columns: 1fr;
  }

  .chat-bubble {
    max-width: min(86%, 22rem);
    padding: .75rem .85rem;
  }

  .chat-message__meta,
  .chat-message--receipt .chat-message__meta,
  .chat-message:hover .chat-message__meta,
  .chat-message:focus-within .chat-message__meta {
    display: none;
  }

  .chat-message.is-expanded .chat-bubble {
    border-color: rgba(255, 255, 255, .22);
    transform: translateY(-3px);
  }

  .chat-message.is-expanded {
    margin-bottom: .2rem;
  }

  .chat-message.is-expanded .chat-message__meta {
    display: block;
    max-width: min(92%, 23rem);
  }

  .admin-chat-card {
    align-items: stretch;
    flex-direction: column;
  }

  .admin-chat-card .button {
    width: 100%;
  }

  .floating-chat {
    bottom: max(.75rem, env(safe-area-inset-bottom));
    left: .5rem;
    max-width: none;
    right: .5rem;
  }

  .floating-chat__panel {
    bottom: 0;
    left: 0;
    right: 0;
    height: min(40rem, calc(100vh - 1.5rem));
    height: min(40rem, calc(100svh - 1.5rem));
    height: min(40rem, calc(100dvh - 1.5rem));
    max-height: calc(100vh - 1.5rem);
    max-height: calc(100svh - 1.5rem);
    max-height: calc(100dvh - 1.5rem);
    min-height: min(24rem, calc(100dvh - 1.5rem));
    width: 100%;
  }

  .floating-chat__head {
    gap: .5rem;
    padding: .85rem .85rem;
  }

  .floating-chat__profile-link {
    font-size: .78rem;
    padding-inline: .55rem;
  }

  .floating-chat__compose {
    gap: .55rem;
    grid-template-columns: minmax(0, 1fr);
    padding: .75rem;
  }

  .floating-chat__search {
    grid-template-columns: 1fr;
  }

  .floating-chat__compose .button {
    width: 100%;
  }

  .floating-chat__compose textarea {
    min-height: 3.4rem;
  }

  .floating-chat__picker .floating-chat__contacts {
    max-height: min(10rem, 24dvh);
  }

  .floating-chat__thread {
    padding: .75rem .75rem .9rem;
  }

  .topbar__links {
    gap: .5rem;
  }

  .topbar__identity {
    flex: 0 1 9.5rem;
    max-width: min(100%, 9.5rem);
    width: auto;
  }

  .topbar__identity span,
  .topbar__identity em {
    font-size: .66rem;
  }

  .topbar__identity strong {
    font-size: .82rem;
  }
}

@media (max-width: 920px) {
  .topbar {
    align-items: center;
    flex-direction: row;
    gap: .7rem;
    padding: .75rem .85rem;
  }

  .brand {
    font-size: .92rem;
  }

  .topbar__links {
    flex: 1 1 auto;
    justify-content: flex-start;
    width: auto;
  }

  .topbar__links a,
  .topbar__links button {
    font-size: .88rem;
    min-height: 2.25rem;
    padding: .3rem .48rem;
  }

  .topbar__identity {
    flex: 0 1 clamp(6.6rem, 24vw, 9.5rem);
    max-width: clamp(6.6rem, 24vw, 9.5rem);
    min-height: 2.35rem;
    padding: .35rem .55rem;
  }

  .topbar__links--desktop {
    display: none;
  }

  .topbar__menu {
    display: block;
  }

  .topbar__menu-panel .topbar__identity {
    display: inline-grid;
    flex: none;
    max-width: none;
    min-height: 2.5rem;
  }
}

@media (max-width: 480px) {
  .topbar {
    gap: .55rem;
  }

  .brand {
    font-size: .86rem;
  }

  .topbar__links {
    gap: .35rem;
  }

  .topbar__links a,
  .topbar__links button {
    font-size: .82rem;
    padding-inline: .38rem;
  }

  .topbar__identity {
    flex-basis: 6.5rem;
    max-width: 6.5rem;
    min-height: 2.1rem;
    padding: .28rem .45rem;
  }

  .topbar__identity span,
  .topbar__identity em {
    display: none;
  }

  .topbar__identity strong {
    font-size: .78rem;
  }

  .topbar__menu-panel {
    min-width: min(20rem, calc(100vw - 1rem));
    right: -.1rem;
  }

  .topbar__menu-panel .topbar__identity span,
  .topbar__menu-panel .topbar__identity em {
    display: block;
  }
}
