@import url('./playground.css');
@import url('./composer.css');
@import url('./owner.css');
.results-tabs {
  margin-bottom: 16px;
}
.results-tabs [aria-pressed='true'] {
  background: var(--soft);
  border-color: var(--accent);
}
.results-filter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px 16px;
}
.results-filter-grid label {
  min-width: 0;
}
.results-filter-grid select {
  width: 100%;
  text-overflow: ellipsis;
}
.results-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.results-metrics h2 {
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
}
.results-value {
  font-size: 30px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin: 10px 0;
}
.results-table td:not(:first-child),
.results-table th:not(:first-child) {
  padding-inline: 8px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.results-table th[scope='row'] {
  max-width: 320px;
  min-width: 180px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  padding: 12px 14px;
  border-block: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 8px 0 0 8px;
}
.results-table small {
  display: block;
  color: var(--muted);
  white-space: normal;
}
.results-context {
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  background: var(--soft);
}
.results-empty {
  padding: 24px 8px;
  text-align: left;
  white-space: normal;
}
#campaign-results {
  min-width: 0;
}
.connection-checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}
.connection-checklist li {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 8px;
  font-size: 13px;
}
.connection-requirements {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 8px;
  font-size: 13px;
}
#connections-panel > .grid > section {
  align-content: start;
}
#connections-panel article + article {
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
@media (max-width: 1100px) {
  .results-filter-grid,
  .results-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .results-filter-grid,
  .results-metrics {
    grid-template-columns: minmax(0, 1fr);
  }
  .results-tabs button {
    width: 100%;
  }
}
:root {
  --workspace-gap: 16px;
  --nav-width: 256px;
  --nav-rail: 72px;
  font-family: 'Segoe UI', system-ui, sans-serif;
  color-scheme: light;
  --bg: #f2f3f5;
  --surface: #fff;
  --soft: #f6f7f9;
  --text: #24262a;
  --muted: #626875;
  --line: #dce0e6;
  --accent: #30343c;
  --on-accent: #fff;
  --sidebar: #e1e3e8;
  --sidebar-text: #272b33;
  --ok: #216447;
  --warn: #865318;
  --danger: #a53038;
  --gap: 16px;
  line-height: 1.4;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
}

.crm-inbox-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.crm-page-head {
  margin-bottom: 12px;
  align-items: center;
}
.crm-page-head > .help {
  text-align: right;
}
.crm-actions-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 16px;
}
.crm-actions-toolbar button.small {
  min-height: 36px;
  white-space: nowrap;
  padding-inline: 7px;
}
.crm-actions-toolbar #new-conversation {
  margin-left: auto;
}
@media (max-width: 600px) {
  .crm-page-head > .help {
    text-align: left;
  }
  .crm-actions-toolbar button.small {
    min-height: 44px;
  }
  .crm-actions-toolbar #new-conversation {
    margin-left: 0;
  }
}
.crm-inbox-main {
  min-width: 0;
  container-type: inline-size;
}
.crm-navigation {
  padding: 12px 8px;
  border: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
  border-radius: 14px;
  background: color-mix(in srgb, var(--soft) 80%, var(--surface));
}
.crm-inbox-layout.navigation-hidden {
  grid-template-columns: 56px minmax(0, 1fr);
}
.crm-channel-rail {
  position: relative;
  z-index: 2;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--soft);
}
.crm-channel-rail nav {
  display: grid;
  gap: 4px;
  overflow: visible;
}
.crm-channel-rail nav button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 44px;
  padding: 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
}
.crm-channel-rail nav button[aria-pressed='true'],
.crm-channel-rail nav button:hover {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
}
.crm-channel-tooltip {
  display: none;
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  white-space: nowrap;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 4px 12px #00000014;
  pointer-events: none;
}
.crm-channel-rail button:hover .crm-channel-tooltip,
.crm-channel-rail button:focus .crm-channel-tooltip {
  display: block;
}
@media (max-width: 600px) {
  .crm-inbox-layout.navigation-hidden {
    grid-template-columns: minmax(0, 1fr);
  }
  .crm-channel-rail {
    justify-self: start;
  }
  .crm-channel-rail nav {
    display: flex;
    flex-wrap: wrap;
  }
  .crm-channel-tooltip {
    left: 0;
    top: calc(100% + 8px);
    transform: none;
  }
}
.crm-navigation-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.crm-navigation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.crm-navigation-heading h2 {
  margin: 0 8px;
  font-size: 14px;
}
.crm-navigation-heading .icon-btn {
  width: 30px;
  height: 30px;
  padding: 6px;
  border: 0;
  background: transparent;
}
.crm-navigation h2 {
  font-size: 16px;
  margin: 0 8px 16px;
}
.crm-navigation h3 {
  font-size: 12px;
  color: var(--muted);
  margin: 20px 10px 6px;
}
.crm-navigation nav {
  display: grid;
  gap: 2px;
}
.crm-navigation nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  border-color: transparent;
  background: transparent;
  text-align: left;
  min-height: 36px;
  width: 100%;
  overflow-wrap: anywhere;
  border-radius: 8px;
  padding: 7px 10px;
}
.crm-navigation nav button svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.8;
}
.crm-navigation nav button[aria-pressed='true'] {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-color: transparent;
  color: var(--accent);
  font-weight: 600;
}
.crm-navigation nav button:hover {
  background: var(--surface);
}
.crm-navigation > .help {
  margin-top: 16px;
  font-size: 12px;
}
@container (max-width:1000px) {
  .crm-inbox-main .crm-workspace {
    display: grid;
    height: auto;
    grid-template-columns: var(--inbox-left) 16px minmax(0, 1fr);
  }
  .crm-inbox-main .crm-thread {
    min-height: 620px;
  }
  .crm-inbox-main .crm-list {
    width: 100%;
  }
  .crm-inbox-main .crm-workspace.hide-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .crm-inbox-main .crm-client {
    grid-column: 1/-1;
    width: 100%;
    max-height: 460px;
  }
  .crm-inbox-main .crm-resize.right {
    display: none;
  }
}
@container (max-width:650px) {
  .crm-inbox-main .crm-workspace {
    display: flex;
    flex-direction: column;
    height: auto;
  }
  .crm-inbox-main .crm-list {
    width: 100%;
    max-height: 380px;
  }
  .crm-inbox-main .crm-resize {
    display: none;
  }
}
@media (max-width: 900px) {
  .crm-inbox-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .crm-navigation {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
  }
  .crm-navigation h2,
  .crm-navigation-heading,
  .crm-navigation h3,
  .crm-navigation > .help {
    grid-column: 1/-1;
    margin: 0;
  }
  .crm-navigation nav {
    grid-column: 1/-1;
    display: flex;
    flex-wrap: wrap;
  }
  .crm-navigation nav button {
    width: auto;
    min-height: 44px;
  }
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea,
summary {
  outline-offset: 3px;
}
*:focus-visible {
  outline: 2px solid var(--link, var(--text));
}
button {
  min-height: var(--control-height, 40px);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  background: var(--surface);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-weight: 600;
}
button:hover {
  background: var(--soft);
  border-color: var(--muted);
}
button:disabled {
  color: var(--muted);
  background: var(--soft);
  border-color: var(--line);
  opacity: 1;
  cursor: not-allowed;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
button.primary:hover {
  filter: brightness(0.9);
}
button.ghost {
  background: transparent;
  border-color: transparent;
}
button.danger {
  color: var(--danger);
}
button.small {
  padding: 5px 10px;
  min-height: 32px;
  font-size: 12px;
}
svg {
  width: 18px;
  height: 18px;
  flex: none;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.6px;
  line-height: 1.3;
}
h2 {
  font-size: 17px;
  font-weight: 650;
}
h3 {
  font-size: 14px;
  font-weight: 650;
}
p {
  max-width: 72ch;
}
a {
  color: var(--link, var(--text));
  text-underline-offset: 4px;
}
input,
select,
textarea {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px 12px;
  width: 100%;
  min-width: 0;
  min-height: 40px;
  caret-color: var(--accent);
}
input::placeholder,
textarea::placeholder {
  color: var(--muted);
}
@supports (appearance: base-select) {
  select,
  select::picker(select) {
    appearance: base-select;
  }
  select::picker(select) {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 6px;
    margin-block: 6px;
    max-height: 320px;
  }
  option {
    padding: 10px 12px;
    border-radius: 6px;
    min-height: 40px;
  }
  option:hover,
  option:checked {
    background: var(--soft);
    color: var(--text);
  }
}
textarea {
  min-height: 90px;
  resize: vertical;
}
label {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}
label span.help {
  font-weight: 400;
}
input[type='checkbox'] {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}
input[type='color'] {
  padding: 4px;
  height: 42px;
}
fieldset {
  border: 0;
  padding: 0;
  margin: 0;
}
::selection {
  background: var(--accent);
  color: var(--on-accent);
}
* {
  scrollbar-color: color-mix(in srgb, var(--muted) 40%, transparent) transparent;
  scrollbar-width: thin;
}
/* Chromium custom scrollbars avoid the bulky native track and arrow buttons. */
@supports selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }
  ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
  }
  ::-webkit-scrollbar-track,
  ::-webkit-scrollbar-corner {
    background: transparent;
  }
  ::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--muted) 36%, transparent);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 20px;
  }
  ::-webkit-scrollbar-thumb:hover {
    background-color: var(--muted);
  }
  ::-webkit-scrollbar-button {
    display: none;
    width: 0;
    height: 0;
  }
}
.muted,
.help {
  color: var(--muted);
}
.help {
  font-size: 12px;
}
.mono {
  font-variant-numeric: tabular-nums;
}
.row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.wrap {
  flex-wrap: wrap;
}
.between {
  justify-content: space-between;
}
.stack {
  display: grid;
  gap: 16px;
}
.compact {
  gap: 8px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 3px 8px;
  font-size: 12px;
  white-space: nowrap;
  background: var(--soft);
  color: var(--muted);
}
.badge.ok {
  color: var(--ok);
}
.badge.warn {
  color: var(--warn);
}
.badge.error {
  color: var(--danger);
}
.notice-inline {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--soft);
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.notice-inline p {
  font-size: 13px;
}
.error-text {
  color: var(--danger);
  font-size: 13px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 20px;
  min-width: 0;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.grid {
  display: grid;
  gap: 16px;
}
.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
  display: grid;
  justify-items: center;
  gap: 12px;
}
.empty p {
  max-width: 46ch;
}
.record {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.records {
  display: grid;
  gap: 12px;
}
.owner-tenants .record {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
}
.owner-tenants .record > .row {
  flex-wrap: nowrap;
}
@media (max-width: 1100px) {
  .owner-tenants .record {
    grid-template-columns: minmax(0, 1fr);
  }
  .owner-tenants .record > .row {
    flex-wrap: wrap;
  }
}
.record h3 {
  margin-bottom: 4px;
}
.record > div {
  min-width: 0;
}
.record p,
.code-preview {
  overflow-wrap: anywhere;
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: separate;
  border-spacing: 0 10px;
  width: 100%;
  font-size: 13px;
}
th {
  color: var(--muted);
  font-size: 12px;
  text-align: left;
  padding: 0 14px;
  font-weight: 500;
}
td {
  background: var(--surface);
  padding: 12px 14px;
  border-block: 1px solid var(--line);
  vertical-align: middle;
}
td:first-child {
  border-left: 1px solid var(--line);
  border-radius: 8px 0 0 8px;
}
td:last-child {
  border-right: 1px solid var(--line);
  border-radius: 0 8px 8px 0;
}
td .help {
  display: block;
  margin-top: 3px;
}
.stat {
  display: block;
  font-size: 30px;
  line-height: 1.25;
  letter-spacing: -0.8px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  margin: 10px 0 5px;
}
.stat-caption {
  font-size: 12px;
  color: var(--muted);
}
.check-label {
  display: flex;
  align-items: center;
  gap: 10px;
}
.separator {
  height: 1px;
  background: var(--line);
  margin: 8px 0;
}
.page-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}
.page-head p {
  margin-top: 6px;
  color: var(--muted);
}
.section-title {
  margin: 12px 0;
}
.shell {
  display: grid;
  grid-template-columns: 228px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-text);
  padding: 24px 14px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  overflow: hidden;
}
.brand {
  font-size: 30px;
  font-weight: 750;
  letter-spacing: -1.4px;
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 0 10px;
}
.brand svg {
  width: 28px;
  height: 28px;
}
.workspace {
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--sidebar-text) 18%, transparent);
  border-radius: 8px;
}
.workspace select {
  background: transparent;
  border: 0;
  color: var(--sidebar-text);
  padding: 6px 0;
  font-weight: 600;
  font-size: 12px;
}
.workspace .help {
  color: inherit;
  opacity: 0.8;
}
nav {
  display: grid;
  gap: 4px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  min-width: 0;
  overscroll-behavior: contain;
  flex: 1;
  align-content: start;
}
nav .group {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 14px 12px 5px;
  opacity: 0.7;
}
nav button {
  justify-content: flex-start;
  background: transparent;
  border: 0;
  color: inherit;
  font-weight: 500;
  text-align: left;
  min-height: 40px;
}
nav button:hover {
  background: color-mix(in srgb, var(--sidebar-text) 7%, transparent);
}
nav button[aria-current='page'] {
  font-weight: 650;
  background: color-mix(in srgb, var(--sidebar-text) 12%, transparent);
}
.sidebar-footer {
  border-top: 1px solid color-mix(in srgb, var(--sidebar-text) 18%, transparent);
  padding: 14px 4px 0;
  display: flex;
  gap: 8px;
  align-items: center;
}
.sidebar-footer button {
  color: inherit;
}
.main {
  grid-column: 2;
  min-width: 0;
  padding: 0 8px 8px 0;
}
.topbar {
  height: 56px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.topbar .row {
  gap: 8px;
  min-width: 0;
}
.topbar button {
  white-space: nowrap;
}
.topbar .crumb {
  font-size: 13px;
  color: var(--bg-text, var(--muted));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar > .row:first-child {
  flex: 1;
  overflow: hidden;
}
.topbar > .row:last-child {
  flex-shrink: 0;
}
@media (max-width: 1200px) {
  .topbar .optional {
    display: none;
  }
}
.content {
  padding: 28px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 14px;
  min-height: calc(100vh - 64px);
}
.environment {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 14px;
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 9px;
}
.environment strong {
  color: var(--text);
}
.shell.rail {
  grid-template-columns: 64px minmax(0, 1fr);
}
.rail .sidebar {
  padding-inline: 8px;
}
.rail .brand {
  padding: 0 9px;
}
.rail .brand span,
.rail .workspace,
.rail .sidebar nav .group,
.rail .sidebar nav button span,
.rail .sidebar-footer span {
  display: none;
}
.rail .sidebar nav button {
  justify-content: center;
  min-height: 44px;
}
.rail .sidebar-footer {
  padding: 8px 0;
}
.rail .sidebar-footer button {
  padding: 8px;
}
.loading {
  padding: 40px;
  color: var(--muted);
}
.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
}
.login {
  max-width: 440px;
  margin: 12vh auto;
  padding: 32px;
}
.login .brand {
  padding: 0;
  margin-bottom: 30px;
}
.login h1 {
  font-size: 23px;
}
.login form {
  margin-top: 24px;
}
.route-list {
  display: grid;
  gap: 12px;
}
.route-step {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.route-step .step-icon {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--soft);
}
.route-step .row {
  gap: 14px;
}
.route-step small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}
.progress-line {
  height: 5px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 14px;
}
.progress-line div {
  height: 100%;
  background: var(--accent);
}
dialog {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  max-width: 760px;
  width: calc(100vw - 32px);
  max-height: 88vh;
  padding: 0;
  box-shadow: 0 18px 70px #0003;
}
dialog::backdrop {
  background: #0006;
}
dialog .dialog-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 2;
}
dialog .dialog-body {
  padding: 24px;
  display: grid;
  gap: 16px;
}
dialog .form-section {
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  display: grid;
  gap: 16px;
}
dialog .actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  position: sticky;
  bottom: 0;
  background: var(--surface);
  padding: 16px 24px;
  border-top: 1px solid var(--line);
}
dialog form {
  margin: 0;
}
#notices {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  display: grid;
  gap: 12px;
  max-width: min(420px, calc(100vw - 32px));
}
.toast {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  box-shadow: 0 5px 20px #0002;
}
.toast.error {
  color: var(--danger);
}
.toast button {
  margin-left: auto;
  padding: 2px;
  min-height: 24px;
  border: 0;
}
.score-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.score-options label {
  display: block;
}
.score-options input {
  position: absolute;
  opacity: 0;
  width: 1px;
  min-height: 1px;
}
.score-options span {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.score-options input:checked + span {
  background: var(--accent);
  color: var(--on-accent);
}
.score-options input:focus-visible + span {
  outline: 2px solid var(--link, var(--text));
  outline-offset: 3px;
}
.survey-public {
  max-width: 650px;
  margin: 8vh auto;
}
.survey-public .card {
  padding: 32px;
}
.theme-swatch {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 5px;
}
.theme-dialog-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(0, 1.1fr);
  gap: 28px;
  margin-top: 24px;
  align-items: start;
}
.theme-choices {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 0;
  border: 0;
}
.theme-choices legend {
  font-weight: 600;
  margin-bottom: 12px;
}
.theme-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}
.theme-choice:has(input:checked) {
  outline: 2px solid var(--text);
  outline-offset: -2px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}
.theme-choice input {
  width: 16px;
  min-height: 16px;
  margin: 0;
  flex-shrink: 0;
}
.theme-choice small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.theme-chip {
  display: flex;
  width: 36px;
  height: 40px;
  overflow: hidden;
  flex-shrink: 0;
  border-radius: 5px;
  border: 1px solid var(--line);
}
.theme-chip i {
  flex: 1;
}
.theme-color-field {
  min-width: 0;
}
.theme-color-field label {
  display: block;
  margin-bottom: 8px;
}
.theme-color-field .row {
  gap: 8px;
}
.theme-color-field input[type='color'] {
  width: 42px;
  height: 42px;
  padding: 4px;
  flex-shrink: 0;
}
.theme-color-field input[data-hex] {
  width: 100%;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.theme-live-preview {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  padding: 8px;
  gap: 8px;
  background: var(--preview-bg);
  color: var(--preview-text);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 120px;
}
.theme-preview-rail {
  background: var(--preview-sidebar);
  color: var(--preview-sidebar-text);
  display: flex;
  justify-content: center;
  padding-top: 16px;
  border-radius: 5px;
}
.theme-preview-sheet {
  display: grid;
  justify-items: start;
  gap: 8px;
  padding: 16px;
  border-radius: 5px;
  background: var(--preview-surface);
}
.theme-preview-sheet > span {
  font-size: 12px;
}
.theme-preview-button {
  padding: 8px 12px;
  background: var(--preview-accent);
  color: var(--preview-on-accent);
  border-radius: 5px;
}
@media (max-width: 700px) {
  .theme-dialog-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
  }
  .theme-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .theme-choice {
    gap: 8px;
    flex-wrap: wrap;
  }
  .theme-choice > span:last-child {
    flex: 1 1 100%;
  }
}
.matrix td,
.matrix th {
  padding: 8px;
  text-align: center;
}
.matrix th:first-child,
.matrix td:first-child {
  text-align: left;
}
.matrix input {
  width: 16px;
}
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  align-items: start;
}
.canvas-viewport {
  height: 620px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  position: relative;
}
.canvas {
  position: relative;
  min-width: 740px;
  min-height: 1200px;
  background-image: radial-gradient(
    var(--line) 1px,
    transparent 1px
  ); /* taste-skill-ignore: positional grid for dragging journey nodes */
  background-size: 20px 20px;
}
.connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.connections path {
  stroke: var(--muted);
  stroke-width: 1.5;
  fill: none;
}
.connections text {
  fill: var(--muted);
  font:
    12px 'Segoe UI',
    sans-serif;
}
.flow-node {
  position: absolute;
  width: 244px;
  min-height: 82px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  cursor: grab;
  touch-action: none;
  display: block;
  text-align: left;
}
.flow-node:hover {
  background: var(--surface);
  border-color: var(--muted);
}
.flow-node[aria-pressed='true'] {
  border: 2px solid var(--accent);
  padding: 13px;
}
.flow-node .node-type {
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 7px;
}
.flow-node .node-type svg {
  width: 14px;
  height: 14px;
}
.flow-node .node-label {
  font-size: 13px;
  font-weight: 600;
}
.flow-node .node-config {
  font-size: 11px;
  color: var(--muted);
  display: block;
  margin-top: 4px;
}
.node-inspector {
  position: sticky;
  top: 16px;
  padding: 18px;
}
.node-inspector form {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}
.node-inspector label {
  font-size: 12px;
}
.node-inspector input,
.node-inspector select {
  font-size: 12px;
}
.editor-toolbar {
  margin-bottom: 16px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.editor-toolbar select {
  width: auto;
  min-width: 140px;
}
.preview-path {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.preview-path span {
  border: 1px solid var(--line);
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.code-preview {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  font:
    13px/1.6 'Segoe UI',
    sans-serif;
  max-height: 360px;
  overflow: auto;
}
@supports (appearance: base-select) {
  select {
    appearance: base-select;
  }
  select::picker(select) {
    appearance: base-select;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 6px;
  }
  option {
    padding: 8px;
    border-radius: 5px;
  }
  option:checked {
    background: var(--soft);
  }
}
@media (max-width: 1200px) {
  .grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .editor-layout {
    grid-template-columns: minmax(0, 1fr) 260px;
  }
  .content {
    padding: 20px;
  }
  .shell {
    grid-template-columns: 204px minmax(0, 1fr);
  }
  .sidebar {
    padding-inline: 10px;
  }
  .grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .shell {
    grid-template-columns: 64px minmax(0, 1fr);
  }
  .sidebar {
    padding-inline: 8px;
  }
  .sidebar .brand {
    padding: 0 9px;
  }
  .sidebar .brand span,
  .sidebar .workspace,
  .sidebar nav .group,
  .sidebar nav button span,
  .sidebar-footer span {
    display: none;
  }
  .sidebar nav button {
    justify-content: center;
  }
}
@media (max-width: 900px) {
  .editor-layout {
    grid-template-columns: 1fr;
  }
  .node-inspector {
    position: static;
  }
  .canvas-viewport {
    height: 500px;
  }
  .grid.two {
    grid-template-columns: 1fr;
  }
  .topbar {
    padding-inline: 12px;
  }
  .content {
    padding: 18px;
  }
  .page-head {
    flex-wrap: wrap;
  }
}
@media (max-width: 600px) {
  .shell,
  .shell.rail {
    grid-template-columns: 52px minmax(0, 1fr);
  }
  .sidebar {
    padding-inline: 4px;
    gap: 16px;
  }
  .brand svg {
    width: 24px;
  }
  .sidebar .brand {
    padding: 0 10px;
  }
  .main {
    padding-right: 4px;
  }
  .content {
    padding: 14px;
    border-radius: 10px;
  }
  .grid.three,
  .grid.four {
    grid-template-columns: 1fr;
  }
  .topbar .crumb {
    max-width: 110px;
  }
  .topbar button {
    padding: 6px;
  }
  .topbar button .optional {
    display: none;
  }
  h1 {
    font-size: 23px;
  }
  .card {
    padding: 16px;
  }
  .record {
    flex-wrap: wrap;
  }
  .environment {
    align-items: flex-start;
  }
  .page-head p {
    font-size: 13px;
  }
  input,
  select,
  textarea {
    font-size: 16px;
  }
  button {
    min-height: 44px;
  }
  .login,
  .survey-public {
    margin: 24px 16px;
  }
  .login {
    padding: 24px;
  }
  dialog .dialog-body {
    padding: 16px;
  }
  .form-section .grid {
    grid-template-columns: 1fr;
  }
  .editor-toolbar {
    gap: 8px;
  }
  .node-inspector input,
  .node-inspector select {
    font-size: 16px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  .toast {
    animation: arrive 0.2s ease-out;
  }
  @keyframes arrive {
    from {
      opacity: 0.4;
      translate: 0 6px;
    }
    to {
      opacity: 1;
      translate: 0 0;
    }
  }
}

.topbar > .row > .ghost {
  color: var(--bg-text, var(--text));
}
.connections path {
  stroke: var(--bg-text, var(--muted));
}
.connections text {
  fill: var(--bg-text, var(--muted));
}
/* Approved Pulso Full v5.8 workspace; common surfaces for every tenant. */
.content {
  background: var(--surface);
  padding: 24px;
  border-radius: 16px;
}
.topbar {
  height: 48px;
  padding-inline: 24px;
}
.sidebar {
  padding: 16px 16px 10px;
  gap: 16px;
  height: 100dvh;
}
.sidebar .brand {
  font-size: 30px;
  padding: 0 6px;
}
.sidebar .brand svg {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  padding: 4px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}
.sidebar .workspace select {
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar .pin-navigation {
  min-height: 34px;
  padding: 6px 8px;
  background: color-mix(in srgb, var(--surface) 35%, transparent);
  border-color: color-mix(in srgb, var(--sidebar-text) 18%, transparent);
  color: inherit;
  font-weight: 400;
  font-size: 12px;
}
.sidebar nav .group {
  font-size: 11px;
  text-transform: none;
  letter-spacing: 0;
  opacity: 1;
  padding: 16px 10px 7px;
}
.sidebar nav button {
  min-width: 0;
  min-height: 44px;
  font-size: 13px;
  gap: 10px;
  padding: 10px;
  border-radius: 8px;
}
.sidebar nav button svg {
  width: 20px;
  height: 20px;
}
.sidebar nav button span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.sidebar > :not(nav) {
  flex-shrink: 0;
}
.sidebar nav {
  gap: 6px;
  padding-block: 4px;
  scrollbar-color: color-mix(in srgb, var(--sidebar-text) 26%, transparent) transparent;
}
.sidebar nav:hover,
.sidebar nav:focus-within {
  scrollbar-color: color-mix(in srgb, var(--sidebar-text) 48%, transparent) transparent;
}
@supports selector(::-webkit-scrollbar) {
  .sidebar nav,
  .sidebar nav:hover,
  .sidebar nav:focus-within {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }
  .sidebar nav::-webkit-scrollbar {
    width: 8px;
  }
  .sidebar nav::-webkit-scrollbar-thumb {
    background-color: color-mix(in srgb, var(--sidebar-text) 22%, transparent);
  }
  .sidebar nav:hover::-webkit-scrollbar-thumb,
  .sidebar nav:focus-within::-webkit-scrollbar-thumb {
    background-color: color-mix(in srgb, var(--sidebar-text) 45%, transparent);
  }
}
.sidebar-footer .help {
  color: inherit;
}
.sidebar :focus-visible {
  outline-color: var(--sidebar-text);
  outline-offset: -2px;
}
.nav-backdrop {
  display: none;
}
.sidebar nav button[aria-current='page'] {
  background: color-mix(in srgb, var(--surface) 75%, transparent);
}
.sidebar nav .group:empty {
  margin-top: 8px;
  padding: 0;
  border-top: 1px solid color-mix(in srgb, var(--sidebar-text) 15%, transparent);
}
.owner-shell .sidebar nav .group:first-child {
  display: none;
}
.environment {
  margin-bottom: 14px;
  padding: 7px 10px;
  background: var(--soft);
  border: 0;
}
.page-head {
  margin-bottom: 24px;
}
h1 {
  font-size: 24px;
  font-weight: 650;
  letter-spacing: -0.4px;
}
.card {
  border-radius: 10px;
}
.workspace-view-switch {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  font-size: 12px;
  color: var(--muted);
}
.workspace-view-switch button[aria-pressed='true'] {
  background: var(--soft);
  color: var(--text);
  border-color: var(--muted);
}
.overview-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--workspace-gap);
  margin-bottom: 28px;
}
.overview-shortcuts button {
  min-height: 78px;
  justify-content: flex-start;
  text-align: left;
  border-radius: 10px;
  padding: 16px;
  font-weight: 400;
}
.overview-shortcuts button span {
  display: grid;
  gap: 4px;
  flex: 1;
}
.overview-shortcuts small {
  color: var(--muted);
  font-size: 12px;
}
.overview-shortcuts svg:last-child {
  width: 14px;
}
.overview-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 16px;
}
.overview-section-head p {
  margin-top: 4px;
}
.overview-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.overview-metrics .card {
  display: grid;
  gap: 8px;
  padding: 16px;
}
.overview-metrics .stat {
  margin: 0;
  font-size: 26px;
  line-height: 1.3;
}
.overview-metrics small {
  font-size: 11px;
  color: var(--muted);
}
.overview-main {
  align-items: stretch;
}
.overview-main > .card {
  padding: 20px;
}
.overview-channels {
  flex: 1;
}
.overview-channels article {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  min-height: 232px;
}
.overview-channels h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.overview-channels article > button {
  margin-top: auto;
  align-self: flex-start;
  font-size: 12px;
}
.overview-panel-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin-top: auto;
}
.overview-support {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
}
.reference-notice {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  font-size: 12px;
}
.reference-notice p {
  max-width: none;
  color: var(--muted);
  margin-top: 4px;
}
.full-reference {
  width: 100%;
  height: max(750px, calc(100vh - 210px));
  display: block;
  border: 0;
  background: var(--surface);
}
.search-results {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}
.search-results button {
  justify-content: flex-start;
}
.shell.rail {
  grid-template-columns: var(--nav-rail) minmax(0, 1fr);
}
.shell.rail .sidebar {
  padding-inline: 10px;
}
.shell.rail .sidebar .brand {
  justify-content: center;
  padding-inline: 0;
}
.shell.rail .pin-navigation {
  min-height: 40px;
}
.shell.rail .sidebar nav button {
  min-width: 44px;
}
.shell.rail .sidebar nav button {
  padding-inline: 4px;
}
.rail .pin-navigation span {
  display: none;
}
.shell.nav-peek .sidebar {
  position: fixed;
  width: var(--nav-width);
  z-index: 50;
  border-right: 1px solid var(--line);
  padding: 16px;
}
.shell.nav-peek .sidebar .brand span,
.shell.nav-peek .sidebar nav button span,
.shell.nav-peek .sidebar-footer span,
.shell.nav-peek .pin-navigation span {
  display: inline;
}
.shell.nav-peek .sidebar .workspace,
.shell.nav-peek .sidebar nav .group {
  display: block;
}
.shell.nav-peek .sidebar nav button {
  justify-content: flex-start;
}
.shell.nav-peek .sidebar .brand {
  padding-inline: 6px;
  justify-content: flex-start;
}
.shell.nav-peek .sidebar nav button {
  padding-inline: 10px;
}
.shell.nav-peek .sidebar {
  color: var(--sidebar-text);
}
@media (min-width: 761px) {
  .shell:not(.rail) {
    grid-template-columns: var(--nav-width) minmax(0, 1fr);
  }
}
@media (max-width: 1200px) {
  .overview-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .overview-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .overview-main {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  .sidebar {
    padding-inline: 10px;
  }
  .sidebar .brand {
    justify-content: center;
    padding-inline: 0;
  }
  .sidebar .pin-navigation span {
    display: none;
  }
  .shell {
    grid-template-columns: var(--nav-rail) minmax(0, 1fr);
  }
}
@media (max-width: 900px) {
  .content {
    padding: 18px;
  }
  .overview-channels {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .overview-support {
    flex-wrap: wrap;
  }
}
@media (max-width: 600px) {
  .shell,
  .shell.rail {
    grid-template-columns: minmax(0, 1fr);
  }
  .main {
    grid-column: 1;
    padding-inline: 8px;
  }
  .shell .sidebar {
    display: none;
  }
  .shell.nav-peek .sidebar {
    display: flex;
    width: min(296px, calc(100vw - 56px));
    left: 0;
    top: 0;
  }
  .shell.nav-peek .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 49;
    border: 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--text) 22%, transparent);
  }
  .sidebar nav button,
  .topbar button {
    min-height: 44px;
  }
  .content {
    padding: 14px;
  }
  .topbar {
    padding-inline: 8px;
    gap: 4px;
  }
  .topbar > .row {
    gap: 2px;
  }
  .workspace-view-switch {
    align-items: flex-start;
    flex-direction: column;
  }
  .workspace-view-switch .row {
    flex-wrap: wrap;
  }
  .overview-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .overview-shortcuts,
  .overview-channels {
    grid-template-columns: 1fr;
  }
  .overview-section-head {
    flex-wrap: wrap;
  }
  .overview-main > .card {
    padding: 14px;
  }
  .page-head > .row {
    flex-wrap: wrap;
  }
  .full-reference {
    height: 900px;
  }
  .sidebar .brand {
    padding: 0 4px;
  }
}

/* Connected inbox: the v5.8 three-panel workspace shares the product theme tokens. */
.crm-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin: 16px 0;
}
.crm-workspace {
  display: flex;
  gap: 6px;
  height: min(760px, calc(100dvh - 380px));
  min-height: 520px;
}
.crm-list,
.crm-thread,
.crm-client {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
  overflow: hidden;
}
.crm-list {
  width: var(--inbox-left);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}
.crm-list header {
  padding: 16px;
  display: grid;
  gap: 12px;
}
.crm-entries {
  overflow-y: auto;
  min-height: 0;
}
.crm-entry {
  display: flex;
  align-items: flex-start;
  width: 100%;
  padding: 12px 14px;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  gap: 10px;
  font-weight: 400;
}
.crm-entry.selected {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--text);
  box-shadow: inset 3px 0 var(--accent);
}
.crm-entry-text {
  display: grid;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.crm-entry-text small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: inherit;
  opacity: 0.85;
}
.crm-avatar {
  position: relative;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--soft);
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}
.crm-channel-icon {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: var(--soft);
  color: var(--accent);
}
.crm-channel-icon svg {
  width: 13px;
  height: 13px;
}
.crm-entry-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.crm-entry-top strong {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.crm-entry-top time {
  color: var(--muted);
  font-size: 11px;
  flex-shrink: 0;
  font-weight: 400;
}
.crm-entry-preview {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 13px;
}
.crm-entry-meta {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 16px;
}
.crm-stage-label {
  border-left: 1px solid var(--line);
  padding-left: 8px;
}
.crm-thread-head .help {
  display: flex;
  align-items: center;
  gap: 6px;
}
.crm-thread-head svg {
  width: 14px;
  height: 14px;
}
.crm-thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 230px;
}
.crm-thread-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 4px;
}
.crm-messages {
  flex: 1;
  overflow: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--soft);
}
.crm-message {
  width: fit-content;
  max-width: min(82%, 68ch);
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  overflow-wrap: anywhere;
}
.crm-message p {
  white-space: pre-wrap;
  margin: 6px 0;
}
.crm-message small {
  color: var(--muted);
  font-size: 12px;
}
.crm-message.outgoing {
  align-self: flex-end;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--text);
}
.crm-message.outgoing small {
  color: inherit;
}
.crm-message.note {
  border-style: dashed;
}
.crm-message.survey {
  width: 100%;
  max-width: 100%;
}
.crm-composer {
  padding: 16px;
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
}
.crm-composer label {
  font-size: 12px;
}
.crm-composer > label:first-child {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
}
.crm-composer > label:first-child select {
  width: auto;
  max-width: 100%;
  font-size: 13px;
}
.crm-composer .error-text:empty {
  display: none;
}
.crm-client {
  width: var(--inbox-right);
  flex-shrink: 0;
  overflow-y: auto;
}
.crm-detail {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}
.crm-detail summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  list-style: none;
  font-weight: 600;
  min-height: 32px;
}
.crm-detail summary::-webkit-details-marker {
  display: none;
}
.crm-detail[open] summary {
  margin-bottom: 16px;
}
.crm-detail[open] summary svg {
  transform: rotate(90deg);
}
.crm-ticket {
  width: 100%;
  padding: 12px;
  display: grid;
  gap: 8px;
  text-align: left;
  font-weight: 400;
}
.crm-ticket small {
  color: var(--muted);
}
.crm-detail p {
  overflow-wrap: anywhere;
}
.crm-resize {
  flex: 0 0 8px;
  cursor: col-resize;
  position: relative;
  touch-action: none;
  border-radius: 8px;
}
.crm-resize::after {
  content: '';
  width: 2px;
  height: 42px;
  background: var(--line);
  border-radius: 2px;
  position: absolute;
  top: 45%;
  left: 3px;
}
.crm-resize:hover,
.crm-resize:focus-visible {
  background: var(--sidebar);
}
.crm-workspace.hide-list .crm-list,
.crm-workspace.hide-list .crm-resize.left,
.crm-workspace.hide-client .crm-client,
.crm-workspace.hide-client .crm-resize.right {
  display: none;
}
.crm-filters {
  display: flex;
  align-items: end;
  gap: 16px;
  margin-bottom: 16px;
}
.crm-filters label:first-child {
  flex: 1;
}
.crm-pipeline {
  display: grid;
  grid-template-columns: repeat(5, minmax(220px, 1fr));
  gap: 16px;
  overflow-x: auto;
  padding: 16px 0;
}
.crm-column {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
  min-height: 500px;
}
.crm-column header {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px 10px 0 0;
  min-height: 80px;
  gap: 8px;
}
.crm-column header h2 {
  font-size: 15px;
}
.crm-bot-empty {
  display: grid;
  gap: 12px;
  align-content: start;
}
.crm-bot-empty .badge {
  justify-self: start;
  white-space: normal;
}
.crm-bot-empty p {
  margin: 0;
}
.crm-bot-test {
  margin-top: 16px;
  scroll-margin-top: 64px;
}
.crm-bot-test summary {
  cursor: pointer;
  font-weight: 600;
}
.crm-bot-result {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 20px;
}
.crm-bot-answer {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 760px) {
  .crm-bot-result {
    grid-template-columns: minmax(0, 1fr);
  }
}
.crm-column-body {
  padding: 12px;
  display: grid;
  gap: 12px;
  align-content: start;
}
.crm-kanban-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  display: grid;
  gap: 12px;
  overflow-wrap: anywhere;
}
.crm-kanban-card[draggable='true'] {
  cursor: grab;
}
.crm-column.drop-target {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}
@media (max-width: 1250px) {
  .crm-workspace {
    flex-wrap: wrap;
    height: auto;
    min-height: 0;
  }
  .crm-list {
    width: min(var(--inbox-left), 35%);
    height: 650px;
  }
  .crm-thread {
    height: 650px;
  }
  .crm-client {
    width: 100%;
    max-height: 420px;
    margin-top: 10px;
  }
  .crm-resize.right {
    display: none;
  }
}
@media (max-width: 760px) {
  .crm-list {
    width: 100%;
    max-height: 280px;
  }
  .crm-thread {
    width: 100%;
    flex-basis: 100%;
    height: 650px;
    min-width: 0;
  }
  .crm-client {
    max-height: none;
  }
  .crm-resize {
    display: none;
  }
  .crm-filters {
    flex-direction: column;
    align-items: stretch;
  }
  .crm-composer .between {
    flex-wrap: wrap;
  }
  .crm-messages {
    padding: 16px;
  }
  .crm-message {
    width: 96%;
  }
}

/* v5.8 refinement: retain the 256/72px shell and 16px grid, with a quieter
   vertical rhythm. At 1440px: 256 + 1176 + 8 = 1440; inner canvas is 1126px. */
:root {
  --nav-duration: 220ms;
  --nav-ease: cubic-bezier(0.16, 1, 0.3, 1);
}
.shell {
  width: 100%;
  min-width: 0;
  transition: grid-template-columns var(--nav-duration) var(--nav-ease);
}
.main,
.content,
#page,
.grid > *,
.stack > *,
.overview-shortcuts > *,
.overview-metrics > * {
  min-width: 0;
}
.content {
  padding-block: 20px;
}
.page-head {
  margin-bottom: 20px;
}
.page-head > div {
  min-width: 0;
}
.page-head h1 {
  overflow-wrap: anywhere;
}
.workspace-view-switch {
  margin-bottom: 16px;
}
.overview-shortcuts {
  margin-bottom: 24px;
}
.overview-shortcuts button {
  min-height: 72px;
  padding-block: 12px;
  color: var(--text);
}
.overview-metrics {
  margin-bottom: 20px;
}
.overview-metrics .card {
  gap: 6px;
  padding-block: 14px;
}
.overview-main > .card {
  padding-block: 18px;
}
.overview-channels article {
  gap: 12px;
  min-height: 216px;
  padding-block: 14px;
}
.route-step {
  padding-block: 14px;
}
.empty {
  padding-block: 28px;
}
.crm-entry {
  padding-block: 12px;
}
.crm-messages {
  gap: 16px;
  padding-block: 20px;
}
.crm-detail[open] summary {
  margin-bottom: 12px;
}
dialog .dialog-head {
  padding-block: 16px;
}
dialog .dialog-body {
  padding-block: 20px;
}
dialog .form-section {
  padding-block: 16px;
}
dialog .actions {
  padding-block: 12px;
}

/* The sidebar stays on one coordinate plane in both pinned and peek modes.
   Hovering opens over the canvas; only pinning changes the reserved grid lane. */
.shell .sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--nav-width);
  padding: 14px 14px 10px;
  gap: 12px;
  transition:
    width var(--nav-duration) var(--nav-ease),
    padding var(--nav-duration) var(--nav-ease),
    transform var(--nav-duration) var(--nav-ease),
    opacity 160ms ease-out;
}
.shell .sidebar .brand {
  font-size: 28px;
  min-height: 34px;
  flex-wrap: nowrap;
}
.shell .sidebar .brand svg {
  width: 30px;
  height: 30px;
}
.shell .sidebar nav {
  gap: 4px;
}
.shell .sidebar nav button {
  min-height: 44px;
  flex-shrink: 0;
  white-space: nowrap;
}
.shell .sidebar nav button span {
  overflow-wrap: normal;
  text-overflow: ellipsis;
}
.shell .sidebar .workspace {
  display: block;
  max-height: 100px;
  padding: 8px 10px;
  overflow: hidden;
  opacity: 1;
  visibility: visible;
  transition:
    max-height var(--nav-duration) var(--nav-ease),
    padding var(--nav-duration) var(--nav-ease),
    opacity 140ms ease-out,
    visibility 0s;
}
.shell .sidebar .workspace select {
  padding-block: 4px;
}
.shell .sidebar nav .group {
  display: block;
  min-block-size: calc(1.4em + 18px);
  block-size: auto;
  max-height: 48px;
  padding: 12px 10px 6px;
  white-space: nowrap;
  overflow: hidden;
  opacity: 1;
  transition:
    min-block-size var(--nav-duration) var(--nav-ease),
    max-height var(--nav-duration) var(--nav-ease),
    padding var(--nav-duration) var(--nav-ease),
    opacity 140ms ease-out;
}
.shell.owner-shell .sidebar nav .group:first-child {
  display: none;
}
.shell .sidebar .brand span,
.shell .sidebar nav button span,
.shell .sidebar-footer span,
.shell .pin-navigation span {
  display: inline;
  max-width: 196px;
  overflow: hidden;
  white-space: nowrap;
  opacity: 1;
  visibility: visible;
  transition:
    max-width var(--nav-duration) var(--nav-ease),
    opacity 140ms ease-out,
    visibility 0s;
}
.shell .sidebar-footer,
.shell.rail .sidebar-footer {
  padding: 10px 0 0;
}
.shell.rail .sidebar {
  width: var(--nav-rail);
  padding-inline: 10px;
}
.shell.nav-peek .sidebar {
  width: var(--nav-width);
  padding: 14px 14px 10px;
  z-index: 50;
}
.shell.rail:not(.nav-peek) .sidebar .brand span,
.shell.rail:not(.nav-peek) .sidebar nav button span,
.shell.rail:not(.nav-peek) .sidebar-footer span,
.shell.rail:not(.nav-peek) .pin-navigation span {
  max-width: 0;
  opacity: 0;
  visibility: hidden;
}
.shell.rail:not(.nav-peek) .sidebar .workspace {
  max-height: 0;
  padding-block: 0;
  border-block-width: 0;
  opacity: 0;
  visibility: hidden;
}
.shell.rail:not(.nav-peek) .sidebar nav .group {
  min-block-size: 0;
  max-height: 0;
  padding-block: 0;
  opacity: 0;
}

/* Journey stages and message composition stay inside their own scroll regions. */
.journey-overview {
  margin-bottom: 16px;
}
.journey-overview > .row {
  gap: 12px;
}
.journey-overview > .row > div {
  min-width: 0;
}
.journey-timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(220px, 1fr);
  align-items: stretch;
  gap: 12px;
  padding-block: 16px 4px;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
}
.journey-stage {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  text-align: left;
  font-weight: 400;
  scroll-snap-align: start;
}
.journey-stage.selected {
  border-color: var(--accent);
  background: var(--soft);
}
.journey-stage-number {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.journey-stage-content {
  display: grid;
  gap: 7px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.journey-stage-content .row {
  gap: 7px;
}
.journey-stage-meta {
  font-size: 11px;
  color: var(--muted);
}
.stage-studio {
  position: static;
  container-type: inline-size;
}
.stage-studio form {
  gap: 16px;
}
body:has(.journey-stage-dialog[open]) {
  overflow: hidden;
}
dialog.journey-stage-dialog {
  max-width: 640px;
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}
dialog.journey-stage-dialog.wide {
  max-width: 1120px;
}
.journey-stage-dialog .stage-studio {
  padding: 0;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 34px);
  min-height: 0;
}
.journey-stage-dialog .dialog-head {
  flex-shrink: 0;
  gap: 16px;
}
.journey-stage-dialog .dialog-head h2 {
  font-size: 18px;
  overflow-wrap: anywhere;
}
.journey-stage-dialog form {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}
.journey-stage-dialog .dialog-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  min-height: 0;
}
.journey-stage-dialog .actions {
  flex-shrink: 0;
}
.journey-template-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 20px;
  align-items: start;
}
.journey-template-picker {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.journey-template-picker legend {
  margin-bottom: 12px;
  font-weight: 600;
}
.journey-template-options {
  display: grid;
  gap: 12px;
  max-height: 32rem;
  overflow-y: auto;
  padding: 2px;
}
.journey-template-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
}
.journey-template-option.selected {
  border-color: var(--accent);
  background: var(--soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.journey-template-option:focus-within {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}
.journey-template-option:has(input:disabled) {
  cursor: default;
}
.journey-template-option input {
  width: 18px;
  min-height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
}
.journey-template-option > span {
  display: grid;
  gap: 8px;
  min-width: 0;
  overflow-wrap: anywhere;
}
.journey-template-excerpt {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
  font-weight: 400;
}
.journey-message-preview {
  display: grid;
  gap: 12px;
  padding: 16px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
  overflow-wrap: anywhere;
}
.journey-message-preview .mail-preview-frame {
  max-height: 32rem;
  border-radius: 8px;
}
.journey-whatsapp-preview {
  padding: 20px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  white-space: pre-wrap;
}
@container (max-width: 760px) {
  .journey-template-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}
.stage-studio .form-section,
.block-settings {
  display: grid;
  gap: 12px;
  min-width: 0;
}
.stage-timing {
  padding: 16px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.stage-timing legend {
  margin-bottom: 8px;
  font-size: 12px;
}
.message-studio {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  align-items: start;
  gap: 16px;
}
.message-studio > *,
.block-workspace > * {
  min-width: 0;
}
.block-palette {
  gap: 8px;
}
.block-palette button {
  font-size: 12px;
}
.block-workspace {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}
.block-list {
  display: grid;
  gap: 12px;
  max-height: 620px;
  overflow-y: auto;
}
.mail-block {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.mail-block.selected {
  border-color: var(--accent);
  background: var(--soft);
}
.mail-block > button {
  display: grid;
  gap: 6px;
  justify-items: start;
  border: 0;
  background: transparent;
  min-width: 0;
  padding: 2px;
  text-align: left;
}
.mail-block strong {
  font-size: 12px;
  overflow-wrap: anywhere;
}
.mail-block .row {
  gap: 4px;
}
.mail-block .small {
  min-height: 32px;
  padding-inline: 6px;
}
.email-preview-panel {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}
.email-preview-panel .row {
  gap: 6px;
}
.email-preview-panel button {
  font-size: 12px;
  padding-inline: 8px;
}
.email-preview-panel button[aria-pressed='true'] {
  border-color: var(--muted);
  background: var(--surface);
}
.mail-preview-frame {
  min-width: 0;
  max-height: 650px;
  overflow: auto;
}
.mail-preview {
  width: 100%;
  min-width: 0;
  margin-inline: auto;
}
.mail-preview.mobile {
  max-width: 320px;
}
.mail-preview table {
  border-collapse: collapse;
  border-spacing: 0;
  font-size: 16px;
}
.mail-preview td,
.mail-preview th {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: inherit;
  font-size: inherit;
  vertical-align: top;
}
.email-document-settings {
  min-width: 0;
  padding-block: 12px;
  border-top: 1px solid var(--line);
}
.email-document-settings > summary,
.email-move-controls > summary {
  min-height: 36px;
  cursor: pointer;
  font-weight: 600;
}
.email-document-settings > label,
.email-document-settings > .grid,
.email-document-settings > .row,
.email-move-controls > label,
.email-move-controls > button {
  margin-top: 12px;
}
.email-document-settings textarea,
.email-code {
  width: 100%;
  min-width: 0;
  font-family: Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: vertical;
}
.email-document-settings input[type='file'] {
  max-width: 100%;
  overflow: hidden;
}
.mail-block[draggable='true'] > button {
  cursor: grab;
}
.mail-block.email-drop-target {
  outline: 2px solid var(--text);
  outline-offset: -2px;
}
.email-column-slot {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.email-column-slot h4 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}
.email-column-slot .mail-block {
  margin-inline-start: 6px;
}
.email-column-slot > .row > label {
  flex: 1 1 140px;
  min-width: 0;
}
.email-column-slot > .row > button {
  align-self: end;
}
.email-move-controls {
  margin-top: 4px;
}
.block-settings input[type='color'] {
  width: 100%;
}
.block-settings .grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@container (max-width: 560px) {
  .block-settings .grid.two {
    grid-template-columns: minmax(0, 1fr);
  }
  .email-document-settings .row > button {
    min-height: 44px;
  }
  .email-document-settings textarea,
  .email-code {
    font-size: 16px;
  }
}
@container (max-width: 900px) {
  .message-studio {
    grid-template-columns: minmax(0, 1fr);
  }
}
@container (max-width: 560px) {
  .block-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
  .block-list {
    max-height: 340px;
  }
}
@media (max-width: 760px) {
  .shell:not(.nav-peek) .sidebar {
    width: var(--nav-rail);
    padding-inline: 10px;
  }
  .shell:not(.nav-peek) .sidebar .brand span,
  .shell:not(.nav-peek) .sidebar nav button span,
  .shell:not(.nav-peek) .sidebar-footer span,
  .shell:not(.nav-peek) .pin-navigation span {
    max-width: 0;
    opacity: 0;
    visibility: hidden;
  }
  .shell:not(.nav-peek) .sidebar .workspace {
    max-height: 0;
    padding-block: 0;
    border-block-width: 0;
    opacity: 0;
    visibility: hidden;
  }
  .shell:not(.nav-peek) .sidebar nav .group {
    min-block-size: 0;
    max-height: 0;
    padding-block: 0;
    opacity: 0;
  }
  .content {
    padding-block: 16px;
  }
  .journey-overview > .row > .row,
  .stage-studio .grid.two {
    grid-template-columns: minmax(0, 1fr);
    flex-wrap: wrap;
  }
  .message-studio,
  .block-workspace {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 600px) {
  .shell,
  .shell.rail {
    grid-template-columns: minmax(0, 1fr);
  }
  .shell .sidebar,
  .shell:not(.nav-peek) .sidebar,
  .shell.nav-peek .sidebar {
    display: flex;
    width: min(var(--nav-width), calc(100vw - 48px));
    padding: 14px;
    transform: translateX(-100%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      transform var(--nav-duration) var(--nav-ease),
      opacity 160ms ease-out,
      visibility 0s var(--nav-duration);
  }
  .shell.nav-peek .sidebar {
    transform: translateX(0);
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }
  .shell .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 39;
    border: 0;
    border-radius: 0;
    background: color-mix(in srgb, var(--text) 22%, transparent);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
      opacity 160ms ease-out,
      visibility 0s var(--nav-duration);
  }
  .shell.nav-peek .nav-backdrop {
    z-index: 49;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }
  .page-head {
    gap: 12px;
    margin-bottom: 16px;
  }
  .page-head > .row {
    width: 100%;
  }
  .overview-metrics > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
  .journey-timeline {
    grid-auto-columns: minmax(210px, 84%);
  }
  .stage-studio,
  .email-preview-panel {
    padding: 14px;
  }
  .mail-block .small {
    min-height: 44px;
  }
  .editor-toolbar > select,
  .editor-toolbar > .check-label {
    flex-basis: 100%;
    width: 100%;
  }
  #notices {
    right: 16px;
    bottom: max(16px, env(safe-area-inset-bottom));
  }
}
@media (prefers-reduced-motion: reduce) {
  .shell {
    transition: none;
  }
  :root .shell .sidebar,
  :root .shell .sidebar *,
  :root .shell .nav-backdrop {
    /* Accessibility preference overrides the label-specific reveal rules. */
    transition: opacity 80ms linear !important;
    animation: none !important;
  }
}

.crm-queue-tabs,
.crm-pagination,
.crm-attachments {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.crm-pagination {
  justify-content: space-between;
  margin-top: 12px;
}
.crm-queue-tabs {
  margin-bottom: 12px;
}
.crm-queue-tabs [aria-pressed='true'] {
  background: var(--accent);
  color: var(--on-accent);
}
.crm-attachment {
  margin-top: 8px;
  max-width: 100%;
}
.crm-attachment-preview {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}
.crm-attachment-preview img,
.crm-attachment-preview video {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 240px;
  object-fit: contain;
}
.crm-attachment-preview audio {
  width: 100%;
  max-width: 320px;
}
.crm-attachment-preview a,
.crm-attachment button,
.crm-attachment-preview p {
  overflow-wrap: anywhere;
}
.crm-sla {
  display: grid;
  gap: 6px;
}
.crm-extra-filters summary,
.crm-attachment-picker summary {
  cursor: pointer;
  font-size: 13px;
}
.crm-extra-filters > .stack,
.crm-attachment-picker > label {
  margin-top: 10px;
}
.crm-workspace {
  min-height: 620px;
}
.crm-messages {
  min-height: 180px;
}
.crm-composer {
  padding: 12px;
  gap: 8px;
}
.crm-composer textarea {
  min-height: 64px;
}
.template-library,
.communication-policy {
  margin-block: 16px;
}
.bases-section {
  margin-block: 0 16px;
}
.base-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 12px;
}
.base-contact-options {
  max-height: 260px;
  overflow: auto;
  margin-top: 12px;
}
.base-contact-options small {
  display: block;
  color: var(--muted);
}
.base-contact-options .check-label {
  padding-block: 8px;
}
#base-options {
  margin-top: 12px;
}
#base-options .check-label {
  padding-block: 6px;
}
.calendar-dialog #calendar-form {
  gap: 16px;
  min-height: auto;
}
.calendar-dialog .dialog-body {
  display: block;
}
.calendar-dialog #calendar-result:not(:empty) {
  margin-top: 24px;
}
.calendar-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.7fr) minmax(0, 1.3fr);
  gap: 20px;
  margin-block: 16px;
}
.calendar-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.calendar-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  white-space: normal;
  gap: 8px;
  padding: 16px;
}
.calendar-item span:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
}
.calendar-item[aria-pressed='true'] {
  border-color: var(--accent);
  background: var(--soft);
}
.calendar-item small {
  color: var(--muted);
  font-weight: 400;
}
.calendar-preview {
  min-width: 0;
  padding: 16px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.calendar-preview h3 {
  overflow-wrap: anywhere;
}
.calendar-message {
  margin-top: 16px;
  overflow: auto;
  max-height: 460px;
}
.calendar-message table {
  min-width: 0;
}
.calendar-dialog #calendar-error:empty {
  display: none;
}
.stage-history {
  margin-block: 24px;
}
.rehearsal-clock {
  margin-block: 16px;
  background: var(--surface);
}
[data-rehearsal='true']
  :is(
    #save-journey,
    #publish-journey,
    #add-type,
    #insert-branch,
    #add-stage,
    #pause-flow,
    #simulation-notice
  ),
[data-rehearsal='true'] .editor-toolbar .check-label {
  display: none;
}
.rehearsal-clock-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-block: 16px;
}
.rehearsal-clock-controls form {
  align-items: end;
}
.rehearsal-clock-controls input {
  min-width: 0;
  max-width: 100%;
}
.rehearsal-clock [aria-pressed='true'] {
  background: var(--soft);
  border-color: var(--accent);
}
.rehearsal-clock #rehearsal-error:empty {
  display: none;
}
.calendar-rehearsal-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.overview-definition {
  margin-top: 8px;
  font-size: 12px;
}
.overview-definition summary {
  color: var(--muted);
  cursor: pointer;
}
.overview-channel-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}
.overview-channel-stats dt,
.overview-rate small {
  color: var(--muted);
  font-size: 12px;
}
.overview-channel-stats dd {
  margin: 4px 0 0;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.overview-rate {
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.overview-rate progress {
  width: 100%;
  height: 6px;
  accent-color: var(--accent);
}
.overview-people .record {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
}
.overview-people p {
  margin-block: 4px;
}
.overview-avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--soft);
  color: var(--accent);
  font-size: 12px;
}
.overview-journeys {
  margin-block: 16px;
}
.overview-journeys > .grid {
  margin-top: 16px;
}
.overview-journeys article {
  display: flex;
  flex-direction: column;
  align-items: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  min-width: 0;
}
.overview-journeys article > button {
  margin-top: auto;
}
@media (max-width: 760px) {
  .overview-people .record {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .overview-people .record > .badge {
    grid-column: 2;
    justify-self: start;
  }
  .overview-journeys > .grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.stage-history-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  margin-top: 8px;
}
.stage-results-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(0, 1.15fr);
  gap: 20px;
  align-items: start;
  margin-top: 16px;
}
.stage-statistics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px 16px;
  margin: 8px 0;
}
.stage-statistics dt,
.stage-statistics small,
.stage-record-meta span {
  color: var(--muted);
}
.stage-statistics dd {
  font-size: 28px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin: 4px 0;
}
.stage-processing {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  border-block: 1px solid var(--line);
  padding-block: 16px;
}
.stage-processing strong {
  margin-left: 6px;
}
.stage-record-meta {
  display: grid;
  gap: 6px;
  margin-bottom: 16px;
  overflow-wrap: anywhere;
}
.stage-record-message {
  max-height: 480px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.stage-record-message .mail-preview {
  background: #ffffff;
  color: #343942;
}
.stage-sent-preview {
  min-width: 0;
}
@media (max-width: 900px) {
  .stage-results-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 760px) {
  .calendar-layout {
    grid-template-columns: 1fr;
  }
  .calendar-dialog .grid.three {
    grid-template-columns: 1fr;
  }
  .calendar-message {
    max-height: 400px;
  }
}
.journey-record {
  flex-wrap: wrap;
}

/* Studio follows the same framed panels and theme tokens as the tenant workspace. */
.studio-workspace,
.studio-workspace > .studio-grid {
  display: grid;
  gap: 16px;
}
.studio-workspace .page-head {
  margin: 12px 0 4px;
}
.studio-tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  margin-bottom: 20px;
}
.studio-tabs button {
  border-color: transparent;
  background: transparent;
  padding: 10px 14px;
  min-height: 42px;
}
.studio-tabs button[aria-current='page'] {
  color: var(--text);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  border-color: var(--line);
  font-weight: 650;
}
.studio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.studio-grid > *,
.studio-workspace > *,
.studio-area > * {
  min-width: 0;
}
.studio-save {
  align-items: flex-end;
  gap: 8px;
}
.studio-status {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  color: var(--muted);
  font-size: 13px;
}
.studio-status > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.studio-end {
  display: flex;
  align-items: end;
}
.studio-workspace textarea {
  min-height: 110px;
  resize: vertical;
}
.studio-workspace textarea[rows='9'] {
  min-height: 250px;
}
.studio-check,
.studio-source {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font-weight: 500;
}
.studio-check input,
.studio-source input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  flex-shrink: 0;
  accent-color: var(--accent);
}
.studio-source {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.studio-source span {
  display: grid;
  gap: 6px;
}
.studio-source small {
  color: var(--muted);
  font-weight: 400;
}
.studio-response {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}
.studio-response summary {
  cursor: pointer;
  padding-block: 4px;
  font-weight: 600;
}
.studio-prose {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.65;
}
.studio-table-wrap {
  overflow-x: auto;
}
.studio-table-wrap table {
  min-width: 700px;
}
.studio-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.studio-facts > div {
  display: grid;
  gap: 8px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.studio-facts strong {
  font-size: 26px;
  font-variant-numeric: tabular-nums;
}
.studio-facts small {
  color: var(--muted);
}
.studio-recommendations {
  padding-left: 24px;
  margin: 0;
  display: grid;
  gap: 12px;
  line-height: 1.6;
}
.studio-area-list {
  display: grid;
  gap: 12px;
}
body:has(.studio-copilot-dialog[open]) {
  overflow: hidden;
}
dialog.studio-copilot-dialog[open] {
  display: flex;
  flex-direction: column;
  max-width: 980px;
  max-height: calc(100dvh - 40px);
  overflow: hidden;
}
.studio-copilot-dialog .dialog-head,
.studio-copilot-dialog .actions {
  flex-shrink: 0;
}
.studio-copilot-dialog .dialog-body {
  overflow-y: auto;
  min-height: 0;
  overscroll-behavior: contain;
}
.studio-area {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(200px, 1fr) auto;
  align-items: center;
  gap: 20px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}
@media (max-width: 760px) {
  .studio-grid,
  .studio-facts,
  .studio-area {
    grid-template-columns: minmax(0, 1fr);
  }
  .studio-save {
    align-items: stretch;
    width: 100%;
  }
  .studio-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
  }
  .studio-tabs button {
    flex: 0 0 auto;
  }
  .studio-response {
    padding: 16px;
  }
}
.journey-record > .row {
  flex-wrap: wrap;
  max-width: 100%;
}
.journey-record > .row:first-child {
  flex: 1 1 240px;
}
.journey-record > .row:first-child > div {
  min-width: 0;
  flex: 1;
  overflow-wrap: anywhere;
}
.journey-record > .row:last-child {
  margin-inline-start: auto;
}
.template-library-row {
  align-items: start;
  gap: 16px;
}
.template-library-row > div,
.template-editor,
.template-editor #email-template-composer {
  min-width: 0;
}
.template-library-row > div:first-child {
  flex: 1;
  overflow-wrap: anywhere;
}
.template-library-row > .row {
  max-width: 440px;
}
.template-editor > .actions {
  flex-wrap: wrap;
}
.communication-policy summary {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 16px;
  cursor: pointer;
}
.communication-policy summary > span:first-child {
  font-size: 17px;
  font-weight: 600;
}
.communication-policy form {
  margin-top: 16px;
}
@media (max-width: 760px) {
  .template-library-row {
    flex-direction: column;
    align-items: stretch;
  }
  .template-library-row > .row {
    max-width: none;
  }
}
@media (max-width: 1250px) {
  .crm-workspace {
    min-height: 0;
  }
  .crm-thread {
    height: 700px;
  }
}
.knowledge-source-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.knowledge-source-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  min-width: 0;
}
.knowledge-source-card h2,
.knowledge-source-card p {
  margin: 0;
}
.knowledge-source-card .badge {
  font-size: 11px;
  white-space: normal;
}
.knowledge-source-icon {
  color: var(--muted);
  display: flex;
}
.knowledge-source-icon svg {
  width: 22px;
  height: 22px;
}
.knowledge-source-actions {
  display: grid;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}
.knowledge-source-actions button {
  justify-content: space-between;
  text-align: left;
}
.knowledge-source-actions svg {
  flex-shrink: 0;
}
.knowledge-options,
.knowledge-origins {
  margin-top: 16px;
}
.knowledge-options summary {
  cursor: pointer;
  font-weight: 600;
}
.knowledge-options[open] summary {
  margin-bottom: 16px;
}
.knowledge-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.knowledge-form-grid > * {
  min-width: 0;
}
.knowledge-library-head {
  margin-top: 28px;
}
.knowledge-library-head h2 {
  margin-bottom: 4px;
}
.knowledge-library-head p {
  margin: 0;
}
.knowledge-origin-url {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.knowledge-import-preview {
  display: grid;
  gap: 12px;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.knowledge-import-preview .record {
  margin: 0;
}
.knowledge-import-preview p {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
input[data-faq-file]::file-selector-button,
input[data-knowledge-file]::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--soft);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
@media (max-width: 1250px) {
  .knowledge-source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 600px) {
  .knowledge-source-grid,
  .knowledge-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.survey-editor-layout {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(0, 3fr);
  gap: 16px;
  margin: 16px 0;
}
.survey-public fieldset {
  border: 0;
  padding: 16px 0;
}
.survey-public legend {
  font-weight: 600;
  margin-bottom: 12px;
}
@media (max-width: 760px) {
  .survey-editor-layout {
    grid-template-columns: 1fr;
  }
}

.crm-view-switch {
  margin-bottom: 12px;
}
.crm-table td {
  padding: 12px;
  vertical-align: top;
  font-size: 13px;
}
.crm-table th {
  white-space: nowrap;
}
.crm-table .crm-table-entry {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  border: 0;
  padding: 0;
  background: transparent;
  min-width: 180px;
  max-width: 320px;
  text-align: left;
}
.crm-table-entry span {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crm-table td small {
  display: block;
}
.crm-row-preview {
  position: relative;
  min-width: 90px;
}
.crm-row-preview p {
  position: absolute;
  right: 0;
  top: 24px;
  z-index: 5;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  width: 280px;
  max-width: 70vw;
}
.crm-table-scroll {
  min-height: 360px;
}

.answer-options span {
  width: auto;
  min-width: 64px;
  height: auto;
  min-height: 44px;
  padding: 8px 14px;
  white-space: normal;
}

.campaign-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}
.campaign-stage {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(200px, 2fr) auto;
  gap: 16px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}
.card:has(> .campaign-stage) {
  margin-bottom: 16px;
}
.campaign-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
  margin: 0;
}
.campaign-metrics dt {
  color: var(--muted);
  font-size: 13px;
}
.campaign-metrics dd {
  font-size: 24px;
  margin: 6px 0 0;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 800px) {
  .campaign-summary {
    align-items: flex-start;
    flex-direction: column;
  }
  .campaign-stage {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .campaign-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Playground and knowledge use the existing v5.8 theme tokens. */
.knowledge-article {
  border-bottom: 1px solid var(--line);
  padding: 0;
}
.knowledge-article:last-child {
  border-bottom: 0;
}
.knowledge-article summary {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 4px;
  cursor: pointer;
}
.knowledge-article summary::before {
  content: '';
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg);
  flex-shrink: 0;
}
.knowledge-article[open] summary::before {
  transform: rotate(45deg);
}
.knowledge-article summary span {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.knowledge-article summary small {
  color: var(--muted);
}
.knowledge-article-body {
  display: grid;
  gap: 12px;
  padding: 0 20px 20px;
}
.knowledge-article-body .studio-prose {
  max-height: 320px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (max-width: 600px) {
  .knowledge-article summary small {
    display: none;
  }
}

/* System Owner uses the existing Framed sheet identity and theme tokens.
   At 1440px: 256px navigation + 8px frame + 1176px sheet; 48px inner
   gutters leave 1128px = 2 x 556px plan columns + a 16px shared gap. */
.owner-shell {
  --owner-section-gap: 24px;
  line-height: 1.5;
}
.owner-shell .content {
  padding: 24px;
}
.owner-shell #page {
  display: grid;
  gap: var(--owner-section-gap);
  align-content: start;
}
.owner-shell #page > .page-head {
  margin: 0;
  align-items: flex-start;
}
.owner-shell .page-head > div {
  flex: 1;
}
.owner-shell .page-head > button {
  flex-shrink: 0;
}
.owner-shell h1 {
  font-size: 24px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.owner-shell h2 {
  font-size: 16px;
  line-height: 1.5;
  font-weight: 600;
}
.owner-shell h3 {
  line-height: 1.5;
  font-weight: 600;
}
.owner-shell .page-head p {
  max-width: 68ch;
  margin-top: 8px;
  font-size: 14px;
}
.owner-shell .card {
  padding: 20px;
}
.owner-shell .card-head {
  align-items: flex-start;
  gap: 16px;
}
.owner-shell .card-head p,
.owner-shell .record p {
  margin-top: 4px;
}
.owner-shell .help {
  font-size: 13px;
  line-height: 1.5;
}
.owner-shell .record {
  padding: 16px;
  gap: 16px;
}
.owner-shell .record > div:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.owner-shell .record > .row {
  flex-shrink: 0;
}
.owner-shell button {
  font-weight: 500;
}
.owner-shell .table-wrap {
  max-width: 100%;
}
.owner-shell .table-wrap table {
  min-width: 760px;
}
.owner-shell .table-wrap :is(th, td):first-child {
  white-space: nowrap;
}
.owner-shell th,
.owner-shell td {
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
body:has(.owner-shell) dialog label {
  font-size: 14px;
  font-weight: 500;
  gap: 8px;
}
body:has(.owner-shell) dialog :is(input, select, textarea) {
  font-variant-numeric: tabular-nums;
}
body:has(.owner-shell) dialog .dialog-body {
  gap: 20px;
}
.commercial-plan-grid {
  align-items: stretch;
}
.commercial-plan {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.commercial-plan-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.commercial-plan-heading h2 {
  overflow-wrap: anywhere;
}
.commercial-plan-heading .badge {
  flex: none;
}
.commercial-plan-price {
  font-size: 28px;
  line-height: 1.2;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.commercial-plan-price span {
  margin-left: 6px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: normal;
  color: var(--muted);
}
.commercial-plan-description {
  color: var(--muted);
  overflow-wrap: anywhere;
}
.commercial-plan-quotas {
  display: grid;
  gap: 0;
  margin: 0;
  font-size: 14px;
}
.commercial-plan-quotas > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: baseline;
  gap: 12px;
  padding-block: 8px;
  border-bottom: 1px solid var(--line);
}
.commercial-plan-quotas dt {
  color: var(--muted);
}
.commercial-plan-quotas dd {
  margin: 0;
  text-align: right;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.commercial-plan-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}
.commercial-plan-history {
  color: var(--muted);
  font-size: 13px;
}
.commercial-plan-history summary {
  cursor: pointer;
  padding-block: 4px;
}
.commercial-plan-history .record {
  margin-top: 12px;
  color: var(--text);
}
.commercial-plan-presets .help {
  max-width: 72ch;
}
dialog.commercial-plan-editor {
  max-width: 960px;
  max-height: 90dvh;
  overflow: auto;
}
.commercial-plan-editor > form {
  gap: 0;
}
.commercial-plan-editor .dialog-head h2 {
  font-size: 20px;
}
.commercial-plan-editor .dialog-body {
  display: grid;
  gap: 20px;
}
.commercial-plan-editor .commercial-section-title {
  font-size: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.commercial-plan-editor fieldset {
  min-width: 0;
}
.commercial-plan-editor legend {
  margin-bottom: 12px;
  font-size: 14px;
  font-weight: 600;
}
.commercial-capability {
  display: grid;
  align-content: start;
  gap: 4px;
  padding-block: 8px;
}
.commercial-capability .check-label {
  min-height: 32px;
}
.commercial-capability :is(.help, small) {
  margin-left: 28px;
}
.commercial-plan-editor [data-capability-group] + [data-capability-group],
.commercial-quota-fields + .commercial-quota-fields {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.commercial-plan-editor [role='status']:empty,
.commercial-plan-editor [role='alert']:empty {
  display: none;
}
@media (max-width: 1100px) {
  .owner-shell .card-head,
  .owner-shell .page-head {
    flex-wrap: wrap;
  }
  .owner-shell .page-head > div {
    flex-basis: min(100%, 440px);
  }
  .owner-shell .record {
    flex-wrap: wrap;
  }
  .owner-shell .record > .row {
    flex-shrink: 1;
  }
}
@media (max-width: 760px) {
  .owner-shell .content {
    padding: 20px 16px;
  }
  .owner-shell #page {
    gap: 20px;
  }
  .owner-shell .page-head > div {
    flex-basis: 100%;
  }
  .owner-shell .card {
    padding: 16px;
  }
  .owner-shell :is(button, summary) {
    min-height: 44px;
  }
  .owner-shell .grid.four {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .owner-shell .grid.four h2 {
    font-size: 14px;
    min-height: 42px;
  }
  .owner-shell .commercial-plan-grid,
  .commercial-plan-editor :is(.grid.two, .grid.three) {
    grid-template-columns: minmax(0, 1fr);
  }
  .commercial-plan-editor .dialog-body,
  .commercial-plan-editor .dialog-head,
  .commercial-plan-editor .actions {
    padding: 16px;
  }
  .commercial-plan-editor :is(input, select, textarea) {
    font-size: 16px;
  }
  .commercial-plan-editor .actions {
    gap: 12px;
  }
  .commercial-plan-editor .actions button {
    flex: 1;
    min-height: 44px;
  }
}

.playground-generation-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
}
.playground-generation-state p {
  flex: 1 1 200px;
  font-size: 13px;
}
.playground-generation-state button {
  flex: 0 0 auto;
}

/* Settings destinations share one text/arrow layout at every viewport. */
.settings-page > .page-head {
  margin-bottom: 0;
}
.settings-destination {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  height: 100%;
  padding: 18px 20px;
  text-align: left;
  white-space: normal;
}
.record-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.record-copy strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.record-copy .help {
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.settings-destination > svg {
  width: 20px;
  height: 20px;
}
@media (max-width: 760px) {
  button.small {
    min-height: 44px;
    min-width: 44px;
  }
  .settings-destination {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 16px;
    text-align: left;
  }
}
@media (max-width: 760px) {
  .studio-tabs button {
    min-height: 44px;
    min-width: 44px;
  }
  .crm-navigation-heading .icon-btn,
  .crm-navigation [data-edit-view] {
    min-width: 44px;
  }
}
/* Shared control geometry: same-role actions and section navigation stay aligned. */
:root {
  --control-height: 40px;
  --control-action-width: 128px;
}
.page-head {
  align-items: flex-start;
  flex-wrap: wrap;
}
.page-head > button {
  min-height: var(--control-height);
  flex: 0 0 auto;
}
.action-group {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(var(--control-action-width), 1fr);
  align-items: stretch;
  gap: 12px;
  max-width: 100%;
}
.action-group > button {
  min-height: var(--control-height);
  white-space: normal;
}
.metric-card {
  display: grid;
  grid-template-rows: minmax(3em, auto) auto 1fr;
  align-content: start;
  gap: 8px;
  min-width: 0;
}
.metric-card > .stat {
  margin: 0;
}
.survey-result-card {
  grid-template-rows: auto minmax(3em, 1fr) auto auto;
  align-content: start;
}
.survey-result-card > .row {
  min-height: 40px;
  align-items: flex-start;
}
.survey-result-card h3 {
  min-width: 0;
  overflow-wrap: anywhere;
}
.survey-result-card .badge {
  flex-shrink: 0;
}
.report-data-table :is(th, td) {
  min-width: 180px;
  vertical-align: top;
}
.report-data-table td {
  overflow-wrap: anywhere;
}
.report-data-table
  :is([data-report-column='id'], [data-report-column$='_id'], [data-report-column$='_at']) {
  min-width: 240px;
  white-space: nowrap;
}
.report-data-table [data-report-column='email'] {
  min-width: 260px;
}
.results-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}
.results-tabs:has(> button:last-child:nth-child(2)) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.results-tabs,
.studio-tabs {
  border-bottom: 1px solid var(--line);
  padding: 0;
  margin-bottom: 24px;
}
.results-tabs > button,
.studio-tabs > button,
.module-tabs > .module-tab {
  position: relative;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  font-weight: 600;
}
.results-tabs > button {
  width: auto;
  white-space: normal;
}
.results-tabs > button[aria-pressed='true'],
.studio-tabs > button[aria-current='page'] {
  color: var(--text);
  background: transparent;
}
.results-tabs > button:hover,
.studio-tabs > button:hover {
  color: var(--text);
  background: var(--soft);
}
.results-tabs > button[aria-pressed='true']::after,
.studio-tabs > button[aria-current='page']::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 2px;
  background: var(--accent);
}
.results-tabs > button:focus-visible,
.studio-tabs > button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: -3px;
}
@media (max-width: 600px) {
  :root {
    --control-height: 44px;
    --control-action-width: 112px;
  }
  .results-tabs,
  .results-tabs:has(> button:last-child:nth-child(2)) {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .report-filter-actions {
    align-items: stretch;
  }
  .report-filter-actions > .action-group {
    width: 100%;
  }
  .page-head > button {
    width: 100%;
  }
}
/* Peer actions keep equal tracks and row heights without changing their handlers. */
.owner-module .actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
}
.owner-module .actions > button {
  min-width: 0;
  white-space: normal;
}
.owner-module .actions:has(> button:only-child) {
  grid-template-columns: minmax(0, max-content);
  justify-content: start;
}
.topbar > .row > .ghost {
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}
@media (max-width: 600px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding-block: 4px;
    row-gap: 4px;
  }
  .topbar > .row:first-child,
  .topbar > .row:last-child {
    flex: 1 1 100%;
    width: 100%;
  }
  .topbar > .row:last-child {
    justify-content: flex-end;
    gap: 4px;
  }
  .topbar .crumb {
    max-width: none;
  }
}
