:root {
  --brand: #9d3836;
  --brand-strong: #7f2c2a;
  --brand-soft: color-mix(in srgb, var(--brand) 12%, transparent);
  --background: #f6f7f9;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-muted: #f0f2f5;
  --text: #242326;
  --text-muted: #68676d;
  --border: #dedfe3;
  --input: #d5d7dc;
  --shadow: 0 18px 50px rgba(33, 29, 31, 0.12);
  --success: #16a34a;
  --success-soft: #dcfce7;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
}

:root[data-theme="dark"] {
  --background: #151416;
  --surface: #1d1c1f;
  --surface-raised: #252327;
  --surface-muted: #2b292d;
  --text: #f4f1f2;
  --text-muted: #aaa5ab;
  --border: #3a373c;
  --input: #4a464d;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.34);
  --success-soft: color-mix(in srgb, var(--success) 18%, transparent);
  --warning-soft: color-mix(in srgb, var(--warning) 18%, transparent);
  --danger-soft: color-mix(in srgb, var(--danger) 18%, transparent);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--background);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--text);
  background: var(--background);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.55rem, 3vw, 2rem);
  line-height: 1.2;
  font-weight: 650;
}

h2 {
  font-size: 1.15rem;
  font-weight: 650;
}

h3 {
  font-size: 1rem;
  font-weight: 650;
}

code {
  padding: 0.12rem 0.35rem;
  border-radius: 5px;
  color: var(--brand);
  background: var(--brand-soft);
}

.icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.boot-state,
.loading-state,
.empty-state {
  display: grid;
  min-height: 140px;
  place-items: center;
  color: var(--text-muted);
  text-align: center;
}

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

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  height: 100vh;
  min-width: 0;
  flex-direction: column;
  gap: 22px;
  padding: 18px 12px;
  overflow: hidden;
  border-right: 1px solid var(--border);
  background: var(--surface);
}

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

.brand__logo {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
}

.brand__copy {
  display: grid;
  min-width: 0;
}

.brand__copy strong,
.workspace strong {
  overflow: hidden;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand__copy small,
.workspace small {
  display: block;
  overflow: hidden;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar__toggle {
  width: 26px;
  height: 26px;
  min-height: 26px;
  margin-left: auto;
  padding: 0;
  border-color: transparent;
  opacity: 0.55;
}

.sidebar__toggle:hover,
.sidebar__toggle:focus-visible {
  opacity: 1;
}

.sidebar__toggle .icon {
  width: 14px;
  height: 14px;
}

.sidebar__nav,
.sidebar__footer {
  display: grid;
  gap: 5px;
}

.sidebar__footer {
  margin-top: auto;
}

.nav-item {
  display: flex;
  width: 100%;
  min-width: 0;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
}

.nav-item:hover,
.nav-item:focus-visible,
.nav-item--active {
  color: var(--text);
  background: var(--brand-soft);
}

.nav-item--active {
  color: var(--brand);
}

.nav-item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 26px;
  align-items: center;
  gap: 7px;
  margin-top: 8px;
  padding: 12px 8px 0;
  border-top: 1px solid var(--border);
}

.workspace__icon,
.session-identity__icon {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: var(--radius-sm);
  color: var(--brand);
  background: var(--brand-soft);
}

.workspace__icon--current {
  color: var(--success);
  background: var(--success-soft);
}

.workspace__icon--update {
  color: var(--warning);
  background: var(--warning-soft);
}

.workspace__icon--unknown {
  color: var(--text-muted);
  background: var(--surface-muted);
}

.app-shell--collapsed .sidebar {
  padding-inline: 10px;
}

.app-shell--collapsed .brand__copy,
.app-shell--collapsed .nav-item span,
.app-shell--collapsed .workspace__icon,
.app-shell--collapsed .workspace__copy {
  display: none;
}

.app-shell--collapsed .sidebar__toggle {
  margin-inline: auto;
}

.app-shell--collapsed .brand {
  justify-content: center;
}

.app-shell--collapsed .nav-item {
  justify-content: center;
  padding-inline: 0;
}

.app-shell--collapsed .workspace {
  grid-template-columns: 1fr;
  justify-items: center;
  padding-inline: 0;
}

.mobile-header {
  display: none;
}

.main {
  width: min(100%, 1440px);
  min-width: 0;
  margin-inline: auto;
  padding: 28px clamp(16px, 3vw, 40px) 52px;
}

.main--documentation {
  width: 100%;
  max-width: none;
  height: 100vh;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.documentation-embed {
  width: 100%;
  height: 100%;
  background: var(--surface);
}

.documentation-embed__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--surface);
}

.page-header,
.section__heading,
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-header {
  margin-bottom: 22px;
}

.page-header > div:first-child,
.section__heading > div:first-child {
  min-width: 0;
}

.actions,
.row-actions,
.form-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-raised);
  cursor: pointer;
  font-weight: 550;
  text-decoration: none;
}

.btn:hover,
.btn:focus-visible {
  border-color: color-mix(in srgb, var(--brand) 45%, var(--border));
  background: var(--brand-soft);
  outline: none;
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.tab:focus-visible,
.action-card:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--brand) 28%, transparent);
  outline-offset: 2px;
}

.btn--ghost {
  background: transparent;
}

.btn--icon {
  width: 38px;
  padding-inline: 0;
}

.btn--block {
  width: 100%;
}

.btn--danger {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
  background: var(--danger-soft);
}

.btn--loading {
  cursor: wait;
}

.btn--loading .icon {
  animation: button-spin 0.8s linear infinite;
}

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

.health-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 11px 0;
  overflow-x: auto;
  border-block: 1px solid var(--border);
  white-space: nowrap;
}

.health-bar > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

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

.stat-card,
.section,
.entity-card,
.action-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat-card {
  display: grid;
  gap: 6px;
  padding: 17px;
}

.stat-card--button {
  width: 100%;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.stat-card--button:hover,
.stat-card--button:focus-visible {
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  transform: translateY(-1px);
}

.stat-card--active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
}

.stat-card > span:first-child {
  color: var(--text-muted);
}

.stat-card > strong {
  font-size: 1.7rem;
  line-height: 1.15;
  font-weight: 650;
}

.stat-card .stat-card__status {
  font-size: 1rem;
}

.section {
  padding: clamp(14px, 2vw, 20px);
}

.section + .section {
  margin-top: 16px;
}

.section__heading {
  margin-bottom: 16px;
}

.section__heading p {
  margin-top: 3px;
}

.integration-card {
  margin-bottom: 16px;
}

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

.integration-identifier {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.integration-identifier > div {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.integration-identifier span {
  color: var(--text-muted);
  font-size: .78rem;
}

.integration-identifier strong {
  overflow: hidden;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: .88rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-identifier .btn {
  flex: 0 0 auto;
}

.integration-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: .84rem;
  line-height: 1.45;
}

.integration-note .icon {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--brand);
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 190px;
  gap: 10px;
  margin-bottom: 14px;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.search-field:focus-within {
  border-color: var(--brand);
  outline: 3px solid color-mix(in srgb, var(--brand) 20%, transparent);
}

.search-field input {
  width: 100%;
  min-width: 0;
  padding: 9px 0;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.field input,
.field select,
.field textarea,
.filters select {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-raised);
  resize: vertical;
}

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

.field--compact {
  align-self: end;
}

.field--connection-peer {
  align-content: start;
}

.field-label {
  display: flex;
  min-height: 28px;
  align-items: center;
  gap: 6px;
}

.secret-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px 36px;
  align-items: center;
  gap: 4px;
}

.secret-field > input {
  grid-column: 1;
}

.secret-field > .btn {
  min-height: 36px;
  padding: 7px;
}

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

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

.stack {
  display: grid;
  gap: 18px;
}

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

.switch-field {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.switch-field label {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 10px;
}

.switch-field input {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
}

.switch-field strong {
  font-weight: 500;
}

.info-tooltip {
  position: relative;
  display: inline-grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  padding: 5px;
  place-items: center;
  border: 0;
  color: var(--text-muted);
  background: transparent;
  cursor: help;
}

.info-tooltip .icon {
  width: 17px;
  height: 17px;
}

.info-tooltip::after {
  position: absolute;
  z-index: 90;
  right: 0;
  bottom: calc(100% + 8px);
  width: min(280px, calc(100vw - 40px));
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  content: attr(data-tooltip);
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  transform: translateY(4px);
  transition: 120ms ease;
  visibility: hidden;
}

.info-tooltip:hover::after,
.info-tooltip:focus-visible::after,
.info-tooltip--open::after {
  opacity: 1;
  transform: translateY(0);
  visibility: visible;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

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

.table-actions {
  text-align: right;
}

.destination {
  max-width: 520px;
  overflow-wrap: anywhere;
}

.queue-filters {
  grid-template-columns: minmax(220px, 1fr) minmax(240px, 0.7fr);
}

.queue-name,
.queue-message__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.queue-inspector-controls {
  align-items: end;
  display: flex;
  gap: 14px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.queue-inspector-controls .field {
  min-width: 230px;
}

.page-back {
  margin-bottom: 14px;
}

.queue-name strong {
  overflow-wrap: anywhere;
}

.queue-scope {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.queue-scope span {
  background: color-mix(in srgb, var(--primary) 9%, transparent);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  padding: 2px 7px;
}

.queue-state {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.queue-state > span {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.queue-state--healthy {
  color: var(--success);
}

.queue-state--healthy > span {
  background: var(--success);
}

.queue-state--danger {
  color: var(--danger);
}

.queue-state--danger > span {
  background: var(--danger);
}

.row--selected {
  background: var(--brand-soft);
}

.queue-inspector {
  margin-top: 16px;
}

.queue-messages {
  display: grid;
  gap: 12px;
}

.queue-message {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.queue-message__header {
  margin-bottom: 10px;
}

.queue-message pre {
  max-height: 360px;
  margin: 0;
  overflow: auto;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.redis-browser {
  display: grid;
  grid-template-columns: minmax(250px, 0.8fr) minmax(0, 1.6fr);
  gap: 16px;
  margin-top: 14px;
}

.redis-tree,
.redis-detail {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.redis-tree__toggle {
  min-width: 0;
  flex: 1;
  padding: 6px 4px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text);
  background: transparent;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  text-align: left;
}

.redis-tree__row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.redis-tree__delete {
  flex: 0 0 auto;
  color: var(--danger);
  opacity: 0.68;
}

.redis-tree__count {
  flex: 0 0 auto;
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.redis-tree__delete:hover,
.redis-tree__delete:focus-visible {
  color: var(--danger);
  background: var(--danger-soft);
  opacity: 1;
}

.redis-tree__toggle:hover,
.redis-tree__toggle:focus-visible {
  background: var(--brand-soft);
}

.redis-tree__arrow {
  width: 12px;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  transform: rotate(0deg);
  transition: transform 120ms ease;
}

.redis-tree__toggle[aria-expanded="true"] .redis-tree__arrow {
  transform: rotate(90deg);
}

.redis-tree__children {
  display: grid;
  gap: 3px;
  padding-left: 20px;
}

.redis-tree__loading {
  padding: 6px 8px;
  color: var(--text-muted);
  font-size: 12px;
}

.field-help {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin: -2px 0 2px;
}

.redis-key {
  padding: 6px 8px;
  overflow-wrap: anywhere;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.redis-key:hover,
.redis-key:focus-visible,
.redis-key--active {
  color: var(--text);
  background: var(--brand-soft);
}

.redis-detail pre,
.redis-query-result {
  max-height: 460px;
  margin: 12px 0 0;
  padding: 14px;
  overflow: auto;
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.redis-query-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.4fr) minmax(240px, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.session-identity {
  display: grid;
  grid-template-columns: 34px minmax(150px, 1fr);
  align-items: center;
  gap: 10px;
}

.session-identity > span:last-child {
  display: grid;
}

.session-identity small {
  font-variant-numeric: tabular-nums;
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  font-weight: 550;
}

.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

.status--online {
  color: var(--success);
}

.status--warning {
  color: var(--warning);
}

.status--danger {
  color: var(--danger);
}

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

.auto-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.legacy-label {
  color: var(--warning);
  font-size: 0.78rem;
  font-weight: 600;
}

.legacy-migration {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-color: color-mix(in srgb, var(--warning) 40%, var(--border));
  background: var(--warning-soft);
}

.legacy-migration p {
  max-width: 720px;
  margin-top: 6px;
}

.session-header__title {
  display: flex;
  min-width: 0;
  align-items: flex-start;
  gap: 10px;
}

.session-header__title .muted {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 5px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding-bottom: 7px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 0 0 auto;
  padding: 8px 11px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
}

.tab:hover,
.tab--active {
  color: var(--text);
  background: var(--brand-soft);
}

.tab--active {
  border-color: color-mix(in srgb, var(--brand) 35%, var(--border));
  color: var(--brand);
}

.voip-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--text-muted);
  background: var(--surface-muted);
  font-size: 0.78rem;
  font-weight: 650;
  white-space: nowrap;
}

.voip-badge--success {
  color: var(--success);
  background: var(--success-soft);
}

.voip-badge--warning {
  color: var(--warning);
  background: var(--warning-soft);
}

.voip-overview-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.voip-summary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 8px;
  border-bottom: 1px solid var(--border);
}

.voip-large-number {
  font-size: 2rem;
  color: var(--brand);
}

.voip-editor-form .wide,
.voip-editor-form > .form-actions {
  grid-column: 1 / -1;
}

.voip-line-group-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 14px 18px;
}

.voip-line-group-grid > .wide {
  grid-column: 1 / -1;
}

.voip-line-group-grid > .field,
.voip-line-group-grid > .voip-option-field {
  align-self: start;
}

.voip-routing-choice {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.voip-routing-choice > .muted {
  margin: 0;
  font-size: .85rem;
}

.voip-routing-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.voip-routing-summary > div {
  display: grid;
  gap: 4px;
}

.voip-routing-summary > div span {
  color: var(--muted);
}

.voip-routing-summary > p {
  grid-column: 1 / -1;
  margin: 0;
}

.voip-option-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.voip-option-field legend {
  margin-bottom: 6px;
}

.voip-option-picker {
  display: grid;
  gap: 8px;
}

.voip-option-picker__list {
  max-height: 190px;
  overflow: auto;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
}

.voip-option-field--single .voip-option-picker__list {
  max-height: 128px;
}

.voip-searchable-dropdown {
  position: relative;
  min-width: 0;
}

.voip-searchable-dropdown > summary {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-raised);
  cursor: pointer;
  list-style: none;
}

.voip-searchable-dropdown > summary::-webkit-details-marker {
  display: none;
}

.voip-searchable-dropdown[open] > summary,
.voip-searchable-dropdown > summary:focus-visible {
  border-color: var(--brand);
  outline: 3px solid color-mix(in srgb, var(--brand) 20%, transparent);
}

.voip-searchable-dropdown__chevron {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 120ms ease;
}

.voip-searchable-dropdown[open] .voip-searchable-dropdown__chevron {
  transform: translateY(2px) rotate(225deg);
}

.voip-searchable-dropdown__panel {
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  right: 0;
  left: 0;
  padding: 8px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.voip-searchable-dropdown .voip-option-picker__list {
  max-height: 210px;
}

.voip-searchable-dropdown .voip-option-picker__option input[type="radio"] {
  position: absolute;
  width: 1px;
  min-width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.voip-option-picker__check {
  margin-left: auto;
  color: var(--brand);
  font-size: 1rem;
  font-weight: 800;
  opacity: 0;
}

.voip-option-picker__option:has(input:checked) .voip-option-picker__check {
  opacity: 1;
}

.voip-searchable-dropdown .voip-option-picker__option:focus-within {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.voip-option-picker__option {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--text);
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}

.voip-option-picker__option:last-of-type {
  border-bottom: 0;
}

.voip-option-picker__option:hover {
  background: var(--surface-muted);
}

.voip-option-picker__option:has(input:checked) {
  background: color-mix(in srgb, var(--brand) 12%, var(--surface-raised));
}

.voip-option-picker__option input {
  width: 16px;
  min-width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  accent-color: var(--brand);
}

.voip-option-picker__empty {
  margin: 0;
  padding: 12px;
}

.voip-searchable-dropdown__panel--members {
  min-width: min(620px, calc(100vw - 64px));
}

.voip-membership-option {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  cursor: default;
}

.voip-membership-option__identity {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  cursor: pointer;
}

.voip-membership-option__identity > span {
  display: grid;
  min-width: 0;
}

.voip-membership-option__identity small {
  color: var(--muted);
}

.voip-membership-option__distance {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .82rem;
}

.voip-membership-option__distance input {
  width: 68px;
  min-width: 68px;
  height: 34px;
  padding: 5px 8px;
}

.voip-group-distance[hidden],
.voip-membership-option__distance[hidden] {
  display: none;
}

.voip-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding-top: 22px;
}

.voip-sip-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.voip-sip-mode legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.voip-sip-mode__option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  cursor: pointer;
}

.voip-sip-mode__option:has(input:checked) {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand) 16%, transparent);
}

.voip-sip-mode__option span {
  display: grid;
  gap: 4px;
}

.voip-sip-mode__option small {
  color: var(--text-muted);
  line-height: 1.35;
}

.voip-recording-actions {
  display: grid;
  min-width: 250px;
  gap: 8px;
}

.voip-audio {
  width: min(100%, 340px);
  height: 36px;
}

select[multiple] {
  min-height: 120px;
}

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

.action-card {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px;
  color: var(--text);
  cursor: pointer;
  text-align: left;
}

.action-card:hover {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--border));
  background: var(--brand-soft);
}

.action-card > .icon {
  width: 21px;
  height: 21px;
  color: var(--brand);
}

.action-card span {
  display: grid;
  min-width: 0;
}

.action-card--danger > .icon,
.action-card--danger strong {
  color: var(--danger);
}

.entity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 12px;
}

.entity-search {
  width: min(100%, 520px);
  margin-bottom: 16px;
}

.entity-search-hint {
  margin: -10px 0 16px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.entity-card {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 14px;
}

.entity-card__body {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.entity-card__body > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entity-card__username {
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 600;
}

.entity-card__actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 7px;
  overflow: visible;
}

.entity-card__actions .btn {
  width: 32px;
  height: 32px;
}

.avatar {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: var(--brand);
  background: var(--brand-soft);
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar .icon {
  width: 24px;
  height: 24px;
}

.avatar--group {
  border-radius: var(--radius);
}

.load-more {
  display: flex;
  justify-content: center;
  margin-top: 16px;
}

.inline-error,
.form-error {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--danger);
  background: var(--danger-soft);
}

.form-error {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hint {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: var(--surface-muted);
}

.modal-backdrop {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
  background: color-mix(in srgb, #000 48%, transparent);
}

.modal {
  width: min(100%, 560px);
  max-height: calc(100vh - 36px);
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
}

.modal--wide {
  width: min(100%, 880px);
}

.modal__header {
  position: sticky;
  top: 0;
  z-index: 2;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-raised);
}

.modal__body {
  padding: 18px;
}

.mobile-removal { display: grid; gap: 18px; }
.mobile-removal p { margin: 0; line-height: 1.6; }
.mobile-removal__device { display: grid; gap: 4px; overflow-wrap: anywhere; }
.mobile-removal__device span { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.mobile-removal__warning { display: grid; gap: 10px; padding: 16px; border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)); border-radius: var(--radius); background: var(--danger-soft); }
.mobile-removal__note, .mobile-removal .field small { color: var(--text-muted); font-size: 12px; font-weight: 400; }
.mobile-removal .field { margin: 0; }
.mobile-removal__checks { display: grid; gap: 14px; }
.mobile-removal__checks label { display: flex; align-items: flex-start; gap: 10px; line-height: 1.6; cursor: pointer; }
.mobile-removal__checks input { flex: 0 0 auto; margin-top: 4px; accent-color: var(--danger); }
.mobile-removal__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }
.mobile-removal__actions .btn { white-space: normal; }
@media (max-width: 420px) { .mobile-removal__actions .btn { width: 100%; } }

.mobile-overview {
  display: grid;
  gap: 18px;
}

.mobile-overview p { margin: 0; line-height: 1.6; color: var(--text-muted); }
.mobile-overview h3 { margin: 0; font-size: 14px; }
.mobile-overview__identity,
.mobile-overview__status,
.mobile-overview__danger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.mobile-overview__identity h3 { font-size: 17px; overflow-wrap: anywhere; }
.mobile-overview__identity p { margin-top: 4px; font-variant-numeric: tabular-nums; }
.mobile-overview__tag { padding: 5px 10px; border-radius: 20px; background: var(--surface-muted); color: var(--text-muted); font-size: 12px; }
.mobile-overview__section { display: grid; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }

/* Dashboard spacing is independent of the sections used inside modals. */
.dashboard-layout { display: grid; gap: 20px; min-width: 0; }
.dashboard-layout > .page-header,
.dashboard-layout > .health-bar,
.dashboard-layout > .stats,
.dashboard-layout > .section { margin: 0; }
.dashboard-layout > .section + .section { margin-top: 0; }
.dashboard-layout .stat-card { padding: 18px 22px; gap: 6px; }
.dashboard-refresh { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 4px; }
.dashboard-refresh p { margin: 0; font-size: 13px; }
.dashboard-refresh .auto-refresh { font-size: 12px; }
.dashboard-refresh .btn { min-height: 36px; padding: 8px 12px; }
.dashboard-badge { display: inline-flex; vertical-align: middle; padding: 4px 8px; margin-left: 8px; border: 1px solid var(--border); border-radius: 999px; font-size: 11px; font-weight: 500; color: var(--text-muted); }
.mobile-device-section .row-actions { gap: 8px; flex-wrap: wrap; }
.mobile-device-section .row-actions .btn { min-height: 36px; padding: 8px 10px; font-size: 13px; }
.mobile-device-section .session-identity strong { overflow-wrap: anywhere; }
.dashboard-layout > .mobile-overview__section { padding: 20px; }
@media (max-width: 760px) {
  .dashboard-layout { gap: 16px; }
  .dashboard-refresh { align-items: flex-start; flex-direction: column; gap: 10px; }
  .dashboard-refresh .actions { width: 100%; justify-content: space-between; }
  .mobile-device-section .row-actions { min-width: 180px; }
}
.mobile-overview__registration { display: grid; gap: 14px; }
.mobile-overview__status { padding-bottom: 12px; border-bottom: 1px solid var(--border); }
.mobile-overview__status p { color: var(--text); font-weight: 600; flex: 1 1 180px; }
.mobile-overview__registration form { display: grid; gap: 12px; padding-top: 14px; border-top: 1px solid var(--border); }
.mobile-overview__registration form > label:not(.field) { display: flex; align-items: flex-start; gap: 9px; line-height: 1.6; color: var(--text-muted); }
.mobile-overview input[type="checkbox"] { flex: 0 0 auto; margin-top: 4px; accent-color: var(--brand); }
.mobile-overview .field { margin: 0; }
.mobile-overview .field small { color: var(--text-muted); font-weight: 400; }
.mobile-overview__verify input { letter-spacing: .25em; font-variant-numeric: tabular-nums; }
.mobile-overview .btn { white-space: normal; max-width: 100%; }
.mobile-overview__registration > .btn,
.mobile-overview__registration form > .btn { justify-self: start; }
.mobile-overview__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.mobile-overview__notes { font-size: 12px; color: var(--text-muted); }
.mobile-overview__notes summary { cursor: pointer; }
.mobile-overview__notes p { margin-top: 10px; }
.mobile-overview__danger { padding-top: 16px; border-top: 1px solid var(--border); }
.mobile-overview__danger > div { flex: 1 1 260px; }
.mobile-overview__danger p { font-size: 12px; margin-top: 4px; }
.mobile-overview__danger .btn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
@media (max-width: 520px) {
  .mobile-overview__section { padding: 12px; }
  .mobile-overview__actions, .mobile-overview__actions .btn { width: 100%; }
  .mobile-overview__registration form > .btn { width: 100%; }
}

.connection-layout {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(240px, 1.2fr);
  gap: 22px;
  align-items: center;
}

.qr-box {
  display: grid;
  width: 100%;
  max-width: 300px;
  aspect-ratio: 1;
  place-items: center;
  margin-inline: auto;
  overflow: hidden;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface-muted);
}

.qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-placeholder,
.pairing-code {
  display: grid;
  place-items: center;
  gap: 9px;
  color: var(--text-muted);
  text-align: center;
}

.qr-placeholder .icon {
  width: 28px;
  height: 28px;
}

.pairing-code strong {
  color: var(--text);
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  letter-spacing: 0.12em;
}

.details-list {
  display: grid;
  margin: 0;
}

.details-list > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

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

.details-list dd {
  margin: 0;
  text-align: right;
}

.toast {
  position: fixed;
  z-index: 150;
  right: 18px;
  bottom: 18px;
  max-width: min(380px, calc(100vw - 36px));
  padding: 12px 15px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  background: var(--surface-raised);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast .icon {
  flex: 0 0 auto;
}

.toast--success {
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
  color: var(--success);
  background: color-mix(in srgb, var(--success-soft) 55%, var(--surface-raised));
}

.toast--error {
  border-color: color-mix(in srgb, var(--danger) 45%, var(--border));
  color: var(--danger);
  background: color-mix(in srgb, var(--danger-soft) 55%, var(--surface-raised));
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 15% 20%, var(--brand-soft), transparent 32%),
    var(--background);
}

.login-panel {
  display: grid;
  width: min(100%, 420px);
  gap: 24px;
  padding: clamp(22px, 5vw, 36px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.login-brand {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 11px;
  padding: 8px 14px 8px 8px;
  border-radius: var(--radius);
  color: #fff;
  background: #1d1c1f;
}

.login-brand__icon {
  width: 42px;
  height: 42px;
}

.login-brand strong {
  color: #fff;
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

@media (max-width: 900px) {
  .app-shell,
  .app-shell--collapsed {
    grid-template-columns: 1fr;
    padding-top: 62px;
  }

  .mobile-header {
    position: fixed;
    z-index: 40;
    top: 0;
    right: 0;
    left: 0;
    display: flex;
    height: 62px;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
  }

  .mobile-header .brand__logo {
    width: 34px;
    height: 34px;
  }

  .sidebar {
    position: fixed;
    z-index: 60;
    width: min(290px, calc(100vw - 48px));
    transform: translateX(-105%);
    transition: transform 180ms ease;
    box-shadow: var(--shadow);
  }

  .app-shell--mobile-open .sidebar {
    transform: translateX(0);
  }

  .app-shell--collapsed .brand__logo,
  .app-shell--collapsed .brand__copy,
  .app-shell--collapsed .nav-item span,
  .app-shell--collapsed .workspace__icon,
  .app-shell--collapsed .workspace__copy {
    display: initial;
  }

  .app-shell--collapsed .brand__copy,
  .app-shell--collapsed .workspace__copy {
    display: grid;
  }

  .app-shell--collapsed .nav-item {
    justify-content: flex-start;
    padding-inline: 10px;
  }

  .app-shell--collapsed .workspace {
    grid-template-columns: 32px minmax(0, 1fr);
    justify-items: stretch;
    padding-inline: 8px;
  }

  .sidebar__toggle {
    display: none;
  }

  .main {
    padding: 22px 14px 42px;
  }

  .main--documentation {
    height: calc(100vh - 62px);
    padding: 0;
  }

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

@media (max-width: 640px) {
  .voip-sip-mode {
    grid-template-columns: 1fr;
  }

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

  .queue-message__header {
    align-items: flex-start;
    flex-direction: column;
  }

  .redis-browser,
  .redis-query-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .page-header,
  .section__heading,
  .legacy-migration {
    align-items: stretch;
    flex-direction: column;
  }

  .page-header .actions,
  .section__heading .actions {
    justify-content: stretch;
  }

  .page-header .actions .btn:not(.btn--icon),
  .section__heading .actions .btn:not(.btn--icon) {
    flex: 1 1 150px;
  }

  .stats,
  .filters,
  .integration-identifiers,
  .form-grid,
  .form-grid--three,
  .voip-line-group-grid,
  .voip-routing-summary,
  .switch-grid,
  .connection-layout {
    grid-template-columns: 1fr;
  }

  .voip-line-group-grid > .wide {
    grid-column: auto;
  }

  .voip-routing-summary > p {
    grid-column: auto;
  }

  .field--wide {
    grid-column: auto;
  }

  .section {
    padding: 14px;
  }

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

  .row-actions .btn:not(.btn--icon) {
    min-width: 0;
  }

  .modal-backdrop {
    align-items: end;
    padding: 0;
  }

  .modal,
  .modal--wide {
    width: 100%;
    max-height: 94vh;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .form-actions .btn {
    flex: 1 1 160px;
  }

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

.companions-panel { display: grid; gap: 20px; }
.companions-panel p, .companions-panel h2, .companions-panel h3 { margin: 0; }
.companions-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.companions-heading > div { display: grid; gap: 6px; }
.companions-panel .btn { flex-shrink: 0; width: auto; min-height: 42px; white-space: nowrap; }
.companions-status, .companions-note { font-size: 12px; line-height: 1.6; }
.companions-list { margin: 0; padding: 0; list-style: none; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.companion-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, .55fr) auto; align-items: center; gap: 24px; padding: 20px; }
.companion-row + .companion-row { border-top: 1px solid var(--border); }
.companion-identity, .companion-date { display: grid; gap: 6px; min-width: 0; }
.companion-identity span { font-size: 12px; overflow-wrap: anywhere; }
.companion-date > .muted { font-size: 12px; }
.companions-empty { padding: 24px; background: var(--surface-muted); border-radius: var(--radius); }
.companion-pairing { display: grid; gap: 14px; padding: 24px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); }
.companion-code-form { display: flex; align-items: flex-end; gap: 12px; margin-top: 4px; }
.companion-code-form label { display: grid; gap: 8px; width: 280px; max-width: 100%; font-weight: 500; }
.companion-code-form input { height: 46px; letter-spacing: .1em; text-transform: uppercase; }
.companion-code-form .btn { min-height: 46px; }
.companion-history { border-top: 1px solid var(--border); padding-top: 18px; }
.companion-history summary { cursor: pointer; font-weight: 500; line-height: 1.6; }
.companion-history p { padding-top: 12px; line-height: 1.7; max-width: 900px; }
@media (max-width: 640px) {
  .companions-heading { align-items: flex-start; flex-direction: column; }
  .companion-row { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px; }
  .companion-row .btn { justify-self: start; }
  .companion-pairing { padding: 16px; }
  .companion-code-form { flex-direction: column; align-items: stretch; }
  .companion-code-form label { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
/* Own WhatsApp profile: reuse panel fields and buttons, with responsive sections. */
.profile-editor { border: 0; padding: 0; margin: 0; min-width: 0; }
.profile-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 24px; }
.profile-editor .stack { align-content: start; }
.profile-images { max-width: 720px; width: 100%; margin: 20px auto 28px; }
.profile-cover { position: relative; height: clamp(180px, 28vw, 300px); border-radius: var(--radius-sm); background: var(--background); }
.profile-cover-preview { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-sm); }
.profile-cover-empty { display: grid; place-items: center; height: 100%; padding: 60px 20px; text-align: center; }
.profile-cover > .profile-image-actions { position: absolute; right: 16px; top: 16px; }
.profile-photo { position: relative; display: flex; flex-direction: column; align-items: center; margin-top: -76px; }
.profile-images--personal .profile-photo { margin-top: 0; }
.profile-avatar { width: 164px; height: 164px; border: 6px solid var(--surface); border-radius: 50%; object-fit: cover; background: var(--surface); }
.profile-avatar--empty { display: grid; place-items: center; color: var(--text-muted); }
.profile-image-edit { display: inline-flex; align-items: center; gap: 8px; border-radius: 999px; padding: 10px 20px; background: var(--surface); }
.profile-photo > .profile-image-actions { margin-top: -14px; z-index: 2; }
.profile-image-actions { position: relative; }
.profile-image-menu { position: absolute; top: calc(100% + 6px); right: 0; width: 200px; padding: 8px; background: var(--surface-raised); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); z-index: 5; }
.profile-image-menu[hidden] { display: none; }
.profile-image-menu a, .profile-image-menu button { display: block; width: 100%; padding: 10px 12px; text-align: left; background: none; border: 0; color: var(--text); text-decoration: none; border-radius: var(--radius-sm); cursor: pointer; }
.profile-image-menu a:hover, .profile-image-menu button:hover { background: var(--surface-muted); }
.profile-image-menu button:disabled { opacity: .45; cursor: not-allowed; }
.profile-image-menu hr { border: 0; border-top: 1px solid var(--border); }
.profile-image-form[hidden] { display: none; }
.profile-editor [data-profile-panel][hidden] { display: none; }
.profile-map-canvas { height: 360px; width: 100%; border-radius: var(--radius-sm); margin-top: 12px; }
.profile-map-static { display: block; width: 100%; max-width: 640px; height: auto; border-radius: var(--radius-sm); }
.profile-location { width: 100%; max-width: 760px; margin: 16px auto; }
.profile-location [data-map-static] { display: flex; justify-content: center; }
.profile-location-actions { justify-content: center; flex-wrap: wrap; }
[data-profile-map] [hidden] { display: none !important; }
[data-map-search] gmp-place-autocomplete { width: 100%; color-scheme: normal; }
.profile-hours { align-items: end; }
.profile-hours-days { max-width: 720px; width: 100%; }
.profile-hours-day { padding: 18px 0; border-bottom: 1px solid var(--border); }
.profile-hours-times { max-width: 400px; }
.profile-hours-times[hidden], [data-hours-description][hidden] { display: none; }
.profile-day-switch { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.profile-day-switch input { appearance: none; width: 42px; height: 24px; border-radius: 99px; background: var(--surface-muted); border: 1px solid var(--border); position: relative; cursor: pointer; }
.profile-day-switch input::after { content: ''; position: absolute; width: 16px; height: 16px; top: 3px; left: 3px; border-radius: 50%; background: var(--text-muted); }
.profile-day-switch input:checked { background: var(--brand); }
.profile-day-switch input:checked::after { left: 21px; background: white; }
.profile-editor .field { margin: 0; }
.profile-editor .field-help { color: var(--text-muted); font-weight: 400; }
.profile-editor input[type="file"] { overflow: hidden; }
.privacy-list-dialog { width: min(560px, calc(100vw - 32px)); max-height: 85vh; overflow: auto; padding: 24px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface, #242224); color: var(--text, #eee); }
.privacy-list-dialog::backdrop { background: rgb(0 0 0 / 65%); }
.privacy-list-dialog textarea { width: 100%; box-sizing: border-box; }
@media (max-width: 700px) { .profile-summary, .profile-hours { grid-template-columns: 1fr; } }

/* Passive session message viewer: bounded columns, independent scrolling. */
.session-messages { display: grid; grid-template-columns: minmax(250px, 32%) minmax(0, 1fr); height: min(760px, 78vh); min-height: 460px; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.message-sidebar, .message-thread { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.message-sidebar { border-right: 1px solid var(--border); gap: 10px; padding: 14px; }
.session-messages header { display: flex; align-items: center; gap: 10px; padding: 12px; border-bottom: 1px solid var(--border); }
.message-sidebar header { padding: 0 0 10px; }
.message-sidebar header strong { flex: 1; }
.message-sidebar select { width: 100%; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; }
.message-thread header small { display: block; }
.message-conversations { flex: 1; overflow: auto; min-height: 0; }
.message-conversation { display: flex; gap: 10px; align-items: center; width: 100%; padding: 14px 8px; text-align: left; color: var(--text); background: transparent; border: 0; border-radius: var(--radius-sm); cursor: pointer; }
.message-conversation:hover, .message-conversation.is-selected { background: var(--brand-soft); }
.message-avatar { display: grid; place-items: center; flex: 0 0 38px; height: 38px; border-radius: 50%; background: var(--surface-muted); color: var(--text-muted); }
.message-conversation__text { flex: 1; min-width: 0; }
.message-conversation__text strong, .message-conversation__text small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-conversation small, .message-conversation time { font-size: 12px; color: var(--text-muted); }
.message-history { flex: 1; overflow: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 20px; background: var(--background); min-height: 0; overscroll-behavior: contain; }
.message-bubble { max-width: 82%; padding: 10px 14px; border: 1px solid var(--border); background: var(--surface-raised); border-radius: 14px 14px 14px 4px; overflow-wrap: anywhere; flex-shrink: 0; }
.message-bubble--out { align-self: flex-end; border-radius: 14px 14px 4px 14px; background: var(--brand-soft); }
.message-bubble--notice { color: var(--text-muted); font-style: italic; }
.message-text { white-space: pre-wrap; }
.message-contact { padding: 8px; margin-top: 8px; border-left: 3px solid var(--brand); background: var(--surface-muted); border-radius: 6px; }
.message-contact small { display: block; color: var(--text-muted); }
.message-interactive-label { display: inline-block; margin-top: 8px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; }
.message-bubble footer { display: flex; gap: 8px; justify-content: flex-end; align-items: center; font-size: 11px; color: var(--text-muted); margin-top: 5px; }
.message-reply { border: 0; color: var(--text-muted); background: transparent; cursor: pointer; font-size: 11px; }
.message-bubble blockquote { margin: 0 0 8px; padding: 6px 10px; border-left: 3px solid var(--brand); background: var(--surface-muted); font-size: 12px; }
.message-sender { display: block; font-size: 12px; color: var(--brand); }
.message-media { display: block; max-width: 100%; max-height: 320px; border-radius: 8px; }
.message-bubble audio { max-width: 100%; }
.message-date, .message-older { align-self: center; font-size: 12px; color: var(--text-muted); }
.message-composer { border-top: 1px solid var(--border); padding: 12px; }
.message-composer__row { display: flex; gap: 8px; align-items: center; }
.message-composer textarea { flex: 1; min-width: 0; max-height: 160px; resize: vertical; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.message-composer__context { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; padding: 8px; background: var(--surface-muted); border-radius: 8px; overflow-wrap: anywhere; }
.message-composer__context img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; }
.message-composer__context video { max-width: 160px; max-height: 80px; }
.message-composer__context audio { max-width: 160px; }
.message-composer__context .btn { margin-left: auto; }
.message-new { padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
.message-new input { width: 100%; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 9px; margin-bottom: 8px; }
.message-back { display: none; }
@media (max-width: 700px) {
  .session-messages { display: flex; height: calc(100dvh - 100px); min-height: 360px; border-radius: 12px; scroll-margin-top: 76px; }
  .message-sidebar, .message-thread { width: 100%; }
  .message-thread { display: none; }
  .session-messages.has-conversation .message-sidebar { display: none; }
  .session-messages.has-conversation .message-thread { display: flex; }
  .message-back { display: inline-flex; }
  .message-history { padding: 12px; }
  .message-bubble { max-width: 90%; }
  .message-composer__row .btn { padding: 8px; }
}
.message-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.message-quote { display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 8px 10px; margin-bottom: 6px; border: 0; border-left: 3px solid var(--brand); border-radius: 4px; background: var(--surface); color: inherit; text-align: left; cursor: pointer; }
.message-quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.message-delivery { margin-left: 5px; font-size: 14px; }
.message-delivery.is-read { color: #53bdeb; }
