:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
  color-scheme: light;
  color: #172033;
  background: #f4f6fb;
  --surface-canvas: #f4f6fb;
  --surface-panel: #ffffff;
  --surface-subtle: #f8f9fc;
  --surface-sidebar: #111827;
  --surface-sidebar-active: #26375a;
  --text-strong: #172033;
  --text-body: #34405a;
  --text-muted: #6c7890;
  --line-soft: #e4e8f0;
  --line-strong: #cfd6e3;
  --accent-700: #1d4fc4;
  --accent-600: #2563eb;
  --accent-500: #3674ee;
  --accent-200: #c9d9ff;
  --accent-100: #eaf1ff;
  --status-success: #16835b;
  --status-warning: #b56b16;
  --status-danger: #cf3f4f;
  --status-info: #6f55d9;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --shadow-panel: 0 1px 2px rgb(23 32 51 / 5%), 0 12px 32px rgb(23 32 51 / 5%);
  --shadow-float: 0 24px 70px rgb(23 32 51 / 16%);
  --sidebar-width: 242px;
  --ink: var(--text-strong);
  --muted: var(--text-muted);
  --line: var(--line-soft);
  --panel: var(--surface-panel);
  --blue: var(--accent-600);
  --green: var(--status-success);
  --red: var(--status-danger);
  --amber: var(--status-warning);
  --purple: var(--status-info);
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--surface-canvas);
  -webkit-font-smoothing: antialiased;
}
button,
input,
select {
  font: inherit;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgb(37 99 235 / 24%);
  outline-offset: 2px;
}
.button-spinner {
  width: 14px;
  height: 14px;
  display: inline-block;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: button-spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 7px;
}
@keyframes button-spin {
  to {
    transform: rotate(360deg);
  }
}
.hidden {
  display: none !important;
}
.muted {
  color: var(--muted);
}
.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 18% 8%, rgb(83 130 246 / 18%), transparent 32%),
    radial-gradient(circle at 88% 84%, rgb(111 85 217 / 10%), transparent 28%),
    var(--surface-canvas);
}
.login-card {
  width: min(420px, calc(100% - 32px));
  padding: 42px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}
.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.7px;
}
.brand-large {
  font-size: 27px;
}
.brand-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: #1d4ed8;
  color: #fff;
  border-radius: 9px;
  font-weight: 900;
}
.brand-dot {
  color: #2b67eb;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--blue);
  font-weight: 800;
  margin: 28px 0 8px;
}
.login-card h1 {
  font-size: 30px;
  margin: 0 0 8px;
}
.login-card form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}
.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}
.auth-back {
  justify-self: center;
  margin-top: 4px;
}
.auth-progress {
  margin-top: 24px;
  padding: 14px;
  border-radius: 8px;
  background: #eef2f8;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.login-card label,
.modal label {
  display: grid;
  gap: 7px;
  font-size: 13px;
  font-weight: 700;
  color: #34405a;
}
.login-card input,
.modal input,
.modal select,
.modal textarea,
.toolbar input,
.toolbar select {
  width: 100%;
  border: 1px solid #d8deea;
  border-radius: 9px;
  padding: 11px 12px;
  outline: 0;
  background: #fff;
  color: var(--ink);
}
.modal textarea {
  min-height: 84px;
  resize: vertical;
  font: inherit;
}
.page-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
}
.page-tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 8px 13px;
  font-size: 12px;
  font-weight: 750;
}
.page-tabs button.active,
.page-tabs button:hover {
  background: #eaf0ff;
  color: var(--blue);
  border-color: #bdd0ff;
}
.table-subtext {
  display: block;
  color: var(--muted);
  font-size: 11px;
  margin-top: 3px;
}
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  gap: 10px;
}
.schedule-day {
  min-height: 100px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  align-content: start;
  gap: 8px;
  font-size: 12px;
}
.schedule-day strong {
  font-size: 12px;
}
.schedule-day span:not(.muted) {
  background: #eef5ff;
  color: #315ba8;
  border-radius: 6px;
  padding: 6px;
}
.schedule-form-grid {
  display: grid;
  gap: 12px;
}
.schedule-form-day {
  display: grid;
  grid-template-columns: 90px repeat(4, minmax(100px, 1fr));
  align-items: end;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}
.schedule-form-day > strong {
  align-self: center;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.conversation-appointments {
  display: grid;
  gap: 8px;
}
.conversation-appointment {
  border: 1px solid var(--line);
  background: #f8faff;
  border-radius: 8px;
  padding: 10px;
  text-align: left;
  display: grid;
  gap: 3px;
}
.conversation-appointment span,
.conversation-appointment small {
  color: var(--muted);
  font-size: 11px;
}
.audit-line {
  display: grid;
  gap: 3px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.audit-line span,
.audit-line small {
  color: var(--muted);
  font-size: 12px;
}
@media (max-width: 1100px) {
  .schedule-grid {
    grid-template-columns: repeat(4, minmax(100px, 1fr));
  }
}
@media (max-width: 720px) {
  .schedule-grid,
  .schedule-form-day,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #2864e814;
}
.button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 750;
  font-size: 12px;
}
.button-primary {
  background: var(--blue);
  color: #fff;
}
.button-secondary {
  background: #eef2f8;
  color: #34405a;
}
.button-danger {
  background: #ffebeb;
  color: var(--red);
}
.button-wide {
  width: 100%;
  padding: 13px;
}
.login-help {
  font-size: 11px;
  color: var(--muted);
  margin: 22px 0 0;
}
.app-shell {
  min-height: 100vh;
  display: flex;
}
.sidebar {
  width: var(--sidebar-width);
  flex: none;
  background: var(--surface-sidebar);
  color: #c4cce0;
  display: flex;
  flex-direction: column;
  padding: 22px 15px;
}
.sidebar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 9px 30px;
}
.sidebar .brand {
  color: #fff;
}
.sidebar .brand-mark {
  background: #3671ee;
}
.admin-badge {
  font-size: 9px;
  letter-spacing: 0.1em;
  border: 1px solid #41506c;
  border-radius: 5px;
  padding: 4px 6px;
  color: #97a6c2;
}
.main-nav {
  display: grid;
  gap: 4px;
}
.nav-section {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #687792;
  margin: 16px 10px 6px;
}
.nav-item {
  border: 0;
  background: transparent;
  color: #aeb9cf;
  text-align: left;
  border-radius: 8px;
  padding: 11px 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  font-size: 13px;
}
.nav-item:hover,
.nav-item.active {
  background: var(--surface-sidebar-active);
  color: #fff;
}
.nav-icon {
  width: 17px;
  text-align: center;
  color: #89a8ef;
}
.sidebar-footer {
  margin-top: auto;
}
.status-line {
  font-size: 11px;
  color: #91a1bd;
  padding: 15px 10px;
  border-top: 1px solid #253049;
  display: flex;
  gap: 8px;
  align-items: center;
}
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2bbd83;
  box-shadow: 0 0 0 3px #2bbd8320;
}
.user-mini {
  border-top: 1px solid #253049;
  padding: 16px 5px 0;
  display: flex;
  align-items: center;
  gap: 9px;
}
.user-mini strong,
.user-mini small {
  display: block;
}
.user-mini strong {
  font-size: 12px;
  color: #f2f5fb;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-mini small {
  font-size: 9px;
  color: #8998b5;
  margin-top: 3px;
}
.avatar {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #314a80;
  color: #dce7ff;
  font-weight: 800;
  font-size: 12px;
}
.user-mini button {
  margin-left: auto;
  background: transparent;
  border: 0;
  color: #91a1bd;
  font-size: 18px;
}
.main-content {
  width: 100%;
  min-width: 0;
}
.topbar {
  height: 92px;
  padding: 22px 38px;
  background: rgb(255 255 255 / 92%);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.breadcrumb {
  font-size: 11px;
  color: #99a3b5;
  margin: 0 0 6px;
}
.breadcrumb span {
  padding: 0 6px;
}
.breadcrumb strong {
  color: #59667e;
}
.topbar h2 {
  font-size: 21px;
  margin: 0;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.date-chip {
  font-size: 11px;
  color: var(--muted);
}
.icon-button {
  border: 1px solid var(--line);
  background: #fff;
  color: #56647d;
  border-radius: 8px;
  width: 34px;
  height: 34px;
  font-size: 18px;
}
.loading-bar {
  height: 3px;
  background: linear-gradient(90deg, var(--blue), #75a0ff, var(--blue));
  background-size: 200% 100%;
  animation: load 1s infinite;
}
@keyframes load {
  to {
    background-position: -200% 0;
  }
}
.content {
  padding: 34px 38px 56px;
  max-width: 1500px;
}
.page-intro {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}
.page-intro h3 {
  font-size: 23px;
  margin: 0 0 7px;
}
.page-intro .eyebrow {
  margin: 0 0 7px;
}
.page-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex-wrap: wrap;
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}
.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-panel);
}
.metric-card {
  padding: 20px 21px;
  position: relative;
  overflow: hidden;
}
.metric-label,
.metric-note {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.metric-value {
  display: block;
  font-size: clamp(22px, 2vw, 28px);
  margin: 13px 0 5px;
}
.metric-value.blue {
  color: var(--blue);
}
.metric-value.green {
  color: var(--green);
}
.metric-value.red {
  color: var(--red);
}
.metric-value.purple {
  color: var(--purple);
}
.split-grid {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.panel {
  padding: 22px;
  margin-bottom: 16px;
}
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 18px;
}
.panel-title h4 {
  margin: 0;
  font-size: 14px;
}
.panel-title p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.panel-title > span {
  color: var(--muted);
  font-size: 11px;
}
.shortcut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.shortcut {
  border: 1px solid var(--line);
  background: #fafbfe;
  border-radius: 9px;
  padding: 15px;
  text-align: left;
  display: grid;
  gap: 6px;
}
.shortcut:hover {
  border-color: #a9bff4;
  background: #f4f7ff;
}
.shortcut strong {
  font-size: 13px;
}
.shortcut span {
  font-size: 11px;
  color: var(--muted);
}
.alert-row,
.empty {
  color: var(--muted);
  font-size: 12px;
  padding: 15px 0;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
}
.toolbar input {
  max-width: 300px;
}
.toolbar select {
  max-width: 180px;
}
.toolbar-spacer {
  flex: 1;
}
.table-wrap {
  overflow-x: auto;
}
.data-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}
.data-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #8b96aa;
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  background: var(--surface-subtle);
}
.data-table td {
  padding: 14px 10px;
  border-bottom: 1px solid #edf0f5;
  white-space: nowrap;
}
.data-table tr:last-child td {
  border-bottom: 0;
}
.data-table tbody tr {
  transition: background 0.18s ease;
}
.data-table tbody tr:hover {
  background: #f8faff;
}
.primary-cell {
  font-weight: 750;
}
.table-action,
.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 750;
  font-size: 12px;
  padding: 0;
}
.pill {
  display: inline-block;
  border-radius: 99px;
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.pill.green {
  color: var(--green);
  background: #e6f7ef;
}
.pill.amber {
  color: var(--amber);
  background: #fff5df;
}
.pill.red {
  color: var(--red);
  background: #ffebeb;
}
.pill.gray {
  color: #68758b;
  background: #eef1f5;
}
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 18px;
  color: var(--muted);
  font-size: 11px;
}
.pagination div {
  display: flex;
  gap: 8px;
}
.detail-grid,
.health-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
.detail-grid div,
.health-item {
  display: grid;
  gap: 7px;
}
.detail-grid span,
.health-item span {
  color: var(--muted);
  font-size: 11px;
}
.detail-grid strong,
.health-item strong {
  font-size: 13px;
  overflow-wrap: anywhere;
}
.detail-grid.compact {
  grid-template-columns: repeat(2, 1fr);
}
.status-note {
  display: grid;
  gap: 6px;
  padding: 16px;
  border-radius: 9px;
  font-size: 12px;
}
.status-note.warning,
.method-note {
  color: #79520e;
  background: #fff5df;
  border: 1px solid #f1d496;
}
.status-note.success {
  color: var(--green);
  background: #eaf8f1;
}
.method-fields {
  display: grid;
  gap: 14px;
}
.method-note {
  padding: 12px;
  border-radius: 8px;
  font-size: 11px;
}
.read-field {
  display: grid;
  gap: 6px;
  padding: 12px;
  background: #f7f9fc;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.read-field span {
  color: var(--muted);
  font-size: 11px;
}
.read-field strong {
  font-size: 13px;
}
.qr-panel {
  text-align: center;
}
.qr-panel img {
  width: min(280px, 100%);
  height: auto;
}
.health-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px;
  border-radius: 9px;
  background: #eaf8f1;
  color: var(--green);
  font-size: 12px;
}
.health-status.degraded {
  background: #fff5df;
  color: var(--amber);
}
.health-status span:last-child {
  margin-left: auto;
  font-size: 11px;
}
.health-grid {
  margin-top: 26px;
}
.resource-summary {
  margin-top: 18px;
}
.resource-alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 9px;
  background: #eaf8f1;
  color: var(--green);
}
.resource-alert.warning {
  background: #fff5df;
  color: var(--amber);
}
.resource-alert.critical {
  background: #ffebeb;
  color: var(--red);
}
.resource-alert span {
  font-size: 11px;
}
.estimate-card {
  display: grid;
  gap: 12px;
}
.estimate-card > strong {
  color: var(--blue);
  font-size: 24px;
}
.estimate-card > span,
.estimate-card > small {
  color: var(--muted);
  font-size: 11px;
}
.resource-note {
  margin-top: 18px;
}
.health-item {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.error-list {
  margin-top: 20px;
  border-left: 3px solid var(--red);
  padding-left: 12px;
  color: var(--red);
  font-size: 12px;
}
.role-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
.role-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 17px;
}
.role-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.role-head h4 {
  font-size: 14px;
  margin: 0 0 5px;
}
.role-head p {
  font-size: 11px;
  color: var(--muted);
  margin: 0;
}
.count-badge {
  font-size: 10px;
  color: var(--blue);
  background: #edf3ff;
  border-radius: 99px;
  padding: 5px 8px;
  height: max-content;
}
.permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 18px 0;
}
.permission {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: #53627b;
  background: #f1f4f8;
  padding: 5px 7px;
  border-radius: 5px;
}
.role-card small {
  display: block;
  margin-bottom: 13px;
}
.mono {
  font-family: ui-monospace, monospace;
  font-size: 10px;
}
.error-panel {
  border-color: #f0b9b9;
  background: #fffafa;
}
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #11182780;
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 5;
}
.modal {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 23px;
  box-shadow: var(--shadow-float);
}
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 20px;
}
.modal-head h3 {
  margin: 0 0 5px;
  font-size: 18px;
}
.modal-head p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}
.close {
  border: 0;
  background: transparent;
  color: #738096;
  font-size: 24px;
  line-height: 1;
}
.modal form {
  display: grid;
  gap: 14px;
}
.modal fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  display: grid;
  gap: 10px;
}
.modal legend {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
}
.check {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
}
.check input {
  width: auto;
}
.permission-option {
  align-items: flex-start;
  padding: 7px 5px;
}
.permission-option span {
  display: grid;
  gap: 3px;
}
.permission-option strong {
  color: var(--ink);
  font-size: 13px;
}
.permission-option small {
  color: var(--muted);
  font-weight: 400;
  line-height: 1.35;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 8;
  background: #172033;
  color: #fff;
  padding: 12px 15px;
  border-radius: 8px;
  font-size: 12px;
  box-shadow: 0 10px 30px #17203340;
}
.toast.error {
  background: #b63131;
}
@media (max-width: 1000px) {
  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .split-grid,
  .role-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .sidebar {
    width: 70px;
    padding: 15px 8px;
  }
  .sidebar .brand span:not(.brand-mark),
  .admin-badge,
  .nav-section,
  .nav-item {
    font-size: 0;
  }
  .nav-item {
    justify-content: center;
    padding: 12px;
  }
  .nav-icon {
    font-size: 16px;
  }
  .user-mini {
    justify-content: center;
  }
  .user-mini > div:not(.avatar),
  .user-mini button,
  .status-line {
    display: none;
  }
  .topbar,
  .content {
    padding-left: 18px;
    padding-right: 18px;
  }
  .topbar {
    height: 78px;
  }
  .date-chip {
    display: none;
  }
  .metric-grid {
    grid-template-columns: 1fr 1fr;
  }
  .detail-grid,
  .health-grid {
    grid-template-columns: 1fr;
  }
  .toolbar {
    flex-wrap: wrap;
  }
  .toolbar input {
    max-width: none;
    flex: 1;
    min-width: 180px;
  }
}

.conversation-toolbar {
  align-items: end;
}

.inline-date {
  display: grid;
  gap: 0.3rem;
  color: var(--muted);
  font-size: 0.76rem;
}

.inline-date input {
  min-width: 145px;
}

.message-preview {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 0.8fr);
  gap: 1rem;
  align-items: start;
}

.chat-panel {
  padding-bottom: 0;
  overflow: hidden;
}

.chat-history {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 280px;
  max-height: 620px;
  overflow-y: auto;
  padding: 1rem;
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.message-bubble {
  width: min(76%, 620px);
  padding: 0.8rem 0.9rem;
  border-radius: 14px;
  box-shadow: 0 2px 7px rgb(15 23 42 / 7%);
}

.message-bubble.inbound {
  align-self: flex-start;
  background: #fff;
  border-bottom-left-radius: 4px;
}

.message-bubble.outbound {
  align-self: flex-end;
  background: #e7f8ee;
  border-bottom-right-radius: 4px;
}

.message-bubble p {
  margin: 0.4rem 0 0.7rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message-direction {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.message-bubble footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.audio-message,
.unsupported-message {
  display: grid;
  gap: 0.4rem;
  margin: 0.65rem 0;
}

.audio-message audio {
  width: 100%;
  min-width: 240px;
}

.audio-message span,
.unsupported-message span,
.message-error {
  color: var(--muted);
  font-size: 0.78rem;
}

.message-error {
  display: block;
  color: #b42318;
  margin-top: 0.45rem;
}

.human-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid #f5c2c0;
  border-radius: 12px;
  background: #fff4f3;
  color: #912018;
}

.human-banner div {
  display: grid;
  gap: 0.25rem;
}

.human-banner span {
  font-size: 0.85rem;
}

.message-composer {
  display: grid;
  gap: 0.7rem;
  margin: 1rem -1.25rem 0;
  padding: 1rem 1.25rem;
  background: #fff;
  border-top: 1px solid var(--line);
}

.message-composer form {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.message-composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 130px;
  resize: vertical;
}

.audio-upload {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 0;
}

.message-composer small {
  color: var(--muted);
}

.conversation-side {
  position: sticky;
  top: 1rem;
}

.event-title {
  margin-top: 1rem;
}

.conversation-events {
  display: grid;
  gap: 0.7rem;
  max-height: 360px;
  overflow-y: auto;
}

.conversation-events > div {
  display: grid;
  gap: 0.15rem;
  padding-left: 0.8rem;
  border-left: 2px solid var(--line);
}

.conversation-events span,
.conversation-events small {
  color: var(--muted);
  font-size: 0.78rem;
}

@media (max-width: 1000px) {
  .conversation-layout {
    grid-template-columns: 1fr;
  }

  .conversation-side {
    position: static;
  }
}

@media (max-width: 720px) {
  .message-bubble {
    width: 92%;
  }

  .message-composer form,
  .human-banner {
    align-items: stretch;
    flex-direction: column;
  }
}

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

.settings-form label,
.ai-client-form label {
  display: grid;
  gap: 0.45rem;
  color: #34405a;
  font-size: 0.8rem;
  font-weight: 700;
}

.settings-form input,
.settings-form select,
.settings-form textarea,
.ai-client-form input,
.ai-client-form select,
.ai-client-form textarea {
  width: 100%;
  border: 1px solid #d8deea;
  border-radius: 9px;
  padding: 0.72rem 0.78rem;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.settings-form textarea,
.ai-client-form textarea {
  resize: vertical;
}

.narrow-content {
  max-width: 980px;
}

.ai-master-layout {
  display: grid;
  grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.ai-selection-list {
  display: grid;
  gap: 0.65rem;
}

.ai-functions-panel {
  margin-top: 1rem;
}

.ai-function-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}

.ai-function-form {
  min-width: 0;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
}

.ai-function-form legend {
  padding: 0 0.35rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.ai-function-form p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.45;
}

.tenant-ai-editor {
  margin-top: 0.25rem;
}

.tenant-ai-editor legend {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 800;
}

.tenant-ai-editor > p {
  margin: 0;
  line-height: 1.45;
}

.tenant-ai-metrics {
  margin-top: 1rem;
}

.pipeline-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
}

.pipeline-strip span {
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
}

.pipeline-strip small {
  color: var(--muted);
  font-weight: 500;
}

.pipeline-strip i {
  color: var(--muted);
  font-style: normal;
}

.ai-select-card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  text-align: left;
}

.ai-select-card:hover,
.ai-select-card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px #2864e810;
}

.ai-select-card span:first-child {
  display: grid;
  gap: 0.35rem;
}

.ai-select-card small,
.form-heading p,
.settings-section p,
.settings-form label small {
  color: var(--muted);
  font-weight: 400;
}

.default-badge {
  border-radius: 99px;
  padding: 0.28rem 0.5rem;
  background: #e9f0ff;
  color: var(--blue);
  font-size: 0.64rem;
  letter-spacing: 0.06em;
}

.form-heading {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--line);
}

.form-heading h4,
.form-heading p,
.settings-section h4,
.settings-section p {
  margin: 0;
}

.secret-field {
  border: 1px solid #d9e4fa;
  border-radius: 10px;
  padding: 1rem;
  background: #f7faff;
}

.secret-field span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.55rem;
}

.ai-client-form {
  display: grid;
  gap: 1rem;
}

.settings-section {
  position: relative;
  display: grid;
  gap: 1rem;
  padding-left: 4.2rem;
}

.section-number {
  position: absolute;
  left: 1.25rem;
  top: 1.25rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #e9f0ff;
  color: var(--blue);
  font-weight: 800;
}

.activation-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  display: flex !important;
  align-items: center;
  gap: 0.8rem !important;
}

.activation-card span {
  display: grid;
  gap: 0.2rem;
}

.activation-card input {
  width: auto !important;
}

.sticky-save {
  position: sticky;
  bottom: 1rem;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 30px #17203318;
  color: var(--muted);
  font-size: 0.8rem;
}

.personality-preview {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  border-radius: 10px;
  padding: 0.85rem;
  background: #f4f6fa;
  font-size: 0.75rem;
}

.personality-preview span {
  width: 100%;
  color: var(--muted);
}

.empty-card {
  padding: 1rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 12px;
}

.settings-form textarea {
  min-height: 150px;
}
.automation-explanation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.automation-explanation {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-soft, #f8fafc);
}

.automation-explanation p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}
.message-trace {
  display: block;
  margin-top: 8px;
}
.trace-artifacts {
  margin-top: 16px;
  display: grid;
  gap: 10px;
}
.trace-artifacts details {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px;
}
.trace-artifacts pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 280px;
  overflow: auto;
}

/* Native data visualizations */
:root {
  --chart-blue: #2563eb;
  --chart-green: #18a06f;
  --chart-purple: #7658df;
  --chart-amber: #d58a27;
  --chart-red: #d84b5b;
  --chart-gray: #c4cad5;
}
.visual-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}
.visual-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface-panel);
  box-shadow: var(--shadow-panel);
}
.visual-empty {
  min-height: 120px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  padding: 20px;
  border: 1px dashed #d8deea;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-align: center;
}
.visual-empty > span {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-subtle);
  font-weight: 800;
}
.visual-empty p {
  margin: 0;
  font-size: 12px;
}
.bar-list {
  display: grid;
  gap: 14px;
}
.bar-row {
  display: grid;
  gap: 7px;
}
.bar-row-label {
  min-width: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
}
.bar-row-label span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-body);
}
.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}
.bar-fill {
  width: var(--bar-value);
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--chart-blue);
  transition: width 0.35s ease;
}
.bar-fill.green {
  background: var(--chart-green);
}
.bar-fill.purple {
  background: var(--chart-purple);
}
.bar-fill.amber {
  background: var(--chart-amber);
}
.bar-fill.red {
  background: var(--chart-red);
}
.donut-layout {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr);
  align-items: center;
  gap: 20px;
}
.donut-chart {
  width: 126px;
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  position: relative;
  border-radius: 50%;
  background: conic-gradient(var(--donut));
}
.donut-chart::after {
  content: '';
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  background: var(--surface-panel);
}
.donut-chart strong,
.donut-chart span {
  position: relative;
  z-index: 1;
  text-align: center;
}
.donut-chart strong {
  font-size: 22px;
}
.donut-chart span {
  color: var(--text-muted);
  font-size: 10px;
}
.donut-legend {
  display: grid;
  gap: 9px;
}
.donut-legend > div {
  min-width: 0;
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.donut-legend i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chart-gray);
}
.donut-legend i.blue {
  background: var(--chart-blue);
}
.donut-legend i.green {
  background: var(--chart-green);
}
.donut-legend i.purple {
  background: var(--chart-purple);
}
.donut-legend i.amber {
  background: var(--chart-amber);
}
.donut-legend i.red {
  background: var(--chart-red);
}
.donut-legend span {
  overflow-wrap: anywhere;
  color: var(--text-muted);
}
.trend-chart {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #f7faff, #fff);
}
.trend-chart svg {
  width: 100%;
  min-height: 100px;
  overflow: visible;
}
.trend-chart polyline {
  fill: none;
  stroke: var(--chart-blue);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.trend-chart.green polyline {
  stroke: var(--chart-green);
}
.trend-chart.purple polyline {
  stroke: var(--chart-purple);
}
.trend-chart.amber polyline {
  stroke: var(--chart-amber);
}
.trend-chart.red polyline {
  stroke: var(--chart-red);
}
.trend-chart > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  color: var(--text-muted);
  font-size: 10px;
}
.trend-chart > div strong {
  color: var(--text-strong);
  font-size: 14px;
}
.status-strip {
  min-height: 68px;
  display: flex;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
  background: var(--surface-subtle);
}
.status-strip-segment {
  min-width: max(76px, calc(var(--segment-value) * 1%));
  flex: var(--segment-value) 1 0;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 11px 12px;
  border-left: 3px solid var(--chart-gray);
  background: rgb(255 255 255 / 75%);
}
.status-strip-segment:first-child {
  border-left-width: 0;
}
.status-strip-segment.blue {
  border-color: var(--chart-blue);
}
.status-strip-segment.green {
  border-color: var(--chart-green);
}
.status-strip-segment.purple {
  border-color: var(--chart-purple);
}
.status-strip-segment.amber {
  border-color: var(--chart-amber);
}
.status-strip-segment.red {
  border-color: var(--chart-red);
}
.status-strip-segment b {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.status-strip-segment small {
  color: var(--text-muted);
}
@media (max-width: 640px) {
  .donut-layout {
    grid-template-columns: 1fr;
  }
  .donut-chart {
    margin-inline: auto;
  }
  .status-strip {
    display: grid;
  }
  .status-strip-segment {
    min-width: 0;
  }
}

/* System health, resources and audit */
.health-hero {
  display: grid;
  grid-template-columns: minmax(240px, 0.75fr) minmax(320px, 1.25fr);
  align-items: center;
  gap: 24px;
  margin-bottom: 16px;
  padding: 24px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #f8fbff, var(--surface-panel));
  box-shadow: var(--shadow-panel);
}

.health-hero.ok {
  border-left: 4px solid var(--status-success);
}

.health-hero.degraded {
  border-left: 4px solid var(--status-danger);
}

.health-hero h4 {
  margin: 3px 0 7px;
  color: var(--text-strong);
  font-size: clamp(22px, 3vw, 32px);
  letter-spacing: -0.035em;
}

.health-service-strip .status-strip {
  min-height: 86px;
}

.resource-gauge-panel {
  margin-bottom: 16px;
}

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

.resource-gauge {
  --gauge-color: var(--chart-blue);
  display: grid;
  min-height: 168px;
  place-items: center;
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.resource-gauge.green {
  --gauge-color: var(--chart-green);
}

.resource-gauge.amber {
  --gauge-color: var(--chart-amber);
}

.resource-gauge.red {
  --gauge-color: var(--chart-red);
}

.resource-gauge.purple {
  --gauge-color: var(--chart-purple);
}

.resource-gauge > div {
  display: grid;
  width: 126px;
  height: 126px;
  place-content: center;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--surface-panel) 57%, transparent 59%),
    conic-gradient(var(--gauge-color) var(--gauge-value), var(--line-soft) 0);
}

.resource-gauge strong {
  color: var(--text-strong);
  font-size: 21px;
}

.resource-gauge span {
  max-width: 90px;
  color: var(--text-muted);
  font-size: 10px;
  text-align: center;
}

.whatsapp-resource-panel .donut-layout {
  grid-template-columns: 200px 1fr;
}

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

.resource-trends article {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

.resource-trends .panel-title {
  margin-bottom: 10px;
}

.audit-overview {
  margin-bottom: 16px;
}

.audit-timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.audit-timeline::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 6px;
  width: 1px;
  background: var(--line-strong);
  content: '';
}

.audit-timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 14px;
  padding: 10px 0;
}

.audit-timeline i {
  z-index: 1;
  width: 13px;
  height: 13px;
  margin-top: 3px;
  border: 3px solid var(--surface-panel);
  border-radius: 50%;
  background: var(--accent-500);
  box-shadow: 0 0 0 1px var(--accent-200);
}

.audit-timeline li div {
  display: grid;
  gap: 3px;
}

.audit-timeline strong {
  color: var(--text-strong);
  font-size: 12px;
}

.audit-timeline span,
.audit-timeline small {
  color: var(--text-muted);
  font-size: 10px;
}

@media (max-width: 900px) {
  .health-hero,
  .resource-trends {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .resource-gauge-grid,
  .whatsapp-resource-panel .donut-layout {
    grid-template-columns: 1fr;
  }
}

/* Cross-screen polish and motion accessibility */
.nav-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border-radius: 7px;
  background: rgb(255 255 255 / 5%);
  color: #aebddb;
  font-size: 13px;
  line-height: 1;
}

.nav-item.active .nav-icon,
.nav-item[aria-current='page'] .nav-icon {
  background: rgb(255 255 255 / 12%);
  color: #fff;
}

.panel-title p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

.toolbar > span:not(.toolbar-spacer) {
  color: var(--text-muted);
  font-size: 11px;
}

.modal {
  max-height: min(88vh, 820px);
  overflow: auto;
}

.toast {
  max-width: min(420px, calc(100vw - 32px));
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-float);
}

.table-wrap {
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
}

@media (max-width: 900px) {
  .page-intro,
  .panel-title {
    align-items: flex-start;
  }

  .page-intro {
    gap: 16px;
  }

  .page-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 640px) {
  .login-card {
    padding: 28px 22px;
  }

  .topbar,
  .content {
    padding-right: 14px;
    padding-left: 14px;
  }

  .page-intro,
  .panel-title,
  .modal-actions {
    flex-direction: column;
  }

  .page-actions,
  .page-actions .button,
  .modal-actions .button {
    width: 100%;
  }

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

  .panel,
  .visual-card {
    padding: 16px;
  }

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

  .modal {
    width: 100%;
    max-height: 92vh;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  }

  .toast {
    right: 16px;
    bottom: 16px;
    left: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Operations dashboard */
.dashboard-content {
  display: grid;
  gap: 16px;
}
.dashboard-hero {
  min-height: 178px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  position: relative;
  overflow: hidden;
  padding: 30px;
  border-radius: var(--radius-lg);
  color: #fff;
  background:
    radial-gradient(circle at 78% 16%, rgb(122 160 255 / 44%), transparent 32%),
    linear-gradient(125deg, #14213b 0%, #1e3f7d 60%, #285fca 100%);
  box-shadow: 0 18px 45px rgb(23 45 89 / 18%);
}
.dashboard-hero::after {
  content: '';
  width: 280px;
  height: 280px;
  position: absolute;
  right: -85px;
  bottom: -180px;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 50%;
  box-shadow:
    0 0 0 28px rgb(255 255 255 / 4%),
    0 0 0 58px rgb(255 255 255 / 3%);
}
.dashboard-hero .eyebrow {
  margin: 0 0 9px;
  color: #a9c5ff;
}
.dashboard-hero h3 {
  margin: 0;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.04em;
}
.dashboard-hero p:not(.eyebrow) {
  max-width: 640px;
  margin: 10px 0 0;
  color: #d9e5ff;
  line-height: 1.55;
}
.dashboard-hero-status {
  min-width: 190px;
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 3px 9px;
  position: relative;
  z-index: 1;
  padding: 14px 16px;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: var(--radius-sm);
  background: rgb(8 24 52 / 32%);
  backdrop-filter: blur(10px);
}
.dashboard-hero-status small {
  grid-column: 2;
  color: #becff0;
  font-size: 10px;
}
.dashboard-overview {
  margin: 0;
}
.dashboard-overview .metric-card::before {
  content: '';
  width: 54px;
  height: 3px;
  position: absolute;
  left: 21px;
  top: 0;
  border-radius: 0 0 999px 999px;
  background: currentColor;
  opacity: 0.78;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.dashboard-section {
  min-width: 0;
  margin: 0;
}
.dashboard-section:nth-child(5n + 1) {
  grid-column: span 2;
}
.dashboard-visual-split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(220px, 0.75fr);
  align-items: center;
  gap: 22px;
}
.dashboard-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.dashboard-facts .metric-card {
  min-width: 0;
  padding: 15px;
  box-shadow: none;
}
.dashboard-inline-stat {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 11px;
}
.dashboard-inline-stat strong {
  color: var(--text-strong);
  font-size: 22px;
}
.dashboard-inline-stat small {
  margin-left: auto;
}
.dashboard-footer-grid {
  margin: 0;
}
.alert-panel.has-alerts {
  border-color: #f0d2a5;
}
.alert-panel .alert-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
}
.alert-panel .alert-row:last-child {
  border-bottom: 0;
}
.alert-panel .alert-row span {
  color: var(--text-muted);
  text-align: right;
}
@media (max-width: 1100px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .dashboard-section:nth-child(5n + 1) {
    grid-column: auto;
  }
}
@media (max-width: 760px) {
  .dashboard-hero {
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    padding: 24px;
  }
  .dashboard-hero-status {
    width: 100%;
  }
  .dashboard-visual-split,
  .dashboard-facts {
    grid-template-columns: 1fr;
  }
}

/* Tenant workspace and finance */
.tenant-workspace {
  display: grid;
  gap: 16px;
}
.tenant-hero {
  min-height: 150px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 24px;
  padding: 26px 28px;
  border: 1px solid #dce5f7;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(125deg, rgb(255 255 255 / 96%), rgb(240 245 255 / 92%)), var(--surface-panel);
  box-shadow: var(--shadow-panel);
}
.tenant-hero .link-button {
  margin-bottom: 18px;
}
.tenant-hero .eyebrow {
  margin: 0 0 7px;
}
.tenant-hero h3 {
  margin: 0;
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.04em;
}
.tenant-hero p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--text-muted);
}
.tenant-hero-status {
  display: grid;
  justify-items: end;
  gap: 9px;
}
.tenant-hero-status .mono {
  color: var(--text-muted);
}
.tenant-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
}
.tenant-tabs {
  margin: 0;
  padding: 5px;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: var(--surface-panel);
  box-shadow: var(--shadow-panel);
}
.tenant-tabs button {
  border: 0;
  background: transparent;
}
.tenant-tabs button.active,
.tenant-tabs button:hover {
  background: var(--accent-100);
  box-shadow: inset 0 0 0 1px #c9d9ff;
}
.tenant-overview-grid {
  display: grid;
  gap: 16px;
}
.tenant-overview-grid > .panel {
  margin: 0;
}
.tenant-operation-note .visual-empty {
  min-height: 100px;
}
.finance-visual-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(0, 1.15fr);
  align-items: stretch;
  gap: 16px;
  margin-bottom: 16px;
}
.financial-composition {
  height: 100%;
}
.financial-balance {
  color: var(--status-success);
  font-size: 20px;
}
.financial-balance.negative {
  color: var(--status-danger);
}
.finance-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}
.visual-detail {
  margin-top: 18px;
  border-top: 1px solid var(--line-soft);
}
.visual-detail summary {
  padding: 13px 0 4px;
  color: var(--accent-600);
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}
@media (max-width: 1000px) {
  .finance-visual-grid {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 720px) {
  .tenant-hero {
    align-items: flex-start;
    flex-direction: column;
  }
  .tenant-hero-status {
    justify-items: start;
  }
  .tenant-summary-grid,
  .finance-kpis {
    grid-template-columns: 1fr;
  }
}
/* AI, plans, usage, billing and automations */
.ai-usage-grid,
.usage-visual-grid {
  display: grid;
  grid-template-columns: minmax(300px, 0.9fr) minmax(0, 1.1fr);
  align-items: stretch;
  gap: 16px;
  margin-bottom: 16px;
}

.ai-usage-grid > *,
.usage-visual-grid > * {
  margin: 0;
}

.ai-usage-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0;
}

.ai-usage-visual,
.billing-snapshot {
  height: 100%;
}

.visual-stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.visual-stat span {
  color: var(--text-muted);
  font-size: 12px;
}

.visual-stat strong {
  color: var(--text-strong);
  font-size: 20px;
}

.plan-comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.plan-comparison-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, var(--surface-panel), var(--surface-subtle));
}

.plan-price-band {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 22px 0 18px;
}

.plan-price-band .plan-price {
  color: var(--accent-700);
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.04em;
}

.plan-price-band span,
.plan-facts span {
  color: var(--text-muted);
  font-size: 11px;
}

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

.plan-facts span {
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface-panel);
}

.plan-facts strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text-strong);
  font-size: 13px;
}

.billing-overview,
.automation-overview,
.execution-summary {
  margin-bottom: 16px;
}

.billing-overview .donut-layout,
.automation-overview .donut-layout,
.execution-summary .donut-layout {
  grid-template-columns: minmax(150px, 0.55fr) minmax(220px, 1.45fr);
}

.execution-summary {
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  background: var(--surface-subtle);
}

@media (max-width: 900px) {
  .ai-usage-grid,
  .usage-visual-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .ai-usage-kpis,
  .plan-facts,
  .billing-overview .donut-layout,
  .automation-overview .donut-layout,
  .execution-summary .donut-layout {
    grid-template-columns: 1fr;
  }
}

.tenant-users-grid {
  display: grid;
  gap: 16px;
}
.tenant-users-grid > .panel {
  margin: 0;
}
.data-table tr.selected-row td {
  background: var(--accent-100);
}
