* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 14px;
}

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

h1 {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: 0;
}

h2 {
  font-size: 15px;
  font-weight: 650;
}

h3 {
  font-size: 14px;
  margin: 0 0 4px;
}

.eyebrow {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

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

/* ------------------------------------------------------------------------ */
/* Public + login shell                                                     */
/* ------------------------------------------------------------------------ */

.nr3-shell {
  margin: 0 auto;
  max-width: 1040px;
  padding: 32px 20px;
}

.login-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-subtle);
  margin: 96px auto 0;
  max-width: 380px;
  padding: 24px;
}

.onboarding-panel {
  max-width: 560px;
}

/* ------------------------------------------------------------------------ */
/* Admin shell: sidebar + main area                                         */
/* ------------------------------------------------------------------------ */

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

.sidebar {
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  align-items: center;
  display: flex;
  gap: 10px;
  padding: 4px 8px 18px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 12px;
}

.brand-mark {
  align-items: center;
  background: var(--color-blue);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  font-weight: 700;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-name {
  font-weight: 700;
  font-size: 14px;
}

.brand-sub {
  color: var(--color-muted);
  font-size: 11px;
}

.tenant-selector {
  background: #f6f8fb;
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 4px;
}

.tenant-selector.is-active,
.tenant-selector.is-open {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 2px var(--color-blue-soft);
}

.tenant-selector-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 8px;
  justify-content: space-between;
  min-height: 0;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.tenant-selector-button:hover {
  background: #eef1f5;
  border-radius: 6px;
}

.tenant-selector-label {
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
}

.tenant-selector-caret {
  color: var(--color-muted);
  font-size: 10px;
}

.tenant-selector-count {
  background: rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
  margin-left: auto;
  margin-right: 6px;
  min-width: 20px;
  padding: 1px 7px;
  text-align: center;
}

.tenant-selector-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 8px 0 4px;
}

.tenant-selector-panel[hidden] {
  display: none;
}

.tenant-search {
  align-items: center;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex;
  gap: 6px;
  padding: 5px 8px;
}

.tenant-search-icon {
  color: var(--color-muted);
  font-size: 12px;
  line-height: 1;
}

.tenant-search-input {
  background: transparent;
  border: 0;
  color: var(--color-text);
  flex: 1;
  font-size: 12px;
  min-width: 0;
  outline: none;
  padding: 2px 0;
}

.tenant-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tenant-filter-chip {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1;
  padding: 4px 8px;
}

.tenant-filter-chip:hover {
  background: #f5f6f7;
  color: var(--color-text);
}

.tenant-filter-chip.is-active {
  background: var(--color-text);
  border-color: var(--color-text);
  color: #fff;
}

.tenant-empty-note {
  color: var(--color-muted);
  font-size: 12px;
  margin: 4px 4px 0;
}

.tenant-selector-list {
  border-top: 1px solid var(--color-border);
  list-style: none;
  margin: 4px 0 0;
  padding: 4px 0 0;
}

.tenant-selector-item {
  align-items: center;
  border-radius: 6px;
  color: var(--color-text);
  display: flex;
  font-size: 12px;
  font-weight: 600;
  gap: 8px;
  padding: 6px 10px;
  text-decoration: none;
}

.tenant-selector-item:hover {
  background: #eef1f5;
}

.tenant-selector-item.active {
  background: var(--color-blue-soft);
  color: var(--color-blue);
}

.tenant-selector-dot {
  border-radius: 50%;
  display: inline-block;
  height: 7px;
  width: 7px;
}

.tenant-selector-dot.tenant-status-active {
  background: var(--color-green);
}

.tenant-selector-dot.tenant-status-paused {
  background: var(--color-yellow);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
}

.nav-item {
  align-items: center;
  border-radius: 6px;
  color: var(--color-text);
  display: flex;
  font-size: 13px;
  font-weight: 600;
  gap: 10px;
  padding: 8px 10px;
  text-decoration: none;
}

.nav-item:hover {
  background: #f1f3f4;
}

.nav-item.active {
  background: var(--color-blue-soft);
  color: var(--color-blue);
}

.nav-dot {
  background: var(--color-border-strong);
  border-radius: 50%;
  display: inline-block;
  height: 6px;
  width: 6px;
}

.nav-item.active .nav-dot {
  background: var(--color-blue);
}

.sidebar-footer {
  border-top: 1px solid var(--color-border);
  margin-top: 12px;
  padding-top: 12px;
}

.button-block {
  width: 100%;
}

.sidebar-scrim {
  background: rgba(32, 33, 36, 0.4);
  border: 0;
  cursor: pointer;
  display: none;
  inset: 0;
  position: fixed;
  z-index: 5;
}

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

.page-header {
  align-items: center;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 16px;
  padding: 16px 24px;
  position: sticky;
  top: 0;
  z-index: 2;
}

.page-header-text {
  flex: 1 1 auto;
  min-width: 0;
}

.page-header-text .eyebrow {
  color: var(--color-blue);
}

.page-header-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.menu-toggle {
  background: transparent;
  border: 1px solid var(--color-border-strong);
  border-radius: 6px;
  color: var(--color-text);
  display: none;
  flex-direction: column;
  gap: 3px;
  height: 36px;
  justify-content: center;
  padding: 0 9px;
  width: 38px;
}

.menu-toggle span {
  background: var(--color-text);
  display: block;
  height: 2px;
  width: 18px;
}

.page-content {
  padding: 20px 24px 32px;
}

/* ------------------------------------------------------------------------ */
/* Panels + forms                                                           */
/* ------------------------------------------------------------------------ */

.panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-subtle);
  margin-bottom: 16px;
  padding: 18px;
}

.panel-header {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.form-stack {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

label {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
}

input {
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  color: var(--color-text);
  font: inherit;
  height: 40px;
  padding: 0 12px;
}

textarea {
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  color: var(--color-text);
  font: inherit;
  min-height: 88px;
  padding: 10px 12px;
  resize: vertical;
}

input:focus,
textarea:focus {
  border-color: var(--color-blue);
  outline: 2px solid var(--color-blue-soft);
}

button {
  background: var(--color-blue);
  border: 1px solid var(--color-blue);
  border-radius: var(--radius);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  min-height: 38px;
  padding: 8px 14px;
}

button:hover {
  background: #1765cc;
}

.button-secondary {
  background: #ffffff;
  border-color: var(--color-border-strong);
  color: var(--color-text);
}

.button-secondary:hover {
  background: #f1f3f4;
}

.button-link {
  align-items: center;
  background: #ffffff;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  color: var(--color-text);
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  justify-content: center;
  min-height: 32px;
  padding: 6px 10px;
  text-decoration: none;
}

.button-link:hover {
  background: #f1f3f4;
}

.alert {
  border-radius: var(--radius);
  margin-top: 16px;
  padding: 10px 12px;
}

.alert-error {
  background: var(--color-red-soft);
  border: 1px solid #f6c6c2;
  color: var(--color-red);
}

.alert-success {
  background: var(--color-green-soft);
  border: 1px solid #c7e6cf;
  color: var(--color-green);
}

.alert-warn {
  background: var(--color-yellow-soft);
  border: 1px solid #f4e3a8;
  color: var(--color-yellow);
}

.status-chip {
  border-radius: 999px;
  display: inline-flex;
  font-size: 11px;
  font-weight: 650;
  padding: 3px 8px;
}

.status-ok {
  background: var(--color-green-soft);
  color: var(--color-green);
}

.status-unknown {
  background: #eef0f2;
  color: var(--color-muted);
}

.status-warn {
  background: var(--color-yellow-soft);
  color: var(--color-yellow);
}

.status-down,
.status-error {
  background: var(--color-red-soft);
  color: var(--color-red);
}

.status-lead {
  background: var(--color-blue-soft);
  color: var(--color-blue);
}

.status-neutral {
  background: #f1f3f4;
  color: var(--color-muted);
}

.button-small {
  font-size: 12px;
  min-height: 32px;
  padding: 6px 10px;
}

.manual-email-block {
  background: #fbfbfd;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  gap: 10px;
  margin-top: 16px;
  padding: 14px;
}

.compact-header {
  margin-bottom: 2px;
}

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

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

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

.field-required label::after {
  color: var(--color-red);
  content: " *";
}

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

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

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

th,
td {
  border-top: 1px solid var(--color-border);
  padding: 10px 0;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--color-muted);
  font-weight: 600;
}

code {
  background: #f1f3f4;
  border-radius: 4px;
  padding: 2px 5px;
}

.lead-table th,
.lead-table td {
  min-width: 110px;
  padding-right: 18px;
}

.primary-cell {
  display: block;
  font-weight: 650;
}

.cell-note {
  color: var(--color-muted);
  display: block;
  font-size: 12px;
  margin-top: 3px;
}

.notes-row td {
  background: #fbfbfd;
  color: var(--color-muted);
  font-size: 12px;
}

.placeholder-detail {
  border-top: 1px solid var(--color-border);
  color: var(--color-text);
  font-weight: 650;
  margin-top: 16px;
  padding-top: 16px;
}

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

.detail-grid div {
  border-top: 1px solid var(--color-border);
  padding-top: 10px;
}

.detail-grid dt {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 650;
}

.detail-grid dd {
  margin: 4px 0 0;
}

.review-answer {
  border-top: 1px solid var(--color-border);
  padding: 12px 0;
}

.review-answer p {
  line-height: 1.5;
  margin-top: 6px;
  white-space: pre-wrap;
}

.summary-box {
  margin-top: 12px;
  min-height: 360px;
  width: 100%;
}

.confirmation-block {
  background: var(--color-green-soft);
  border: 1px solid #c7e6cf;
  border-radius: var(--radius);
  margin-top: 18px;
  padding: 14px;
}

.confirmation-block h2,
.next-steps h2 {
  margin-bottom: 6px;
}

.confirmation-block p {
  line-height: 1.5;
}

.next-steps {
  border-top: 1px solid var(--color-border);
  margin-top: 18px;
  padding-top: 16px;
}

.next-steps ol {
  color: var(--color-muted);
  line-height: 1.6;
  margin: 8px 0 0;
  padding-left: 20px;
}

.review-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.review-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.progress-line {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  color: var(--color-muted);
  display: flex;
  font-size: 12px;
  font-weight: 650;
  justify-content: space-between;
  margin: 18px 0 4px;
  padding: 10px 0;
}

.intake-form {
  margin-top: 16px;
}

.intake-form textarea {
  min-height: 180px;
}

/* ------------------------------------------------------------------------ */
/* KPI cards + dashboards                                                   */
/* ------------------------------------------------------------------------ */

.kpi-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
}

.kpi-card.kpi-accent {
  border-color: var(--color-blue-soft);
  background: var(--color-blue-soft);
}

.kpi-label {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kpi-value {
  color: var(--color-text);
  font-size: 26px;
  font-weight: 700;
  line-height: 1.1;
}

.kpi-help {
  color: var(--color-muted);
  font-size: 12px;
}

.kpi-link {
  color: var(--color-blue);
  font-size: 12px;
  font-weight: 650;
  margin-top: 2px;
  text-decoration: none;
}

.kpi-link:hover {
  text-decoration: underline;
}

.next-actions {
  list-style: none;
  margin: 0;
  padding: 0;
}

.next-actions li {
  align-items: center;
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 12px 0;
}

.next-actions li:first-child {
  border-top: 0;
}

.next-actions li > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.next-actions strong {
  color: var(--color-text);
  font-size: 13px;
  font-weight: 650;
}

.recent-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.recent-list li {
  align-items: center;
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto auto;
  padding: 10px 0;
}

.recent-list li:first-child {
  border-top: 0;
}

.recent-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.recent-main a {
  color: var(--color-text);
  font-weight: 650;
  text-decoration: none;
}

.recent-main a:hover {
  text-decoration: underline;
}

.settings-note {
  margin-top: 14px;
}

/* ------------------------------------------------------------------------ */
/* Compact data lists (home + tenant workspace)                             */
/* ------------------------------------------------------------------------ */

.datapoint-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.datapoint-list li {
  align-items: center;
  border-top: 1px solid var(--color-border);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(180px, 1fr) auto;
  padding: 8px 0;
}

.datapoint-list li:first-child {
  border-top: 0;
}

.datapoint-label {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
}

.datapoint-value {
  color: var(--color-text);
  font-size: 13px;
  font-weight: 700;
}

.inline-link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.inline-link {
  align-items: center;
  border: 1px solid var(--color-border-strong);
  border-radius: 6px;
  color: var(--color-text);
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  text-decoration: none;
}

.inline-link:hover {
  background: #f1f3f4;
}

.compact-note {
  font-size: 12px;
  margin-top: 10px;
}

.action-list {
  display: grid;
  gap: 6px;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  list-style: none;
  margin: 0;
  padding: 0;
}

.action-list button {
  background: #ffffff;
  text-align: left;
  width: 100%;
}

.button-disabled,
button.button-disabled,
.button-disabled:hover {
  background: #f6f7f9;
  border-color: var(--color-border);
  color: var(--color-muted);
  cursor: not-allowed;
}

/* ------------------------------------------------------------------------ */
/* Tenant workspace (ICP command center)                                    */
/* ------------------------------------------------------------------------ */

.tenant-header {
  align-items: center;
  background: #eef4ff;
  border: 1px solid #d6e4ff;
  border-radius: var(--radius);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 14px 18px;
}

.tenant-header-paused {
  background: #fff8e1;
  border-color: #f4e3a8;
}

.tenant-header-suspended {
  background: var(--color-red-soft);
  border-color: #f6c6c2;
}

.tenant-header-name {
  font-size: 16px;
  margin: 0 0 2px;
}

.tenant-header-meta {
  color: var(--color-muted);
  font-size: 12px;
  margin: 0;
}

.tenant-header-meta .dot-sep {
  margin: 0 6px;
}

.health-strip {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  gap: 0;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 14px;
  overflow: hidden;
}

.health-cell {
  align-items: center;
  border-left: 1px solid var(--color-border);
  display: grid;
  gap: 2px;
  grid-template-columns: 10px 1fr;
  grid-template-rows: auto auto;
  padding: 10px 12px;
}

.health-cell:first-child {
  border-left: 0;
}

.health-dot {
  background: var(--color-border-strong);
  border-radius: 50%;
  grid-column: 1;
  grid-row: 1 / span 2;
  height: 8px;
  width: 8px;
}

.health-ok .health-dot { background: var(--color-green); }
.health-warn .health-dot { background: var(--color-yellow); }
.health-trial .health-dot { background: var(--color-yellow); }
.health-down .health-dot { background: var(--color-red); }
.health-overdue .health-dot { background: var(--color-red); }

.health-label {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 650;
  grid-column: 2;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.health-state {
  color: var(--color-text);
  font-size: 12px;
  font-weight: 650;
  grid-column: 2;
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.control-btn {
  background: #ffffff;
  border: 1px solid var(--color-border-strong);
  color: var(--color-text);
  font-size: 12px;
  font-weight: 650;
  min-height: 34px;
  padding: 6px 12px;
}

.control-btn:hover:not([disabled]) {
  background: #f1f3f4;
}

.control-btn[disabled],
.control-btn[disabled]:hover {
  background: #f6f7f9;
  color: var(--color-muted);
  cursor: not-allowed;
}

.control-btn-warn[disabled] {
  border-color: #f4e3a8;
}

.op-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-bottom: 14px;
}

.op-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 14px 16px;
}

.op-card header {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.op-card h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0;
}

.op-meta {
  color: var(--color-muted);
  font-size: 11px;
  margin-top: 8px;
}

.op-kv {
  display: grid;
  gap: 4px 12px;
  grid-template-columns: 80px 1fr;
  margin: 0;
}

.op-kv dt {
  color: var(--color-muted);
  font-size: 12px;
  font-weight: 600;
}

.op-kv dd {
  color: var(--color-text);
  font-size: 12px;
  margin: 0;
}

.channel-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.channel-list li {
  align-items: center;
  border-top: 1px solid var(--color-border);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  padding: 6px 0;
}

.channel-list li:first-child {
  border-top: 0;
}

.channel-name {
  font-weight: 600;
}

.activity-card {
  margin-bottom: 14px;
}

.activity-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 16px 18px;
}

.activity-panel-header {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.activity-panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

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

.activity-table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}

.activity-table th,
.activity-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.activity-table th {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

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

@media (max-width: 720px) {
  .activity-table thead { display: none; }
  .activity-table, .activity-table tbody, .activity-table tr, .activity-table td {
    display: block;
    width: 100%;
  }
  .activity-table tr {
    border-bottom: 1px solid var(--color-border);
    padding: 6px 0;
  }
  .activity-table td {
    border: 0;
    padding: 2px 0;
  }
}

/* AI Agent control panel */
.agent-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 16px 18px;
}

.agent-panel-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.agent-panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.agent-toggle-row {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
}

.agent-toggle {
  align-items: center;
  background: transparent;
  border: 0;
  border-left: 1px solid var(--color-border);
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 8px;
  justify-content: space-between;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.agent-toggle[disabled],
.agent-toggle[disabled]:hover {
  cursor: not-allowed;
}

.agent-toggle:first-child {
  border-left: 0;
}

.agent-toggle-label {
  color: var(--color-text);
  font-size: 12px;
  font-weight: 650;
}

.agent-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  margin-bottom: 12px;
}

.agent-block {
  background: #fafbfc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
}

.agent-block h4 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0;
  text-transform: uppercase;
}

.agent-summary {
  color: var(--color-text);
  font-size: 12px;
  margin: 0;
}

.escalation-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.escalation-list li {
  align-items: center;
  border-top: 1px solid var(--color-border);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  padding: 6px 0;
}

.escalation-list li:first-child {
  border-top: 0;
}

.agent-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.agent-replies h4 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.reply-list {
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.reply-list li {
  border-bottom: 1px solid var(--color-border);
  padding: 6px 0;
}

@media (max-width: 720px) {
  .agent-toggle-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .agent-toggle {
    border-top: 1px solid var(--color-border);
  }
}

/* Channels control */
.channels-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 16px 18px;
}

.channels-panel-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.channels-panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.channels-panel { padding: 12px 14px; }

.channels-table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}

.channels-table th,
.channels-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 6px 8px;
  text-align: left;
  vertical-align: middle;
}

.channels-table th {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
}

.channels-table tr:last-child td {
  border-bottom: 0;
}

.ch-col-toggle { width: 56px; }
.ch-col-status { width: 84px; }
.ch-col-actions { width: 80px; text-align: right; }

.ch-name {
  font-weight: 600;
}

.ch-meta {
  font-size: 11px;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

/* Compact toggle (visual only — disabled placeholder) */
.channel-toggle {
  background: #d8dbe0;
  border-radius: 999px;
  cursor: not-allowed;
  display: inline-block;
  height: 16px;
  position: relative;
  transition: background 0.15s;
  width: 30px;
}

.channel-toggle.is-on {
  background: var(--color-blue, #2f6fed);
}

.channel-toggle-knob {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
  height: 12px;
  left: 2px;
  position: absolute;
  top: 2px;
  transition: left 0.15s;
  width: 12px;
}

.channel-toggle.is-on .channel-toggle-knob {
  left: 16px;
}

.link-btn {
  background: transparent;
  border: 0;
  color: var(--color-muted);
  cursor: not-allowed;
  font: inherit;
  font-size: 11px;
  padding: 2px 4px;
  text-decoration: underline;
}

.channels-foot {
  margin: 8px 2px 0;
}

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

/* Attention center */
.attention-center {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 14px 16px;
}

.attention-center-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.attention-center-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.attention-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  list-style: none;
  margin: 0;
  overflow: hidden;
  padding: 0;
}

.attention-row {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: grid;
  font-size: 12px;
  gap: 10px;
  grid-template-columns: 44px minmax(0, 1.2fr) minmax(0, 2fr) auto;
  padding: 7px 10px;
}

.attention-row:last-child {
  border-bottom: none;
}

.attention-sev {
  justify-self: start;
}

.attention-tenant {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-issue {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attention-action {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  text-decoration: none;
}

.attention-action:hover {
  background: #f5f6f7;
}

@media (max-width: 720px) {
  .attention-row {
    grid-template-columns: 44px 1fr auto;
  }
  .attention-issue {
    grid-column: 2 / -1;
    white-space: normal;
  }
}

/* Anomaly monitor */
.anomaly-monitor {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 14px 16px;
}

.anomaly-monitor-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.anomaly-monitor-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.anomaly-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  list-style: none;
  margin: 0 0 8px;
  overflow: hidden;
  padding: 0;
}

.anomaly-row {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: grid;
  font-size: 12px;
  gap: 10px;
  grid-template-columns: 44px minmax(0, 1.1fr) minmax(0, 1.6fr) minmax(0, 1.2fr) auto auto;
  padding: 7px 10px;
}

.anomaly-row:last-child {
  border-bottom: none;
}

.anomaly-sev {
  justify-self: start;
}

.anomaly-tenant {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anomaly-signal,
.anomaly-detected {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.anomaly-actions {
  display: inline-flex;
  gap: 6px;
}

.anomaly-action {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  text-decoration: none;
}

.anomaly-action:hover:not([disabled]) {
  background: #f5f6f7;
}

.anomaly-action[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.anomaly-empty {
  margin: 0 0 8px;
}

.anomaly-watching {
  font-size: 11px;
  margin: 0;
}

@media (max-width: 720px) {
  .anomaly-row {
    grid-template-columns: 44px 1fr auto;
  }
  .anomaly-signal,
  .anomaly-detected,
  .anomaly-status,
  .anomaly-actions {
    grid-column: 2 / -1;
    white-space: normal;
  }
}

/* Owner action modal (used by all data-action buttons) */
.owner-modal {
  align-items: center;
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: fixed;
  z-index: 1000;
}

.owner-modal[hidden] { display: none; }

.owner-modal-backdrop {
  background: rgba(15, 23, 42, 0.45);
  inset: 0;
  position: absolute;
}

.owner-modal-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 32px);
  max-width: 480px;
  position: relative;
  width: 100%;
}

.owner-modal-head {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 14px 18px;
}

.owner-modal-head h2 {
  font-size: 15px;
  margin: 0;
}

.owner-modal-x {
  background: transparent;
  border: 0;
  color: var(--color-muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 0 4px;
}

.owner-modal-body {
  overflow: auto;
  padding: 16px 18px;
}

.owner-modal-text {
  color: var(--color-text);
  font-size: 13px;
  margin: 0 0 12px;
}

.owner-modal-meta {
  background: #f6f8fb;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  font-size: 12px;
  gap: 6px;
  margin: 0;
  padding: 10px 12px;
}

.owner-modal-meta > div {
  display: flex;
  gap: 8px;
}

.owner-modal-meta dt {
  color: var(--color-muted);
  flex-shrink: 0;
  font-weight: 600;
  margin: 0;
  width: 90px;
}

.owner-modal-meta dd {
  color: var(--color-text);
  margin: 0;
}

.owner-modal-result {
  background: #fbf3f4;
  border: 1px solid #efd7da;
  border-radius: 8px;
  color: #8a2c33;
  font-size: 12px;
  margin: 12px 0 0;
  padding: 10px 12px;
}

.owner-modal-foot {
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  padding: 12px 18px;
}

body.owner-modal-open { overflow: hidden; }

/* Owner action buttons must always look active (not greyed out).
   We intentionally override the default disabled look for [data-action]. */
[data-action],
[data-action]:hover,
[data-action]:focus {
  cursor: pointer;
  opacity: 1;
}

[data-action][data-action-type="dangerous"] {
  border-color: #efd7da;
  color: #8a2c33;
}

[data-action][data-action-type="dangerous"]:hover {
  background: #fbf3f4;
}

/* Collapsible workspace sections (details/summary) */
.ws-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
}

.ws-section + .ws-section {
  margin-top: 0;
}

.ws-summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 10px;
  list-style: none;
  padding: 10px 14px;
  user-select: none;
}

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

.ws-summary::marker {
  content: "";
}

.ws-summary:hover {
  background: #f6f8fb;
}

.ws-section[open] > .ws-summary {
  border-bottom: 1px solid var(--color-border);
}

.ws-title {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
}

.ws-desc {
  flex: 1;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ws-chevron {
  color: var(--color-muted);
  display: inline-block;
  font-size: 12px;
  transition: transform 0.15s;
}

.ws-section[open] > .ws-summary .ws-chevron {
  transform: rotate(180deg);
}

/* Inside details, the legacy section's own bg/border is redundant */
.ws-section > section {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin: 0;
}

/* Soft section tones — restrained, enterprise-friendly tints.
   Backgrounds are very light so text and borders remain readable. */
.ws-tone-blue-gray { background: #f3f6fa; border-color: #e1e7ef; }
.ws-tone-cyan      { background: #f0f7fa; border-color: #dceaf0; }
.ws-tone-violet    { background: #f5f3fb; border-color: #e6e1ef; }
.ws-tone-mint      { background: #f1f8f4; border-color: #dceae1; }
.ws-tone-amber     { background: #faf6ee; border-color: #ece4d1; }
.ws-tone-yellow    { background: #fbf9ef; border-color: #ece8d4; }
.ws-tone-slate     { background: #f3f5f8; border-color: #dfe4ec; }
.ws-tone-lavender  { background: #f6f4fb; border-color: #e7e2f0; }
.ws-tone-peach     { background: #fbf3ef; border-color: #efddd2; }
.ws-tone-gray      { background: #f6f6f7; border-color: #e6e6e9; }
.ws-tone-beige     { background: #f9f6f1; border-color: #ebe4d8; }
.ws-tone-blue      { background: #f1f5fb; border-color: #dde6f1; }
.ws-tone-gray-blue { background: #f3f5f8; border-color: #e1e6ee; }
.ws-tone-mint2     { background: #f2f8f5; border-color: #dde9e1; }
.ws-tone-gray2     { background: #f6f6f7; border-color: #e7e7ea; }
.ws-tone-cream     { background: #faf7f1; border-color: #ece6d6; }
.ws-tone-gray3     { background: #f5f5f6; border-color: #e6e6e9; }
.ws-tone-danger    { background: #fbf3f4; border-color: #efd7da; }

/* Slightly deeper hover on summary so the tint stays visible but reacts */
.ws-tone-blue-gray .ws-summary:hover { background: #ebf0f7; }
.ws-tone-cyan      .ws-summary:hover { background: #e6f1f6; }
.ws-tone-violet    .ws-summary:hover { background: #ede9f6; }
.ws-tone-mint      .ws-summary:hover { background: #e7f2ec; }
.ws-tone-amber     .ws-summary:hover { background: #f4ede0; }
.ws-tone-yellow    .ws-summary:hover { background: #f5f1de; }
.ws-tone-slate     .ws-summary:hover { background: #ebeff5; }
.ws-tone-lavender  .ws-summary:hover { background: #efeaf6; }
.ws-tone-peach     .ws-summary:hover { background: #f5e7df; }
.ws-tone-gray      .ws-summary:hover { background: #eeeef0; }
.ws-tone-beige     .ws-summary:hover { background: #f3ede1; }
.ws-tone-blue      .ws-summary:hover { background: #e7eef7; }
.ws-tone-gray-blue .ws-summary:hover { background: #ebeff5; }
.ws-tone-mint2     .ws-summary:hover { background: #e8f1eb; }
.ws-tone-gray2     .ws-summary:hover { background: #eeeef0; }
.ws-tone-cream     .ws-summary:hover { background: #f4ede0; }
.ws-tone-gray3     .ws-summary:hover { background: #ededef; }
.ws-tone-danger    .ws-summary:hover { background: #f5e6e8; }

/* Generic compact card layout (contract/features/runtime/backup/comms/invoices) */
.contract-card,
.features-card,
.runtime-card,
.backup-card,
.comms-card,
.invoices-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 14px 16px;
}

.card-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.card-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.kv-grid {
  display: grid;
  font-size: 12px;
  gap: 6px 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  margin: 0 0 10px;
}

.kv-grid dt {
  color: var(--color-text-muted);
  font-size: 11px;
  margin: 0;
}

.kv-grid dd {
  font-weight: 600;
  margin: 0;
}

.danger-row {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--color-border);
}

.features-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  list-style: none;
  margin: 0;
  overflow: hidden;
  padding: 0;
}

.feature-row {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  font-size: 12px;
  gap: 10px;
  justify-content: space-between;
  padding: 7px 10px;
}

.feature-row:last-child {
  border-bottom: none;
}

.feature-label {
  font-weight: 500;
}

.invoices-table,
.audit-table,
.admin-users-table {
  border-collapse: collapse;
  font-size: 12px;
  margin: 0 0 10px;
  width: 100%;
}

.invoices-table th,
.invoices-table td,
.audit-table th,
.audit-table td,
.admin-users-table th,
.admin-users-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 6px 8px;
  text-align: left;
}

.invoices-table th,
.audit-table th,
.admin-users-table th {
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 600;
}

.invoice-actions {
  display: flex;
  gap: 6px;
}

/* Setup checklist */
.setup-checklist {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 14px 16px;
}

.setup-checklist-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.setup-checklist-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.setup-percent {
  font-variant-numeric: tabular-nums;
}

.setup-progress {
  background: #eef0f2;
  border-radius: 999px;
  height: 6px;
  margin-bottom: 10px;
  overflow: hidden;
  width: 100%;
}

.setup-progress-bar {
  height: 100%;
  transition: width 200ms ease;
}

.setup-progress-ok { background: #2f9e44; }
.setup-progress-warn { background: #d9a400; }
.setup-progress-down { background: #c92a2a; }

.setup-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  list-style: none;
  margin: 0;
  overflow: hidden;
  padding: 0;
}

.setup-row {
  align-items: center;
  border-bottom: 1px solid var(--color-border);
  display: grid;
  font-size: 12px;
  gap: 10px;
  grid-template-columns: 110px minmax(0, 1fr) auto;
  padding: 7px 10px;
}

.setup-row:last-child {
  border-bottom: none;
}

.setup-chip {
  justify-self: start;
}

.setup-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-action {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  color: var(--color-text);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  text-decoration: none;
}

.setup-action:hover {
  background: #f5f6f7;
}

@media (max-width: 720px) {
  .setup-row {
    grid-template-columns: 110px 1fr;
  }
  .setup-action {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* Tenant notes / internal CRM */
.notes-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 14px 16px;
}

.notes-panel-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.notes-panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.notes-panel-summary {
  align-items: center;
  display: inline-flex;
  gap: 10px;
}

.notes-list {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  list-style: none;
  margin: 0;
  overflow: hidden;
  padding: 0;
}

.note-row {
  border-bottom: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 9px 12px;
}

.note-row:last-child {
  border-bottom: none;
}

.note-row.note-pinned {
  background: #fafbfc;
}

.note-row-head {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  font-size: 11px;
  gap: 6px;
}

.note-prio,
.note-pin-chip {
  font-size: 10px;
}

.note-body {
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.note-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.notes-empty {
  margin: 0;
}

/* Onboarding control */
.onboarding-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 16px 18px;
}

.onboarding-panel-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.onboarding-panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.onboarding-stats {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
}

.onboarding-next {
  background: #fafbfc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  padding: 10px 12px;
}

.onboarding-next-text {
  color: var(--color-text);
  font-size: 12px;
  line-height: 1.5;
  margin: 4px 0 0;
}

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

@media (max-width: 720px) {
  .onboarding-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .onboarding-stats .data-stat {
    border-top: 1px solid var(--color-border);
  }
}

/* Escalations */
.escalations-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 16px 18px;
}

.escalations-panel-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.escalations-panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.escalations-stats {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
}

.escalations-meta {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 12px;
}

.escalations-rules {
  background: #fafbfc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 10px 12px;
}

.escalations-rules-text {
  color: var(--color-text);
  font-size: 12px;
  line-height: 1.5;
  margin: 4px 0 0;
}

.escalations-side {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.escalations-side .data-stat {
  background: #fafbfc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 8px 12px;
}

.escalations-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

@media (max-width: 720px) {
  .escalations-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .escalations-stats .data-stat {
    border-top: 1px solid var(--color-border);
  }
  .escalations-meta {
    grid-template-columns: 1fr;
  }
}

/* Operators & access */
.access-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 16px 18px;
}

.access-panel-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.access-panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.access-summary {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
}

.access-table {
  border: 1px solid var(--color-border);
  border-collapse: collapse;
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 12px;
  overflow: hidden;
  width: 100%;
}

.access-table th,
.access-table td {
  border-bottom: 1px solid var(--color-border);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}

.access-table thead th {
  background: #fafbfc;
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.access-table tbody tr:last-child td {
  border-bottom: none;
}

.access-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

@media (max-width: 720px) {
  .access-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .access-summary .data-stat {
    border-top: 1px solid var(--color-border);
  }
}

/* Push changes */
.push-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 16px 18px;
}

.push-panel-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.push-panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.push-stats {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
}

.push-warning {
  font-size: 12px;
  margin: 0 0 12px;
}

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

@media (max-width: 720px) {
  .push-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .push-stats .data-stat {
    border-top: 1px solid var(--color-border);
  }
}

/* Billing / Trial */
.billing-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 16px 18px;
}

.billing-panel-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.billing-panel-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.billing-stats {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
}

.billing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.billing-danger {
  align-items: center;
  background: #fff5f5;
  border: 1px solid #f6c6c2;
  border-radius: var(--radius);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 12px 14px;
}

.billing-danger strong {
  color: var(--color-red);
  font-size: 12px;
}

.billing-danger p {
  margin: 2px 0 0;
}

@media (max-width: 720px) {
  .billing-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .billing-stats .data-stat {
    border-top: 1px solid var(--color-border);
  }
  .billing-danger {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Source of Truth / Data Room */
.data-room {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  margin-bottom: 14px;
  padding: 16px 18px;
}

.data-room-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.data-room-header h3 {
  font-size: 13px;
  font-weight: 700;
  margin: 0 0 2px;
}

.data-room-stats {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 12px;
  overflow: hidden;
}

.data-stat {
  border-left: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
}

.data-stat:first-child {
  border-left: 0;
}

.data-stat-label {
  color: var(--color-muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.data-stat-value {
  align-items: center;
  color: var(--color-text);
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  font-weight: 700;
  gap: 6px;
}

.data-room-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.data-room-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.data-room-block {
  background: #fafbfc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 12px 14px;
}

.data-room-block h4 {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  text-transform: uppercase;
}

.cloud-list,
.category-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.cloud-list li {
  align-items: center;
  border-top: 1px solid var(--color-border);
  display: flex;
  font-size: 12px;
  justify-content: space-between;
  padding: 6px 0;
}

.cloud-list li:first-child {
  border-top: 0;
}

.cloud-name {
  font-weight: 600;
}

.category-list li {
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  padding: 5px 0;
}

.category-list li:first-child {
  border-top: 0;
}

@media (max-width: 720px) {
  .data-room-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .data-stat {
    border-top: 1px solid var(--color-border);
  }
}

.activity-list {
  border-top: 1px solid var(--color-border);
  font-size: 12px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-list li {
  border-bottom: 1px solid var(--color-border);
  padding: 6px 0;
}

.danger-zone {
  align-items: center;
  background: #fff5f5;
  border: 1px solid #f6c6c2;
  border-radius: var(--radius);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 14px 18px;
}

.danger-zone h3 {
  color: var(--color-red);
  font-size: 13px;
  margin: 0 0 4px;
}

.danger-zone p {
  font-size: 12px;
  margin: 0;
  max-width: 520px;
}

.danger-btn {
  background: #ffffff;
  border: 1px solid var(--color-red);
  color: var(--color-red);
  font-size: 12px;
  font-weight: 650;
  min-height: 34px;
  padding: 6px 14px;
}

.danger-btn[disabled],
.danger-btn[disabled]:hover {
  background: #fbeae8;
  color: #c98a85;
  cursor: not-allowed;
}

@media (max-width: 720px) {
  .health-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .health-cell {
    border-top: 1px solid var(--color-border);
  }
  .danger-zone {
    flex-direction: column;
    align-items: flex-start;
  }
  .tenant-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ------------------------------------------------------------------------ */
/* Responsive                                                               */
/* ------------------------------------------------------------------------ */

@media (max-width: 960px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

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

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

  .sidebar {
    height: 100vh;
    left: 0;
    position: fixed;
    top: 0;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    width: 260px;
    z-index: 6;
  }

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

  .app-shell.is-open .sidebar-scrim {
    display: block;
  }

  .page-header {
    padding: 12px 16px;
  }

  .page-content {
    padding: 16px 16px 24px;
  }
}

@media (max-width: 720px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .nr3-shell {
    padding: 20px 12px;
  }

  .recent-list li {
    grid-template-columns: 1fr;
  }

  .next-actions li {
    flex-direction: column;
    align-items: flex-start;
  }

  .review-actions {
    flex-direction: column;
  }

  .lead-form {
    grid-template-columns: 1fr;
  }

  .field-actions {
    justify-content: stretch;
  }

  .field-actions button {
    width: 100%;
  }

  .lead-table,
  .lead-table thead,
  .lead-table tbody,
  .lead-table tr,
  .lead-table th,
  .lead-table td {
    display: block;
  }

  .lead-table thead {
    display: none;
  }

  .lead-table tr {
    border-top: 1px solid var(--color-border);
    padding: 10px 0;
  }

  .lead-table td {
    border-top: 0;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    min-width: 0;
    padding: 5px 0;
  }

  .lead-table td::before {
    color: var(--color-muted);
    content: attr(data-label);
    font-weight: 650;
  }

  .notes-row td {
    display: block;
    padding: 10px;
  }

  .notes-row td::before {
    content: "";
  }

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

/* R3-UX-02: pending changes / push audit / demo banner */
.demo-banner {
  margin-bottom: 12px;
  border-left: 3px solid #4f8df9;
}
.alert-info {
  background: #eef4ff;
  border: 1px solid #cfe0fb;
  color: #1f3a73;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
}
.push-subhead {
  margin: 14px 0 6px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: #555;
}
.push-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 10px;
}
.push-table th, .push-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #ececec;
  vertical-align: middle;
}
.push-table thead th {
  font-weight: 600;
  color: #444;
  background: #fafafa;
}
.push-audit-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.push-audit-list li {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 14px;
}

/* R3-UX-02 #8: effective state source badge */
.source-badge {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 600;
  border: 1px solid transparent;
  margin-right: 6px;
  white-space: nowrap;
}
.source-backend {
  background: #eef4ff;
  color: #1f3a73;
  border-color: #cfe0fb;
}
.source-icp_override {
  background: #fff4d9;
  color: #6b4f00;
  border-color: #f0d791;
}

/* R3-UX-03: tenant header chips, preview block, push confirm form */
.tenant-header-chips {
  display: flex;
  align-items: center;
  gap: 6px;
}
.preview-block {
  background: #f6f7f9;
  border: 1px solid #e3e6ec;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0 0 12px;
}
.push-confirm-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.push-confirm-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: #444;
}
.push-confirm-label input {
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 14px;
  max-width: 280px;
}
.push-row-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
